diff --git a/.classpath b/.classpath index 2d7b47c..3975a14 100644 --- a/.classpath +++ b/.classpath @@ -2,7 +2,7 @@ - - + + diff --git a/.gitignore b/.gitignore index f79de94..97e76c5 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,5 @@ Temporary Items .idea deployment certs -userlib/* -userlib/*.jar + diff --git a/.project b/.project index 0141fe2..7486421 100644 --- a/.project +++ b/.project @@ -16,7 +16,7 @@ LaunchConfigHandle - <project>/deployment/run/bndbuild.launch + <project>/deployment/run/componentbuild.launch diff --git a/DIST/MqttClient-1.0.mpk b/DIST/MqttClient-1.0.mpk new file mode 100644 index 0000000..5a6b95d Binary files /dev/null and b/DIST/MqttClient-1.0.mpk differ diff --git a/DIST/MqttClient-2.0.mpk b/DIST/MqttClient-2.0.mpk new file mode 100644 index 0000000..6609b03 Binary files /dev/null and b/DIST/MqttClient-2.0.mpk differ diff --git a/DIST/MqttClient-2.1.0--AKA-4.0.mpk b/DIST/MqttClient-2.1.0--AKA-4.0.mpk new file mode 100644 index 0000000..d87aa3f Binary files /dev/null and b/DIST/MqttClient-2.1.0--AKA-4.0.mpk differ diff --git a/DIST/MqttClient-2.2.0_Mx8.12.5.mpk b/DIST/MqttClient-2.2.0_Mx8.12.5.mpk new file mode 100644 index 0000000..d6534ad Binary files /dev/null and b/DIST/MqttClient-2.2.0_Mx8.12.5.mpk differ diff --git a/GPUCache/data_0 b/GPUCache/data_0 new file mode 100644 index 0000000..bbb39df Binary files /dev/null and b/GPUCache/data_0 differ diff --git a/GPUCache/data_1 b/GPUCache/data_1 new file mode 100644 index 0000000..1fa5acf Binary files /dev/null and b/GPUCache/data_1 differ diff --git a/GPUCache/data_2 b/GPUCache/data_2 new file mode 100644 index 0000000..c7e2eb9 Binary files /dev/null and b/GPUCache/data_2 differ diff --git a/GPUCache/data_3 b/GPUCache/data_3 new file mode 100644 index 0000000..6dde4bf Binary files /dev/null and b/GPUCache/data_3 differ diff --git a/GPUCache/index b/GPUCache/index new file mode 100644 index 0000000..32793ee Binary files /dev/null and b/GPUCache/index differ diff --git a/MqttClient.launch b/MqttClient.launch index 9e1a0e0..58b6db0 100644 --- a/MqttClient.launch +++ b/MqttClient.launch @@ -9,24 +9,25 @@ - - - - + + + + + + - - + - - - + + + diff --git a/MqttClient.mpr b/MqttClient.mpr index bd2fc5e..db47194 100644 Binary files a/MqttClient.mpr and b/MqttClient.mpr differ diff --git a/docs/images/mqtt-toolbox.png b/docs/images/mqtt-toolbox.png index e174dad..1bbcd82 100644 Binary files a/docs/images/mqtt-toolbox.png and b/docs/images/mqtt-toolbox.png differ diff --git a/javasource/administration/proxies/Account.java b/javasource/administration/proxies/Account.java index 6111836..e5dbdb3 100644 --- a/javasource/administration/proxies/Account.java +++ b/javasource/administration/proxies/Account.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -38,7 +38,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -60,7 +60,7 @@ protected Account(com.mendix.systemwideinterfaces.core.IContext context, com.men /** * @deprecated Use 'Account.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static administration.proxies.Account initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return administration.proxies.Account.load(context, mendixIdentifier); @@ -197,7 +197,7 @@ public final void setIsLocalUser(com.mendix.systemwideinterfaces.core.IContext c getMendixObject().setValue(context, MemberNames.IsLocalUser.toString(), islocaluser); } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -211,7 +211,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -229,8 +229,8 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Override - @Deprecated + @java.lang.Override + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/administration/proxies/AccountPasswordData.java b/javasource/administration/proxies/AccountPasswordData.java index 89b5d84..76846d3 100644 --- a/javasource/administration/proxies/AccountPasswordData.java +++ b/javasource/administration/proxies/AccountPasswordData.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -32,7 +32,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -58,7 +58,7 @@ protected AccountPasswordData(com.mendix.systemwideinterfaces.core.IContext cont /** * @deprecated Use 'AccountPasswordData.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static administration.proxies.AccountPasswordData initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return administration.proxies.AccountPasswordData.load(context, mendixIdentifier); @@ -277,7 +277,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -291,7 +291,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -309,7 +309,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/administration/proxies/microflows/Microflows.java b/javasource/administration/proxies/microflows/Microflows.java index 45b148f..cf4d0e7 100644 --- a/javasource/administration/proxies/microflows/Microflows.java +++ b/javasource/administration/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -17,66 +17,25 @@ public class Microflows // These are the microflows for the Administration module public static void changeMyPassword(IContext context, administration.proxies.AccountPasswordData _accountPasswordData) { - try - { - Map params = new HashMap(); - params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); - Core.execute(context, "Administration.ChangeMyPassword", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); + Core.microflowCall("Administration.ChangeMyPassword").withParams(params).execute(context); } public static void changePassword(IContext context, administration.proxies.AccountPasswordData _accountPasswordData) { - try - { - Map params = new HashMap(); - params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); - Core.execute(context, "Administration.ChangePassword", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void iVK_RetrieveAppCloudUserAccountData(IContext context, administration.proxies.Account _account) - { - try - { - Map params = new HashMap(); - params.put("Account", _account == null ? null : _account.getMendixObject()); - Core.execute(context, "Administration.IVK_RetrieveAppCloudUserAccountData", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); + Core.microflowCall("Administration.ChangePassword").withParams(params).execute(context); } public static void manageMyAccount(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "Administration.ManageMyAccount", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("Administration.ManageMyAccount").withParams(params).execute(context); } public static void newAccount(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "Administration.NewAccount", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("Administration.NewAccount").withParams(params).execute(context); } /** * Create a new user object and change the default attribute values so the user will be handled as a webservice user. @@ -84,86 +43,38 @@ public static void newAccount(IContext context) */ public static void newWebServiceAccount(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "Administration.NewWebServiceAccount", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void onFirstLoginAppCloudUser(IContext context, java.lang.String _userIdentity) - { - try - { - Map params = new HashMap(); - params.put("UserIdentity", _userIdentity); - Core.execute(context, "Administration.OnFirstLoginAppCloudUser", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("Administration.NewWebServiceAccount").withParams(params).execute(context); } public static java.util.List retrieveTimeZones(IContext context) { - try + Map params = new HashMap<>(); + java.util.List objs = Core.microflowCall("Administration.RetrieveTimeZones").withParams(params).execute(context); + java.util.List result = null; + if (objs != null) { - Map params = new HashMap(); - java.util.List objs = Core.execute(context, "Administration.RetrieveTimeZones", params); - java.util.List result = null; - if (objs != null) - { - result = new java.util.ArrayList(); - for (IMendixObject obj : objs) - result.add(system.proxies.TimeZone.initialize(context, obj)); - } - return result; - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); + result = new java.util.ArrayList<>(); + for (IMendixObject obj : objs) + result.add(system.proxies.TimeZone.initialize(context, obj)); } + return result; } public static void saveNewAccount(IContext context, administration.proxies.AccountPasswordData _accountPasswordData) { - try - { - Map params = new HashMap(); - params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); - Core.execute(context, "Administration.SaveNewAccount", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject()); + Core.microflowCall("Administration.SaveNewAccount").withParams(params).execute(context); } public static void showMyPasswordForm(IContext context, administration.proxies.Account _account) { - try - { - Map params = new HashMap(); - params.put("Account", _account == null ? null : _account.getMendixObject()); - Core.execute(context, "Administration.ShowMyPasswordForm", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Account", _account == null ? null : _account.getMendixObject()); + Core.microflowCall("Administration.ShowMyPasswordForm").withParams(params).execute(context); } public static void showPasswordForm(IContext context, administration.proxies.Account _account) { - try - { - Map params = new HashMap(); - params.put("Account", _account == null ? null : _account.getMendixObject()); - Core.execute(context, "Administration.ShowPasswordForm", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Account", _account == null ? null : _account.getMendixObject()); + Core.microflowCall("Administration.ShowPasswordForm").withParams(params).execute(context); } } \ No newline at end of file diff --git a/javasource/appcloudservices/CommonsLoggingListener.java b/javasource/appcloudservices/CommonsLoggingListener.java deleted file mode 100644 index 65391f2..0000000 --- a/javasource/appcloudservices/CommonsLoggingListener.java +++ /dev/null @@ -1,114 +0,0 @@ -package appcloudservices; - -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.LogManager; -import java.util.logging.LogRecord; - -import org.apache.commons.logging.LogConfigurationException; -import org.apache.commons.logging.LogFactory; - -import com.mendix.core.Core; -import com.mendix.logging.ILogNode; - -public class CommonsLoggingListener extends Handler -{ - private static CommonsLoggingListener listenerInstance; - private static Set registeredLoggers ; - - static { - registeredLoggers = new HashSet(); - listenerInstance = new CommonsLoggingListener(); - CommonsLoggingListener.listenToCommonsLogging("org.openid4java"); - } - - private CommonsLoggingListener() - { - // hidden empty constructor - } - - - //MWE: move this function to communitycommons, or better, to the runtime. - public synchronized static void listenToCommonsLogging(String filter) - { - try { - //Note that this does not pick up all runtime initizalid loggers, only the static initialized ones. That is good enough for openid4java though. - Enumeration it = LogManager.getLogManager().getLoggerNames(); - while (it.hasMoreElements()) { - String logName = it.nextElement(); - if (filter == null || logName.contains(filter)) - followCommonsLog(listenerInstance, logName); - } - } - catch(Exception e) { - Core.getLogger(CommonsLoggingListener.class.getSimpleName()).error("Failed to setup log listener: " + e.getMessage(), e); - } - } - - private static void followCommonsLog(CommonsLoggingListener logger, String logName) - throws LogConfigurationException, SecurityException - { - if (registeredLoggers.contains(logName)) //make sure no log is registered twice! - return; - - Core.getLogger(CommonsLoggingListener.class.getName()).info("Now listening to " + logName); - registeredLoggers.add(logName); - org.apache.commons.logging.impl.Jdk14Logger lognode = (org.apache.commons.logging.impl.Jdk14Logger) LogFactory.getLog(logName); - lognode.getLogger().addHandler(logger); - } - - @Override - public void close() - throws SecurityException - { - // - - } - - @Override - public void flush() - { - // - } - - @Override - public void publish(LogRecord record) - { - /* - @see java.util.logging.Level; - public static final Level OFF = new Level("OFF", 2147483647, defaultBundle); - public static final Level SEVERE = new Level("SEVERE", 1000, defaultBundle); - public static final Level WARNING = new Level("WARNING", 900, defaultBundle); - public static final Level INFO = new Level("INFO", 800, defaultBundle); - public static final Level CONFIG = new Level("CONFIG", 700, defaultBundle); - public static final Level FINE = new Level("FINE", 500, defaultBundle); - public static final Level FINER = new Level("FINER", 400, defaultBundle); - public static final Level FINEST = new Level("FINEST", 300, defaultBundle); - public static final Level ALL = new Level("ALL", -2147483648, defaultBundle); - */ - if (record.getLevel() == Level.OFF || record.getLevel() == Level.ALL) //These loglevels should not be used inside a log record - return; - - ILogNode logNode = Core.getLogger(record.getLoggerName()); - int loglevel = record.getLevel().intValue(); - - if (loglevel < Level.INFO.intValue() && !logNode.isDebugEnabled()) - return; - if (loglevel < Level.FINER.intValue() && !logNode.isTraceEnabled()) - return; - - Throwable ex = record.getThrown(); - if (loglevel < Level.FINER.intValue()) - logNode.trace(record.getMessage(), ex); - else if (loglevel < Level.INFO.intValue()) - logNode.debug(record.getMessage(), ex); - else if (ex != null) - logNode.error(record.getMessage(), ex); - else - logNode.info(record.getMessage()); - } - -} diff --git a/javasource/appcloudservices/DefaultLoginHandler.java b/javasource/appcloudservices/DefaultLoginHandler.java deleted file mode 100644 index c2953bc..0000000 --- a/javasource/appcloudservices/DefaultLoginHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -package appcloudservices; -import java.io.IOException; - -import appcloudservices.OpenIDHandler.ResponseType; - -import com.mendix.core.CoreException; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.m2ee.api.IMxRuntimeResponse; -import com.mendix.systemwideinterfaces.core.IUser; - - -public class DefaultLoginHandler implements ILoginHandler -{ - - public void onCompleteLogin(String openId, String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp) - throws CoreException, IllegalStateException, IOException - { - IUser user = null; - try { - user = SessionInitializer.findOrCreateUser(openId); - } - catch(Throwable e) { - OpenIDHandler.error(resp, ResponseType.INTERNAL_SERVER_ERROR, "We failed to register your account in this app. Please try again later or contact the administrator of this app.", e); - return; - } - - if (user == null) { - OpenIDHandler.error(resp, ResponseType.UNAUTHORIZED, "Your account has not been authorized to use this application. ", null); - } else if (user.getUserRoleNames().size() == 0) { - OpenIDHandler.error(resp, ResponseType.UNAUTHORIZED, "Your account has not been authorized to use this application. No permissions for this app have been assigned to your account. ", null); - } else { - try { - SessionInitializer.createSessionForUser(resp, req, user); - SessionInitializer.redirectToIndex(resp, continuation); - } catch (Exception e) { - OpenIDHandler.error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Failed to initialize session", e); - } - } - } - - public void onCompleteAnonymousLogin(String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp) - throws CoreException, IllegalStateException, IOException - { - try { - /** Setting up guest sessions is not the responsibility of this module, but otherwise: - if (Core.getConfiguration().getEnableGuestLogin()) { - ISession session = Core.initializeGuestSession(); - SessionInitializer.writeSessionCookies(resp, session); - } - */ - SessionInitializer.redirectToIndex(resp, continuation); - } catch (Exception e) { - OpenIDHandler.error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Failed to initialize session", e); - } - } - -} diff --git a/javasource/appcloudservices/ILoginHandler.java b/javasource/appcloudservices/ILoginHandler.java deleted file mode 100644 index d32c2e6..0000000 --- a/javasource/appcloudservices/ILoginHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package appcloudservices; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.m2ee.api.IMxRuntimeResponse; - - -public interface ILoginHandler -{ - public void onCompleteLogin(String openId, String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception; - - public void onCompleteAnonymousLogin(String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception; - -} diff --git a/javasource/appcloudservices/OpenIDHandler.java b/javasource/appcloudservices/OpenIDHandler.java deleted file mode 100644 index 349766e..0000000 --- a/javasource/appcloudservices/OpenIDHandler.java +++ /dev/null @@ -1,415 +0,0 @@ -package appcloudservices; - -import static appcloudservices.OpenIDUtils.APPLICATION_ROOT_URL; -import static appcloudservices.OpenIDUtils.getFingerPrint; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang.StringEscapeUtils; -import org.openid4java.association.AssociationSessionType; -import org.openid4java.consumer.ConsumerManager; -import org.openid4java.consumer.InMemoryConsumerAssociationStore; -import org.openid4java.consumer.InMemoryNonceVerifier; -import org.openid4java.consumer.VerificationResult; -import org.openid4java.discovery.DiscoveryInformation; -import org.openid4java.discovery.Identifier; -import org.openid4java.message.AuthRequest; -import org.openid4java.message.ParameterList; - -import appcloudservices.proxies.constants.Constants; - -import com.mendix.core.Core; -import com.mendix.core.CoreException; -import com.mendix.externalinterface.connector.RequestHandler; -import com.mendix.logging.ILogNode; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.m2ee.api.IMxRuntimeResponse; -import com.mendix.systemwideinterfaces.core.ISession; -import org.openid4java.discovery.DiscoveryException; - -public class OpenIDHandler extends RequestHandler { - - public enum ResponseType { - INTERNAL_SERVER_ERROR("Internal Server Error", IMxRuntimeResponse.INTERNAL_SERVER_ERROR), - UNAUTHORIZED("Unauthorized", IMxRuntimeResponse.UNAUTHORIZED); - - String title; - int status; - ResponseType(String title, int httpStatus) { - this.title = title; - this.status = httpStatus; - } - } - - public static String OPENID_CLIENTSERVLET_LOCATION = "openid/"; - public static String FALLBACK_LOGINPAGE = "/login.html"; - public static String INDEX_PAGE = "/index.html"; - public static boolean SINGLESIGNOFF_ENABLED = true; - - public static final String CONTINUATION_PARAM = "continuation"; - public static final String IMMEDIATE_PARAM = "immediate"; - - public static String INTERNAL_SERVER_ERROR_MESSAGE = - "" + - "" + - "" + - " " + - " Mendix App Platform" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - "
\"Mendix\"
{{title}}

{{message}}

Try again or contact your app administrator if this problem persists

" + - " " + - ""; - - private static final String CALLBACK = "callback"; - public static final String LOGIN = "login"; - private static final String FORCE_LOGOFF = "force_logoff"; - public static final String LOGOFF = "logoff"; - - private static final String OPENID_PROVIDER = Constants.getOpenIdProvider(); - private static final boolean OPENID_ENABLED = Constants.getOpenIdEnabled(); - - private static final String OPENID_RETURN_URL = APPLICATION_ROOT_URL + OPENID_CLIENTSERVLET_LOCATION + CALLBACK; - private static final String OPENID_LOGOFF_URL = APPLICATION_ROOT_URL + OPENID_CLIENTSERVLET_LOCATION + FORCE_LOGOFF; - - private DiscoveryInformation discovered; - private List discoveries; - private ConsumerManager manager; - private static final ILogNode LOG = Core.getLogger(Constants.getLogNode()); - - private boolean started = false; - public static ILoginHandler loginHandler = new DefaultLoginHandler(); - - public OpenIDHandler() { - if (!OPENID_ENABLED) { - LOG.info("NOT starting OpenId handler, disabled by configuration"); - } else { - reconnectToMxID(); - } - } - - private void reconnectToMxID() { - LOG.info("Starting OpenId handler ... OpenIDReturnURL = " + OPENID_RETURN_URL + "; OpenIdProvider: " + OPENID_PROVIDER); - try { - - manager = new ConsumerManager(); - manager.setAssociations(new InMemoryConsumerAssociationStore()); - manager.setNonceVerifier(new InMemoryNonceVerifier(5000)); - manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256); - manager.getRealmVerifier().setEnforceRpId(true); - - discoveries = manager.discover(OPENID_PROVIDER); - discovered = manager.associate(discoveries); - - started = true; - LOG.info("Starting OpenId handler ... DONE"); - - } catch (DiscoveryException e) { - LOG.error("Failed to discover OpenId service: " + e.getMessage(), e); - } - } - - private static final Set OPENID_LOCKS = new HashSet(); - - public static void lockOpenID(String openID) throws InterruptedException { - synchronized (OPENID_LOCKS) { - while (OPENID_LOCKS.contains(openID)) - OPENID_LOCKS.wait(); - OPENID_LOCKS.add(openID); - } - } - - public static void unlockOpenID(String openID) { - synchronized (OPENID_LOCKS) { - OPENID_LOCKS.remove(openID); - OPENID_LOCKS.notifyAll(); - } - } - - /** - * Handles openId related requests. Two requests are supported: - * 'openid/login': tries to setup a new user session. (Note: does not check if there is already a session) - * 'openid/callback': used by the openId provider to confirm the identity of the current user - */ - @Override - public void processRequest(IMxRuntimeRequest req, IMxRuntimeResponse resp, - String path) throws Exception { - - //always force expiration on this handler! - resp.addHeader("Expires", "0"); - - if (LOG.isDebugEnabled()) - LOG.debug("Incoming request: " + path + " fingerprint: " + getFingerPrint(req)); - - if (!OPENID_ENABLED) { - LOG.info("NOT handling SSO request, disabled by configuration, redirecting to login.html"); - redirect(resp, FALLBACK_LOGINPAGE); - return; - } - - if (!started) { - reconnectToMxID(); - } - - if (!started) { - LOG.error("NOT handling SSO request, could not connect to MxID 2.0, redirecting to login.html"); - redirect(resp, FALLBACK_LOGINPAGE); - return; - } - - try { - if (LOGOFF.equalsIgnoreCase(path)) { - logoff(req, resp); //requesting Single Sign Off (from client) - } else if (FORCE_LOGOFF.equalsIgnoreCase(path)) { - forceLogoff(req, resp); //requesting Single Sign Off (from server) - } else if (LOGIN.equalsIgnoreCase(path)) { - login(req, resp); //requesting authorization - } else if (CALLBACK.equalsIgnoreCase(path)) { - callback(req, resp); //redirect from open id provider - } else { - error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Unsupported request '" + path + "'", null); - } - } catch (Exception e) { - error(resp, ResponseType.INTERNAL_SERVER_ERROR, "An unexpected exception occurred while handling request " + path, e); - } - } - - private void callback(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception { - LOG.debug("Callback from OpenID provider, evaluating.."); - - HttpServletRequest origreq = req.getHttpServletRequest(); - - //verification request? - if (origreq.getMethod().equals("HEAD")) { - handleHeadRequest(resp); - } else if (req.getHeader("Accept") != null && req.getHeader("Accept").contains("application/xrds+xml")) { - handleXrds(resp); - } else { - ParameterList openidResp = new ParameterList(origreq.getParameterMap()); - - String mxid2Continuation = req.getParameter("mxid2.continuation"); - detectContinuationJsInjection(mxid2Continuation); - - String mode = openidResp.getParameter("openid.mode").getValue(); - if ("setup_needed".equalsIgnoreCase(mode)) { - /* - * original request mode is immediate, because checkid setup would not have returned id_res without verified ID. - * Return to return url, but without identity. - * - * @See http://openid.net/specs/openid-authentication-2_0.html#negative_assertions - */ - if (LOG.isDebugEnabled()) - LOG.debug("Immediate authentication responded with setup_needed. Assuming that the app should continue as anonymous. "); - - loginHandler.onCompleteAnonymousLogin(mxid2Continuation, req, resp); - } else if ("id_res".equals(mode)) { - handleIdRes(req, resp, origreq, openidResp, mxid2Continuation); - } else if ("cancel".equals(mode)) { - LOG.warn("OpenId login failed: cancelled"); - resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED); - error(resp, ResponseType.UNAUTHORIZED, "OpenId login failed. Please try again later.", null); - } else - throw new IllegalStateException("Unexpected OpenID callback mode: " + mode); - } - } - - private void handleXrds(IMxRuntimeResponse resp) throws IOException { - LOG.info("Found local discovery of RP return_url endpoint."); - - resp.setContentType("application/xrds+xml; charset=UTF-8"); - resp.getWriter().write( - "" + - "" + - "" + - "" + - "http://specs.openid.net/auth/2.0/return_to" + - "" + OPENID_RETURN_URL + "" + - "" + - "" + - ""); - resp.getWriter().close(); - } - - private void handleHeadRequest(IMxRuntimeResponse resp) { - LOG.debug("Callback from OpenID provider, evaluating.. HEAD request not supported, ignoring."); - resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); //405 - Method Not Allowed - } - - private void handleIdRes(IMxRuntimeRequest req, IMxRuntimeResponse resp, HttpServletRequest origreq, - ParameterList openidResp, String mxid2Continuation) throws Exception { - // extract the receiving URL from the HTTP request - StringBuffer receivingURL = new StringBuffer(OPENID_RETURN_URL); - - String queryString = origreq.getQueryString(); - if (queryString != null && queryString.length() > 0) - receivingURL.append("?").append(origreq.getQueryString()); - - // verify the response - LOG.info("[OpenID Verify Response] receivingurl: " + receivingURL + "; to: " + openidResp.getParameter("openid.return_to")); - VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, discovered); - - // examine the verification result and extract the verified identifier - Identifier verified = verification.getVerifiedId(); - - if (verified != null) { - String userId = verified.getIdentifier(); - lockOpenID(userId); - try { - loginHandler.onCompleteLogin(userId, mxid2Continuation, req, resp); - } finally { - unlockOpenID(userId); - } - } else { - LOG.warn("OpenId authentication failed: " + verification.getStatusMsg()); - resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED); - error(resp, ResponseType.UNAUTHORIZED, "OpenId authentication request failed. Please try again later.", null); - } - } - - private void login(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception { - String continuation = req.getParameter(CONTINUATION_PARAM); - detectContinuationJsInjection(continuation); - - //special case 1: already a valid session, do not bother with a new login - ISession session = this.getSessionFromRequest(req); - if (session != null && !session.getUser().isAnonymous()) { - - //Logout old session and initialize new session. This will allow for role changes to take effect. - String userId = session.getUser().getName(); - lockOpenID(userId); - try { - loginHandler.onCompleteLogin(userId, continuation, req, resp); - Core.logout(session); - } finally { - unlockOpenID(userId); - } - } else if (!started) { - //special case 2: no OpenID provider discovered - LOG.warn("OpenId handler is in state 'NOT STARTED'. Falling back to default login.html"); - redirect(resp, FALLBACK_LOGINPAGE); - } else { - LOG.debug("Incoming login request, redirecting to OpenID provider"); - - AuthRequest authReq = manager.authenticate(discovered, OPENID_RETURN_URL); - authReq.setImmediate("true".equalsIgnoreCase(req.getParameter(IMMEDIATE_PARAM))); - - String url = authReq.getDestinationUrl(true); - - //MWE: publish the url which can be used to sign off - if (SINGLESIGNOFF_ENABLED) - url += "&mxid2.logoffcallback=" + OpenIDUtils.urlEncode(OPENID_LOGOFF_URL); - - if (continuation != null) - url += "&mxid2.continuation=" + OpenIDUtils.urlEncode(continuation); - - redirect(resp, url); - } - } - - private void forceLogoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) { - String username = req.getParameter("openid"); - String fingerprint = req.getParameter("fingerprint"); - - if (SINGLESIGNOFF_ENABLED) - forceSessionLogoff(username, fingerprint); - else - LOG.warn("Received force_logoff request, but single sign off is not unabled in the configuration!"); - - resp.setStatus(IMxRuntimeResponse.OK); - resp.setContentType("text/plain"); - } - - private void logoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws CoreException { - if (SINGLESIGNOFF_ENABLED) { - resp.addCookie(getSessionCookieName(), "", "/", "", 0, true); - resp.addCookie(SessionInitializer.XASID_COOKIE, "", "/", "", 0, true); - resp.setStatus(IMxRuntimeResponse.SEE_OTHER); - resp.addHeader("location", OPENID_PROVIDER + "/../" + LOGOFF); - } else { - ISession ses = this.getSessionFromRequest(req); - if (ses != null) { - Core.logout(ses); - } - redirect(resp, INDEX_PAGE); - } - } - - private void detectContinuationJsInjection(String url) { - if (url != null && url.trim().startsWith("javascript:")) - throw new IllegalArgumentException("Javascript injection detected in parameter '" + CONTINUATION_PARAM + "'"); - } - - private void forceSessionLogoff(String username, String fingerprint) { - String basemsg = String.format("Received logoff request for '%s' with fingerprint '%s'... ", username, fingerprint); - LOG.debug(basemsg); - - List sessionsOfThisUser = new ArrayList<>(); - for (ISession session : Core.getActiveSessions()) { - if (session.getUser() != null && - session.getUser().getName() != null && - session.getUser().getName().equals(username)) - sessionsOfThisUser.add(session); - } - - if (sessionsOfThisUser.isEmpty()) - LOG.debug(basemsg + "IGNORING. User has no active sessions"); - else { - boolean found = false; - for (ISession session : sessionsOfThisUser) { - if (getFingerPrint(session).equals(fingerprint)) { - Core.logout(session); - found = true; - } - } - - if (found) - LOG.info(basemsg + "SUCCESS. Session removed."); - else - LOG.warn(basemsg + "FAILED. User has active sessions but none matches the provided fingerprint. "); - } - } - - public static void error(IMxRuntimeResponse resp, ResponseType responseType, String message, Throwable e) throws IOException { - resp.setStatus(responseType.status); - resp.getWriter().write( - INTERNAL_SERVER_ERROR_MESSAGE - .replace("{{message}}", StringEscapeUtils.escapeHtml(message)) - .replace("{{title}}", StringEscapeUtils.escapeHtml(responseType.title)) - ); - if (e != null) - LOG.error("Error while handling OpenID request: " + responseType.title + ":\n" + message + ": " + e.getMessage(), e); - else - LOG.error("Error while handling OpenID request: " + responseType.title + ":\n" + message); - } - - private void redirect(IMxRuntimeResponse resp, String url) { - resp.setStatus(IMxRuntimeResponse.SEE_OTHER); - resp.addHeader("location", url); - } -} diff --git a/javasource/appcloudservices/OpenIDUtils.java b/javasource/appcloudservices/OpenIDUtils.java deleted file mode 100644 index 06791d6..0000000 --- a/javasource/appcloudservices/OpenIDUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package appcloudservices; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -import org.apache.axiom.util.base64.Base64Utils; -import org.apache.commons.lang.StringUtils; - -import com.mendix.core.Core; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.systemwideinterfaces.core.ISession; - -public class OpenIDUtils { - - public static final String APPLICATION_ROOT_URL = Core.getConfiguration().getApplicationRootUrl() + (Core.getConfiguration().getApplicationRootUrl().endsWith("/")?"":"/"); - - public static String urlEncode(String value) { - try { - return URLEncoder.encode(value, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } - - public static String base64Encode(byte[] bytes) { - return Base64Utils.encode(bytes); - } - - public static String getFingerPrint(IMxRuntimeRequest req) - { - String agent = req.getHeader("User-Agent"); - if (agent != null) - return base64Encode(agent.getBytes()); - - return ""; - } - - public static String getFingerPrint(ISession session) - { - String agent = session.getUserAgent(); - if (agent != null) - return base64Encode(agent.getBytes()); - - return ""; - - } - - public static String getStringConstantValueOrDefault(String key, String defaultValue) { - String value = Core.getConfiguration().getConstantValue(key).toString(); - if (value == null || value.trim().isEmpty()) - value = defaultValue; - - return value; - } - - public static String obfuscate(String value) { - if (value == null) - return null; - - String res = value.substring(0, value.length() / 2); - return StringUtils.rightPad(res, value.length(), '*'); - } -} diff --git a/javasource/appcloudservices/SessionInitializer.java b/javasource/appcloudservices/SessionInitializer.java deleted file mode 100644 index 26d9512..0000000 --- a/javasource/appcloudservices/SessionInitializer.java +++ /dev/null @@ -1,155 +0,0 @@ -package appcloudservices; - -import java.io.IOException; -import java.util.List; - -import system.proxies.User; -import appcloudservices.proxies.microflows.Microflows; -import static appcloudservices.proxies.constants.Constants.getLogNode; - -import com.mendix.core.Core; -import com.mendix.core.CoreException; -import com.mendix.logging.ILogNode; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.m2ee.api.IMxRuntimeResponse; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.systemwideinterfaces.core.IMendixObject; -import com.mendix.systemwideinterfaces.core.ISession; -import com.mendix.systemwideinterfaces.core.IUser; - -public class SessionInitializer { - - public static String USER_ENTITY = "System.User"; - public static String USER_ENTITY_NAME = "Name"; - public static String DEFAULT_MENDIX_USERNAME_ATTRIBUTE = "Name"; - public static final String XASID_COOKIE = "XASID"; - private static final String ORIGIN_COOKIE = "originURI"; - private static final ILogNode LOG = Core.getLogger(getLogNode()); - private static final String XAS_SESSION_ID = Core.getConfiguration().getSessionIdCookieName(); - - /** - * Given a username, starts a new session for the user and redirects back to index.html. - * If no matching account is found for the user, a new account will be created automatically. - * @param resp - * @param req - * @param user - * @return - * @throws CoreException - * @throws IOException - * @throws NoSuchMethodException - * @throws SecurityException - */ - static public ISession createSessionForUser(IMxRuntimeResponse resp, - IMxRuntimeRequest req, IUser user) throws Exception { - - LOG.info("User " + user.getName() + " authenticated. Starting session.."); - - String sessionid = req.getCookie(XAS_SESSION_ID); - - ISession session = Core.initializeSession(user, sessionid); - - // Used to enable Single Sign Off request (from remote sso *server*); must only sign off user in a particular User Agent / Browser - String ua = req.getHeader("User-Agent"); - session.setUserAgent(ua); - - if (LOG.isDebugEnabled()) - LOG.debug("Created session, fingerprint: " + OpenIDUtils.getFingerPrint(session)); - - writeSessionCookies(resp, session); - - return session; - } - - public static void writeSessionCookies(IMxRuntimeResponse resp, - ISession session) { - resp.addCookie(XAS_SESSION_ID, session.getId().toString(),"/" ,"" ,-1, true ); - resp.addCookie(XASID_COOKIE, "0." + Core.getXASId(),"/" ,"" ,-1, true); - resp.addCookie(ORIGIN_COOKIE, "/" + OpenIDHandler.OPENID_CLIENTSERVLET_LOCATION + OpenIDHandler.LOGIN, "/", "", -1, false); - } - - public static void redirectToIndex(IMxRuntimeResponse resp, String continuation) - { - resp.setStatus(IMxRuntimeResponse.SEE_OTHER); - - //no continuation provided, use index - if (continuation == null) - resp.addHeader("location", OpenIDHandler.INDEX_PAGE); - else { - if (continuation.trim().startsWith("javascript:")) { - throw new IllegalArgumentException("Javascript injection detected!"); - } else if (!continuation.startsWith("http://") && !continuation.startsWith("https://")) { - resp.addHeader("location", OpenIDUtils.APPLICATION_ROOT_URL + continuation); - } else { - resp.addHeader("location", continuation); - } - } - } - - /** - * Finds a user account matching the given username. If not found the new account callback triggered. - * @param openID - * @return Newly created user or null. - * @throws Throwable - * @throws CoreException - */ - public static IUser findOrCreateUser(String openID) throws Throwable { - IContext c = Core.createSystemContext(); - c.startTransaction(); - try { - IUser user = findUser(c, openID); - - //Existing user - if (user != null) { - try { - Microflows.invokeOnNonFirstLoginAppCloudUser(c, User.initialize(c, user.getMendixObject())); - } - catch(Exception e) { - LOG.warn("Failed to update user roles for '" + openID + "', permissions for this user might be outdated", e); - } - } - - //New user - else { - String basemsg = "User '" + openID + "' does not exist in database. Triggering OnFirstLogin action... "; - LOG.info(basemsg); - - //Expect user input here. - // Create new user: - Microflows.invokeOnFirstLoginAppCloudUser(c, openID); - - IUser newUser = findUser(c, openID); - if (newUser != null) { - LOG.info(basemsg + "Account created."); - user = newUser; - } - - else { - LOG.info(basemsg + "No user was created. Rejecting the login request."); - } - } - - c.endTransaction(); - return user; - } - catch (Throwable e) { - LOG.warn("Find or create user for openID '" + openID + "' caught exception. Triggering rollback."); - c.rollbackTransAction(); - throw e; - } - } - - private static IUser findUser(IContext c, String openID) throws CoreException { - List userList = Core.retrieveXPathQuery(c, String.format("//%s[%s='%s']", USER_ENTITY, USER_ENTITY_NAME, openID)); - - if (userList.size() > 0) { - IMendixObject userObject = userList.get(0); - String username = userObject.getValue(c, DEFAULT_MENDIX_USERNAME_ATTRIBUTE); - if (LOG.isTraceEnabled()) - LOG.trace("Getting System.User using username: '" + username + "'"); - - return Core.getUser(c, username); - } else { - return null; - } - } -} diff --git a/javasource/appcloudservices/actions/GenerateRandomPassword.java b/javasource/appcloudservices/actions/GenerateRandomPassword.java deleted file mode 100644 index 6b8975a..0000000 --- a/javasource/appcloudservices/actions/GenerateRandomPassword.java +++ /dev/null @@ -1,81 +0,0 @@ -// This file was generated by Mendix Modeler. -// -// WARNING: Only the following code will be retained when actions are regenerated: -// - the import list -// - the code between BEGIN USER CODE and END USER CODE -// - the code between BEGIN EXTRA CODE and END EXTRA CODE -// Other code you write will be lost the next time you deploy the project. -// Special characters, e.g., é, ö, à, etc. are supported in comments. - -package appcloudservices.actions; - -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.lang.RandomStringUtils; -import org.apache.commons.lang.math.RandomUtils; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.webui.CustomJavaAction; - -/** - * Generate a valid strong random password for Mendix user - */ -public class GenerateRandomPassword extends CustomJavaAction -{ - private java.lang.Long length; - - public GenerateRandomPassword(IContext context, java.lang.Long length) - { - super(context); - this.length = length; - } - - @Override - public java.lang.String executeAction() throws Exception - { - // BEGIN USER CODE - String _pw_charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - + "abcdefghijklmnopqrstuvwxyz" - + "!@#$%^&*()+-_[]{}=,./\\|~`'\":;<>?" + "1234567890"; - - if (length < 5) - throw new IllegalArgumentException( - "Password length should at least be 4"); - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < length - 4; i++) - sb.append(_pw_charset.charAt(RandomUtils.nextInt(_pw_charset - .length()))); - - // make sure it is strong - sb.append(RandomStringUtils.random(1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")); - sb.append(RandomStringUtils.random(1, "abcdefghijklmnopqrstuvwxyz")); - sb.append(RandomStringUtils.random(1, - "!@#$%^&*()+-_[]{}=,./\\|~`'\":;<>?")); - sb.append(RandomStringUtils.random(1, "1234567890")); - - // do shuffle - List base = new ArrayList(); - StringBuilder result = new StringBuilder(); - - for (char c : sb.toString().toCharArray()) - base.add(String.valueOf(c)); - - while (base.size() > 0) - result.append(base.remove(RandomUtils.nextInt(base.size()))); - - return result.toString(); - // END USER CODE - } - - /** - * Returns a string representation of this action - */ - @Override - public java.lang.String toString() - { - return "GenerateRandomPassword"; - } - - // BEGIN EXTRA CODE - // END EXTRA CODE -} diff --git a/javasource/appcloudservices/actions/LogOutUser.java b/javasource/appcloudservices/actions/LogOutUser.java deleted file mode 100644 index fd7bb97..0000000 --- a/javasource/appcloudservices/actions/LogOutUser.java +++ /dev/null @@ -1,53 +0,0 @@ -// This file was generated by Mendix Modeler. -// -// WARNING: Only the following code will be retained when actions are regenerated: -// - the import list -// - the code between BEGIN USER CODE and END USER CODE -// - the code between BEGIN EXTRA CODE and END EXTRA CODE -// Other code you write will be lost the next time you deploy the project. -// Special characters, e.g., é, ö, à, etc. are supported in comments. - -package appcloudservices.actions; - -import com.mendix.core.Core; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.systemwideinterfaces.core.ISession; -import com.mendix.webui.CustomJavaAction; -import java.util.Collection; - -public class LogOutUser extends CustomJavaAction -{ - private java.lang.String openId; - - public LogOutUser(IContext context, java.lang.String openId) - { - super(context); - this.openId = openId; - } - - @Override - public java.lang.Boolean executeAction() throws Exception - { - // BEGIN USER CODE - Collection activeSessions = Core.getActiveSessions(); - for (ISession session : activeSessions) { - if(session.getUser() != null && session.getUser().getName().equals(openId)) { - Core.logout(session); - } - } - return true; - // END USER CODE - } - - /** - * Returns a string representation of this action - */ - @Override - public java.lang.String toString() - { - return "LogOutUser"; - } - - // BEGIN EXTRA CODE - // END EXTRA CODE -} diff --git a/javasource/appcloudservices/proxies/constants/Constants.java b/javasource/appcloudservices/proxies/constants/Constants.java deleted file mode 100644 index 52193fd..0000000 --- a/javasource/appcloudservices/proxies/constants/Constants.java +++ /dev/null @@ -1,73 +0,0 @@ -// This file was generated by Mendix Modeler 7.0. -// -// WARNING: Code you write here will be lost the next time you deploy the project. - -package appcloudservices.proxies.constants; - -import com.mendix.core.Core; - -public class Constants -{ - // These are the constants for the AppCloudServices module - - /** - * This is the password which is used to communicate with the Mendix AppCloud Services. This password will be set automatically on deployment in the Mendix Cloud. - */ - public static java.lang.String getEnvironmentPassword() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.EnvironmentPassword"); - } - - /** - * This is the environment UUID which is used to communicate with the Mendix AppCloud Services to identify this application. This UUID will be set automatically on deployment in the Mendix Cloud. - */ - public static java.lang.String getEnvironmentUUID() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.EnvironmentUUID"); - } - - public static java.lang.String getInviteAPI_Location() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.InviteAPI_Location"); - } - - public static java.lang.String getLogNode() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.LogNode"); - } - - /** - * This constant indicates whether Single Sign On through MxID will be performend whenever a user tries to access this app. This constant defaults to 'false' for local deployments and will be set to 'true' automatically upon deployment in the Mendix AppCloud. - * - * If enabled, the Single Sign On process can be initiated by navigating to "/openid/login" - */ - public static boolean getOpenIdEnabled() - { - return (java.lang.Boolean)Core.getConfiguration().getConstantValue("AppCloudServices.OpenIdEnabled"); - } - - /** - * This constant defines the location of the MxID provider in the AppCloud. This constant will be set by the Mendix AppCloud upon deployment. - */ - public static java.lang.String getOpenIdProvider() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.OpenIdProvider"); - } - - /** - * This constant defines the location of the Permissions API provider in the AppCloud. This constant will be set by the Mendix AppCloud upon deployment. - */ - public static java.lang.String getPermissionsAPI_Location() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.PermissionsAPI_Location"); - } - - /** - * This constant should refer to the location of the latest profile service version. At the moment, the latest version is: 3 - * Note that if you previously deployed your app with an older version of the AppCloudServices module, you will need to update the value of this constant in the Cloud Portal. - */ - public static java.lang.String getProfileServiceLocation() - { - return (java.lang.String)Core.getConfiguration().getConstantValue("AppCloudServices.ProfileServiceLocation"); - } -} \ No newline at end of file diff --git a/javasource/appcloudservices/proxies/microflows/Microflows.java b/javasource/appcloudservices/proxies/microflows/Microflows.java deleted file mode 100644 index 82d669c..0000000 --- a/javasource/appcloudservices/proxies/microflows/Microflows.java +++ /dev/null @@ -1,138 +0,0 @@ -// This file was generated by Mendix Modeler 7.0. -// -// WARNING: Code you write here will be lost the next time you deploy the project. - -package appcloudservices.proxies.microflows; - -import java.util.HashMap; -import java.util.Map; -import com.mendix.core.Core; -import com.mendix.core.CoreException; -import com.mendix.systemwideinterfaces.MendixRuntimeException; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.systemwideinterfaces.core.IMendixObject; - -public class Microflows -{ - // These are the microflows for the AppCloudServices module - public static boolean checkUserRolesRemoved(IContext context, system.proxies.User _user) - { - try - { - Map params = new HashMap(); - params.put("User", _user == null ? null : _user.getMendixObject()); - return (java.lang.Boolean)Core.execute(context, "AppCloudServices.CheckUserRolesRemoved", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void inviteUserToApp(IContext context, java.lang.String _inviteeEmailAddress, system.proxies.UserRole _userRole, java.lang.String _inviterEmailAddress) - { - try - { - Map params = new HashMap(); - params.put("InviteeEmailAddress", _inviteeEmailAddress); - params.put("UserRole", _userRole == null ? null : _userRole.getMendixObject()); - params.put("InviterEmailAddress", _inviterEmailAddress); - Core.execute(context, "AppCloudServices.InviteUserToApp", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void invokeOnFirstLoginAppCloudUser(IContext context, java.lang.String _userIdentity) - { - try - { - Map params = new HashMap(); - params.put("UserIdentity", _userIdentity); - Core.execute(context, "AppCloudServices.InvokeOnFirstLoginAppCloudUser", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void invokeOnNonFirstLoginAppCloudUser(IContext context, system.proxies.User _user) - { - try - { - Map params = new HashMap(); - params.put("User", _user == null ? null : _user.getMendixObject()); - Core.execute(context, "AppCloudServices.InvokeOnNonFirstLoginAppCloudUser", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static boolean provisionAsAppCloudUser(IContext context, system.proxies.User _userAccount, java.lang.String _userIdentity) - { - try - { - Map params = new HashMap(); - params.put("UserAccount", _userAccount == null ? null : _userAccount.getMendixObject()); - params.put("UserIdentity", _userIdentity); - return (java.lang.Boolean)Core.execute(context, "AppCloudServices.ProvisionAsAppCloudUser", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static void refreshUserPermissions(IContext context, java.lang.String _openId) - { - try - { - Map params = new HashMap(); - params.put("OpenId", _openId); - Core.execute(context, "AppCloudServices.RefreshUserPermissions", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static profileservice.proxies.UserProfile retrieveUserProfile(IContext context, java.lang.String _userIdentity) - { - try - { - Map params = new HashMap(); - params.put("UserIdentity", _userIdentity); - IMendixObject result = (IMendixObject)Core.execute(context, "AppCloudServices.RetrieveUserProfile", params); - return result == null ? null : profileservice.proxies.UserProfile.initialize(context, result); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static boolean retrieveUserRoles(IContext context, system.proxies.User _user) - { - try - { - Map params = new HashMap(); - params.put("User", _user == null ? null : _user.getMendixObject()); - return (java.lang.Boolean)Core.execute(context, "AppCloudServices.RetrieveUserRoles", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } - public static boolean startAppCloudServices(IContext context) - { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "AppCloudServices.StartAppCloudServices", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } - } -} \ No newline at end of file diff --git a/javasource/atlas_ui_resources/proxies/constants/Constants.java b/javasource/atlas_ui_resources/proxies/constants/Constants.java new file mode 100644 index 0000000..c11d979 --- /dev/null +++ b/javasource/atlas_ui_resources/proxies/constants/Constants.java @@ -0,0 +1,17 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package atlas_ui_resources.proxies.constants; + +import com.mendix.core.Core; + +public class Constants +{ + // These are the constants for the Atlas_UI_Resources module + + public static java.lang.String getAtlas_UI_Resources_Version() + { + return (java.lang.String)Core.getConfiguration().getConstantValue("Atlas_UI_Resources.Atlas_UI_Resources_Version"); + } +} \ No newline at end of file diff --git a/javasource/inviteapi/proxies/microflows/Microflows.java b/javasource/inviteapi/proxies/microflows/Microflows.java index 43bd373..7a1a7ef 100644 --- a/javasource/inviteapi/proxies/microflows/Microflows.java +++ b/javasource/inviteapi/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Modeler 7.16. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/mqttclient/actions/MqttInitialize.java b/javasource/mqttclient/actions/MqttInitialize.java deleted file mode 100644 index 65dc89f..0000000 --- a/javasource/mqttclient/actions/MqttInitialize.java +++ /dev/null @@ -1,45 +0,0 @@ -// This file was generated by Mendix Modeler. -// -// WARNING: Only the following code will be retained when actions are regenerated: -// - the import list -// - the code between BEGIN USER CODE and END USER CODE -// - the code between BEGIN EXTRA CODE and END EXTRA CODE -// Other code you write will be lost the next time you deploy the project. -// Special characters, e.g., é, ö, à, etc. are supported in comments. - -package mqttclient.actions; - -import com.mendix.core.Core; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.webui.CustomJavaAction; -import mqttclient.impl.MqttConnector; - -public class MqttInitialize extends CustomJavaAction -{ - public MqttInitialize(IContext context) - { - super(context); - } - - @Override - public java.lang.Boolean executeAction() throws Exception - { - // BEGIN USER CODE - //throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented"); - MqttConnector handler = new MqttConnector(Core.getLogger("MqttConnector")); - return true; - // END USER CODE - } - - /** - * Returns a string representation of this action - */ - @Override - public java.lang.String toString() - { - return "MqttInitialize"; - } - - // BEGIN EXTRA CODE - // END EXTRA CODE -} diff --git a/javasource/mqttclient/actions/MqttPublish.java b/javasource/mqttclient/actions/MqttPublish.java index 9fe858c..726d45e 100644 --- a/javasource/mqttclient/actions/MqttPublish.java +++ b/javasource/mqttclient/actions/MqttPublish.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -19,6 +19,7 @@ public class MqttPublish extends CustomJavaAction private java.lang.String BrokerHost; private java.lang.Long BrokerPort; private java.lang.String BrokerOrganisation; + private java.lang.Long Timeout; private java.lang.String Username; private java.lang.String Password; private java.lang.String TopicName; @@ -27,13 +28,15 @@ public class MqttPublish extends CustomJavaAction private java.lang.String ClientCertificate; private java.lang.String ClientKey; private java.lang.String CertificatePassword; + private mqttclient.proxies.qos QoS; - public MqttPublish(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String BrokerOrganisation, java.lang.String Username, java.lang.String Password, java.lang.String TopicName, java.lang.String Payload, java.lang.String CA, java.lang.String ClientCertificate, java.lang.String ClientKey, java.lang.String CertificatePassword) + public MqttPublish(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String BrokerOrganisation, java.lang.Long Timeout, java.lang.String Username, java.lang.String Password, java.lang.String TopicName, java.lang.String Payload, java.lang.String CA, java.lang.String ClientCertificate, java.lang.String ClientKey, java.lang.String CertificatePassword, java.lang.String QoS) { super(context); this.BrokerHost = BrokerHost; this.BrokerPort = BrokerPort; this.BrokerOrganisation = BrokerOrganisation; + this.Timeout = Timeout; this.Username = Username; this.Password = Password; this.TopicName = TopicName; @@ -42,15 +45,15 @@ public MqttPublish(IContext context, java.lang.String BrokerHost, java.lang.Long this.ClientCertificate = ClientCertificate; this.ClientKey = ClientKey; this.CertificatePassword = CertificatePassword; + this.QoS = QoS == null ? null : mqttclient.proxies.qos.valueOf(QoS); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE - MqttConnector handler = new MqttConnector(Core.getLogger("MqttConnector")); - try { - handler.publish(this.BrokerHost, this.BrokerPort, this.BrokerOrganisation,this.TopicName, this.Payload, this.CA, this.ClientCertificate, this.ClientKey, this.CertificatePassword, this.Username, this.Password); + try { + MqttConnector.publish(this.BrokerHost, this.BrokerPort, this.BrokerOrganisation,this.TopicName, this.Payload, this.CA, this.ClientCertificate, this.ClientKey, this.CertificatePassword, this.Username, this.Password, this.QoS, this.Timeout); return true; } catch (Exception e) { return false; @@ -61,7 +64,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "MqttPublish"; diff --git a/javasource/mqttclient/actions/MqttSubscribe.java b/javasource/mqttclient/actions/MqttSubscribe.java index e3b20ef..8c0eab0 100644 --- a/javasource/mqttclient/actions/MqttSubscribe.java +++ b/javasource/mqttclient/actions/MqttSubscribe.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -29,8 +29,9 @@ public class MqttSubscribe extends CustomJavaAction private java.lang.String ClientCertificate; private java.lang.String ClientKey; private java.lang.String CertificatePassword; + private mqttclient.proxies.qos QoS; - public MqttSubscribe(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String BrokerOrganisation, java.lang.Long Timeout, java.lang.String Username, java.lang.String Password, java.lang.String TopicName, java.lang.String OnMessageMicroflow, java.lang.String CA, java.lang.String ClientCertificate, java.lang.String ClientKey, java.lang.String CertificatePassword) + public MqttSubscribe(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String BrokerOrganisation, java.lang.Long Timeout, java.lang.String Username, java.lang.String Password, java.lang.String TopicName, java.lang.String OnMessageMicroflow, java.lang.String CA, java.lang.String ClientCertificate, java.lang.String ClientKey, java.lang.String CertificatePassword, java.lang.String QoS) { super(context); this.BrokerHost = BrokerHost; @@ -45,17 +46,15 @@ public MqttSubscribe(IContext context, java.lang.String BrokerHost, java.lang.Lo this.ClientCertificate = ClientCertificate; this.ClientKey = ClientKey; this.CertificatePassword = CertificatePassword; + this.QoS = QoS == null ? null : mqttclient.proxies.qos.valueOf(QoS); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE - ILogNode logger = Core.getLogger("MqttConnector"); try { - MqttConnector handler = new MqttConnector(logger); - logger.info(String.format("subscribe: %s", this.TopicName)); - handler.subscribe(this.BrokerHost, this.BrokerPort, this.BrokerOrganisation, this.TopicName, this.OnMessageMicroflow, this.CA, this.ClientCertificate, this.ClientKey, this.CertificatePassword, this.Username, this.Password); + MqttConnector.subscribe(this.BrokerHost, this.BrokerPort, this.BrokerOrganisation, this.TopicName, this.OnMessageMicroflow, this.CA, this.ClientCertificate, this.ClientKey, this.CertificatePassword, this.Username, this.Password, this.QoS, this.Timeout); return true; } catch (Exception e) { return false; @@ -66,7 +65,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "MqttSubscribe"; diff --git a/javasource/mqttclient/actions/MqttUnsubscribe.java b/javasource/mqttclient/actions/MqttUnsubscribe.java index ab88ce0..42b8ee6 100644 --- a/javasource/mqttclient/actions/MqttUnsubscribe.java +++ b/javasource/mqttclient/actions/MqttUnsubscribe.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -9,46 +9,50 @@ package mqttclient.actions; -import com.mendix.core.Core; -import com.mendix.logging.ILogNode; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; import mqttclient.impl.MqttConnector; +/** + * + * Returns true if successful + * if an exception occurs during the unsubscribe this activity will return a false + */ public class MqttUnsubscribe extends CustomJavaAction { private java.lang.String BrokerHost; private java.lang.Long BrokerPort; + private java.lang.String BrokerOrganisation; + private java.lang.String Username; private java.lang.String TopicName; - public MqttUnsubscribe(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String TopicName) + public MqttUnsubscribe(IContext context, java.lang.String BrokerHost, java.lang.Long BrokerPort, java.lang.String BrokerOrganisation, java.lang.String Username, java.lang.String TopicName) { super(context); this.BrokerHost = BrokerHost; this.BrokerPort = BrokerPort; + this.BrokerOrganisation = BrokerOrganisation; + this.Username = Username; this.TopicName = TopicName; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE - ILogNode logger = Core.getLogger("MqttConnector"); - try { - MqttConnector handler = new MqttConnector(logger); - logger.info(String.format("Unsubscribe: %s", this.TopicName)); - handler.unsubscribe(this.BrokerHost, this.BrokerPort, this.TopicName); - return true; - } catch (Exception e) { - return false; - } + try { + MqttConnector.unsubscribe(this.BrokerHost, this.BrokerPort, this.BrokerOrganisation, this.TopicName, this.Username); + return true; + } catch (Exception e) { + return false; + } // END USER CODE } /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "MqttUnsubscribe"; diff --git a/javasource/mqttclient/impl/MqttConnector.java b/javasource/mqttclient/impl/MqttConnector.java index b4f812e..47341aa 100644 --- a/javasource/mqttclient/impl/MqttConnector.java +++ b/javasource/mqttclient/impl/MqttConnector.java @@ -1,118 +1,115 @@ package mqttclient.impl; -import com.mendix.core.Core; -import com.mendix.logging.ILogNode; -import org.eclipse.paho.client.mqttv3.*; -import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; - import java.io.File; -import java.net.InetAddress; import java.util.HashMap; import java.util.Map; +import org.eclipse.paho.client.mqttv3.IMqttToken; +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; + +import com.mendix.core.Core; +import com.mendix.logging.ILogNode; +import com.mendix.systemwideinterfaces.core.IDataType; + /** * Created by ako on 1/9/2016. */ public class MqttConnector { - private static Map mqttHandlers; - private ILogNode logger; + private static Map mqttHandlers = new HashMap(); + protected static ILogNode logger = Core.getLogger("MqttConnector"); - public MqttConnector(ILogNode logger) { - this.logger = logger; - if (mqttHandlers == null) { - mqttHandlers = new HashMap(); - } - } + private MqttConnector() { } - public void subscribe(String brokerHost, Long brokerPort, String brokerOrganisation, String topicName, String onMessageMicroflow, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password) throws Exception { - logger.info("MqttConnector.subscribe"); - MqttConnection connection = getMqttConnection(brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password); - connection.subscribe(topicName, onMessageMicroflow); + + public static void subscribe(String brokerHost, Long brokerPort, String brokerOrganisation, String topicName, String onMessageMicroflow, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password, mqttclient.proxies.qos QoS, long timeout) throws Exception { + MqttConnection connection = getMqttConnection(brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password, timeout); + connection.subscribe(topicName, onMessageMicroflow, QoS); } - public void publish(String brokerHost, Long brokerPort, String brokerOrganisation, String topicName, String message, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password) throws Exception { - logger.info("MqttConnector.publish"); - MqttConnection connection = getMqttConnection(brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password); - connection.publish(topicName, message); + public static void unsubscribe(String brokerHost, Long brokerPort, String brokerOrganisation, String topicName, String username) throws Exception { + MqttConnection connection = getMqttConnection(brokerHost, brokerPort, brokerOrganisation, null, null, null, null, username, null,0); + connection.unsubscribe(topicName); + } + + public static void publish(String brokerHost, Long brokerPort, String brokerOrganisation, String topicName, String message, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password, mqttclient.proxies.qos QoS, long timeout) throws Exception { + MqttConnection connection = getMqttConnection(brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password, timeout); + connection.publish(topicName, message, QoS); } - private MqttConnection getMqttConnection(String brokerHost, Long brokerPort, String brokerOrganisation, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password) throws Exception { - String key = brokerHost + ":" + brokerPort; + private static MqttConnection getMqttConnection(String brokerHost, Long brokerPort, String brokerOrganisation, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password, long timeout) throws Exception { + String key = formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username); MqttConnection handler; synchronized (mqttHandlers) { - logger.info("NUmber of objects in mqttHandlers map: " + mqttHandlers.size()); + logger.trace("Number of active MQTT Connections: " + mqttHandlers.size()); if (!mqttHandlers.containsKey(key)) { - logger.info("creating new MqttConnection"); + logger.info("Creating new MqttConnection to: " + formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username)); + try { - handler = new MqttConnection(logger, brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password); + handler = new MqttConnection(brokerHost, brokerPort, brokerOrganisation, CA, ClientCertificate, ClientKey, CertificatePassword, username, password, timeout); mqttHandlers.put(key, handler); } catch (Exception e) { - logger.error(e); + logger.error("Unable to create an MQTT Connection to: "+ formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username), e); throw e; } } else { - logger.info("Found existing MqttConnection"); + logger.info("Found existing MqttConnection for: " + formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username)); handler = mqttHandlers.get(key); } - logger.info("Number of objects in mqttHandlers map: " + mqttHandlers.size()); + logger.debug("Number of active MQTT Connections: " + mqttHandlers.size()); } return handler; } - public void unsubscribe(String brokerHost, Long brokerPort, String topicName) throws Exception { - MqttConnection connection = getMqttConnection(brokerHost, brokerPort, null, null, null, null, null, null, null); - connection.unsubscribe(topicName); - } - private class MqttConnection { - private ILogNode logger; + protected static class MqttConnection { private MqttClient client; private HashMap subscriptions = new HashMap<>(); - private String broker; - private String clientId; - private MqttConnectOptions connOpts; - private MemoryPersistence persistence; + private String brokerKey; + private MqttConnectOptions connectionOpts; - public MqttConnection(ILogNode logger, String brokerHost, Long brokerPort, String brokerOrganisation, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password) throws Exception { - logger.info("new MqttConnection"); - - this.logger = logger; - - String hostname = InetAddress.getLocalHost().getHostName(); - String xasId = Core.getXASId(); + public MqttConnection(String brokerHost, Long brokerPort, String brokerOrganisation, String CA, String ClientCertificate, String ClientKey, String CertificatePassword, String username, String password, long connectionTimeout) throws Exception { + this.brokerKey = formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username); boolean useSsl = (ClientCertificate != null && !ClientCertificate.equals("")); - connOpts = new MqttConnectOptions(); + MqttConnectOptions connOpts = new MqttConnectOptions(); connOpts.setCleanSession(true); connOpts.setAutomaticReconnect(true); + if(connectionTimeout != 0) + connOpts.setConnectionTimeout(Math.toIntExact(connectionTimeout)); + else + connOpts.setConnectionTimeout(60); + connOpts.setKeepAliveInterval(60); + String brokerURL = "", clientId = ""; if(brokerOrganisation != null && !brokerOrganisation.equals("")){ - broker = String.format("tcp://%1s.%2s:%d",brokerOrganisation, brokerHost, brokerPort); - clientId = "a:" + brokerOrganisation + ":" + xasId; - }else{ - broker = String.format("tcp://%s:%d", brokerHost, brokerPort); - clientId = "MxClient_" + xasId + "_" + hostname + "_" + brokerHost + "_" + brokerPort; + brokerURL = String.format("tcp://%1s.%2s:%d",brokerOrganisation, brokerHost, brokerPort); + clientId = "a:" + brokerOrganisation + ":" + Core.getXASId(); + } + else{ + brokerURL = String.format("tcp://%s:%d", brokerHost, brokerPort); + clientId = "MxClient_" + Core.getXASId(); } - logger.info("new MqttConnection client id " + clientId); + logger.debug("Assigned MQTT Connection client id " + clientId + " to: " + formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username)); - if (username != null && !username.equals("")) { + if (username != null && !"".equals(username.trim())) { connOpts.setUserName(username); } - if (password != null && !password.equals("")) { + if (password != null && !"".equals(password.trim())) { connOpts.setPassword(password.toCharArray()); } if (useSsl) { - broker = String.format("ssl://%s:%d", brokerHost, brokerPort); - //connOpts = new MqttConnectOptions(); - connOpts.setConnectionTimeout(60); - connOpts.setKeepAliveInterval(60); + brokerURL = String.format("ssl://%s:%d", brokerHost, brokerPort); connOpts.setCleanSession(true); try { @@ -122,7 +119,6 @@ public MqttConnection(ILogNode logger, String brokerHost, Long brokerPort, Stri resourcesPath += File.separator; } catch (Exception e) { - //testing mode? resourcesPath = ""; } connOpts.setSocketFactory(SslUtil.getSslSocketFactory( @@ -132,77 +128,141 @@ public MqttConnection(ILogNode logger, String brokerHost, Long brokerPort, Stri CertificatePassword )); } catch (Exception e) { - logger.error(e); + logger.error(String.format("Unable to load certificates for: " + formatBrokerId(brokerHost, brokerPort, brokerOrganisation, username), brokerHost,brokerPort), e); throw e; } } - persistence = new MemoryPersistence(); + MemoryPersistence persistence = new MemoryPersistence(); try { - this.client = new MqttClient(broker, clientId, persistence); - logger.info("Connecting to broker: " + broker); - client.connect(connOpts); - client.setCallback(new MxMqttCallback(logger, client, subscriptions)); - logger.info("Connected"); + this.client = new MqttClient(brokerURL, clientId, persistence); + this.client.setCallback(new MxMqttCallback(this.brokerKey, this, this.subscriptions)); + + logger.debug("Connecting to broker: " + brokerURL); + IMqttToken token = this.client.connectWithResult(connOpts); + token.waitForCompletion(connectionTimeout); + logger.trace("Connected"); } catch (Exception e) { - logger.error(e); throw e; } } - public void finalize() { - logger.info("finalize MqttConnection"); - } - public boolean isSubscribed(String topic) { - return subscriptions.containsKey(topic); - - } - - public void subscribe(String topic, String onMessageMicroflow) throws MqttException { - logger.info(String.format("MqttConnection.subscribe: %s", client.getClientId())); + public void subscribe(String topic, String onMessageMicroflow, mqttclient.proxies.qos QoS) throws MqttException { + logger.info(String.format("Subscribe: %s", this.client.getClientId())); try { - if(!client.isConnected()){ - client.reconnect(); + if(!this.client.isConnected()){ + this.client.reconnect(); + } + int subscriptionQos = 0; + if(QoS.equals(mqttclient.proxies.qos.At_Most_Once_0)){ + subscriptionQos = 0; + }else if(QoS.equals(mqttclient.proxies.qos.At_Least_Once_1)){ + subscriptionQos= 1; + }else if(QoS.equals(mqttclient.proxies.qos.Exactly_Once_2)){ + subscriptionQos= 2; } - // 0 - at most once - // 1 - at least once - // 2 - exactly once - - int subscriptionQos = 1; - client.subscribe(topic, subscriptionQos); - subscriptions.put(topic, new MqttSubscription(topic, onMessageMicroflow)); + /* Request the input parameters from the OnMessageMicroflow so we can + * validate that both 'Topic' & 'Payload' present. + */ + Map params = Core.getInputParameters(onMessageMicroflow); + if( !params.containsKey("Topic") && !params.containsKey("Payload") ) + logger.warn("On Message Microflow: " + onMessageMicroflow + " is missing all required parameters [Topic & Payload]"); + else if( !params.containsKey("Topic") ) + logger.warn("On Message Microflow: " + onMessageMicroflow + " is missing parameter [Topic]"); + else if( !params.containsKey("Payload") ) + logger.warn("On Message Microflow: " + onMessageMicroflow + " is missing required parameter [Payload]"); + + + this.client.subscribe(topic, subscriptionQos); + this.subscriptions.put(topic, new MqttSubscription(topic, onMessageMicroflow, QoS)); } catch (Exception e) { logger.error(e); throw e; } } - - public void publish(String topic, String message) throws MqttException { - logger.info(String.format("MqttConnection.publish: %s, %s, %s", topic, message, client.getClientId())); + public void unsubscribe(String topicName) throws MqttException { + logger.info(String.format("Unsubscribe: %s, %s", topicName, this.client.getClientId())); try { - MqttMessage payload = new MqttMessage(message.getBytes()); - int qos = 1; - payload.setQos(qos); - client.publish(topic, payload); - logger.info("Message published"); - } catch (Exception e) { + this.subscriptions.remove(topicName); + + this.client.unsubscribe(topicName); + } catch (MqttException e) { logger.error(e); throw e; } + finally { + if( this.subscriptions.size() == 0 ) { + synchronized (mqttHandlers) { + this.client.disconnect(); + mqttHandlers.remove(this.brokerKey); + + logger.info("Closed MqttConnection after unsubscribing from the last topic. For: " + this.brokerKey); + logger.debug("Number of active MQTT Connections: " + mqttHandlers.size()); + } + } + } } - public void unsubscribe(String topicName) throws MqttException { - logger.info(String.format("unsubscribe: %s, %s", topicName, client.getClientId())); + public void publish(String topic, String message,mqttclient.proxies.qos QoS) throws MqttException { + logger.debug(String.format("Publish: %s, %s, %s", topic, message, this.client.getClientId())); try { - client.unsubscribe(topicName); - } catch (MqttException e) { - logger.error(e); + if(!this.client.isConnected()){ + this.client.reconnect(); + } + + MqttMessage payload = new MqttMessage(message.getBytes()); + int subscriptionQos = 0; + if(QoS.equals(mqttclient.proxies.qos.At_Most_Once_0)){ + subscriptionQos = 0; + }else if(QoS.equals(mqttclient.proxies.qos.At_Least_Once_1)){ + subscriptionQos= 1; + }else if(QoS.equals(mqttclient.proxies.qos.Exactly_Once_2)){ + subscriptionQos= 2; + } + payload.setQos(subscriptionQos); + this.client.publish(topic, payload); + + logger.trace("Message published"); + } catch (Exception e) { + logger.error("Unable to publish message to topic: " + topic, e); throw e; } } + + public void reconnect() { + + int numAttempts = 0; + while( numAttempts < 10 && !this.client.isConnected() ) { + try { + logger.info(String.format("Attempt (%d/10) to re-establish connection to: %s", numAttempts, this.brokerKey)); + + IMqttToken token = this.client.connectWithResult(this.connectionOpts); + token.waitForCompletion(); + if (this.client.isConnected()) + logger.info(String.format("Attempt (%d/10) - Re-connected to: %s", numAttempts, this.brokerKey)); + + } catch (MqttException e) { + MqttConnector.logger.error(String.format("Attempt (%d/10) - An error occured while reconnecting to: %s", numAttempts, this.brokerKey), e); + } + + //If we're still not connected wait 2 seconds before trying again + finally { + numAttempts++; + try { + if( !this.client.isConnected() ) Thread.sleep(2000); + } catch(InterruptedException e) { } ; //Ignore this exception + } + } + + if (!this.client.isConnected()) + logger.error(String.format("Reconnection Failed, quitting after multiple attempts to reconnect to: %s", numAttempts, this.brokerKey)); + } + } + private static String formatBrokerId(String brokerHost, Long brokerPort, String brokerOrganisation, String username ) { + return String.format("[H:%s|O:%s|P:%d|U:%s]", brokerHost,brokerOrganisation,brokerPort,username); } } diff --git a/javasource/mqttclient/impl/MqttSubscription.java b/javasource/mqttclient/impl/MqttSubscription.java index 95617d4..890ce1b 100644 --- a/javasource/mqttclient/impl/MqttSubscription.java +++ b/javasource/mqttclient/impl/MqttSubscription.java @@ -1,23 +1,30 @@ package mqttclient.impl; +import mqttclient.proxies.qos; + /** * Created by ako on 4/26/2016. */ public class MqttSubscription { private String topic; private String onMessageMicroflow; + private qos QoS; - public MqttSubscription(String topic, String onMessageMicroflow) { + public MqttSubscription(String topic, String onMessageMicroflow, qos QoS) { this.onMessageMicroflow = onMessageMicroflow; this.topic = topic; - + this.QoS = QoS; } public String getTopic() { - return topic; + return this.topic; } public String getOnMessageMicroflow() { - return onMessageMicroflow; + return this.onMessageMicroflow; } + + public qos getQoS() { + return this.QoS; + } } diff --git a/javasource/mqttclient/impl/MxMqttCallback.java b/javasource/mqttclient/impl/MxMqttCallback.java index 6b03a7e..52cbfed 100644 --- a/javasource/mqttclient/impl/MxMqttCallback.java +++ b/javasource/mqttclient/impl/MxMqttCallback.java @@ -1,65 +1,63 @@ package mqttclient.impl; -import com.google.common.collect.ImmutableMap; -import com.mendix.core.Core; -import com.mendix.logging.ILogNode; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.systemwideinterfaces.core.ISession; -import org.eclipse.paho.client.mqttv3.*; - import java.util.HashMap; import java.util.Iterator; +import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; +import org.eclipse.paho.client.mqttv3.MqttCallbackExtended; +import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.MqttMessage; + +import com.mendix.core.Core; + +import mqttclient.impl.MqttConnector.MqttConnection; + /** * Created by ako on 12-8-2016. */ public class MxMqttCallback implements MqttCallbackExtended { - private ILogNode logger = null; - private MqttClient client = null; + private MqttConnection mqttConnection = null; + private String brokerKey; private HashMap subscriptions = null; - public MxMqttCallback(ILogNode logger, MqttClient client, HashMap subscriptions) { - this.logger = logger; - this.client = client; + + protected MxMqttCallback(String brokerKey, MqttConnection mqttConnection, HashMap subscriptions) { + this.mqttConnection = mqttConnection; + this.brokerKey=brokerKey; this.subscriptions = subscriptions; } @Override public void connectionLost(Throwable throwable) { - logger.info(String.format("connectionLost: %s, %s", throwable.getMessage(), client.getClientId())); - logger.warn(throwable); - try { - client.connect(); - } catch (MqttException e) { - logger.error(e); - } + MqttConnector.logger.warn(String.format("Connection Lost for: %s | %s", this.brokerKey, throwable.getMessage()), throwable); + this.mqttConnection.reconnect(); } @Override public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { try { - logger.info(String.format("messageArrived: %s, %s, %s", topic, new String(mqttMessage.getPayload()), client.getClientId())); - IContext ctx = Core.createSystemContext(); - ISession session = ctx.getSession(); + MqttConnector.logger.debug(String.format("Message Arrived for: %s | %s | %s", this.brokerKey, topic, new String(mqttMessage.getPayload()))); + MqttSubscription subscription = getSubscriptionForTopic(topic); if (subscription != null) { String microflow = subscription.getOnMessageMicroflow(); - logger.info(String.format("Calling onMessage microflow: %s, %s", microflow, client.getClientId())); - final ImmutableMap map = ImmutableMap.of("Topic", topic, "Payload", new String(mqttMessage.getPayload())); - logger.info("Parameter map: " + map); - //Core.execute(ctx, microflow, true, map); - Core.executeAsync(ctx, microflow, true, map); + MqttConnector.logger.trace(String.format("Calling onMessage microflow: %s, %s", microflow, this.brokerKey)); + + Core.microflowCall(microflow) + .withParam("Topic", topic) + .withParam("Payload", new String(mqttMessage.getPayload())) + .execute(Core.createSystemContext()); } else { - logger.error(String.format("Cannot find microflow for message received on topic %s", topic)); + MqttConnector.logger.error(String.format("Cannot find microflow for message received on topic %s", topic)); } } catch (Exception e) { - logger.error(e); + MqttConnector.logger.error(e); } } @Override public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { - logger.info(String.format("deliveryComplete: %s", client.getClientId())); + MqttConnector.logger.info(String.format("deliveryComplete: %s", this.brokerKey)); } /** @@ -67,30 +65,30 @@ public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { */ private MqttSubscription getSubscriptionForTopic(String topic) { - logger.info("getSubscriptionForTopic: " + topic); - Iterator subscriptionTopics = subscriptions.keySet().iterator(); + MqttConnector.logger.trace("getSubscriptionForTopic: " + topic); + Iterator subscriptionTopics = this.subscriptions.keySet().iterator(); while (subscriptionTopics.hasNext()) { String topicWithWildcards = subscriptionTopics.next(); - String topicWithWildcardsRe = topicWithWildcards.replaceAll("\\+", "[^/]+").replaceAll("/#", "\\(|/.*\\)"); - logger.info(String.format("Comparing topic %s with subscription %s as regex %s", topic, topicWithWildcards, topicWithWildcardsRe)); + String topicWithWildcardsRe = topicWithWildcards.replaceAll("\\+", "[^/]+").replaceAll("/#", "\\(|/.*\\)").replaceAll("\\$", "\\\\\\$"); + MqttConnector.logger.trace(String.format("Comparing topic %s with subscription %s as regex %s", topic, topicWithWildcards, topicWithWildcardsRe)); if (topic.matches(topicWithWildcardsRe)) { - logger.info("Found subscription " + topicWithWildcards); - return subscriptions.get(topicWithWildcards); + MqttConnector.logger.trace("Found subscription " + topicWithWildcards); + return this.subscriptions.get(topicWithWildcards); } } - logger.info("No subscription found for topic " + topic); + return null; } @Override public void connectComplete(boolean isReconnect, String serverUri) { - logger.info(String.format("connectComplete %s, %s", isReconnect, serverUri)); + MqttConnector.logger.info(String.format("connectComplete %s, %s", isReconnect, serverUri)); this.subscriptions.forEach((topic, subs) -> { try { - logger.info(String.format("Resubscribing microflow %s to topic %s (%s)", subs.getOnMessageMicroflow(), topic, subs.getTopic())); - client.subscribe(topic, 1); + MqttConnector.logger.info(String.format("Resubscribing microflow %s to topic %s (%s)", subs.getOnMessageMicroflow(), topic, subs.getTopic())); + this.mqttConnection.subscribe(topic, subs.getOnMessageMicroflow(),subs.getQoS()); } catch (MqttException e) { - logger.error(String.format("Reconnect failed for topic %s: %s", topic, e.getMessage())); + MqttConnector.logger.error(String.format("Reconnect failed for topic %s: %s", topic, e.getMessage())); } }); } diff --git a/javasource/mqttclient/impl/Subscription.java b/javasource/mqttclient/impl/Subscription.java deleted file mode 100644 index 534524c..0000000 --- a/javasource/mqttclient/impl/Subscription.java +++ /dev/null @@ -1,23 +0,0 @@ -package mqttclient.impl; - -/** - * Created by ako on 1/10/2016. - */ -public class Subscription { - private String topic; - private String onMessageMicroflow; - - public Subscription(String topic, String onMessageMicroflow) { - this.onMessageMicroflow = onMessageMicroflow; - this.topic = topic; - - } - - public String getTopic() { - return topic; - } - - public String getOnMessageMicroflow() { - return onMessageMicroflow; - } -} diff --git a/javasource/mqttclient/proxies/constants/Constants.java b/javasource/mqttclient/proxies/constants/Constants.java index db3013b..a4114ad 100644 --- a/javasource/mqttclient/proxies/constants/Constants.java +++ b/javasource/mqttclient/proxies/constants/Constants.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/mqttclient/proxies/qos.java b/javasource/mqttclient/proxies/qos.java new file mode 100644 index 0000000..693ee50 --- /dev/null +++ b/javasource/mqttclient/proxies/qos.java @@ -0,0 +1,33 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package mqttclient.proxies; + +public enum qos +{ + At_Most_Once_0(new java.lang.String[][] { new java.lang.String[] { "en_US", "At Most Once 0" } }), + At_Least_Once_1(new java.lang.String[][] { new java.lang.String[] { "en_US", "At Least Once 1" } }), + Exactly_Once_2(new java.lang.String[][] { new java.lang.String[] { "en_US", "Exactly Once 2" } }); + + private java.util.Map captions; + + private qos(java.lang.String[][] captionStrings) + { + this.captions = new java.util.HashMap(); + for (java.lang.String[] captionString : captionStrings) + captions.put(captionString[0], captionString[1]); + } + + public java.lang.String getCaption(java.lang.String languageCode) + { + if (captions.containsKey(languageCode)) + return captions.get(languageCode); + return captions.get("en_US"); + } + + public java.lang.String getCaption() + { + return captions.get("en_US"); + } +} diff --git a/javasource/objecthandling/ORM.java b/javasource/objecthandling/ORM.java index ff08d92..eb05db2 100644 --- a/javasource/objecthandling/ORM.java +++ b/javasource/objecthandling/ORM.java @@ -5,12 +5,8 @@ import java.util.Arrays; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; import com.mendix.core.Core; import com.mendix.core.CoreException; @@ -25,7 +21,6 @@ import com.mendix.systemwideinterfaces.core.IMendixObject.ObjectState; import com.mendix.systemwideinterfaces.core.IMendixObjectMember; import com.mendix.systemwideinterfaces.core.IMendixObjectMember.MemberState; -import com.mendix.systemwideinterfaces.core.ISession; import com.mendix.systemwideinterfaces.core.meta.IMetaAssociation; import com.mendix.systemwideinterfaces.core.meta.IMetaAssociation.AssociationType; import com.mendix.systemwideinterfaces.core.meta.IMetaEnumValue; @@ -37,8 +32,6 @@ public class ORM { - - public static Long getGUID(IMendixObject item) { return item.getId().toLong(); @@ -180,8 +173,8 @@ private static void duplicateReverseAssociations(IContext ctx, IMendixObject src throw new IllegalArgumentException("It is not possible to clone reverse referencesets: '" + fullAssocName + "'"); } - List objs = Core.retrieveXPathQueryEscaped(ctx, "//%s[%s='%s']", - relationParent.getName(), assocname, String.valueOf(src.getId().toLong())); + List objs = Core.retrieveXPathQuery(ctx, String.format("//%s[%s='%s']", + relationParent.getName(), assocname, String.valueOf(src.getId().toLong()))); for(IMendixObject obj : objs) { @SuppressWarnings("unused") // object is unused on purpose @@ -307,20 +300,6 @@ public static IMendixObject getCreatedByUser(IContext context, return Core.retrieveId(context, itemId); } -// public static boolean encryptMemberIfChanged(IContext context, IMendixObject item, -// String member, String key) throws Exception -// { -// if (memberHasChanged(context, item, member)) { -// -// if (item.getMetaObject().getMetaPrimitive(member).getType() != PrimitiveType.String) -// throw new IllegalArgumentException("The member '" + member + "' is not a string attribute!"); -// -// item.setValue(context, member, StringUtils.encryptString(key, (String) item.getValue(context, member))); -// return true; -// } -// return false; -// } - public static void commitSilent(IContext c, IMendixObject mendixObject) { try diff --git a/javasource/objecthandling/XPath.java b/javasource/objecthandling/XPath.java index d62c14d..e0e548e 100644 --- a/javasource/objecthandling/XPath.java +++ b/javasource/objecthandling/XPath.java @@ -256,6 +256,15 @@ public String getXPath() { return "//" + this.entity + "[" + builder.toString() + "]"; return "//" + this.entity; } + public XPath gte(Object attr, Object valuecomparison) { + return compare(attr,">=", valuecomparison); + } + + public XPath gte(Object... pathAndValue) { + assertEven(pathAndValue); + return compare(Arrays.copyOfRange(pathAndValue, 0, pathAndValue.length -1), ">=", pathAndValue[pathAndValue.length -1 ]); + } + private void assertEmptyStack() throws IllegalStateException { diff --git a/javasource/objecthandling/actions/EndTransaction.java b/javasource/objecthandling/actions/EndTransaction.java index 4b090cc..9637aa6 100644 --- a/javasource/objecthandling/actions/EndTransaction.java +++ b/javasource/objecthandling/actions/EndTransaction.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -22,7 +22,7 @@ public EndTransaction(IContext context) super(context); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -34,7 +34,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "EndTransaction"; diff --git a/javasource/objecthandling/actions/StartTransaction.java b/javasource/objecthandling/actions/StartTransaction.java index 98cd71e..f4d7fae 100644 --- a/javasource/objecthandling/actions/StartTransaction.java +++ b/javasource/objecthandling/actions/StartTransaction.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -22,7 +22,7 @@ public StartTransaction(IContext context) super(context); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -34,7 +34,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "StartTransaction"; diff --git a/javasource/objecthandling/actions/clone.java b/javasource/objecthandling/actions/clone.java index 4974c2b..2e1c27b 100644 --- a/javasource/objecthandling/actions/clone.java +++ b/javasource/objecthandling/actions/clone.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -37,7 +37,7 @@ public clone(IContext context, IMendixObject source, IMendixObject target, java. this.withAssociations = withAssociations; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -48,7 +48,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "clone"; diff --git a/javasource/objecthandling/actions/commitInSeparateDatabaseTransaction.java b/javasource/objecthandling/actions/commitInSeparateDatabaseTransaction.java index 5fc7eb6..335bebb 100644 --- a/javasource/objecthandling/actions/commitInSeparateDatabaseTransaction.java +++ b/javasource/objecthandling/actions/commitInSeparateDatabaseTransaction.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -28,7 +28,7 @@ public commitInSeparateDatabaseTransaction(IContext context, IMendixObject mxObj this.mxObject = mxObject; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -43,7 +43,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "commitInSeparateDatabaseTransaction"; diff --git a/javasource/objecthandling/actions/copyAttributes.java b/javasource/objecthandling/actions/copyAttributes.java index 6ed3a39..bdd235d 100644 --- a/javasource/objecthandling/actions/copyAttributes.java +++ b/javasource/objecthandling/actions/copyAttributes.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -31,7 +31,7 @@ public copyAttributes(IContext context, IMendixObject source, IMendixObject targ this.target = target; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -43,7 +43,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "copyAttributes"; diff --git a/javasource/objecthandling/actions/createObjectListFromObject.java b/javasource/objecthandling/actions/createObjectListFromObject.java index 049725f..24e5946 100644 --- a/javasource/objecthandling/actions/createObjectListFromObject.java +++ b/javasource/objecthandling/actions/createObjectListFromObject.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -25,7 +25,7 @@ public createObjectListFromObject(IContext context, IMendixObject inputObject) this.inputObject = inputObject; } - @Override + @java.lang.Override public java.util.List executeAction() throws Exception { // BEGIN USER CODE @@ -39,7 +39,7 @@ public java.util.List executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "createObjectListFromObject"; diff --git a/javasource/objecthandling/actions/deepClone.java b/javasource/objecthandling/actions/deepClone.java index d38c6fa..2367fe3 100644 --- a/javasource/objecthandling/actions/deepClone.java +++ b/javasource/objecthandling/actions/deepClone.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -57,7 +57,7 @@ public deepClone(IContext context, IMendixObject source, IMendixObject target, j this.excludeModules = excludeModules; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -75,7 +75,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "deepClone"; diff --git a/javasource/objecthandling/actions/deleteAll.java b/javasource/objecthandling/actions/deleteAll.java index 31502ec..c41161d 100644 --- a/javasource/objecthandling/actions/deleteAll.java +++ b/javasource/objecthandling/actions/deleteAll.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -27,18 +27,18 @@ public deleteAll(IContext context, IMendixObject entityType) this.entityType = entityType; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE - return XPath.create(this.getContext(), entityType.toString()).deleteAll(); + return XPath.create(this.getContext(), entityType.getType()).deleteAll(); // END USER CODE } /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "deleteAll"; diff --git a/javasource/objecthandling/actions/deleteInSeparateTransaction.java b/javasource/objecthandling/actions/deleteInSeparateTransaction.java index d5977e2..40a9f8d 100644 --- a/javasource/objecthandling/actions/deleteInSeparateTransaction.java +++ b/javasource/objecthandling/actions/deleteInSeparateTransaction.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -28,7 +28,7 @@ public deleteInSeparateTransaction(IContext context, java.util.List objec this.useDeleteBehavior = useDeleteBehavior; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -41,7 +41,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "deleteWithoutEvents"; diff --git a/javasource/objecthandling/actions/getCreatedByUser.java b/javasource/objecthandling/actions/getCreatedByUser.java index 13ab7a6..d7a2ee1 100644 --- a/javasource/objecthandling/actions/getCreatedByUser.java +++ b/javasource/objecthandling/actions/getCreatedByUser.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -29,7 +29,7 @@ public getCreatedByUser(IContext context, IMendixObject thing) this.thing = thing; } - @Override + @java.lang.Override public IMendixObject executeAction() throws Exception { // BEGIN USER CODE @@ -40,7 +40,7 @@ public IMendixObject executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "getCreatedByUser"; diff --git a/javasource/objecthandling/actions/getGUID.java b/javasource/objecthandling/actions/getGUID.java index 5c54518..137e9c4 100644 --- a/javasource/objecthandling/actions/getGUID.java +++ b/javasource/objecthandling/actions/getGUID.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -27,7 +27,7 @@ public getGUID(IContext context, IMendixObject item) this.item = item; } - @Override + @java.lang.Override public java.lang.Long executeAction() throws Exception { // BEGIN USER CODE @@ -38,7 +38,7 @@ public java.lang.Long executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "getGUID"; diff --git a/javasource/objecthandling/actions/getLastChangedByUser.java b/javasource/objecthandling/actions/getLastChangedByUser.java index 24f9dd9..2c45e85 100644 --- a/javasource/objecthandling/actions/getLastChangedByUser.java +++ b/javasource/objecthandling/actions/getLastChangedByUser.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -29,7 +29,7 @@ public getLastChangedByUser(IContext context, IMendixObject thing) this.thing = thing; } - @Override + @java.lang.Override public IMendixObject executeAction() throws Exception { // BEGIN USER CODE @@ -40,7 +40,7 @@ public IMendixObject executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "getLastChangedByUser"; diff --git a/javasource/objecthandling/actions/getOriginalValueAsString.java b/javasource/objecthandling/actions/getOriginalValueAsString.java index 754db68..4e22009 100644 --- a/javasource/objecthandling/actions/getOriginalValueAsString.java +++ b/javasource/objecthandling/actions/getOriginalValueAsString.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -35,7 +35,7 @@ public getOriginalValueAsString(IContext context, IMendixObject item, java.lang. this.member = member; } - @Override + @java.lang.Override public java.lang.String executeAction() throws Exception { // BEGIN USER CODE @@ -46,7 +46,7 @@ public java.lang.String executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "getOriginalValueAsString"; diff --git a/javasource/objecthandling/actions/getTypeAsString.java b/javasource/objecthandling/actions/getTypeAsString.java index 124c0d2..9128c4c 100644 --- a/javasource/objecthandling/actions/getTypeAsString.java +++ b/javasource/objecthandling/actions/getTypeAsString.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -26,7 +26,7 @@ public getTypeAsString(IContext context, IMendixObject instance) this.instance = instance; } - @Override + @java.lang.Override public java.lang.String executeAction() throws Exception { // BEGIN USER CODE @@ -39,7 +39,7 @@ public java.lang.String executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "getTypeAsString"; diff --git a/javasource/objecthandling/actions/memberHasChanged.java b/javasource/objecthandling/actions/memberHasChanged.java index 1a327a2..02887a1 100644 --- a/javasource/objecthandling/actions/memberHasChanged.java +++ b/javasource/objecthandling/actions/memberHasChanged.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -34,7 +34,7 @@ public memberHasChanged(IContext context, IMendixObject item, java.lang.String m this.member = member; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -45,7 +45,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "memberHasChanged"; diff --git a/javasource/objecthandling/actions/objectHasChanged.java b/javasource/objecthandling/actions/objectHasChanged.java index e34e8be..22dba7e 100644 --- a/javasource/objecthandling/actions/objectHasChanged.java +++ b/javasource/objecthandling/actions/objectHasChanged.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -27,7 +27,7 @@ public objectHasChanged(IContext context, IMendixObject item) this.item = item; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -38,7 +38,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "objectHasChanged"; diff --git a/javasource/objecthandling/actions/refreshClassByObject.java b/javasource/objecthandling/actions/refreshClassByObject.java index f566a5a..1524b8f 100644 --- a/javasource/objecthandling/actions/refreshClassByObject.java +++ b/javasource/objecthandling/actions/refreshClassByObject.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -29,7 +29,7 @@ public refreshClassByObject(IContext context, IMendixObject instance) this.instance = instance; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -43,7 +43,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "refreshClassByObject"; diff --git a/javasource/permissionsapi/proxies/microflows/Microflows.java b/javasource/permissionsapi/proxies/microflows/Microflows.java index 8416e4e..3edc954 100644 --- a/javasource/permissionsapi/proxies/microflows/Microflows.java +++ b/javasource/permissionsapi/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Modeler 7.16. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/profileservice/proxies/microflows/Microflows.java b/javasource/profileservice/proxies/microflows/Microflows.java index 4d29f41..ebb020b 100644 --- a/javasource/profileservice/proxies/microflows/Microflows.java +++ b/javasource/profileservice/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Modeler 7.16. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/system/UserActionsRegistrar.java b/javasource/system/UserActionsRegistrar.java index c38a144..a7c8fb0 100644 --- a/javasource/system/UserActionsRegistrar.java +++ b/javasource/system/UserActionsRegistrar.java @@ -1,21 +1,12 @@ package system; -import aQute.bnd.annotation.component.Component; -import aQute.bnd.annotation.component.Reference; - import com.mendix.core.actionmanagement.IActionRegistrator; -@Component(immediate = true) public class UserActionsRegistrar { - @Reference public void registerActions(IActionRegistrator registrator) { registrator.bundleComponentLoaded(); - registrator.registerUserAction(appcloudservices.actions.GenerateRandomPassword.class); - registrator.registerUserAction(appcloudservices.actions.LogOutUser.class); - registrator.registerUserAction(appcloudservices.actions.StartSignOnServlet.class); - registrator.registerUserAction(mqttclient.actions.MqttInitialize.class); registrator.registerUserAction(mqttclient.actions.MqttPublish.class); registrator.registerUserAction(mqttclient.actions.MqttSubscribe.class); registrator.registerUserAction(mqttclient.actions.MqttUnsubscribe.class); @@ -38,6 +29,7 @@ public void registerActions(IActionRegistrator registrator) registrator.registerUserAction(objecthandling.actions.refreshClassByObject.class); registrator.registerUserAction(objecthandling.actions.StartTransaction.class); registrator.registerUserAction(system.actions.VerifyPassword.class); + registrator.registerUserAction(testmqttclient.actions.Sleep.class); registrator.registerUserAction(unittesting.actions.FindAllUnitTests.class); registrator.registerUserAction(unittesting.actions.ReportStepJava.class); registrator.registerUserAction(unittesting.actions.RunAllUnitTestsWrapper.class); diff --git a/javasource/system/actions/VerifyPassword.java b/javasource/system/actions/VerifyPassword.java index db5305a..c0e3d51 100644 --- a/javasource/system/actions/VerifyPassword.java +++ b/javasource/system/actions/VerifyPassword.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -29,7 +29,7 @@ public VerifyPassword(IContext context, java.lang.String userName, java.lang.Str this.password = password; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -41,7 +41,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "VerifyPassword"; diff --git a/javasource/system/proxies/DeviceType.java b/javasource/system/proxies/DeviceType.java index 12a60af..9fe5636 100644 --- a/javasource/system/proxies/DeviceType.java +++ b/javasource/system/proxies/DeviceType.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/system/proxies/Error.java b/javasource/system/proxies/Error.java index c627d36..655acb5 100644 --- a/javasource/system/proxies/Error.java +++ b/javasource/system/proxies/Error.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -31,7 +31,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -57,7 +57,7 @@ protected Error(com.mendix.systemwideinterfaces.core.IContext context, com.mendi /** * @deprecated Use 'Error.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.Error initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.Error.load(context, mendixIdentifier); @@ -236,7 +236,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -250,7 +250,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -268,7 +268,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/EventStatus.java b/javasource/system/proxies/EventStatus.java index 88e0c67..508e043 100644 --- a/javasource/system/proxies/EventStatus.java +++ b/javasource/system/proxies/EventStatus.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -8,7 +8,8 @@ public enum EventStatus { Running(new java.lang.String[][] { new java.lang.String[] { "en_US", "Running" }, new java.lang.String[] { "nl_NL", "Bezig" } }), Completed(new java.lang.String[][] { new java.lang.String[] { "en_US", "Completed" }, new java.lang.String[] { "nl_NL", "Voltooid" } }), - Error(new java.lang.String[][] { new java.lang.String[] { "en_US", "Error" }, new java.lang.String[] { "nl_NL", "Fout" } }); + Error(new java.lang.String[][] { new java.lang.String[] { "en_US", "Error" }, new java.lang.String[] { "nl_NL", "Fout" } }), + Stopped(new java.lang.String[][] { new java.lang.String[] { "en_US", "Stopped" } }); private java.util.Map captions; diff --git a/javasource/system/proxies/FileDocument.java b/javasource/system/proxies/FileDocument.java index 7077a04..eea5059 100644 --- a/javasource/system/proxies/FileDocument.java +++ b/javasource/system/proxies/FileDocument.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -24,7 +24,8 @@ public enum MemberNames Name("Name"), DeleteAfterDownload("DeleteAfterDownload"), Contents("Contents"), - HasContents("HasContents"); + HasContents("HasContents"), + Size("Size"); private java.lang.String metaName; @@ -33,7 +34,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -59,7 +60,7 @@ protected FileDocument(com.mendix.systemwideinterfaces.core.IContext context, co /** * @deprecated Use 'FileDocument.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.FileDocument initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.FileDocument.load(context, mendixIdentifier); @@ -74,6 +75,9 @@ public static system.proxies.FileDocument initialize(com.mendix.systemwideinterf if (com.mendix.core.Core.isSubClassOf("System.Image", mendixObject.getType())) return system.proxies.Image.initialize(context, mendixObject); + if (com.mendix.core.Core.isSubClassOf("System.SynchronizationErrorFile", mendixObject.getType())) + return system.proxies.SynchronizationErrorFile.initialize(context, mendixObject); + return new system.proxies.FileDocument(context, mendixObject); } @@ -297,6 +301,42 @@ public final void setHasContents(com.mendix.systemwideinterfaces.core.IContext c getMendixObject().setValue(context, MemberNames.HasContents.toString(), hascontents); } + /** + * @return value of Size + */ + public final java.lang.Long getSize() + { + return getSize(getContext()); + } + + /** + * @param context + * @return value of Size + */ + public final java.lang.Long getSize(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.Long) getMendixObject().getValue(context, MemberNames.Size.toString()); + } + + /** + * Set value of Size + * @param size + */ + public final void setSize(java.lang.Long size) + { + setSize(getContext(), size); + } + + /** + * Set value of Size + * @param context + * @param size + */ + public final void setSize(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Long size) + { + getMendixObject().setValue(context, MemberNames.Size.toString(), size); + } + /** * @return the IMendixObject instance of this proxy for use in the Core interface. */ @@ -313,7 +353,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -327,7 +367,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -345,7 +385,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/HttpHeader.java b/javasource/system/proxies/HttpHeader.java index 7a87aa0..35658d9 100644 --- a/javasource/system/proxies/HttpHeader.java +++ b/javasource/system/proxies/HttpHeader.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -31,7 +31,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -57,7 +57,7 @@ protected HttpHeader(com.mendix.systemwideinterfaces.core.IContext context, com. /** * @deprecated Use 'HttpHeader.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.HttpHeader initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.HttpHeader.load(context, mendixIdentifier); @@ -184,7 +184,7 @@ public final void setValue(com.mendix.systemwideinterfaces.core.IContext context /** * @return value of HttpHeaders */ - public final system.proxies.HttpResponse getHttpHeaders() throws com.mendix.core.CoreException + public final system.proxies.HttpMessage getHttpHeaders() throws com.mendix.core.CoreException { return getHttpHeaders(getContext()); } @@ -193,12 +193,12 @@ public final system.proxies.HttpResponse getHttpHeaders() throws com.mendix.core * @param context * @return value of HttpHeaders */ - public final system.proxies.HttpResponse getHttpHeaders(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + public final system.proxies.HttpMessage getHttpHeaders(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException { - system.proxies.HttpResponse result = null; + system.proxies.HttpMessage result = null; com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.HttpHeaders.toString()); if (identifier != null) - result = system.proxies.HttpResponse.load(context, identifier); + result = system.proxies.HttpMessage.load(context, identifier); return result; } @@ -206,7 +206,7 @@ public final system.proxies.HttpResponse getHttpHeaders(com.mendix.systemwideint * Set value of HttpHeaders * @param httpheaders */ - public final void setHttpHeaders(system.proxies.HttpResponse httpheaders) + public final void setHttpHeaders(system.proxies.HttpMessage httpheaders) { setHttpHeaders(getContext(), httpheaders); } @@ -216,7 +216,7 @@ public final void setHttpHeaders(system.proxies.HttpResponse httpheaders) * @param context * @param httpheaders */ - public final void setHttpHeaders(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.HttpResponse httpheaders) + public final void setHttpHeaders(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.HttpMessage httpheaders) { if (httpheaders == null) getMendixObject().setValue(context, MemberNames.HttpHeaders.toString(), null); @@ -240,7 +240,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -254,7 +254,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -272,7 +272,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/HttpMessage.java b/javasource/system/proxies/HttpMessage.java new file mode 100644 index 0000000..7e1f255 --- /dev/null +++ b/javasource/system/proxies/HttpMessage.java @@ -0,0 +1,242 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class HttpMessage +{ + private final com.mendix.systemwideinterfaces.core.IMendixObject httpMessageMendixObject; + + private final com.mendix.systemwideinterfaces.core.IContext context; + + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.HttpMessage"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + HttpVersion("HttpVersion"), + Content("Content"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public HttpMessage(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.HttpMessage")); + } + + protected HttpMessage(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject httpMessageMendixObject) + { + if (httpMessageMendixObject == null) + throw new java.lang.IllegalArgumentException("The given object cannot be null."); + if (!com.mendix.core.Core.isSubClassOf("System.HttpMessage", httpMessageMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.HttpMessage"); + + this.httpMessageMendixObject = httpMessageMendixObject; + this.context = context; + } + + /** + * @deprecated Use 'HttpMessage.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.HttpMessage initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.HttpMessage.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.HttpMessage initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + if (com.mendix.core.Core.isSubClassOf("System.HttpRequest", mendixObject.getType())) + return system.proxies.HttpRequest.initialize(context, mendixObject); + + if (com.mendix.core.Core.isSubClassOf("System.HttpResponse", mendixObject.getType())) + return system.proxies.HttpResponse.initialize(context, mendixObject); + + return new system.proxies.HttpMessage(context, mendixObject); + } + + public static system.proxies.HttpMessage load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.HttpMessage.initialize(context, mendixObject); + } + + /** + * Commit the changes made on this proxy object. + */ + public final void commit() throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Commit the changes made on this proxy object using the specified context. + */ + public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Delete the object. + */ + public final void delete() + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + + /** + * Delete the object using the specified context. + */ + public final void delete(com.mendix.systemwideinterfaces.core.IContext context) + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + /** + * @return value of HttpVersion + */ + public final java.lang.String getHttpVersion() + { + return getHttpVersion(getContext()); + } + + /** + * @param context + * @return value of HttpVersion + */ + public final java.lang.String getHttpVersion(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.HttpVersion.toString()); + } + + /** + * Set value of HttpVersion + * @param httpversion + */ + public final void setHttpVersion(java.lang.String httpversion) + { + setHttpVersion(getContext(), httpversion); + } + + /** + * Set value of HttpVersion + * @param context + * @param httpversion + */ + public final void setHttpVersion(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String httpversion) + { + getMendixObject().setValue(context, MemberNames.HttpVersion.toString(), httpversion); + } + + /** + * @return value of Content + */ + public final java.lang.String getContent() + { + return getContent(getContext()); + } + + /** + * @param context + * @return value of Content + */ + public final java.lang.String getContent(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.Content.toString()); + } + + /** + * Set value of Content + * @param content + */ + public final void setContent(java.lang.String content) + { + setContent(getContext(), content); + } + + /** + * Set value of Content + * @param context + * @param content + */ + public final void setContent(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String content) + { + getMendixObject().setValue(context, MemberNames.Content.toString(), content); + } + + /** + * @return the IMendixObject instance of this proxy for use in the Core interface. + */ + public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject() + { + return httpMessageMendixObject; + } + + /** + * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization. + */ + public final com.mendix.systemwideinterfaces.core.IContext getContext() + { + return context; + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.HttpMessage that = (system.proxies.HttpMessage) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.HttpMessage"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/HttpRequest.java b/javasource/system/proxies/HttpRequest.java new file mode 100644 index 0000000..b378c69 --- /dev/null +++ b/javasource/system/proxies/HttpRequest.java @@ -0,0 +1,147 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class HttpRequest extends system.proxies.HttpMessage +{ + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.HttpRequest"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + Uri("Uri"), + HttpVersion("HttpVersion"), + Content("Content"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public HttpRequest(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.HttpRequest")); + } + + protected HttpRequest(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject httpRequestMendixObject) + { + super(context, httpRequestMendixObject); + if (!com.mendix.core.Core.isSubClassOf("System.HttpRequest", httpRequestMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.HttpRequest"); + } + + /** + * @deprecated Use 'HttpRequest.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.HttpRequest initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.HttpRequest.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.HttpRequest initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + return new system.proxies.HttpRequest(context, mendixObject); + } + + public static system.proxies.HttpRequest load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.HttpRequest.initialize(context, mendixObject); + } + + /** + * @return value of Uri + */ + public final java.lang.String getUri() + { + return getUri(getContext()); + } + + /** + * @param context + * @return value of Uri + */ + public final java.lang.String getUri(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.Uri.toString()); + } + + /** + * Set value of Uri + * @param uri + */ + public final void setUri(java.lang.String uri) + { + setUri(getContext(), uri); + } + + /** + * Set value of Uri + * @param context + * @param uri + */ + public final void setUri(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String uri) + { + getMendixObject().setValue(context, MemberNames.Uri.toString(), uri); + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.HttpRequest that = (system.proxies.HttpRequest) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.HttpRequest"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Override + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/HttpResponse.java b/javasource/system/proxies/HttpResponse.java index bf6c718..5b8de9c 100644 --- a/javasource/system/proxies/HttpResponse.java +++ b/javasource/system/proxies/HttpResponse.java @@ -1,15 +1,11 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. package system.proxies; -public class HttpResponse +public class HttpResponse extends system.proxies.HttpMessage { - private final com.mendix.systemwideinterfaces.core.IMendixObject httpResponseMendixObject; - - private final com.mendix.systemwideinterfaces.core.IContext context; - /** * Internal name of this entity */ @@ -20,9 +16,9 @@ public class HttpResponse */ public enum MemberNames { - HttpVersion("HttpVersion"), StatusCode("StatusCode"), ReasonPhrase("ReasonPhrase"), + HttpVersion("HttpVersion"), Content("Content"); private java.lang.String metaName; @@ -32,7 +28,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -46,19 +42,15 @@ public HttpResponse(com.mendix.systemwideinterfaces.core.IContext context) protected HttpResponse(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject httpResponseMendixObject) { - if (httpResponseMendixObject == null) - throw new java.lang.IllegalArgumentException("The given object cannot be null."); + super(context, httpResponseMendixObject); if (!com.mendix.core.Core.isSubClassOf("System.HttpResponse", httpResponseMendixObject.getType())) throw new java.lang.IllegalArgumentException("The given object is not a System.HttpResponse"); - - this.httpResponseMendixObject = httpResponseMendixObject; - this.context = context; } /** * @deprecated Use 'HttpResponse.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.HttpResponse initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.HttpResponse.load(context, mendixIdentifier); @@ -79,73 +71,6 @@ public static system.proxies.HttpResponse load(com.mendix.systemwideinterfaces.c return system.proxies.HttpResponse.initialize(context, mendixObject); } - /** - * Commit the changes made on this proxy object. - */ - public final void commit() throws com.mendix.core.CoreException - { - com.mendix.core.Core.commit(context, getMendixObject()); - } - - /** - * Commit the changes made on this proxy object using the specified context. - */ - public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException - { - com.mendix.core.Core.commit(context, getMendixObject()); - } - - /** - * Delete the object. - */ - public final void delete() - { - com.mendix.core.Core.delete(context, getMendixObject()); - } - - /** - * Delete the object using the specified context. - */ - public final void delete(com.mendix.systemwideinterfaces.core.IContext context) - { - com.mendix.core.Core.delete(context, getMendixObject()); - } - /** - * @return value of HttpVersion - */ - public final java.lang.String getHttpVersion() - { - return getHttpVersion(getContext()); - } - - /** - * @param context - * @return value of HttpVersion - */ - public final java.lang.String getHttpVersion(com.mendix.systemwideinterfaces.core.IContext context) - { - return (java.lang.String) getMendixObject().getValue(context, MemberNames.HttpVersion.toString()); - } - - /** - * Set value of HttpVersion - * @param httpversion - */ - public final void setHttpVersion(java.lang.String httpversion) - { - setHttpVersion(getContext(), httpversion); - } - - /** - * Set value of HttpVersion - * @param context - * @param httpversion - */ - public final void setHttpVersion(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String httpversion) - { - getMendixObject().setValue(context, MemberNames.HttpVersion.toString(), httpversion); - } - /** * @return value of StatusCode */ @@ -218,59 +143,7 @@ public final void setReasonPhrase(com.mendix.systemwideinterfaces.core.IContext getMendixObject().setValue(context, MemberNames.ReasonPhrase.toString(), reasonphrase); } - /** - * @return value of Content - */ - public final java.lang.String getContent() - { - return getContent(getContext()); - } - - /** - * @param context - * @return value of Content - */ - public final java.lang.String getContent(com.mendix.systemwideinterfaces.core.IContext context) - { - return (java.lang.String) getMendixObject().getValue(context, MemberNames.Content.toString()); - } - - /** - * Set value of Content - * @param content - */ - public final void setContent(java.lang.String content) - { - setContent(getContext(), content); - } - - /** - * Set value of Content - * @param context - * @param content - */ - public final void setContent(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String content) - { - getMendixObject().setValue(context, MemberNames.Content.toString(), content); - } - - /** - * @return the IMendixObject instance of this proxy for use in the Core interface. - */ - public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject() - { - return httpResponseMendixObject; - } - - /** - * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization. - */ - public final com.mendix.systemwideinterfaces.core.IContext getContext() - { - return context; - } - - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -284,7 +157,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -302,7 +175,8 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Override + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/Image.java b/javasource/system/proxies/Image.java index 766e8ea..210f355 100644 --- a/javasource/system/proxies/Image.java +++ b/javasource/system/proxies/Image.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -21,7 +21,8 @@ public enum MemberNames Name("Name"), DeleteAfterDownload("DeleteAfterDownload"), Contents("Contents"), - HasContents("HasContents"); + HasContents("HasContents"), + Size("Size"); private java.lang.String metaName; @@ -30,7 +31,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -52,7 +53,7 @@ protected Image(com.mendix.systemwideinterfaces.core.IContext context, com.mendi /** * @deprecated Use 'Image.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.Image initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.Image.load(context, mendixIdentifier); @@ -117,7 +118,7 @@ public final void setPublicThumbnailPath(com.mendix.systemwideinterfaces.core.IC getMendixObject().setValue(context, MemberNames.PublicThumbnailPath.toString(), publicthumbnailpath); } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -131,7 +132,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -149,8 +150,8 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Override - @Deprecated + @java.lang.Override + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/Language.java b/javasource/system/proxies/Language.java index 5c5e460..d66f748 100644 --- a/javasource/system/proxies/Language.java +++ b/javasource/system/proxies/Language.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -30,7 +30,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -56,7 +56,7 @@ protected Language(com.mendix.systemwideinterfaces.core.IContext context, com.me /** * @deprecated Use 'Language.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.Language initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.Language.load(context, mendixIdentifier); @@ -204,7 +204,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -218,7 +218,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -236,7 +236,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/Paging.java b/javasource/system/proxies/Paging.java new file mode 100644 index 0000000..a3d2e6b --- /dev/null +++ b/javasource/system/proxies/Paging.java @@ -0,0 +1,347 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class Paging +{ + private final com.mendix.systemwideinterfaces.core.IMendixObject pagingMendixObject; + + private final com.mendix.systemwideinterfaces.core.IContext context; + + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.Paging"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + PageNumber("PageNumber"), + IsSortable("IsSortable"), + SortAttribute("SortAttribute"), + SortAscending("SortAscending"), + HasMoreData("HasMoreData"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public Paging(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.Paging")); + } + + protected Paging(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject pagingMendixObject) + { + if (pagingMendixObject == null) + throw new java.lang.IllegalArgumentException("The given object cannot be null."); + if (!com.mendix.core.Core.isSubClassOf("System.Paging", pagingMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.Paging"); + + this.pagingMendixObject = pagingMendixObject; + this.context = context; + } + + /** + * @deprecated Use 'Paging.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.Paging initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.Paging.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.Paging initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + return new system.proxies.Paging(context, mendixObject); + } + + public static system.proxies.Paging load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.Paging.initialize(context, mendixObject); + } + + /** + * Commit the changes made on this proxy object. + */ + public final void commit() throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Commit the changes made on this proxy object using the specified context. + */ + public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Delete the object. + */ + public final void delete() + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + + /** + * Delete the object using the specified context. + */ + public final void delete(com.mendix.systemwideinterfaces.core.IContext context) + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + /** + * @return value of PageNumber + */ + public final java.lang.Long getPageNumber() + { + return getPageNumber(getContext()); + } + + /** + * @param context + * @return value of PageNumber + */ + public final java.lang.Long getPageNumber(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.Long) getMendixObject().getValue(context, MemberNames.PageNumber.toString()); + } + + /** + * Set value of PageNumber + * @param pagenumber + */ + public final void setPageNumber(java.lang.Long pagenumber) + { + setPageNumber(getContext(), pagenumber); + } + + /** + * Set value of PageNumber + * @param context + * @param pagenumber + */ + public final void setPageNumber(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Long pagenumber) + { + getMendixObject().setValue(context, MemberNames.PageNumber.toString(), pagenumber); + } + + /** + * @return value of IsSortable + */ + public final java.lang.Boolean getIsSortable() + { + return getIsSortable(getContext()); + } + + /** + * @param context + * @return value of IsSortable + */ + public final java.lang.Boolean getIsSortable(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.IsSortable.toString()); + } + + /** + * Set value of IsSortable + * @param issortable + */ + public final void setIsSortable(java.lang.Boolean issortable) + { + setIsSortable(getContext(), issortable); + } + + /** + * Set value of IsSortable + * @param context + * @param issortable + */ + public final void setIsSortable(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean issortable) + { + getMendixObject().setValue(context, MemberNames.IsSortable.toString(), issortable); + } + + /** + * @return value of SortAttribute + */ + public final java.lang.String getSortAttribute() + { + return getSortAttribute(getContext()); + } + + /** + * @param context + * @return value of SortAttribute + */ + public final java.lang.String getSortAttribute(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.SortAttribute.toString()); + } + + /** + * Set value of SortAttribute + * @param sortattribute + */ + public final void setSortAttribute(java.lang.String sortattribute) + { + setSortAttribute(getContext(), sortattribute); + } + + /** + * Set value of SortAttribute + * @param context + * @param sortattribute + */ + public final void setSortAttribute(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String sortattribute) + { + getMendixObject().setValue(context, MemberNames.SortAttribute.toString(), sortattribute); + } + + /** + * @return value of SortAscending + */ + public final java.lang.Boolean getSortAscending() + { + return getSortAscending(getContext()); + } + + /** + * @param context + * @return value of SortAscending + */ + public final java.lang.Boolean getSortAscending(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SortAscending.toString()); + } + + /** + * Set value of SortAscending + * @param sortascending + */ + public final void setSortAscending(java.lang.Boolean sortascending) + { + setSortAscending(getContext(), sortascending); + } + + /** + * Set value of SortAscending + * @param context + * @param sortascending + */ + public final void setSortAscending(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean sortascending) + { + getMendixObject().setValue(context, MemberNames.SortAscending.toString(), sortascending); + } + + /** + * @return value of HasMoreData + */ + public final java.lang.Boolean getHasMoreData() + { + return getHasMoreData(getContext()); + } + + /** + * @param context + * @return value of HasMoreData + */ + public final java.lang.Boolean getHasMoreData(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.HasMoreData.toString()); + } + + /** + * Set value of HasMoreData + * @param hasmoredata + */ + public final void setHasMoreData(java.lang.Boolean hasmoredata) + { + setHasMoreData(getContext(), hasmoredata); + } + + /** + * Set value of HasMoreData + * @param context + * @param hasmoredata + */ + public final void setHasMoreData(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean hasmoredata) + { + getMendixObject().setValue(context, MemberNames.HasMoreData.toString(), hasmoredata); + } + + /** + * @return the IMendixObject instance of this proxy for use in the Core interface. + */ + public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject() + { + return pagingMendixObject; + } + + /** + * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization. + */ + public final com.mendix.systemwideinterfaces.core.IContext getContext() + { + return context; + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.Paging that = (system.proxies.Paging) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.Paging"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/ScheduledEventInformation.java b/javasource/system/proxies/ScheduledEventInformation.java index 5acd162..639c1ab 100644 --- a/javasource/system/proxies/ScheduledEventInformation.java +++ b/javasource/system/proxies/ScheduledEventInformation.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -24,7 +24,8 @@ public enum MemberNames Description("Description"), StartTime("StartTime"), EndTime("EndTime"), - Status("Status"); + Status("Status"), + ScheduledEventInformation_XASInstance("System.ScheduledEventInformation_XASInstance"); private java.lang.String metaName; @@ -33,7 +34,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -59,7 +60,7 @@ protected ScheduledEventInformation(com.mendix.systemwideinterfaces.core.IContex /** * @deprecated Use 'ScheduledEventInformation.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.ScheduledEventInformation initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.ScheduledEventInformation.load(context, mendixIdentifier); @@ -307,6 +308,49 @@ public final void setStatus(com.mendix.systemwideinterfaces.core.IContext contex getMendixObject().setValue(context, MemberNames.Status.toString(), null); } + /** + * @return value of ScheduledEventInformation_XASInstance + */ + public final system.proxies.XASInstance getScheduledEventInformation_XASInstance() throws com.mendix.core.CoreException + { + return getScheduledEventInformation_XASInstance(getContext()); + } + + /** + * @param context + * @return value of ScheduledEventInformation_XASInstance + */ + public final system.proxies.XASInstance getScheduledEventInformation_XASInstance(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + system.proxies.XASInstance result = null; + com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.ScheduledEventInformation_XASInstance.toString()); + if (identifier != null) + result = system.proxies.XASInstance.load(context, identifier); + return result; + } + + /** + * Set value of ScheduledEventInformation_XASInstance + * @param scheduledeventinformation_xasinstance + */ + public final void setScheduledEventInformation_XASInstance(system.proxies.XASInstance scheduledeventinformation_xasinstance) + { + setScheduledEventInformation_XASInstance(getContext(), scheduledeventinformation_xasinstance); + } + + /** + * Set value of ScheduledEventInformation_XASInstance + * @param context + * @param scheduledeventinformation_xasinstance + */ + public final void setScheduledEventInformation_XASInstance(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.XASInstance scheduledeventinformation_xasinstance) + { + if (scheduledeventinformation_xasinstance == null) + getMendixObject().setValue(context, MemberNames.ScheduledEventInformation_XASInstance.toString(), null); + else + getMendixObject().setValue(context, MemberNames.ScheduledEventInformation_XASInstance.toString(), scheduledeventinformation_xasinstance.getMendixObject().getId()); + } + /** * @return the IMendixObject instance of this proxy for use in the Core interface. */ @@ -323,7 +367,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -337,7 +381,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -355,7 +399,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/Session.java b/javasource/system/proxies/Session.java index 0d7e9fd..b63bcbc 100644 --- a/javasource/system/proxies/Session.java +++ b/javasource/system/proxies/Session.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -32,7 +32,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -58,7 +58,7 @@ protected Session(com.mendix.systemwideinterfaces.core.IContext context, com.men /** * @deprecated Use 'Session.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.Session initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.Session.load(context, mendixIdentifier); @@ -285,7 +285,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -299,7 +299,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -317,7 +317,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/SoapFault.java b/javasource/system/proxies/SoapFault.java index 90a6ada..270ac7b 100644 --- a/javasource/system/proxies/SoapFault.java +++ b/javasource/system/proxies/SoapFault.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -32,7 +32,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -54,7 +54,7 @@ protected SoapFault(com.mendix.systemwideinterfaces.core.IContext context, com.m /** * @deprecated Use 'SoapFault.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.SoapFault initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.SoapFault.load(context, mendixIdentifier); @@ -255,7 +255,7 @@ public final void setDetail(com.mendix.systemwideinterfaces.core.IContext contex getMendixObject().setValue(context, MemberNames.Detail.toString(), detail); } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -269,7 +269,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -287,8 +287,8 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Override - @Deprecated + @java.lang.Override + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/SynchronizationError.java b/javasource/system/proxies/SynchronizationError.java new file mode 100644 index 0000000..24ea5d3 --- /dev/null +++ b/javasource/system/proxies/SynchronizationError.java @@ -0,0 +1,318 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class SynchronizationError +{ + private final com.mendix.systemwideinterfaces.core.IMendixObject synchronizationErrorMendixObject; + + private final com.mendix.systemwideinterfaces.core.IContext context; + + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.SynchronizationError"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + Reason("Reason"), + ObjectId("ObjectId"), + ObjectType("ObjectType"), + ObjectContent("ObjectContent"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public SynchronizationError(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.SynchronizationError")); + } + + protected SynchronizationError(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject synchronizationErrorMendixObject) + { + if (synchronizationErrorMendixObject == null) + throw new java.lang.IllegalArgumentException("The given object cannot be null."); + if (!com.mendix.core.Core.isSubClassOf("System.SynchronizationError", synchronizationErrorMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.SynchronizationError"); + + this.synchronizationErrorMendixObject = synchronizationErrorMendixObject; + this.context = context; + } + + /** + * @deprecated Use 'SynchronizationError.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.SynchronizationError initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.SynchronizationError.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.SynchronizationError initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + return new system.proxies.SynchronizationError(context, mendixObject); + } + + public static system.proxies.SynchronizationError load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.SynchronizationError.initialize(context, mendixObject); + } + + public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException + { + java.util.List result = new java.util.ArrayList(); + for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//System.SynchronizationError" + xpathConstraint)) + result.add(system.proxies.SynchronizationError.initialize(context, obj)); + return result; + } + + /** + * Commit the changes made on this proxy object. + */ + public final void commit() throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Commit the changes made on this proxy object using the specified context. + */ + public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Delete the object. + */ + public final void delete() + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + + /** + * Delete the object using the specified context. + */ + public final void delete(com.mendix.systemwideinterfaces.core.IContext context) + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + /** + * @return value of Reason + */ + public final java.lang.String getReason() + { + return getReason(getContext()); + } + + /** + * @param context + * @return value of Reason + */ + public final java.lang.String getReason(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.Reason.toString()); + } + + /** + * Set value of Reason + * @param reason + */ + public final void setReason(java.lang.String reason) + { + setReason(getContext(), reason); + } + + /** + * Set value of Reason + * @param context + * @param reason + */ + public final void setReason(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String reason) + { + getMendixObject().setValue(context, MemberNames.Reason.toString(), reason); + } + + /** + * @return value of ObjectId + */ + public final java.lang.String getObjectId() + { + return getObjectId(getContext()); + } + + /** + * @param context + * @return value of ObjectId + */ + public final java.lang.String getObjectId(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.ObjectId.toString()); + } + + /** + * Set value of ObjectId + * @param objectid + */ + public final void setObjectId(java.lang.String objectid) + { + setObjectId(getContext(), objectid); + } + + /** + * Set value of ObjectId + * @param context + * @param objectid + */ + public final void setObjectId(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String objectid) + { + getMendixObject().setValue(context, MemberNames.ObjectId.toString(), objectid); + } + + /** + * @return value of ObjectType + */ + public final java.lang.String getObjectType() + { + return getObjectType(getContext()); + } + + /** + * @param context + * @return value of ObjectType + */ + public final java.lang.String getObjectType(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.ObjectType.toString()); + } + + /** + * Set value of ObjectType + * @param objecttype + */ + public final void setObjectType(java.lang.String objecttype) + { + setObjectType(getContext(), objecttype); + } + + /** + * Set value of ObjectType + * @param context + * @param objecttype + */ + public final void setObjectType(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String objecttype) + { + getMendixObject().setValue(context, MemberNames.ObjectType.toString(), objecttype); + } + + /** + * @return value of ObjectContent + */ + public final java.lang.String getObjectContent() + { + return getObjectContent(getContext()); + } + + /** + * @param context + * @return value of ObjectContent + */ + public final java.lang.String getObjectContent(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.ObjectContent.toString()); + } + + /** + * Set value of ObjectContent + * @param objectcontent + */ + public final void setObjectContent(java.lang.String objectcontent) + { + setObjectContent(getContext(), objectcontent); + } + + /** + * Set value of ObjectContent + * @param context + * @param objectcontent + */ + public final void setObjectContent(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String objectcontent) + { + getMendixObject().setValue(context, MemberNames.ObjectContent.toString(), objectcontent); + } + + /** + * @return the IMendixObject instance of this proxy for use in the Core interface. + */ + public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject() + { + return synchronizationErrorMendixObject; + } + + /** + * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization. + */ + public final com.mendix.systemwideinterfaces.core.IContext getContext() + { + return context; + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.SynchronizationError that = (system.proxies.SynchronizationError) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.SynchronizationError"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/SynchronizationErrorFile.java b/javasource/system/proxies/SynchronizationErrorFile.java new file mode 100644 index 0000000..bc1f74f --- /dev/null +++ b/javasource/system/proxies/SynchronizationErrorFile.java @@ -0,0 +1,166 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class SynchronizationErrorFile extends system.proxies.FileDocument +{ + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.SynchronizationErrorFile"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + FileID("FileID"), + Name("Name"), + DeleteAfterDownload("DeleteAfterDownload"), + Contents("Contents"), + HasContents("HasContents"), + Size("Size"), + SynchronizationErrorFile_SynchronizationError("System.SynchronizationErrorFile_SynchronizationError"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public SynchronizationErrorFile(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.SynchronizationErrorFile")); + } + + protected SynchronizationErrorFile(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject synchronizationErrorFileMendixObject) + { + super(context, synchronizationErrorFileMendixObject); + if (!com.mendix.core.Core.isSubClassOf("System.SynchronizationErrorFile", synchronizationErrorFileMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.SynchronizationErrorFile"); + } + + /** + * @deprecated Use 'SynchronizationErrorFile.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.SynchronizationErrorFile initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.SynchronizationErrorFile.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.SynchronizationErrorFile initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + return new system.proxies.SynchronizationErrorFile(context, mendixObject); + } + + public static system.proxies.SynchronizationErrorFile load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.SynchronizationErrorFile.initialize(context, mendixObject); + } + + public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException + { + java.util.List result = new java.util.ArrayList(); + for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//System.SynchronizationErrorFile" + xpathConstraint)) + result.add(system.proxies.SynchronizationErrorFile.initialize(context, obj)); + return result; + } + + /** + * @return value of SynchronizationErrorFile_SynchronizationError + */ + public final system.proxies.SynchronizationError getSynchronizationErrorFile_SynchronizationError() throws com.mendix.core.CoreException + { + return getSynchronizationErrorFile_SynchronizationError(getContext()); + } + + /** + * @param context + * @return value of SynchronizationErrorFile_SynchronizationError + */ + public final system.proxies.SynchronizationError getSynchronizationErrorFile_SynchronizationError(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + system.proxies.SynchronizationError result = null; + com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.SynchronizationErrorFile_SynchronizationError.toString()); + if (identifier != null) + result = system.proxies.SynchronizationError.load(context, identifier); + return result; + } + + /** + * Set value of SynchronizationErrorFile_SynchronizationError + * @param synchronizationerrorfile_synchronizationerror + */ + public final void setSynchronizationErrorFile_SynchronizationError(system.proxies.SynchronizationError synchronizationerrorfile_synchronizationerror) + { + setSynchronizationErrorFile_SynchronizationError(getContext(), synchronizationerrorfile_synchronizationerror); + } + + /** + * Set value of SynchronizationErrorFile_SynchronizationError + * @param context + * @param synchronizationerrorfile_synchronizationerror + */ + public final void setSynchronizationErrorFile_SynchronizationError(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.SynchronizationError synchronizationerrorfile_synchronizationerror) + { + if (synchronizationerrorfile_synchronizationerror == null) + getMendixObject().setValue(context, MemberNames.SynchronizationErrorFile_SynchronizationError.toString(), null); + else + getMendixObject().setValue(context, MemberNames.SynchronizationErrorFile_SynchronizationError.toString(), synchronizationerrorfile_synchronizationerror.getMendixObject().getId()); + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.SynchronizationErrorFile that = (system.proxies.SynchronizationErrorFile) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.SynchronizationErrorFile"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Override + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/TimeZone.java b/javasource/system/proxies/TimeZone.java index b13abfd..e32e1e8 100644 --- a/javasource/system/proxies/TimeZone.java +++ b/javasource/system/proxies/TimeZone.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -31,7 +31,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -57,7 +57,7 @@ protected TimeZone(com.mendix.systemwideinterfaces.core.IContext context, com.me /** * @deprecated Use 'TimeZone.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.TimeZone initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.TimeZone.load(context, mendixIdentifier); @@ -241,7 +241,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -255,7 +255,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -273,7 +273,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/TokenInformation.java b/javasource/system/proxies/TokenInformation.java index 3b8092d..613da29 100644 --- a/javasource/system/proxies/TokenInformation.java +++ b/javasource/system/proxies/TokenInformation.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -32,7 +32,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -58,7 +58,7 @@ protected TokenInformation(com.mendix.systemwideinterfaces.core.IContext context /** * @deprecated Use 'TokenInformation.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.TokenInformation initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.TokenInformation.load(context, mendixIdentifier); @@ -268,7 +268,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -282,7 +282,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -300,7 +300,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/User.java b/javasource/system/proxies/User.java index f6341fe..7ec4bdf 100644 --- a/javasource/system/proxies/User.java +++ b/javasource/system/proxies/User.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -39,7 +39,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -65,7 +65,7 @@ protected User(com.mendix.systemwideinterfaces.core.IContext context, com.mendix /** * @deprecated Use 'User.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.User initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.User.load(context, mendixIdentifier); @@ -547,7 +547,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -561,7 +561,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -579,7 +579,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/UserReportInfo.java b/javasource/system/proxies/UserReportInfo.java new file mode 100644 index 0000000..d0e9447 --- /dev/null +++ b/javasource/system/proxies/UserReportInfo.java @@ -0,0 +1,296 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public class UserReportInfo +{ + private final com.mendix.systemwideinterfaces.core.IMendixObject userReportInfoMendixObject; + + private final com.mendix.systemwideinterfaces.core.IContext context; + + /** + * Internal name of this entity + */ + public static final java.lang.String entityName = "System.UserReportInfo"; + + /** + * Enum describing members of this entity + */ + public enum MemberNames + { + UserType("UserType"), + Hash("Hash"), + UserReportInfo_User("System.UserReportInfo_User"); + + private java.lang.String metaName; + + MemberNames(java.lang.String s) + { + metaName = s; + } + + @java.lang.Override + public java.lang.String toString() + { + return metaName; + } + } + + public UserReportInfo(com.mendix.systemwideinterfaces.core.IContext context) + { + this(context, com.mendix.core.Core.instantiate(context, "System.UserReportInfo")); + } + + protected UserReportInfo(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject userReportInfoMendixObject) + { + if (userReportInfoMendixObject == null) + throw new java.lang.IllegalArgumentException("The given object cannot be null."); + if (!com.mendix.core.Core.isSubClassOf("System.UserReportInfo", userReportInfoMendixObject.getType())) + throw new java.lang.IllegalArgumentException("The given object is not a System.UserReportInfo"); + + this.userReportInfoMendixObject = userReportInfoMendixObject; + this.context = context; + } + + /** + * @deprecated Use 'UserReportInfo.load(IContext, IMendixIdentifier)' instead. + */ + @java.lang.Deprecated + public static system.proxies.UserReportInfo initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + return system.proxies.UserReportInfo.load(context, mendixIdentifier); + } + + /** + * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called. + * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access). + */ + public static system.proxies.UserReportInfo initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject) + { + return new system.proxies.UserReportInfo(context, mendixObject); + } + + public static system.proxies.UserReportInfo load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException + { + com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier); + return system.proxies.UserReportInfo.initialize(context, mendixObject); + } + + public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException + { + java.util.List result = new java.util.ArrayList(); + for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//System.UserReportInfo" + xpathConstraint)) + result.add(system.proxies.UserReportInfo.initialize(context, obj)); + return result; + } + + /** + * Commit the changes made on this proxy object. + */ + public final void commit() throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Commit the changes made on this proxy object using the specified context. + */ + public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + com.mendix.core.Core.commit(context, getMendixObject()); + } + + /** + * Delete the object. + */ + public final void delete() + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + + /** + * Delete the object using the specified context. + */ + public final void delete(com.mendix.systemwideinterfaces.core.IContext context) + { + com.mendix.core.Core.delete(context, getMendixObject()); + } + /** + * Set value of UserType + * @param usertype + */ + public final system.proxies.UserType getUserType() + { + return getUserType(getContext()); + } + + /** + * @param context + * @return value of UserType + */ + public final system.proxies.UserType getUserType(com.mendix.systemwideinterfaces.core.IContext context) + { + Object obj = getMendixObject().getValue(context, MemberNames.UserType.toString()); + if (obj == null) + return null; + + return system.proxies.UserType.valueOf((java.lang.String) obj); + } + + /** + * Set value of UserType + * @param usertype + */ + public final void setUserType(system.proxies.UserType usertype) + { + setUserType(getContext(), usertype); + } + + /** + * Set value of UserType + * @param context + * @param usertype + */ + public final void setUserType(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.UserType usertype) + { + if (usertype != null) + getMendixObject().setValue(context, MemberNames.UserType.toString(), usertype.toString()); + else + getMendixObject().setValue(context, MemberNames.UserType.toString(), null); + } + + /** + * @return value of Hash + */ + public final java.lang.String getHash() + { + return getHash(getContext()); + } + + /** + * @param context + * @return value of Hash + */ + public final java.lang.String getHash(com.mendix.systemwideinterfaces.core.IContext context) + { + return (java.lang.String) getMendixObject().getValue(context, MemberNames.Hash.toString()); + } + + /** + * Set value of Hash + * @param hash + */ + public final void setHash(java.lang.String hash) + { + setHash(getContext(), hash); + } + + /** + * Set value of Hash + * @param context + * @param hash + */ + public final void setHash(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String hash) + { + getMendixObject().setValue(context, MemberNames.Hash.toString(), hash); + } + + /** + * @return value of UserReportInfo_User + */ + public final system.proxies.User getUserReportInfo_User() throws com.mendix.core.CoreException + { + return getUserReportInfo_User(getContext()); + } + + /** + * @param context + * @return value of UserReportInfo_User + */ + public final system.proxies.User getUserReportInfo_User(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException + { + system.proxies.User result = null; + com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.UserReportInfo_User.toString()); + if (identifier != null) + result = system.proxies.User.load(context, identifier); + return result; + } + + /** + * Set value of UserReportInfo_User + * @param userreportinfo_user + */ + public final void setUserReportInfo_User(system.proxies.User userreportinfo_user) + { + setUserReportInfo_User(getContext(), userreportinfo_user); + } + + /** + * Set value of UserReportInfo_User + * @param context + * @param userreportinfo_user + */ + public final void setUserReportInfo_User(com.mendix.systemwideinterfaces.core.IContext context, system.proxies.User userreportinfo_user) + { + if (userreportinfo_user == null) + getMendixObject().setValue(context, MemberNames.UserReportInfo_User.toString(), null); + else + getMendixObject().setValue(context, MemberNames.UserReportInfo_User.toString(), userreportinfo_user.getMendixObject().getId()); + } + + /** + * @return the IMendixObject instance of this proxy for use in the Core interface. + */ + public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject() + { + return userReportInfoMendixObject; + } + + /** + * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization. + */ + public final com.mendix.systemwideinterfaces.core.IContext getContext() + { + return context; + } + + @java.lang.Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + + if (obj != null && getClass().equals(obj.getClass())) + { + final system.proxies.UserReportInfo that = (system.proxies.UserReportInfo) obj; + return getMendixObject().equals(that.getMendixObject()); + } + return false; + } + + @java.lang.Override + public int hashCode() + { + return getMendixObject().hashCode(); + } + + /** + * @return String name of this class + */ + public static java.lang.String getType() + { + return "System.UserReportInfo"; + } + + /** + * @return String GUID from this object, format: ID_0000000000 + * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. + */ + @java.lang.Deprecated + public java.lang.String getGUID() + { + return "ID_" + getMendixObject().getId().toLong(); + } +} diff --git a/javasource/system/proxies/UserRole.java b/javasource/system/proxies/UserRole.java index 96cfa7b..3ee3dc0 100644 --- a/javasource/system/proxies/UserRole.java +++ b/javasource/system/proxies/UserRole.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -32,7 +32,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -58,7 +58,7 @@ protected UserRole(com.mendix.systemwideinterfaces.core.IContext context, com.me /** * @deprecated Use 'UserRole.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.UserRole initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.UserRole.load(context, mendixIdentifier); @@ -288,7 +288,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -302,7 +302,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -320,7 +320,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/UserType.java b/javasource/system/proxies/UserType.java new file mode 100644 index 0000000..ceb3342 --- /dev/null +++ b/javasource/system/proxies/UserType.java @@ -0,0 +1,32 @@ +// This file was generated by Mendix Studio Pro. +// +// WARNING: Code you write here will be lost the next time you deploy the project. + +package system.proxies; + +public enum UserType +{ + Internal(new java.lang.String[][] { new java.lang.String[] { "en_US", "Internal" }, new java.lang.String[] { "nl_NL", "Intern" } }), + External(new java.lang.String[][] { new java.lang.String[] { "en_US", "External" }, new java.lang.String[] { "nl_NL", "Extern" } }); + + private java.util.Map captions; + + private UserType(java.lang.String[][] captionStrings) + { + this.captions = new java.util.HashMap(); + for (java.lang.String[] captionString : captionStrings) + captions.put(captionString[0], captionString[1]); + } + + public java.lang.String getCaption(java.lang.String languageCode) + { + if (captions.containsKey(languageCode)) + return captions.get(languageCode); + return captions.get("en_US"); + } + + public java.lang.String getCaption() + { + return captions.get("en_US"); + } +} diff --git a/javasource/system/proxies/XASInstance.java b/javasource/system/proxies/XASInstance.java index 596e64f..21dd57b 100644 --- a/javasource/system/proxies/XASInstance.java +++ b/javasource/system/proxies/XASInstance.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -33,7 +33,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -59,7 +59,7 @@ protected XASInstance(com.mendix.systemwideinterfaces.core.IContext context, com /** * @deprecated Use 'XASInstance.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static system.proxies.XASInstance initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return system.proxies.XASInstance.load(context, mendixIdentifier); @@ -315,7 +315,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -329,7 +329,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -347,7 +347,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/system/proxies/microflows/Microflows.java b/javasource/system/proxies/microflows/Microflows.java index 385e01f..75804c9 100644 --- a/javasource/system/proxies/microflows/Microflows.java +++ b/javasource/system/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -16,14 +16,7 @@ public class Microflows // These are the microflows for the System module public static void showHomePage(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "System.ShowHomePage", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("System.ShowHomePage").withParams(params).execute(context); } } \ No newline at end of file diff --git a/javasource/appcloudservices/actions/StartSignOnServlet.java b/javasource/testmqttclient/actions/Sleep.java similarity index 58% rename from javasource/appcloudservices/actions/StartSignOnServlet.java rename to javasource/testmqttclient/actions/Sleep.java index 8ea2916..e5040cd 100644 --- a/javasource/appcloudservices/actions/StartSignOnServlet.java +++ b/javasource/testmqttclient/actions/Sleep.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -7,36 +7,37 @@ // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. -package appcloudservices.actions; +package testmqttclient.actions; -import appcloudservices.OpenIDHandler; -import com.mendix.core.Core; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; -public class StartSignOnServlet extends CustomJavaAction +public class Sleep extends CustomJavaAction { - public StartSignOnServlet(IContext context) + private java.lang.Long Time_ms; + + public Sleep(IContext context, java.lang.Long Time_ms) { super(context); + this.Time_ms = Time_ms; } - @Override - public java.lang.Boolean executeAction() throws Exception + @java.lang.Override + public java.lang.Void executeAction() throws Exception { // BEGIN USER CODE - Core.addRequestHandler(OpenIDHandler.OPENID_CLIENTSERVLET_LOCATION, new OpenIDHandler()); - return true; + Thread.sleep(this.Time_ms); + return null; // END USER CODE } /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { - return "StartSignOnServlet"; + return "Sleep"; } // BEGIN EXTRA CODE diff --git a/javasource/testmqttclient/proxies/MqttJsonMessaage.java b/javasource/testmqttclient/proxies/MqttJsonMessaage.java index 1a6b872..af4446c 100644 --- a/javasource/testmqttclient/proxies/MqttJsonMessaage.java +++ b/javasource/testmqttclient/proxies/MqttJsonMessaage.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -33,7 +33,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -59,7 +59,7 @@ protected MqttJsonMessaage(com.mendix.systemwideinterfaces.core.IContext context /** * @deprecated Use 'MqttJsonMessaage.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static testmqttclient.proxies.MqttJsonMessaage initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return testmqttclient.proxies.MqttJsonMessaage.load(context, mendixIdentifier); @@ -315,7 +315,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -329,7 +329,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -347,7 +347,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/testmqttclient/proxies/MqttMessages.java b/javasource/testmqttclient/proxies/MqttMessages.java index 52bac0b..1ce8583 100644 --- a/javasource/testmqttclient/proxies/MqttMessages.java +++ b/javasource/testmqttclient/proxies/MqttMessages.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -31,7 +31,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -57,7 +57,7 @@ protected MqttMessages(com.mendix.systemwideinterfaces.core.IContext context, co /** * @deprecated Use 'MqttMessages.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static testmqttclient.proxies.MqttMessages initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return testmqttclient.proxies.MqttMessages.load(context, mendixIdentifier); @@ -241,7 +241,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -255,7 +255,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -273,7 +273,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/testmqttclient/proxies/constants/Constants.java b/javasource/testmqttclient/proxies/constants/Constants.java index 0ac6a51..8ca320e 100644 --- a/javasource/testmqttclient/proxies/constants/Constants.java +++ b/javasource/testmqttclient/proxies/constants/Constants.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/testmqttclient/proxies/microflows/Microflows.java b/javasource/testmqttclient/proxies/microflows/Microflows.java index 6f1bda1..948725c 100644 --- a/javasource/testmqttclient/proxies/microflows/Microflows.java +++ b/javasource/testmqttclient/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -16,144 +16,77 @@ public class Microflows // These are the microflows for the TestMqttClient module public static void onMessageTestSubscribe(IContext context, java.lang.String _payload, java.lang.String _topic) { - try - { - Map params = new HashMap(); - params.put("Payload", _payload); - params.put("Topic", _topic); - Core.execute(context, "TestMqttClient.OnMessageTestSubscribe", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Payload", _payload); + params.put("Topic", _topic); + Core.microflowCall("TestMqttClient.OnMessageTestSubscribe").withParams(params).execute(context); } public static void onTopic1ImportMessage(IContext context, java.lang.String _payload, java.lang.String _topic) { - try - { - Map params = new HashMap(); - params.put("Payload", _payload); - params.put("Topic", _topic); - Core.execute(context, "TestMqttClient.OnTopic1ImportMessage", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Payload", _payload); + params.put("Topic", _topic); + Core.microflowCall("TestMqttClient.OnTopic1ImportMessage").withParams(params).execute(context); } public static void onTopic1Message(IContext context, java.lang.String _payload, java.lang.String _topic) { - try - { - Map params = new HashMap(); - params.put("Payload", _payload); - params.put("Topic", _topic); - Core.execute(context, "TestMqttClient.OnTopic1Message", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Payload", _payload); + params.put("Topic", _topic); + Core.microflowCall("TestMqttClient.OnTopic1Message").withParams(params).execute(context); } public static void onTopic2ImportMessage(IContext context, java.lang.String _payload, java.lang.String _topic) { - try - { - Map params = new HashMap(); - params.put("Payload", _payload); - params.put("Topic", _topic); - Core.execute(context, "TestMqttClient.OnTopic2ImportMessage", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Payload", _payload); + params.put("Topic", _topic); + Core.microflowCall("TestMqttClient.OnTopic2ImportMessage").withParams(params).execute(context); } public static void onTopic2Message(IContext context, java.lang.String _payload, java.lang.String _topic) { - try - { - Map params = new HashMap(); - params.put("Payload", _payload); - params.put("Topic", _topic); - Core.execute(context, "TestMqttClient.OnTopic2Message", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Payload", _payload); + params.put("Topic", _topic); + Core.microflowCall("TestMqttClient.OnTopic2Message").withParams(params).execute(context); } - public static void test_AwsIotSubscribe(IContext context) + public static boolean test_AwsIotSubscribe(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_AwsIotSubscribe", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_AwsIotSubscribe").withParams(params).execute(context); } - public static void test_IBMPublish(IContext context) + public static boolean test_IBMPublish(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_IBMPublish", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_IBMPublish").withParams(params).execute(context); } - public static void test_IBMSubscribe(IContext context) + public static boolean test_IBMSubscribe(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_IBMSubscribe", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_IBMSubscribe").withParams(params).execute(context); } - public static void test_SubscribeTwoMosquittoImportTopics(IContext context) + public static boolean test_SubscribeMosquittoTopics_BBCSubtitles(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_SubscribeTwoMosquittoImportTopics", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_SubscribeMosquittoTopics_BBCSubtitles").withParams(params).execute(context); } - public static void test_SubscribeTwoMosquittoTopics(IContext context) + public static boolean test_SubscribeTwoMosquittoImportTopics(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_SubscribeTwoMosquittoTopics", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_SubscribeTwoMosquittoImportTopics").withParams(params).execute(context); } - public static void test_TTNSubscribe(IContext context) + public static boolean test_ThinkSpeakPublish(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "TestMqttClient.Test_TTNSubscribe", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_ThinkSpeakPublish").withParams(params).execute(context); + } + public static boolean test_ThinkSpeakSubscribe(IContext context) + { + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_ThinkSpeakSubscribe").withParams(params).execute(context); + } + public static boolean test_TTNSubscribe(IContext context) + { + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("TestMqttClient.Test_TTNSubscribe").withParams(params).execute(context); } } \ No newline at end of file diff --git a/javasource/unittesting/RemoteApiServlet.java b/javasource/unittesting/RemoteApiServlet.java index 7545f9b..4d573b8 100644 --- a/javasource/unittesting/RemoteApiServlet.java +++ b/javasource/unittesting/RemoteApiServlet.java @@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; -import org.apache.http.auth.InvalidCredentialsException; +import org.apache.hc.client5.http.auth.InvalidCredentialsException; import com.mendix.core.Core; import com.mendix.core.CoreException; import com.mendix.externalinterface.connector.RequestHandler; diff --git a/javasource/unittesting/TestManager.java b/javasource/unittesting/TestManager.java index 1cf625c..1fc9d2d 100644 --- a/javasource/unittesting/TestManager.java +++ b/javasource/unittesting/TestManager.java @@ -20,6 +20,7 @@ import org.junit.Test; import org.junit.runner.Description; import org.junit.runner.JUnitCore; +import org.junit.runner.Request; import org.junit.runners.JUnit4; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; @@ -57,19 +58,19 @@ public AssertionException(String message) } } - private static final String TEST_MICROFLOW_PREFIX_2 = "UT_"; - static final String CLOUD_SECURITY_ERROR = "Unable to find JUnit test classes or methods. \n\n"; - + private static TestManager instance; public static ILogNode LOG = Core.getLogger("UnitTestRunner"); - + private static final Map emptyArguments = new HashMap(); private static final Map[]> classCache = new HashMap[]>(); + private IContext setupContext; + private String lastStep; - - + + public static TestManager instance() { @@ -94,7 +95,7 @@ private static Class[] getUnitTestClasses(TestSuite testRun) throws ZipExcept public synchronized void runTest(IContext context, UnitTest unitTest) throws ClassNotFoundException, CoreException { TestSuite testSuite = unitTest.getUnitTest_TestSuite(); - + /** * Is Mf */ @@ -112,22 +113,34 @@ public synchronized void runTest(IContext context, UnitTest unitTest) throws Cla * Is java */ else { - - Class test = Class.forName(unitTest.getName().split("/")[0]); + String[] parts = unitTest.getName().split("/"); + Request request; + if (parts.length == 1) // class-scale test run + request = Request.aClass(Class.forName(parts[0])); + else if (parts.length == 2) // method-scale test run + request = Request.method(Class.forName(parts[0]), parts[1]); + else + throw new CoreException("Invalid test specification: " + unitTest.getName() + "\nTest method run should be defined in either form $testClass or $testClass/$testMethod."); JUnitCore junit = new JUnitCore(); junit.addListener(new UnitTestRunListener(context, testSuite)); - junit.run(test); + junit.run(request); } } - private void runMfSetup(TestSuite testSuite) + private void runMfSetup(TestSuite testSuite) { if (Core.getMicroflowNames().contains(testSuite.getModule() + ".Setup")) { try { LOG.info("Running Setup microflow.."); - Core.execute(Core.createSystemContext(), testSuite.getModule() + ".Setup", emptyArguments); + if (testSuite.getAutoRollbackMFs()) { + setupContext = Core.createSystemContext(); + setupContext.startTransaction(); + Core.execute(setupContext, testSuite.getModule() + ".Setup", emptyArguments); + } else { + Core.execute(Core.createSystemContext(), testSuite.getModule() + ".Setup", emptyArguments); + } } catch(Exception e) { LOG.error("Exception during SetUp microflow: " + e.getMessage(), e); @@ -136,32 +149,47 @@ private void runMfSetup(TestSuite testSuite) } } - private void runMfTearDown(TestSuite testSuite) + private void runMfTearDown(TestSuite testSuite) { + IContext tearDownContext = setupContext; if (Core.getMicroflowNames().contains(testSuite.getModule() + ".TearDown")) { try { LOG.info("Running TearDown microflow.."); - Core.execute(Core.createSystemContext(), testSuite.getModule() + ".TearDown", emptyArguments); + if (tearDownContext == null) { + tearDownContext = Core.createSystemContext(); + } + if (testSuite.getAutoRollbackMFs()) { + tearDownContext.startTransaction(); + } + Core.execute(tearDownContext, testSuite.getModule() + ".TearDown", emptyArguments); } catch (Exception e) { - LOG.error("Severe: exception in unittest TearDown microflow '" + testSuite.getModule() + ".Setup': " +e.getMessage(), e); + LOG.error("Severe: exception in unittest TearDown microflow '" + testSuite.getModule() + ".TearDown': " +e.getMessage(), e); throw new RuntimeException(e); } } + + // Either we had a teardown a teardown or + if (testSuite.getAutoRollbackMFs() && tearDownContext != null) { + tearDownContext.rollbackTransAction(); + } + + // Make sure we clean setupContext after running this test/suite + setupContext = null; } - + public synchronized void runTestSuites() throws CoreException { LOG.info("Starting testrun on all suites"); - + //Context without transaction! IContext context = Core.createSystemContext(); - + List testsuites = Core.retrieveXPathQuery(context,"//" +TestSuite.entityName); - + for(IMendixObject suite : testsuites) { - suite.setValue(context, TestSuite.MemberNames.Result.toString(), null);; + suite.setValue(context, TestSuite.MemberNames.Result.toString(), null);; } Core.commit(context, testsuites); @@ -184,12 +212,12 @@ public synchronized boolean runTestSuite(IContext context, TestSuite testSuite) testSuite.setTestFailedCount(0L); testSuite.setResult(UnitTestResult._1_Running); testSuite.commit(); - + for(UnitTest test : XPath.create(context, UnitTest.class).eq(UnitTest.MemberNames.UnitTest_TestSuite, testSuite).all()) { test.setResult(null); test.commit(); } - + long start = System.currentTimeMillis(); /** @@ -204,39 +232,39 @@ public synchronized boolean runTestSuite(IContext context, TestSuite testSuite) catch(Exception e) { LOG.error(CLOUD_SECURITY_ERROR + e.getMessage(), e); } - + if (clazzez != null && clazzez.length > 0) { JUnitCore junit = new JUnitCore(); junit.addListener(new UnitTestRunListener(context, testSuite)); - + junit.run(clazzez); } } - /** + /** * Run microflow tests - * + * */ try { runMfSetup(testSuite); - + List mfnames = findMicroflowUnitTests(testSuite); - + for (String mf : mfnames){ - if (!runMicroflowTest(mf, getUnitTest(context, testSuite, mf, true), testSuite)) + if (!runMicroflowTest(mf, getUnitTest(context, testSuite, mf, true), testSuite)) { testSuite.setTestFailedCount(testSuite.getTestFailedCount() + 1); testSuite.commit(); } } - + } finally { runMfTearDown(testSuite); } - - /** + + /** * Aggregate */ testSuite.setLastRunTime((System.currentTimeMillis() - start) / 1000); @@ -258,14 +286,14 @@ public List findMicroflowUnitTests(TestSuite testRun) if(testRun.getPrefix2() == null) { testRun.setPrefix2("UT_"); } - - + + String basename1 = (testRun.getModule() + "." + testRun.getPrefix1()).toLowerCase(); String basename2 = (testRun.getModule() + "." + testRun.getPrefix2()).toLowerCase(); - + //Find microflownames - for (String mf : Core.getMicroflowNames()) - if (mf.toLowerCase().startsWith(basename1) || mf.toLowerCase().startsWith(basename2)) + for (String mf : Core.getMicroflowNames()) + if (mf.toLowerCase().startsWith(basename1) || mf.toLowerCase().startsWith(basename2)) mfnames.add(mf); //Sort microflow names @@ -276,23 +304,23 @@ public List findMicroflowUnitTests(TestSuite testRun) private boolean runMicroflowTest(String mf, UnitTest test) throws CoreException { - /** + /** * Prepare... */ TestSuite testSuite = test.getUnitTest_TestSuite(); return runMicroflowTest(mf, test, testSuite); } - + private boolean runMicroflowTest(String mf, UnitTest test, TestSuite testSuite) throws CoreException { - /** + /** * Prepare... */ LOG.info("Starting unittest for microflow " + mf); reportStep("Starting microflow test '" + mf + "'"); - + test.setResult(UnitTestResult._1_Running); test.setName(mf); test.setResultMessage(""); @@ -302,38 +330,49 @@ private boolean runMicroflowTest(String mf, UnitTest test, TestSuite testSuite) test.setResultMessage("Unable to start test '" + mf + "', microflow has parameters"); test.setResult(UnitTestResult._2_Failed); } - else if (Core.getReturnType(mf).getType() != IDataType.DataTypeEnum.Boolean && + else if (Core.getReturnType(mf).getType() != IDataType.DataTypeEnum.Boolean && Core.getReturnType(mf).getType() != IDataType.DataTypeEnum.String && Core.getReturnType(mf).getType() != IDataType.DataTypeEnum.Nothing) { - + test.setResultMessage("Unable to start test '" + mf + "', microflow should return either a boolean or a string or nothing at all"); - + test.setResult(UnitTestResult._2_Failed); } commitSilent(test); - IContext mfContext = Core.createSystemContext(); - if (testSuite.getAutoRollbackMFs()) + IContext mfContext = null; + + if (testSuite.getAutoRollbackMFs()) { + if (Core.getMicroflowNames().contains(testSuite.getModule() + ".Setup")) + mfContext = setupContext.clone(); + else + mfContext = Core.createSystemContext(); mfContext.startTransaction(); + } else { + mfContext = Core.createSystemContext(); + } + long start = System.currentTimeMillis(); try { Object resultObject = Core.execute(mfContext, mf, emptyArguments); - + start = System.currentTimeMillis() - start; boolean res = resultObject == null || Boolean.TRUE.equals(resultObject) || "".equals(resultObject); - + test.setResult(res ? UnitTestResult._3_Success : UnitTestResult._2_Failed); - + if (res) { test.setResultMessage("Microflow completed successfully"); } - + return res; } catch(Exception e) { + if (testSuite.getAutoRollbackMFs()) + mfContext.startTransaction(); start = System.currentTimeMillis() - start; test.setResult(UnitTestResult._2_Failed); Throwable cause = ExceptionUtils.getRootCause(e); @@ -342,12 +381,11 @@ else if (Core.getReturnType(mf).getType() != IDataType.DataTypeEnum.Boolean && else test.setResultMessage("Exception: " + e.getMessage() + "\n\n" + ExceptionUtils.getStackTrace(e)); return false; - + } finally { if (testSuite.getAutoRollbackMFs()) mfContext.rollbackTransAction(); - test.setLastStep(lastStep); test.setReadableTime((start > 10000 ? Math.round(start / 1000) + " seconds" : start + " milliseconds")); commitSilent(test); @@ -402,35 +440,34 @@ private UnitTest getUnitTest(IContext context, TestSuite testSuite, String name, /** - * - * + * + * * Find runabble classes - * + * * https://github.com/ddopson/java-class-enumerator/blob/master/src/pro/ddopson/ClassEnumerator.java - * + * */ private static Class loadClass(String className) { try { return TestManager.instance().getClass().getClassLoader().loadClass(className); - } + } catch (ClassNotFoundException e) { throw new RuntimeException("Unexpected ClassNotFoundException loading class '" + className + "'"); } } - private static void processProjectJar(File projectJar, String pkgname, ArrayList> classes) throws IOException { + private static void processProjectJar(File projectJar, String pkgname, ArrayList> classes) throws IOException { // Get the list of the files contained in the package - + ZipFile zipFile = new ZipFile(projectJar); Enumeration entries = zipFile.entries(); - System.out.println("Starting processProjec"); while(entries.hasMoreElements()){ ZipEntry zipEntry = entries.nextElement(); String fileName = zipEntry.getName(); String className = null; - + if (fileName.startsWith(pkgname) && fileName.endsWith(".class")) { fileName = fileName.replace("/", "."); // removes the .class extension @@ -447,7 +484,7 @@ private static void processProjectJar(File projectJar, String pkgname, ArrayList private static boolean isProperUnitTest(Class clazz) { - for (Method m : clazz.getMethods()) + for (Method m : clazz.getMethods()) if (m.getAnnotation(org.junit.Test.class) != null) return true; @@ -467,9 +504,9 @@ public static ArrayList> getClassesForPackage(String path /*Package pkg // Get a File object containing the classes. This file is expected to be located at [deploymentdir]/model/bundles/project.jar File projectjar = new File(Core.getConfiguration().getBasePath() + File.separator + "model" + File.separator + "bundles" + File.separator + "project.jar"); - + processProjectJar(projectjar, pkgname, classes); - + return classes; } @@ -487,7 +524,7 @@ public synchronized void findAllTests(IContext context) throws CoreException { Set modules = new HashSet(); for(String name : Core.getMicroflowNames()) modules.add(name.split("\\.")[0]); - + /* * Update modules */ @@ -495,7 +532,7 @@ public synchronized void findAllTests(IContext context) throws CoreException { TestSuite testSuite = XPath.create(context, TestSuite.class).findOrCreate(TestSuite.MemberNames.Module, module); updateUnitTestList(context, testSuite); } - + /* * Remove all modules without tests */ @@ -514,30 +551,30 @@ public synchronized void updateUnitTestList(IContext context, TestSuite testSuit test.set_dirty(true); test.commit(); } - + /* * Find microflow tests */ - for (String mf : findMicroflowUnitTests(testSuite)) { + for (String mf : findMicroflowUnitTests(testSuite)) { UnitTest test = getUnitTest(context, testSuite, mf, true); test.set_dirty(false); test.setUnitTest_TestSuite(testSuite); test.commit(); } - + if(unittesting.proxies.constants.Constants.getFindJUnitTests()) { /* * Find Junit tests */ - for (String jtest : findJUnitTests(testSuite)) { + for (String jtest : findJUnitTests(testSuite)) { UnitTest test = getUnitTest(context, testSuite, jtest, false); test.set_dirty(false); test.setUnitTest_TestSuite(testSuite); test.commit(); } } - + /* * Delete dirty tests */ @@ -546,44 +583,44 @@ public synchronized void updateUnitTestList(IContext context, TestSuite testSuit .all()) { test.delete(); } - + /* * Update count */ testSuite.setTestCount(XPath.create(context, UnitTest.class).eq(UnitTest.MemberNames.UnitTest_TestSuite, testSuite).count()); testSuite.commit(); - + } catch(Exception e) { LOG.error("Failed to update unit test list: " + e.getMessage(), e); } - + } public List findJUnitTests(TestSuite testSuite) { - List junitTests = new ArrayList(); + List junitTests = new ArrayList(); try { Class[] clazzez = getUnitTestClasses(testSuite); - if (clazzez != null && clazzez.length > 0) { + if (clazzez != null && clazzez.length > 0) { for (Class clazz : clazzez) { - + //From https://github.com/KentBeck/junit/blob/master/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java method computeTestMethods try { List methods = new JUnit4(clazz).getTestClass().getAnnotatedMethods(Test.class); - - if (methods != null && !methods.isEmpty()) + + if (methods != null && !methods.isEmpty()) for (FrameworkMethod method: methods) junitTests.add(clazz.getName() + "/" + method.getName()); } catch(InitializationError e2) { StringBuilder errors = new StringBuilder(); - + for(Throwable cause : e2.getCauses()) errors.append("\n").append(cause.getMessage()); - + LOG.error("Failed to recognize class '" + clazz + "' as unitTestClass: " + errors.toString()); } } @@ -600,5 +637,4 @@ public String getLastReportedStep() { //MWE: this system is problematic weird if used from multiple simultanously used threads.. return lastStep; } - -} \ No newline at end of file +} diff --git a/javasource/unittesting/UnitTestRunListener.java b/javasource/unittesting/UnitTestRunListener.java index 87edd3e..79fdc6d 100644 --- a/javasource/unittesting/UnitTestRunListener.java +++ b/javasource/unittesting/UnitTestRunListener.java @@ -4,7 +4,6 @@ import java.security.AccessControlException; import java.util.Date; -import org.apache.commons.lang3.StringUtils; import org.junit.runner.Description; import org.junit.runner.Result; import org.junit.runner.notification.Failure; diff --git a/javasource/unittesting/actions/FindAllUnitTests.java b/javasource/unittesting/actions/FindAllUnitTests.java index d02fc62..c4f49e7 100644 --- a/javasource/unittesting/actions/FindAllUnitTests.java +++ b/javasource/unittesting/actions/FindAllUnitTests.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -20,7 +20,7 @@ public FindAllUnitTests(IContext context) super(context); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -32,7 +32,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "FindAllUnitTests"; diff --git a/javasource/unittesting/actions/ReportStepJava.java b/javasource/unittesting/actions/ReportStepJava.java index 9dd0dd7..df31b17 100644 --- a/javasource/unittesting/actions/ReportStepJava.java +++ b/javasource/unittesting/actions/ReportStepJava.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -23,7 +23,7 @@ public ReportStepJava(IContext context, java.lang.String message) this.message = message; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -35,7 +35,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "ReportStepJava"; diff --git a/javasource/unittesting/actions/RunAllUnitTestsWrapper.java b/javasource/unittesting/actions/RunAllUnitTestsWrapper.java index 3945c42..950746c 100644 --- a/javasource/unittesting/actions/RunAllUnitTestsWrapper.java +++ b/javasource/unittesting/actions/RunAllUnitTestsWrapper.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -27,7 +27,7 @@ public RunAllUnitTestsWrapper(IContext context, IMendixObject testRun) this.__testRun = testRun; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { this.testRun = __testRun == null ? null : unittesting.proxies.TestSuite.initialize(getContext(), __testRun); @@ -48,7 +48,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "RunAllUnitTestsWrapper"; diff --git a/javasource/unittesting/actions/RunUnitTest.java b/javasource/unittesting/actions/RunUnitTest.java index d1021d1..962fdae 100644 --- a/javasource/unittesting/actions/RunUnitTest.java +++ b/javasource/unittesting/actions/RunUnitTest.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -25,7 +25,7 @@ public RunUnitTest(IContext context, IMendixObject unitTest) this.__unitTest = unitTest; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { this.unitTest = __unitTest == null ? null : unittesting.proxies.UnitTest.initialize(getContext(), __unitTest); @@ -39,7 +39,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "RunUnitTest"; diff --git a/javasource/unittesting/actions/StartRemoteApiServlet.java b/javasource/unittesting/actions/StartRemoteApiServlet.java index 0259723..4329dae 100644 --- a/javasource/unittesting/actions/StartRemoteApiServlet.java +++ b/javasource/unittesting/actions/StartRemoteApiServlet.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -24,7 +24,7 @@ public StartRemoteApiServlet(IContext context, java.lang.String password) this.password = password; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -36,7 +36,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "StartRemoteApiServlet"; diff --git a/javasource/unittesting/actions/StartRunAllSuites.java b/javasource/unittesting/actions/StartRunAllSuites.java index e4d863c..2742b80 100644 --- a/javasource/unittesting/actions/StartRunAllSuites.java +++ b/javasource/unittesting/actions/StartRunAllSuites.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -20,7 +20,7 @@ public StartRunAllSuites(IContext context) super(context); } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -32,7 +32,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "StartRunAllSuites"; diff --git a/javasource/unittesting/actions/ThrowAssertionFailed.java b/javasource/unittesting/actions/ThrowAssertionFailed.java index 64d37bf..b6e8aef 100644 --- a/javasource/unittesting/actions/ThrowAssertionFailed.java +++ b/javasource/unittesting/actions/ThrowAssertionFailed.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list @@ -23,7 +23,7 @@ public ThrowAssertionFailed(IContext context, java.lang.String message) this.message = message; } - @Override + @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE @@ -34,7 +34,7 @@ public java.lang.Boolean executeAction() throws Exception /** * Returns a string representation of this action */ - @Override + @java.lang.Override public java.lang.String toString() { return "ThrowAssertionFailed"; diff --git a/javasource/unittesting/proxies/TestSuite.java b/javasource/unittesting/proxies/TestSuite.java index a9f7012..b4db39a 100644 --- a/javasource/unittesting/proxies/TestSuite.java +++ b/javasource/unittesting/proxies/TestSuite.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -37,7 +37,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -63,7 +63,7 @@ protected TestSuite(com.mendix.systemwideinterfaces.core.IContext context, com.m /** * @deprecated Use 'TestSuite.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static unittesting.proxies.TestSuite initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return unittesting.proxies.TestSuite.load(context, mendixIdentifier); @@ -471,7 +471,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -485,7 +485,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -503,7 +503,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/unittesting/proxies/UnitTest.java b/javasource/unittesting/proxies/UnitTest.java index 46300bc..4882e85 100644 --- a/javasource/unittesting/proxies/UnitTest.java +++ b/javasource/unittesting/proxies/UnitTest.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -37,7 +37,7 @@ public enum MemberNames metaName = s; } - @Override + @java.lang.Override public java.lang.String toString() { return metaName; @@ -63,7 +63,7 @@ protected UnitTest(com.mendix.systemwideinterfaces.core.IContext context, com.me /** * @deprecated Use 'UnitTest.load(IContext, IMendixIdentifier)' instead. */ - @Deprecated + @java.lang.Deprecated public static unittesting.proxies.UnitTest initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException { return unittesting.proxies.UnitTest.load(context, mendixIdentifier); @@ -478,7 +478,7 @@ public final com.mendix.systemwideinterfaces.core.IContext getContext() return context; } - @Override + @java.lang.Override public boolean equals(Object obj) { if (obj == this) @@ -492,7 +492,7 @@ public boolean equals(Object obj) return false; } - @Override + @java.lang.Override public int hashCode() { return getMendixObject().hashCode(); @@ -510,7 +510,7 @@ public static java.lang.String getType() * @return String GUID from this object, format: ID_0000000000 * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object. */ - @Deprecated + @java.lang.Deprecated public java.lang.String getGUID() { return "ID_" + getMendixObject().getId().toLong(); diff --git a/javasource/unittesting/proxies/UnitTestResult.java b/javasource/unittesting/proxies/UnitTestResult.java index 420eee5..f642302 100644 --- a/javasource/unittesting/proxies/UnitTestResult.java +++ b/javasource/unittesting/proxies/UnitTestResult.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -6,9 +6,9 @@ public enum UnitTestResult { - _1_Running(new java.lang.String[][] { new java.lang.String[] { "en_US", "Running" } }), - _2_Failed(new java.lang.String[][] { new java.lang.String[] { "en_US", "Failed" } }), - _3_Success(new java.lang.String[][] { new java.lang.String[] { "en_US", "Success" } }); + _1_Running(new java.lang.String[][] { new java.lang.String[] { "en_US", "Running" }, new java.lang.String[] { "nl_NL", "Uitvoeren" } }), + _2_Failed(new java.lang.String[][] { new java.lang.String[] { "en_US", "Failed" }, new java.lang.String[] { "nl_NL", "mislukt" } }), + _3_Success(new java.lang.String[][] { new java.lang.String[] { "en_US", "Success" }, new java.lang.String[] { "nl_NL", "Succes" } }); private java.util.Map captions; diff --git a/javasource/unittesting/proxies/constants/Constants.java b/javasource/unittesting/proxies/constants/Constants.java index 4dfbefd..449160d 100644 --- a/javasource/unittesting/proxies/constants/Constants.java +++ b/javasource/unittesting/proxies/constants/Constants.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. diff --git a/javasource/unittesting/proxies/microflows/Microflows.java b/javasource/unittesting/proxies/microflows/Microflows.java index 224b580..ad9d51f 100644 --- a/javasource/unittesting/proxies/microflows/Microflows.java +++ b/javasource/unittesting/proxies/microflows/Microflows.java @@ -1,4 +1,4 @@ -// This file was generated by Mendix Modeler 7.0. +// This file was generated by Mendix Studio Pro. // // WARNING: Code you write here will be lost the next time you deploy the project. @@ -16,276 +16,122 @@ public class Microflows // These are the microflows for the UnitTesting module public static void assertTrue1(IContext context, boolean _valueToAssert) { - try - { - Map params = new HashMap(); - params.put("ValueToAssert", _valueToAssert); - Core.execute(context, "UnitTesting.AssertTrue1", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("ValueToAssert", _valueToAssert); + Core.microflowCall("UnitTesting.AssertTrue1").withParams(params).execute(context); } public static void assertTrue2(IContext context, boolean _valueToAssert, java.lang.String _message) { - try - { - Map params = new HashMap(); - params.put("ValueToAssert", _valueToAssert); - params.put("Message", _message); - Core.execute(context, "UnitTesting.AssertTrue2", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("ValueToAssert", _valueToAssert); + params.put("Message", _message); + Core.microflowCall("UnitTesting.AssertTrue2").withParams(params).execute(context); } public static void iVK_FindAllTests(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.IVK_FindAllTests", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.IVK_FindAllTests").withParams(params).execute(context); } public static void iVK_RemoveAllAndFindAllTests(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.IVK_RemoveAllAndFindAllTests", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.IVK_RemoveAllAndFindAllTests").withParams(params).execute(context); } public static void iVK_RemoveTestSuiteAndFindAllTests(IContext context, unittesting.proxies.TestSuite _testSuite) { - try - { - Map params = new HashMap(); - params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); - Core.execute(context, "UnitTesting.IVK_RemoveTestSuiteAndFindAllTests", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); + Core.microflowCall("UnitTesting.IVK_RemoveTestSuiteAndFindAllTests").withParams(params).execute(context); } public static void iVK_ResetUnitTests(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.IVK_ResetUnitTests", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.IVK_ResetUnitTests").withParams(params).execute(context); } public static void iVK_RunAllTests(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.IVK_RunAllTests", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.IVK_RunAllTests").withParams(params).execute(context); } public static void iVK_ToggleAutoRollback(IContext context, unittesting.proxies.TestSuite _testSuite) { - try - { - Map params = new HashMap(); - params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); - Core.execute(context, "UnitTesting.IVK_ToggleAutoRollback", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); + Core.microflowCall("UnitTesting.IVK_ToggleAutoRollback").withParams(params).execute(context); } public static void iVK_UnitTestDetails(IContext context, unittesting.proxies.UnitTest _unitTest) { - try - { - Map params = new HashMap(); - params.put("UnitTest", _unitTest == null ? null : _unitTest.getMendixObject()); - Core.execute(context, "UnitTesting.IVK_UnitTestDetails", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("UnitTest", _unitTest == null ? null : _unitTest.getMendixObject()); + Core.microflowCall("UnitTesting.IVK_UnitTestDetails").withParams(params).execute(context); } public static void oCh_TestSuiteRollback(IContext context, unittesting.proxies.TestSuite _testSuite) { - try - { - Map params = new HashMap(); - params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); - Core.execute(context, "UnitTesting.OCh_TestSuiteRollback", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); + Core.microflowCall("UnitTesting.OCh_TestSuiteRollback").withParams(params).execute(context); } public static void reportStep(IContext context, java.lang.String _message) { - try - { - Map params = new HashMap(); - params.put("Message", _message); - Core.execute(context, "UnitTesting.ReportStep", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("Message", _message); + Core.microflowCall("UnitTesting.ReportStep").withParams(params).execute(context); } public static void rerunUnittest(IContext context, unittesting.proxies.UnitTest _unitTestRun) { - try - { - Map params = new HashMap(); - params.put("UnitTestRun", _unitTestRun == null ? null : _unitTestRun.getMendixObject()); - Core.execute(context, "UnitTesting.RerunUnittest", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("UnitTestRun", _unitTestRun == null ? null : _unitTestRun.getMendixObject()); + Core.microflowCall("UnitTesting.RerunUnittest").withParams(params).execute(context); } public static void setup(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.Setup", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.Setup").withParams(params).execute(context); } public static void startUnittestRun(IContext context, unittesting.proxies.TestSuite _testSuite) { - try - { - Map params = new HashMap(); - params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); - Core.execute(context, "UnitTesting.StartUnittestRun", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + params.put("TestSuite", _testSuite == null ? null : _testSuite.getMendixObject()); + Core.microflowCall("UnitTesting.StartUnittestRun").withParams(params).execute(context); } public static boolean startup(IContext context) { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "UnitTesting.Startup", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("UnitTesting.Startup").withParams(params).execute(context); } public static void tearDown(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.TearDown", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.TearDown").withParams(params).execute(context); } public static boolean test_FailingUnitTest(IContext context) { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "UnitTesting.Test_FailingUnitTest", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("UnitTesting.Test_FailingUnitTest").withParams(params).execute(context); } public static boolean test_IsAssertionErrorCheck(IContext context) { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "UnitTesting.Test_IsAssertionErrorCheck", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("UnitTesting.Test_IsAssertionErrorCheck").withParams(params).execute(context); } public static boolean test_ValidUnitTest(IContext context) { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "UnitTesting.Test_ValidUnitTest", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("UnitTesting.Test_ValidUnitTest").withParams(params).execute(context); } public static void test_WithoutReturn(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.Test_WithoutReturn", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.Test_WithoutReturn").withParams(params).execute(context); } public static void unitTestOverview(IContext context) { - try - { - Map params = new HashMap(); - Core.execute(context, "UnitTesting.UnitTestOverview", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + Core.microflowCall("UnitTesting.UnitTestOverview").withParams(params).execute(context); } public static boolean uT_ValidUnitTest(IContext context) { - try - { - Map params = new HashMap(); - return (java.lang.Boolean)Core.execute(context, "UnitTesting.UT_ValidUnitTest", params); - } - catch (CoreException e) - { - throw new MendixRuntimeException(e); - } + Map params = new HashMap<>(); + return (java.lang.Boolean) Core.microflowCall("UnitTesting.UT_ValidUnitTest").withParams(params).execute(context); } } \ No newline at end of file diff --git a/readme.md b/readme.md index 5ce6fb4..604623a 100644 --- a/readme.md +++ b/readme.md @@ -14,12 +14,70 @@ Main java actions: ![MQTT Microflow actions toolbox][9] -## Usage with Amazon AWS IoT + +### MQTT Publish +This activity allows you to publish a message to a specific MQTT topic. When you execute this activit the module will setup a connection to the topic and publish the message, it will retain the connection in memory for faster publishing in the future. + +Parameters (if parameters are optional you can pass empty or ''): + +* **Broker host** *(required)*: The url of your MQTT broker, needs to be the URL without protocol and without port. (e.g. 'test.mosquitto.org') +* **Broker port** *(required)*: The port of your broker +* **Broker organisation** *(optional)*: Some brokers use an organization as part of the URL, pass that here. +* **Timeout** *(required)*: Maximum timeout between broker and this application in Seconds (default=60) +* **Broker Username** *(optional)*: If your broker has username/password authentication pass the username here. If you set a username you must set a password. +* **Broker Password** *(optional)*: If your broker has username/password authentication pass the username here. If you set a password you must set a username. +* **Topic name** *(required)*: The full topic name you want to publish the message to. This needs to be the topic name starting at the root, but **not** including a leading slash. Example: 'iot-2/type/exampledevice/status' +* **Payload** *(required)*: The message that is passed to the broker, this can be any format. The message is passed as-is to the broker. +* **CA** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Certificate Authority used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/ca.pem' if your certificate is located in 'resources/cert/'. +* **Client certificate** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Client Certificate used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/client.pem' if your certificate is located in 'resources/cert/'. +* **Client key** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Client Key used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/client.key' if your certificate is located in 'resources/cert/'. +* **Certificate Password** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is password that is needed to use the client key. +* **QOS** *(required)*: Passes the Quality of Service parameter straight to the broker (At_Most_Once_0 / At_Least_Once_1 / Exactly_Once_2). *See MQTT service definitions for more info, i.e.: [https://mosquitto.org/man/mqtt-7.html#idm72][17]* (In short, Higher levels of QoS are more reliable, but involve higher latency and have higher bandwidth requirements.) + + +### MQTT Subscribe +This activity sets up the Subscription to an MQTT topic. When you execute this activit the module will setup a connection to the topic and wait for any message that comes in on the topic. + +Parameters (if parameters are optional you can pass empty or ''): + +* **Broker host** *(required)*: The url of your MQTT broker, needs to be the URL without protocol and without port. (e.g. 'test.mosquitto.org') +* **Broker port** *(required)*: The port of your broker +* **Broker organisation** *(optional)*: Some brokers use an organization as part of the URL, pass that here. +* **Timeout** *(required)*: Maximum timeout between broker and this application in Seconds (default=60) +* **Broker Username** *(optional)*: If your broker has username/password authentication pass the username here. If you set a username you must set a password. +* **Broker Password** *(optional)*: If your broker has username/password authentication pass the username here. If you set a password you must set a username. +* **Topic name** *(required)*: The full topic name you want to publish the message to. This needs to be the topic name starting at the root, but **not** including a leading slash. Example: 'iot-2/type/exampledevice/status' +* **On message Microflow** *(required)*: The Microflow that will be executed for each message on the Topic. This microflow must have 2 parameters of type String: Topic & Payload. +* **CA** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Certificate Authority used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/ca.pem' if your certificate is located in 'resources/cert/'. +* **Client certificate** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Client Certificate used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/client.pem' if your certificate is located in 'resources/cert/'. +* **Client key** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is the Client Key used for the connection. Place the certificates inside of the resource folders. This value must be a relative path inside the resource folder. E.g.: 'cert/client.key' if your certificate is located in 'resources/cert/'. +* **Certificate Password** *(optional)*: If the broker requires a (custom) SSL authentication pass the certificates here. This is password that is needed to use the client key. +* **QOS** *(required)*: Passes the Quality of Service parameter straight to the broker (At_Most_Once_0 / At_Least_Once_1 / Exactly_Once_2). *See MQTT service definitions for more info, i.e.: [https://mosquitto.org/man/mqtt-7.html#idm72][17]* (In short, Higher levels of QoS are more reliable, but involve higher latency and have higher bandwidth requirements.) + + + +### MQTT Unsubscribe +This activity will unsubscribe your application from listening to an MQTT topic. All values passed into this acitivity need to be identical to the subscribe action. These values are used to identify unique MQTT connections. + +Parameters (if parameters are optional you can pass empty or ''): + + +* **Broker host** *(required)*: The url of your MQTT broker, needs to be the URL without protocol and without port. (e.g. 'test.mosquitto.org') +* **Broker port** *(required)*: The port of your broker +* **Broker organisation** *(optional)*: Some brokers use an organization as part of the URL, pass that here. +* **Broker Username** *(optional)*: If your broker has username/password authentication pass the username here. If you set a username you must set a password. +* **Topic name** *(required)*: The full topic name you want to publish the message to. This needs to be the topic name starting at the root, but **not** including a leading slash. Example: 'iot-2/type/exampledevice/status' + + + +## Examples + +### Usage with Amazon AWS IoT You need to register your app as a Thing on AWS IoT. Download the generated certificates and store them in your resources folder of your app. When subscribing or publishing a message specify their location reletive to the resources folder. -## Usage with TTN +### Usage with TTN For TTN you can leave the certificate info empty, instead provide username and password. @@ -37,16 +95,16 @@ Microflow to handled messages received: More info can be found here: [Using Mendix with TTN][14] -## Usage with IBM IoT +### Usage with IBM IoT To use IBM IOT you need to fill in your organisation ID with your organisation ID. For the Username & Password you need to use the API Key for the username and Authentication Token for password. ![IBM IOT][15] -### Setting up your IBM Application +#### Setting up your IBM Application To get your API Key and Authentication token login to your IBM IOT Launchpad and click on apps. Then click new Generate New API Key. ![IBM Apps][16] -## Development +### Development Java dependencies are managed using Apache Ivy. There are two configuration: * export - this is used to make sure only the required jars for the connector module are in userlib @@ -58,21 +116,9 @@ included in the connector mpk. ## License [Apache License V2.0][13] - -## Version history - -* 1.0 - 2016-08-13 - initial release - * Implementation - * Fix for subscribing to multiple topics with different microflows - * Fix to ensure unique client id -* 1.1 - 2016-12-11 - reconnect - * Resubscribe on reconnect - * Upgrade to mendix 6.10.0 - * Use microflow parameter type for subscription onMessageMicroflow - * More TTN documentation -* 1.2 - 2017-04-04 - * Added support for IBM Watson - + + [Eclipse Public License][18] + [1]: http://mqtt.org/ [2]: http://mosquitto.org/ [3]: http://www.eclipse.org/paho/ @@ -88,4 +134,6 @@ included in the connector mpk. [13]: license.txt [14]: docs/blogpost-ttn-mqtt-mendix.md [15]: docs/images/IBM.png - [16]: docs/images/IBMApps.png \ No newline at end of file + [16]: docs/images/IBMApps.png + [17]: https://mosquitto.org/man/mqtt-7.html#idm72 + [18]: https://www.eclipse.org/legal/epl-2.0/ \ No newline at end of file diff --git a/theme/.prettierrc b/theme/.prettierrc new file mode 100644 index 0000000..a46f75f --- /dev/null +++ b/theme/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": false, + "printWidth": 120, + "proseWrap": "always", + "tabWidth": 4, + "useTabs": false, + "trailingComma": "all", + "bracketSpacing": true, + "semi": true, + "arrowParens": "avoid" +} diff --git a/theme/.stylelintrc b/theme/.stylelintrc new file mode 100644 index 0000000..62c30a6 --- /dev/null +++ b/theme/.stylelintrc @@ -0,0 +1,32 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "indentation": 4, + "string-quotes": "double", + "no-duplicate-selectors": true, + "color-hex-case": "upper", + "color-hex-length": "short", + "selector-combinator-space-after": "always", + "selector-attribute-operator-space-before": "always", + "selector-attribute-operator-space-after": "always", + "selector-attribute-brackets-space-inside": "always", + "declaration-block-trailing-semicolon": "always", + "declaration-colon-space-before": "never", + "declaration-colon-space-after": "always", + "number-leading-zero": "never", + "function-url-quotes": "always", + "font-family-name-quotes": "always-unless-keyword", + "comment-whitespace-inside": "always", + "comment-empty-line-before": "always", + "rule-empty-line-before": "always-multi-line", + "selector-pseudo-element-colon-notation": "single", + "media-feature-range-operator-space-after": "always", + "media-feature-colon-space-after": "always", + "no-descending-specificity": null, + "declaration-colon-newline-after": null, + "value-list-comma-newline-after": null, + "at-rule-no-unknown": [true, { + "ignoreAtRules": ["function", "if", "each", "include", "mixin"] + }] + } +} diff --git a/theme/LICENSE b/theme/LICENSE new file mode 100644 index 0000000..476061e --- /dev/null +++ b/theme/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Mendix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/theme/README.md b/theme/README.md new file mode 100644 index 0000000..e07d8b5 --- /dev/null +++ b/theme/README.md @@ -0,0 +1,87 @@ +# Mendix Atlas UI + +Mendix Atlas UI is the foundation of making beautiful apps with Mendix. For more information about the framework go to +[here](https://atlas.mendix.com/). + +#### Structure + +Mendix is capable of creating beautiful and user-friendly UI. Our Atlas UI framework demonstrates some of its +possibilities. Here you will find a basic overview of our framework. + +``` +theme/ +├── styles/ +| ├── native/ +| | ├── ts/ // Will not be in the Atlas UI Resources module +| | ├── js/ +| | ├── app/ +| | | ├── _custom-variables.js +| | | └── _custom.js +| | ├── core/ +| |     |   ├── base/ +| |     |   ├── helpers/ +| | | ├── widgets/ +| |    |  | _variables.js +| |    |  └── manifest.json +| | ├── ui_resources/ +| |     |   └── atlas_ui_resources/ +| |     |   ├── buildingblocks/ +| |     |   └── layouts/ +| | └── main.js +| └── web/ +| ├── css/ +| │ ├── * all output files +| └── sass/ +| ├── app/ +| | ├── _custom-variables.scss +| | └── _custom.scss +| ├── core/ +|       |   ├── _legacy/ +|       |   ├── base/ +|       |   ├── helpers/ +| | ├── widgets/ +| | ├── widgetscustom/ +|      |   | _variables.scss +|      |  └── manifest.json +| ├── ui_resources/ +|       |   └── atlas_ui_resources/ +|       |   ├── buildingblocks/ +|       |   └── layouts/ +| └── main.scss +├── * index files +├── * assets +├── * settings*.json (Design Properties) +└── styles.js +``` + +#### App + +The app folder contains all custom styling. We recommend users to only use this directory for any custom styling. + +When you want to customize something, you should first check if you can accomplish your goal by changing variables. +These variables can be found in _styles/web/sass/core/variables.scss_ or _styles/native/core/variables.js_. If you want +to change any core variable, copy it to _../app/\_custom-variables.(scss|js)_ and change it there. It will then +overwrite the core variable. This will make updating Atlas UI much easier in the future. + +#### Core + +The core folder is the heart of Atlas UI. This folder includes base styling, widget styling & additional helper classes. +The core widget styling is split in to two parts. The widget folder includes the default widget styling, as it will look +out of the box. The helpers folder will include design properties and extra classes to change that default styling. + +#### UI Resources + +THe UI Resources folder will contain any styling related to Building Blocks, Page Templates and Layouts. + +Building blocks are created with Widgets. For example _cards_ or _headers_ are building blocks. A building block could +be an image, a title, and a button, assembled together into one UI block. + +Page Templates are created with Building Blocks and Widgets. Page Templates are an example of how a page could look +like. + +Layouts are created with widgets. They are mainly used for navigation or user experiences which need to be consistent +between pages. + +## License + +MIT diff --git a/theme/com.mendix.charts.json b/theme/com.mendix.charts.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/theme/com.mendix.charts.json @@ -0,0 +1 @@ +{} diff --git a/theme/components.json b/theme/components.json index 1f89214..df42ffa 100644 --- a/theme/components.json +++ b/theme/components.json @@ -1 +1,7 @@ -{"files":{"css":["lib/bootstrap/css/bootstrap.min.css","mxclientsystem/mxui/ui/mxui.css","styles/css/lib/lib.css","styles/css/custom/custom.css"],"js":["mxclientsystem/mxui/mxui.js"]},"cachebust":"635689412670032000"} \ No newline at end of file +{ + "files": { + "css": ["styles/web/css/main.css"], + "js": ["mxclientsystem/mxui/mxui.js"] + }, + "cachebust": "{{cachebust}}" +} diff --git a/theme/favicon.ico b/theme/favicon.ico deleted file mode 100644 index fa10282..0000000 Binary files a/theme/favicon.ico and /dev/null differ diff --git a/theme/index-phone-preview.html b/theme/index-phone-preview.html new file mode 100644 index 0000000..e64a7da --- /dev/null +++ b/theme/index-phone-preview.html @@ -0,0 +1,29 @@ + + + + + Mendix - Phone preview + + {{themecss}} + {{appicons}} + + + + +
+
+ +
+ This is not a simulator but just a resized view surrounded with an image to give an impression of + what the app might look like on a phone. +
+
+
+ + + + diff --git a/theme/index-rtl.html b/theme/index-rtl.html index 626c591..4b74063 100644 --- a/theme/index-rtl.html +++ b/theme/index-rtl.html @@ -6,12 +6,10 @@ Mendix - - - - - + {{themecss}} + {{appicons}} +
diff --git a/theme/index-tablet-preview.html b/theme/index-tablet-preview.html new file mode 100644 index 0000000..a311e25 --- /dev/null +++ b/theme/index-tablet-preview.html @@ -0,0 +1,29 @@ + + + + + Mendix - Tablet preview + + {{themecss}} + {{appicons}} + + + + +
+
+ +
+ This is not a simulator but just a resized view surrounded with an image to give an impression of + what the app might look like on a tablet. +
+
+
+ + + + diff --git a/theme/index.html b/theme/index.html index bf765d4..8244e25 100644 --- a/theme/index.html +++ b/theme/index.html @@ -6,16 +6,9 @@ Mendix - - - - - - - - - + {{themecss}} + {{appicons}} @@ -32,7 +25,7 @@ diff --git a/theme/login-with-sso.html b/theme/login-with-sso.html new file mode 100644 index 0000000..216132c --- /dev/null +++ b/theme/login-with-sso.html @@ -0,0 +1,138 @@ + + + + + + Login + + + + {{themecss}} + + + + +
+
+
+
+
+
+

Sign in

+
+
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+ +
+ +
+
Or sign in with
+
+
+ + + + + +
+
+
+ +
+ + + + + + diff --git a/theme/login.html b/theme/login.html index 6b99e90..8c1fc3c 100644 --- a/theme/login.html +++ b/theme/login.html @@ -1,40 +1,127 @@ - + - - - Mendix 5 - Login - - - - - - -