Class Core


  • public final class Core
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Core()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addRequestHandler​(java.lang.String path, RequestHandler requestHandler)
      Add a custom request handler to the Mendix Business Server.
      static void addUserAction​(java.lang.Class<? extends UserAction<?>> userActionClass)
      Add the action specified by the given action name to action registry.
      static boolean authenticate​(IContext context, IUser user, java.lang.String password)
      Authenticate the given user with the given password.
      static void buildException​(java.lang.StringBuilder trace, java.lang.Throwable throwable)
      Prints the message and stacktrace of a Throwable and its cause(s).
      static boolean change​(IContext context, IMendixObject object, java.util.Map<java.lang.String,​java.lang.String> changes)
      Changes the given object in cache (synchronously).
      static java.util.concurrent.Future<java.lang.Boolean> changeAsync​(IContext context, IMendixObject obj, java.util.Map<java.lang.String,​java.lang.String> changes)
      Changes the object (asynchronously).
      static IMendixObject commit​(IContext context, IMendixObject object)
      Commits the given object.
      static java.util.List<IMendixObject> commit​(IContext context, java.util.List<IMendixObject> objects)
      Commits the given objects.
      static java.util.List<java.util.concurrent.Future<java.util.List<IMendixObject>>> commitAsync​(IContext context, java.util.List<IMendixObject> objects)
      Commits the given object (asynchronously).
      static IMendixObject commitWithoutEvents​(IContext context, IMendixObject object)
      Commits the given object without events.
      static java.util.List<IMendixObject> commitWithoutEvents​(IContext context, java.util.List<IMendixObject> objects)
      Commits the given objects without events.
      static IDataType createDataType​(java.lang.String type)
      Creates a DataType based on a type.
      Possible types:
      - Boolean
      - Integer
      - Long
      - Float
      - String
      - Datetime
      - {code#id} (enumeration key)
      - ModuleName.ObjectName (IMendixObject)
      - [ModuleName.ObjectName] (List<IMendixObject>)
      static IDataType createDataType​(java.lang.String objectType, java.lang.String attributeName)
      Creates a DataType based on an object type and a attribute name.
      static IMendixIdentifier createMendixIdentifier​(long guid)
      Creates a new IMendixIdentifier for the given guid.
      static IMendixIdentifier createMendixIdentifier​(java.lang.String guid)
      Creates a IMendixIdentifier for the given guid.
      static IOQLTextGetRequest createOQLTextGetRequest()
      Create a new IOQLTextGetRequest.
      static IOQLTextGetRequest createOQLTextGetRequestFromDataSet​(java.lang.String dataSetQualifiedName)
      Instantiate IOQLTextGetRequest from given qualified DataSet name.
      static IRetrievalSchema createRetrievalSchema()
      Create a new IRetrievalSchema.
      static IContext createSystemContext()
      Returns the context of the system session (this is always a sudo context).
      static XPathQuery createXPathQuery​(java.lang.String xpathQuery)
      Creates an XPath query representation that can be built up in a fluent manner
      static IXPathTextGetRequest createXPathTextGetRequest()
      Create a new IXPathTextGetRequest.
      static DataStorage dataStorage()
      Returns an interface to data storage functionality.
      static boolean delete​(IContext context, IMendixObject... objects)
      Deletes the given objects from the database and server cache (synchronously).
      static boolean delete​(IContext context, java.util.List<IMendixObject> objectList)
      Deletes the given objects from the database and server cache (synchronously).
      static java.util.List<java.util.concurrent.Future<java.lang.Boolean>> deleteAsync​(IContext context, IMendixObject object, boolean useDeleteBehavior)
      Deletes the given object from the database and server cache (asynchronously).
      static java.util.List<java.util.concurrent.Future<java.lang.Boolean>> deleteAsync​(IContext context, java.util.List<IMendixObject> objects, boolean useDeleteBehavior)
      Deletes the given object from the database and server cache (asynchronously).
      static boolean deleteWithoutEvents​(IContext context, java.util.List<IMendixObject> objects, boolean useDeleteBehavior)
      Deletes the given objects from the database and server cache (synchronously) without events This action is executed in a transaction.
      static java.lang.Object evaluateExpression​(IContext context, java.util.Map<java.lang.String,​java.lang.Object> variables, java.lang.String expression)
      Evaluate the given (microflow)expression.
      static <R> R execute​(IContext context, java.lang.String microflowName, boolean executeInTransaction, java.util.Map<java.lang.String,​java.lang.Object> params)
      Execute the specified microflow (synchronously).
      static <R> R execute​(IContext context, java.lang.String name, java.lang.Object... params)
      Execute a Java or microflow action synchronously based on the name passed.
      static <R> R execute​(IContext context, java.lang.String microflowName, java.util.Map<java.lang.String,​java.lang.Object> params)
      Execute the specified microflow synchronously in a transaction (enables rolling back changes when exceptions are raised).
      static <T extends CoreAction<R>,​R>
      java.util.concurrent.Future<R>
      execute​(T action)
      Execute an action asynchronously, result is given and/or exceptions are raised when calling Future.get().
      static <R> java.util.concurrent.Future<R> executeAsync​(IContext context, java.lang.String microflowName, boolean executeInTransaction, java.util.Map<java.lang.String,​java.lang.Object> params)
      Execute the specified microflow (asynchronously).
      static <R> java.util.concurrent.Future<R> executeAsync​(IContext context, java.lang.String actionName, java.lang.Object... params)
      Execute the specified action (asynchronously).
      static <T extends CoreAction<R>,​R>
      R
      executeSync​(T action)
      Execute an action synchronously.
      static <T extends CoreAction<R>,​R>
      void
      executeVoid​(T action)
      Execute the specified action (asynchronously).
      static int getActionQueueSize()
      Returns the current action pool queue size.
      static int getActiveActionCount()
      Returns the current number of active actions.
      static ISession getActiveSession​(java.lang.String userName)
      Returns the active session for the user with the given user name.
      static java.util.Collection<? extends ISession> getActiveSessions()
      Returns all active sessions.
      static java.lang.Iterable<IMendixObject> getAllMendixObjects()
      Get all IMendixObject types.
      static long getCompletedActionCount()
      Returns the number of completed actions since server startup.
      static long getConcurrentUserCount​(boolean anonymous)
      The current number of concurrent users.
      static Configuration getConfiguration()
      Returns the current configuration.
      static int getCurrentPoolSize()
      Returns the current action pool size.
      static java.lang.String getDatabaseChildColumnName​(IMetaAssociation metaAssociation)
      Returns the name of the database column for the child of the given association.
      static java.lang.String getDatabaseColumnName​(IMetaPrimitive metaPrimitive)
      Returns the name of the database column for the given attribute.
      static java.lang.String getDatabaseParentColumnName​(IMetaAssociation metaAssociation)
      Returns the name of the database column for the parent of the given association.
      static java.lang.String getDatabaseTableName​(IMetaAssociation metaAssociation)
      Returns the name of the database table for the given association.
      static java.lang.String getDatabaseTableName​(IMetaObject metaObject)
      Returns the name of the database table for the given entity type.
      static ILanguage getDefaultLanguage()
      Returns the default language of the project.
      static java.io.InputStream getFileDocumentContent​(IContext context, IMendixObject fileDocument)
      Returns contents of a file document as an input stream.
      static java.io.InputStream getImage​(IContext context, IMendixObject imageDocument, boolean retrieveThumbnail)
      Retrieve contents of the given image document.
      static java.util.Map<java.lang.String,​IDataType> getInputParameters​(java.lang.String actionName)
      Returns all input parameter data types the specified action by name.
      static java.lang.String getInternationalizedString​(IContext context, java.lang.String key, java.lang.Object... args)
      Returns the translated string for a certain key and context.
      static java.lang.String getInternationalizedString​(java.lang.String languageCode, java.lang.String key, java.lang.Object... args)
      Returns the translated string for a certain key and language code.
      static ILanguage getLanguage​(IContext context)
      Get the language for the current context.
      static int getLargestPoolSize()
      Returns the largest action pool size.
      static ListenersRegistry getListenersRegistry()
      Returns an instance of ListenersRegistry which can be used to register callbacks for commit, create, change and delete actions on all persistable entities in the application.
      static java.util.Locale getLocale​(IContext context)
      Retrieve locale using the given context.
      static java.util.Locale getLocale​(java.lang.String languageCode)
      Retrieve locale using the given language code (e.g.
      static com.mendix.logging.ILogNode getLogger​(java.lang.String name)  
      static int getMaximumNumberConcurrentUsers()
      Returns the maximum number of concurrent users since the server was started.
      static IMetaAssociation getMetaAssociation​(java.lang.String association)
      Get the IMetaAssociation corresponding to the given association name.
      static java.lang.Iterable<IMetaAssociation> getMetaAssociations()
      Get all IMetaAssociations.
      static IMetaObject getMetaObject​(java.lang.String metaObjectName)
      Get the IMetaObject corresponding to the given meta object name.
      static java.lang.Iterable<IMetaObject> getMetaObjects()
      Get all IMetaObjects.
      static IMetaPrimitive getMetaPrimitive​(java.lang.String qualifiedAttributeName)
      Get the IMetaPrimtive based on a qualified attribute name (e.g.
      static java.util.Set<java.lang.String> getMicroflowNames()
      Returns the names of all modeled microflows.
      static java.lang.String getModelVersion()
      Returns the model version of the project.
      static long getNamedUserCount()  
      static long getNumberConcurrentSessions()
      Returns current number of concurrent sessions.
      static IProfiler getProfiler()  
      static java.util.UUID getProjectId()
      Returns the project identifier of the project.
      static IDataType getReturnType​(java.lang.String actionName)
      Returns the return type of the specified action.
      static int getScheduledActionCount()
      Returns the number of actions currently scheduled for future execution.
      static ISession getSessionById​(java.util.UUID sessionId)
      Returns the session belonging to the given session id.
      static java.util.Date getStartupDateTime()
      Returns the startup date time of the Mendix Business Server.
      static java.util.List<java.lang.String> getSubtypesOf​(java.lang.String objectType)
      Get all subtypes for an object type (including subtypes of subtypes, etc.).
      static IUser getUser​(IContext context, java.lang.String userName)
      Returns a user using the given user name.
      static java.lang.String getXASId()
      Returns the id of this server instance.
      static Http http()
      Returns an interface to HTTP functionality.
      static void initialize​(com.mendix.core.internal.ICore core, Http http, Integration integration, DataStorage dataStorage, Metrics metrics)
      Initializes this Core class, so that all methods can be invoked statically.
      static ISession initializeGuestSession()
      Initialize a new session for a guest user.
      static ISession initializeSession​(IUser user, java.lang.String currentSessionId)
      Initialize a new session for the given user.
      static IMendixObject instantiate​(IContext context, java.lang.String objectType)
      Creates a new IMendixObject with the given object type (synchronously).
      static java.util.concurrent.Future<IMendixObject> instantiateAsync​(IContext context, java.lang.String objectType)
      Creates a new IMendixObject with the given object type (asynchronously).
      static Integration integration()
      Returns an interface to import and export data into and from Mendix.
      static boolean isInDevelopment()  
      static boolean isSubClassOf​(IMetaObject superObject, IMetaObject type)
      Checks whether a type is a subclass of or equal to a potential super class.
      static boolean isSubClassOf​(java.lang.String superClass, short typeHash)
      Checks whether a type is a subclass of or equal to a potential super class.
      static boolean isSubClassOf​(java.lang.String superClass, java.lang.String type)
      Checks whether a type is a subclass of or equal to a potential super class.
      static ISession login​(java.lang.String userName, java.lang.String password)
      Login user with the given user name and password.
      static ISession login​(java.lang.String userName, java.lang.String password, com.mendix.m2ee.api.IMxRuntimeRequest request)  
      static ISession login​(java.lang.String userName, java.lang.String password, java.lang.String currentSessionId)
      Login user with the given parameters.
      static ISession login​(java.util.Map<java.lang.String,​? extends java.lang.Object> params)
      Generic login method (can be used in modules in combination with LoginAction replacement).
      static void logout​(ISession session)
      Logout the given session.
      static Metrics metrics()
      Returns the metrics API.
      static void registerLogSubscriber​(com.mendix.logging.LogSubscriber subscriber)  
      static void registerProfiler​(IProfiler profiler)  
      static boolean removeScheduledFuture​(java.util.concurrent.RunnableScheduledFuture<?> scheduledFuture)
      Remove scheduled future.
      static <R> java.util.concurrent.ScheduledFuture<?> reschedule​(java.util.concurrent.RunnableScheduledFuture<R> scheduledFuture, CoreAction<R> action, long newDelay, java.util.concurrent.TimeUnit timeUnit)
      Reschedule an action with a new delay.
      static java.lang.Object resolveTokens​(IContext context, java.lang.String text)
      Resolve tokens in the given text.
      static java.util.List<IMendixObject> retrieveByPath​(IContext context, IMendixObject mxObject, java.lang.String path)
      Retrieves objects using the given object and path.
      static java.util.List<IMendixObject> retrieveByPath​(IContext context, IMendixObject mxObject, java.lang.String path, boolean isSelfAssociationChild)
      Retrieves objects using the given object and path.
      static IMendixObject retrieveId​(IContext context, IMendixIdentifier id)
      Retrieves object with the given id (synchronously).
      static java.util.concurrent.Future<IMendixObject> retrieveIdAsync​(IContext context, IMendixIdentifier id)
      Retrieves object with the given id (asynchronously).
      static java.util.List<IMendixObject> retrieveIdList​(IContext context, java.util.List<IMendixIdentifier> ids)
      Retrieves objects with the given ids (synchronously).
      static java.util.List<IMendixObject> retrieveIdList​(IContext context, java.util.List<IMendixIdentifier> ids, int amount, int offset, java.util.Map<java.lang.String,​java.lang.String> sort)
      Retrieves objects with the given ids (synchronously).
      static java.util.concurrent.Future<java.util.List<IMendixObject>> retrieveIdListAsync​(IContext context, java.util.List<IMendixIdentifier> ids)
      Retrieves objects with the given ids (asynchronously).
      static IDataTable retrieveOQLDataTable​(IContext context, IGetRequest request)
      Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).
      static IDataTable retrieveOQLDataTable​(IContext context, java.lang.String oqlQuery)
      Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).
      static IDataTable retrieveOQLDataTable​(IContext context, java.lang.String oqlQuery, int amount, int offset)
      Retrieve raw data (IDataTable) using an OQL query (asynchronously).
      static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context, IGetRequest request)
      Retrieve raw data (IDataTable) using an IGetRequest object (asynchronously).
      static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context, java.lang.String oqlQuery)
      Retrieve raw data (IDataTable) using an OQL query (asynchronously).
      static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context, java.lang.String oqlQuery, int amount, int offset)
      Retrieve raw data (IDataTable) using an OQL query (asynchronously).
      static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context, java.lang.String xpathQuery)
      Retrieves object list based on the given XPath query (synchronously).
      static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context, java.lang.String xpathQuery, int depth)
      Retrieves object list based on the given XPath query (synchronously).
      static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context, java.lang.String xpathQuery, int amount, int offset, java.util.Map<java.lang.String,​java.lang.String> sort)
      Retrieves object list based on the given XPath query (synchronously).
      static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context, java.lang.String xpathQuery, int amount, int offset, java.util.Map<java.lang.String,​java.lang.String> sort, int depth)
      Retrieves object list based on the given XPath query (synchronously).
      static java.lang.Long retrieveXPathQueryAggregate​(IContext context, java.lang.String xpathQuery)
      Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously).
      static java.util.concurrent.Future<java.lang.Long> retrieveXPathQueryAggregateAsync​(IContext context, java.lang.String xpathQuery)
      Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (asynchronously).
      static java.util.concurrent.Future<java.lang.Double> retrieveXPathQueryAggregateAsyncDouble​(IContext context, java.lang.String xpathQuery)
      Retrieves long value based on the given query (query should have an aggregate function as root element).
      static java.lang.Double retrieveXPathQueryAggregateDouble​(IContext context, java.lang.String xpathQuery)
      Retrieves double aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously).
      static java.lang.Long retrieveXPathQueryAggregateSchema​(IContext context, java.lang.String xpathQuery, IRetrievalSchema retrievalSchema)
      Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function).
      static java.lang.Long retrieveXPathQueryAggregateSchema​(IContext context, java.lang.String xpathQuery, IRetrievalSchema retrievalSchema, boolean disableSecurity)
      Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function).
      static java.util.concurrent.Future<java.util.List<IMendixObject>> retrieveXPathQueryAsync​(IContext context, java.lang.String xpathQuery, int amount, int offset, java.util.Map<java.lang.String,​java.lang.String> sort, int depth)
      Retrieves object list based on the given XPath query (asynchronously).
      static IDataTable retrieveXPathQueryRaw​(IContext context, java.lang.String xpathQuery, int amount, int offset, java.util.Map<java.lang.String,​java.lang.String> sort, int depth)
      Retrieves raw data (IDataTables) based on the given XPath query (synchronously).
      static java.util.List<IMendixObject> retrieveXPathSchema​(IContext context, java.lang.String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount)
      Retrieves objects based on the XPath query and given schema (synchronously).
      static java.util.List<IMendixObject> retrieveXPathSchema​(IContext context, java.lang.String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, boolean disableSecurity)
      Retrieves objects based on the XPath query and given schema (synchronously).
      static IDataTable retrieveXPathSchemaRaw​(IContext context, java.lang.String xpathQuery, boolean shouldRetrieveCount, IRetrievalSchema retrievalSchema)
      Retrieves raw data (IDataTables) based on the XPath query and given schema (synchronously).
      static IMendixObject rollback​(IContext context, IMendixObject object)
      Rollback changes of the object with the given id (synchronously).
      static java.util.concurrent.Future<IMendixObject> rollbackAsync​(IContext context, IMendixObject object)
      Rollback changes of the object with the given id (asynchronously).
      static <R> java.util.concurrent.RunnableScheduledFuture<?> schedule​(CoreAction<R> action, long delay, java.util.concurrent.TimeUnit timeUnit)
      Schedule an action on a certain delay from now.
      static <R> java.util.concurrent.RunnableScheduledFuture<?> schedule​(java.lang.String actionName, java.util.Date date)
      Schedule an action on a certain date.
      static <R> void scheduleAtFixedRate​(CoreAction<R> action, long initialDelay, long period, java.util.concurrent.TimeUnit timeUnit)
      Schedule a periodic action that runs for the first time after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.
      static <R> void scheduleAtFixedRate​(CoreAction<R> action, java.util.Date firstRun, long period, java.util.concurrent.TimeUnit timeUnit)
      Schedule a periodic action that run for the first time on the given date/time, and subsequently with the given period; that is executions will commence on firstRun then initialDelay+period, then initialDelay + 2 * period, and so on.
      No result will be returned.
      static <R> void scheduleAtFixedRate​(java.lang.String actionName, java.util.Date firstRun, long period, java.util.concurrent.TimeUnit timeUnit, java.lang.String name, java.lang.String description)
      Schedule a periodic action that runs for the first time after the given initial delay (first run), and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.
      static <R> void scheduleWithFixedDelay​(CoreAction<R> action, long initialDelay, long delay, java.util.concurrent.TimeUnit timeUnit)
      Schedule a periodic action that runs for the first time after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.
      static void storeFileDocumentContent​(IContext context, IMendixObject fileDocument, java.io.InputStream inputStream)
      Physically stores a file using the given input stream and commits the file document.
      static void storeFileDocumentContent​(IContext context, IMendixObject fileDocument, java.lang.String fileName, java.io.InputStream inputStream)
      Physically stores a file using the given input stream and commits the file document.
      static void storeImageDocumentContent​(IContext context, IMendixObject imageDocument, java.io.InputStream inputStream, int thumbnailWidth, int thumbnailHeight)
      Physically stores an image using the given input stream and commits the image document.
      static void unregisterProfiler()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Core

        public Core()
    • Method Detail

      • initialize

        public static void initialize​(com.mendix.core.internal.ICore core,
                                      Http http,
                                      Integration integration,
                                      DataStorage dataStorage,
                                      Metrics metrics)
        Initializes this Core class, so that all methods can be invoked statically.
      • dataStorage

        public static DataStorage dataStorage()
        Returns an interface to data storage functionality.
        Returns:
        Get the public interface to DataStorage.
      • http

        public static Http http()
        Returns an interface to HTTP functionality.
        Returns:
        Get the public interface to Http.
      • integration

        public static Integration integration()
        Returns an interface to import and export data into and from Mendix.
        Returns:
        Get the public interface to Integration.
      • metrics

        public static Metrics metrics()
        Returns the metrics API.
        Returns:
        the metrics API.
      • isInDevelopment

        public static boolean isInDevelopment()
      • getXASId

        public static java.lang.String getXASId()
        Returns the id of this server instance.
        Returns:
        the server id in UUID format.
      • getMicroflowNames

        public static java.util.Set<java.lang.String> getMicroflowNames()
        Returns the names of all modeled microflows.
        Returns:
        all microflow names (format "ModuleName.MicroflowName").
      • getInputParameters

        public static java.util.Map<java.lang.String,​IDataType> getInputParameters​(java.lang.String actionName)
        Returns all input parameter data types the specified action by name.
        Parameters:
        actionName - the name of a microflow or java action (format "ModuleName.ActionName").
        Returns:
        data types by input parameter name.
      • getReturnType

        public static IDataType getReturnType​(java.lang.String actionName)
        Returns the return type of the specified action.
        Parameters:
        actionName - the name of a microflow or java action (format "ModuleName.ActionName").
        Returns:
        the return data type of the specified action.
      • evaluateExpression

        public static java.lang.Object evaluateExpression​(IContext context,
                                                          java.util.Map<java.lang.String,​java.lang.Object> variables,
                                                          java.lang.String expression)
        Evaluate the given (microflow)expression.
        Parameters:
        context - the context
        variables - name of variables referenced in the expression (without '$') and their values.
        expression - the expression
        Returns:
        the evaluated value of the expression.
      • execute

        public static <T extends CoreAction<R>,​R> java.util.concurrent.Future<R> execute​(T action)
        Execute an action asynchronously, result is given and/or exceptions are raised when calling Future.get(). When calling Future.get() the result of the action will return immediately if the execution is done, otherwise the call is blocking. Exceptions raised while executing the action will not be thrown until Future.get() is called.
        Type Parameters:
        T - action type, subclass of CoreAction.
        R - result type of the action, can be any object.
        Parameters:
        action - the action to execute.
        Returns:
        the Future object.
      • execute

        public static <R> R execute​(IContext context,
                                    java.lang.String name,
                                    java.lang.Object... params)
                             throws CoreException
        Execute a Java or microflow action synchronously based on the name passed. Note in case of a microflow it will be executed in a transaction.
        Parameters:
        context - the context
        name - the name of the user action or microflow
        params - the objects to be passed to either the constructor of the Java action or the microflow in which case one can pass IMendixObject, IMendixIdentifier or primitive values.
        Returns:
        return value of the specified action.
        Throws:
        CoreException
      • execute

        public static <R> R execute​(IContext context,
                                    java.lang.String microflowName,
                                    java.util.Map<java.lang.String,​java.lang.Object> params)
                             throws CoreException
        Execute the specified microflow synchronously in a transaction (enables rolling back changes when exceptions are raised).
        Parameters:
        context - the context for this action.
        microflowName - the name of a microflow (format "ModuleName.MicroflowName").
        params - parameters by name.
        Returns:
        return value of the specified microflow.
        Throws:
        CoreException
      • execute

        public static <R> R execute​(IContext context,
                                    java.lang.String microflowName,
                                    boolean executeInTransaction,
                                    java.util.Map<java.lang.String,​java.lang.Object> params)
                             throws CoreException
        Execute the specified microflow (synchronously).
        Parameters:
        context - the context for this action.
        microflowName - the name of a microflow (format "ModuleName.MicroflowName").
        executeInTransaction - defines whether the microflow should be execute in a transaction (enables rolling back changes when exceptions are raised).
        params - parameters by name.
        Returns:
        return value of the specified microflow.
        Throws:
        CoreException
      • executeSync

        public static <T extends CoreAction<R>,​R> R executeSync​(T action)
                                                               throws CoreException
        Execute an action synchronously.
        Type Parameters:
        T - action type, subclass of CoreAction.
        R - result type of action, can be any object.
        Parameters:
        action - the action to execute.
        Returns:
        return value of the specified action.
        Throws:
        CoreException
      • executeAsync

        public static <R> java.util.concurrent.Future<R> executeAsync​(IContext context,
                                                                      java.lang.String actionName,
                                                                      java.lang.Object... params)
                                                               throws CoreException
        Execute the specified action (asynchronously). Use only to call other Java actions (not microflows)! When calling microflows use executeAsync(IContext, String, boolean, Map) with a named parameter map instead. Result is given and/or exceptions are raised when calling Future.get(). When calling Future.get() the result of the action will return immediately if the execution is done, otherwise the call is blocking. Exceptions raised while executing the action will not be thrown until Future.get() is called.
        Parameters:
        context - the context for this action.
        actionName - the name of a microflow or java action (format "ModuleName.ActionName").
        params - ordered params for the Java action.
        Returns:
        the Future object.
        Throws:
        CoreException
      • executeAsync

        public static <R> java.util.concurrent.Future<R> executeAsync​(IContext context,
                                                                      java.lang.String microflowName,
                                                                      boolean executeInTransaction,
                                                                      java.util.Map<java.lang.String,​java.lang.Object> params)
                                                               throws CoreException
        Execute the specified microflow (asynchronously).
        Parameters:
        context - the context for this microflow.
        microflowName - the name of the microflow (format "ModuleName.ActionName").
        executeInTransaction - defines whether the microflow should be executed in a transaction (enables rolling back changes when exceptions are raised).
        params - microflow parameters by name.
        Returns:
        return value of the specified microflow.
        Throws:
        CoreException
      • executeVoid

        public static <T extends CoreAction<R>,​R> void executeVoid​(T action)
        Execute the specified action (asynchronously).
        Type Parameters:
        R - result type of the action, can be any object.
        T - action type, subclass of CoreAction.
        Parameters:
        action - the action to execute.
      • schedule

        public static <R> java.util.concurrent.RunnableScheduledFuture<?> schedule​(java.lang.String actionName,
                                                                                   java.util.Date date)
                                                                            throws CoreException
        Schedule an action on a certain date.
        Parameters:
        actionName - the name of a microflow or java action (format "ModuleName.ActionName")
        date - the date and time on which the action should be executed
        Returns:
        the RunnableScheduledFuture object for keeping track of the result
        Throws:
        CoreException
      • schedule

        public static <R> java.util.concurrent.RunnableScheduledFuture<?> schedule​(CoreAction<R> action,
                                                                                   long delay,
                                                                                   java.util.concurrent.TimeUnit timeUnit)
        Schedule an action on a certain delay from now.
        Parameters:
        action - the action to execute.
        delay - the delay after which the action should be executed.
        timeUnit - time unit in which the delay is specified.
        Returns:
        returns RunnableScheduleFuture object for keeping track of the result.
      • scheduleAtFixedRate

        public static <R> void scheduleAtFixedRate​(java.lang.String actionName,
                                                   java.util.Date firstRun,
                                                   long period,
                                                   java.util.concurrent.TimeUnit timeUnit,
                                                   java.lang.String name,
                                                   java.lang.String description)
        Schedule a periodic action that runs for the first time after the given initial delay (first run), and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. No result will be returned.
        Parameters:
        actionName - the name of a microflow or java action (format "ModuleName.ActionName").
        firstRun - the date on which the action will be executed the first time.
        period - the period between each start of the execution of the action.
        timeUnit - the timeUnit in which the initialDelay and the period is specified.
        name - the name of the scheduled event.
        description - the description of the scheduled event.
      • scheduleAtFixedRate

        public static <R> void scheduleAtFixedRate​(CoreAction<R> action,
                                                   long initialDelay,
                                                   long period,
                                                   java.util.concurrent.TimeUnit timeUnit)
        Schedule a periodic action that runs for the first time after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. No result will be returned.
        Parameters:
        action - the action to execute.
        initialDelay - the delay after which the action will be executed the first time.
        period - the period between each start of the execution of the action.
        timeUnit - the timeUnit in which the initialDelay and the period is specified.
      • scheduleAtFixedRate

        public static <R> void scheduleAtFixedRate​(CoreAction<R> action,
                                                   java.util.Date firstRun,
                                                   long period,
                                                   java.util.concurrent.TimeUnit timeUnit)
        Schedule a periodic action that run for the first time on the given date/time, and subsequently with the given period; that is executions will commence on firstRun then initialDelay+period, then initialDelay + 2 * period, and so on.
        No result will be returned.
        Parameters:
        action - the action to execute
        firstRun - the Date/time on which the action will be executed the first time
        period - the period between each start of the execution of the action
        timeUnit - the timeUnit in which the period is specified
      • scheduleWithFixedDelay

        public static <R> void scheduleWithFixedDelay​(CoreAction<R> action,
                                                      long initialDelay,
                                                      long delay,
                                                      java.util.concurrent.TimeUnit timeUnit)
        Schedule a periodic action that runs for the first time after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. No result will be returned.
        Parameters:
        action - the action to execute.
        initialDelay - the delay after which the action will be executed the first time.
        delay - the delay between the end of the execution of the action and the start of the next time the action will be executed.
        timeUnit - the timeUnit in which the initialDelay and the delay is specified.
      • removeScheduledFuture

        public static boolean removeScheduledFuture​(java.util.concurrent.RunnableScheduledFuture<?> scheduledFuture)
        Remove scheduled future.
        Parameters:
        scheduledFuture - the RunnableScheduledFuture to remove.
        Returns:
        whether removing the RunnableScheduledFuture was successful.
      • reschedule

        public static <R> java.util.concurrent.ScheduledFuture<?> reschedule​(java.util.concurrent.RunnableScheduledFuture<R> scheduledFuture,
                                                                             CoreAction<R> action,
                                                                             long newDelay,
                                                                             java.util.concurrent.TimeUnit timeUnit)
        Reschedule an action with a new delay.
        Parameters:
        scheduledFuture - the scheduledFuture (old action) to remove from the queue.
        action - the action to reschedule.
        newDelay - the new delay.
        timeUnit - time unit of the delay.
        Returns:
        scheduled future object.
      • getListenersRegistry

        public static ListenersRegistry getListenersRegistry()
        Returns an instance of ListenersRegistry which can be used to register callbacks for commit, create, change and delete actions on all persistable entities in the application.
        Returns:
        the register of listeners
        Since:
        7.6
      • commitAsync

        public static java.util.List<java.util.concurrent.Future<java.util.List<IMendixObject>>> commitAsync​(IContext context,
                                                                                                             java.util.List<IMendixObject> objects)
        Commits the given object (asynchronously). This will store the object in the database and remove it from the server cache. This action is not executed in a transaction.
        Parameters:
        context - the context.
        objects - the IMendixObjects to commit.
        Returns:
        returns a list of future objects with committed object lists, one for each entity type.
      • commit

        public static IMendixObject commit​(IContext context,
                                           IMendixObject object)
                                    throws CoreException
        Commits the given object. This will store the object in the database and remove it from the server cache. This action is executed in a transaction.
        Parameters:
        context - the context.
        object - the IMendixObject to commit.
        Returns:
        returns committed object
        Throws:
        CoreRuntimeException - if commit fails
        CoreException
      • commit

        public static java.util.List<IMendixObject> commit​(IContext context,
                                                           java.util.List<IMendixObject> objects)
        Commits the given objects. This will store the objects in the database and remove them from the server cache. Before events defined for these objects are executed before any object will be committed and after events will be executed after all objects have been committed. This action is executed in a transaction.
        Parameters:
        context - the context.
        objects - the objects to commit.
        Returns:
        returns committed objects
        Throws:
        CoreRuntimeException - if commit fails
      • commitWithoutEvents

        public static IMendixObject commitWithoutEvents​(IContext context,
                                                        IMendixObject object)

        Commits the given object without events. This will store the object in the database and remove it from the server cache.

        This action is executed in a transaction.

        Validations except unique validation are not executed. It is possible to save an entity which would not pass validations using this method.

        Parameters:
        context - the context.
        object - the IMendixObject to commit.
        Returns:
        returns committed object
        Throws:
        CoreRuntimeException - if commit fails
      • commitWithoutEvents

        public static java.util.List<IMendixObject> commitWithoutEvents​(IContext context,
                                                                        java.util.List<IMendixObject> objects)

        Commits the given objects without events. This will store the objects in the database and remove it from the server cache.

        This action is executed in a transaction.

        Validations except unique validation are not executed. It is possible to save entities which would not pass validations using this method.

        Parameters:
        context - the context.
        objects - the objects to commit.
        Returns:
        returns commited objects
        Throws:
        CoreRuntimeException - if commit fails
      • instantiateAsync

        public static java.util.concurrent.Future<IMendixObject> instantiateAsync​(IContext context,
                                                                                  java.lang.String objectType)
        Creates a new IMendixObject with the given object type (asynchronously). The object will NOT be stored in the database. This action is not executed in a transaction.
        Parameters:
        context - the context.
        objectType - type of object to create (e.g. "System.User").
        Returns:
        returns the Future object.
      • instantiate

        public static IMendixObject instantiate​(IContext context,
                                                java.lang.String objectType)
        Creates a new IMendixObject with the given object type (synchronously). The object will NOT be stored in the database. This action is executed in a transaction.
        Parameters:
        context - the context.
        objectType - type of object to create (e.g. "System.User").
        Returns:
        returns the newly created object.
      • change

        public static boolean change​(IContext context,
                                     IMendixObject object,
                                     java.util.Map<java.lang.String,​java.lang.String> changes)
                              throws CoreException
        Changes the given object in cache (synchronously). When the object is not cache yet, the object will be retrieved from the database and put in the cache. This action is executed in a transaction.
        Parameters:
        context - the context.
        object - the object to change.
        changes - contains changes by member name (e.g. <"Name", "User1">).
        Returns:
        returns whether the change succeeded or not.
        Throws:
        CoreException
      • changeAsync

        public static java.util.concurrent.Future<java.lang.Boolean> changeAsync​(IContext context,
                                                                                 IMendixObject obj,
                                                                                 java.util.Map<java.lang.String,​java.lang.String> changes)
        Changes the object (asynchronously). Object will be stored in cache. This action is not executed in a transaction.
        Parameters:
        context - the context.
        obj - the MendixObject to change
        changes - contains changes by member name (e.g. <"Name", "User1">).
        Returns:
        returns the Future object.
      • rollbackAsync

        public static java.util.concurrent.Future<IMendixObject> rollbackAsync​(IContext context,
                                                                               IMendixObject object)
        Rollback changes of the object with the given id (asynchronously). When the object's state is NORMAL: Removes the object from the cache, all performed changes without commit will be lost. When the object's state is NEW: Removes the object from the database. This action is not executed in a transaction.
        Parameters:
        context - the context.
        object - the object to rollback.
        Returns:
        returns the Future object.
      • rollback

        public static IMendixObject rollback​(IContext context,
                                             IMendixObject object)
                                      throws CoreException
        Rollback changes of the object with the given id (synchronously). When the object's state is NORMAL: Removes the object from the cache, all performed changes without commit will be lost. When the object's state is NEW: Removes the object from the database. This action is executed in a transaction.
        Parameters:
        context - the context.
        object - the object to rollback.
        Returns:
        returns the Future object.
        Throws:
        CoreException
      • delete

        public static boolean delete​(IContext context,
                                     IMendixObject... objects)
        Deletes the given objects from the database and server cache (synchronously). This action is executed in a transaction.
        Parameters:
        context - the context.
        objects - the objects to delete.
        Returns:
        returns whether the delete succeeded.
      • delete

        public static boolean delete​(IContext context,
                                     java.util.List<IMendixObject> objectList)
        Deletes the given objects from the database and server cache (synchronously). This action is executed in a transaction.
        Parameters:
        context - the context.
        objectList - the objects to delete.
        Returns:
        returns whether the delete succeeded.
      • deleteWithoutEvents

        public static boolean deleteWithoutEvents​(IContext context,
                                                  java.util.List<IMendixObject> objects,
                                                  boolean useDeleteBehavior)
        Deletes the given objects from the database and server cache (synchronously) without events This action is executed in a transaction.
        Parameters:
        context - the context.
        objects - the objects to delete.
        Returns:
        returns whether the delete succeeded.
      • deleteAsync

        public static java.util.List<java.util.concurrent.Future<java.lang.Boolean>> deleteAsync​(IContext context,
                                                                                                 IMendixObject object,
                                                                                                 boolean useDeleteBehavior)
        Deletes the given object from the database and server cache (asynchronously). This action is not executed in a transaction.
        Parameters:
        context - the context.
        object - the object to delete.
        useDeleteBehavior - whether to use delete behavior.
        Returns:
        returns a list of future booleans, one for each entity type.
      • deleteAsync

        public static java.util.List<java.util.concurrent.Future<java.lang.Boolean>> deleteAsync​(IContext context,
                                                                                                 java.util.List<IMendixObject> objects,
                                                                                                 boolean useDeleteBehavior)
        Deletes the given object from the database and server cache (asynchronously). This action is not executed in a transaction.
        Parameters:
        context - the context.
        objects - the objects to delete.
        useDeleteBehavior - whether to use delete behavior.
        Returns:
        returns a list of future booleans, one for each entity type.
      • retrieveIdListAsync

        public static java.util.concurrent.Future<java.util.List<IMendixObject>> retrieveIdListAsync​(IContext context,
                                                                                                     java.util.List<IMendixIdentifier> ids)
        Retrieves objects with the given ids (asynchronously). First, objects are attempted to be retrieved from cache. When an object cannot be retrieve from the cache it will be retrieved from the database. When (amount > 0) || (offset > 0) || (sort.size() > 0), all objects will be retrieve from the database.
        Parameters:
        context - the context.
        ids - ids of the objects to retrieve.
        Returns:
        returns the Future object.
      • retrieveIdList

        public static java.util.List<IMendixObject> retrieveIdList​(IContext context,
                                                                   java.util.List<IMendixIdentifier> ids,
                                                                   int amount,
                                                                   int offset,
                                                                   java.util.Map<java.lang.String,​java.lang.String> sort)
                                                            throws CoreException
        Retrieves objects with the given ids (synchronously). First, objects are attempted to be retrieved from cache. When an object cannot be retrieve from the cache it will be retrieved from the database. When (amount > 0) || (offset > 0) || (sort.size() > 0), all objects will be retrieve from the database.
        Parameters:
        context - the context.
        ids - ids of the objects to retrieve.
        amount - the maximum number of objects to retrieve from the database.
        offset - offset of returned objects when retrieved from the database.
        sort - sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">).
        Returns:
        returns the Future object.
        Throws:
        CoreException
      • retrieveIdList

        public static java.util.List<IMendixObject> retrieveIdList​(IContext context,
                                                                   java.util.List<IMendixIdentifier> ids)
                                                            throws CoreException
        Retrieves objects with the given ids (synchronously). First, objects are attempted to be retrieved from cache. When an object cannot be retrieved from the cache it will be retrieved from the database. When (amount > 0) || (offset > 0) || (sort.size() > 0), all objects will be retrieved from the database.
        Parameters:
        context - the context.
        ids - ids of the objects to retrieve.
        Returns:
        returns the objects of the given ids.
        Throws:
        CoreException
      • retrieveIdAsync

        public static java.util.concurrent.Future<IMendixObject> retrieveIdAsync​(IContext context,
                                                                                 IMendixIdentifier id)
        Retrieves object with the given id (asynchronously). First, the object is attempted to be retrieved from the cache. When the object cannot be retrieve from the cache it will be retrieved from the database.
        Parameters:
        context - the context.
        id - id of the object to retrieve.
        Returns:
        returns the Future object.
      • retrieveId

        public static IMendixObject retrieveId​(IContext context,
                                               IMendixIdentifier id)
                                        throws CoreException
        Retrieves object with the given id (synchronously). First, the object is attempted to be retrieved from the cache. When the object cannot be retrieve from the cache it will be retrieved from the database.
        Parameters:
        context - the context.
        id - id of the object to retrieve.
        Returns:
        returns the Future object.
        Throws:
        CoreException
      • retrieveByPath

        public static java.util.List<IMendixObject> retrieveByPath​(IContext context,
                                                                   IMendixObject mxObject,
                                                                   java.lang.String path)
        Retrieves objects using the given object and path.
        Parameters:
        context - the context.
        mxObject - the start point of the path.
        path - the path (association) to the objects to retrieve.
        Returns:
        the list of retrieved objects.
      • retrieveByPath

        public static java.util.List<IMendixObject> retrieveByPath​(IContext context,
                                                                   IMendixObject mxObject,
                                                                   java.lang.String path,
                                                                   boolean isSelfAssociationChild)
        Retrieves objects using the given object and path.
        Parameters:
        context - the context.
        mxObject - the start point of the path.
        path - the path (association) to the objects to retrieve.
        isSelfAssociationChild - defines whether the mxObject instance is the child of the path of a self association.
        Returns:
        the list of retrieved objects.
      • retrieveXPathQueryAsync

        public static java.util.concurrent.Future<java.util.List<IMendixObject>> retrieveXPathQueryAsync​(IContext context,
                                                                                                         java.lang.String xpathQuery,
                                                                                                         int amount,
                                                                                                         int offset,
                                                                                                         java.util.Map<java.lang.String,​java.lang.String> sort,
                                                                                                         int depth)
        Retrieves object list based on the given XPath query (asynchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        sort - sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">).
        depth - indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject.
        Returns:
        the Future object.
      • retrieveXPathQuery

        public static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context,
                                                                       java.lang.String xpathQuery,
                                                                       int amount,
                                                                       int offset,
                                                                       java.util.Map<java.lang.String,​java.lang.String> sort,
                                                                       int depth)
                                                                throws CoreException
        Retrieves object list based on the given XPath query (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        sort - sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">).
        depth - indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject.
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • retrieveXPathQuery

        public static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context,
                                                                       java.lang.String xpathQuery,
                                                                       int amount,
                                                                       int offset,
                                                                       java.util.Map<java.lang.String,​java.lang.String> sort)
                                                                throws CoreException
        Retrieves object list based on the given XPath query (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        sort - sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">).
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • retrieveXPathQuery

        public static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context,
                                                                       java.lang.String xpathQuery,
                                                                       int depth)
                                                                throws CoreException
        Retrieves object list based on the given XPath query (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        depth - indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject.
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • retrieveXPathQuery

        public static java.util.List<IMendixObject> retrieveXPathQuery​(IContext context,
                                                                       java.lang.String xpathQuery)
                                                                throws CoreException
        Retrieves object list based on the given XPath query (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • retrieveXPathQueryRaw

        public static IDataTable retrieveXPathQueryRaw​(IContext context,
                                                       java.lang.String xpathQuery,
                                                       int amount,
                                                       int offset,
                                                       java.util.Map<java.lang.String,​java.lang.String> sort,
                                                       int depth)
                                                throws CoreException
        Retrieves raw data (IDataTables) based on the given XPath query (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        sort - sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">).
        depth - indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject.
        Returns:
        the data table containing the raw data.
        Throws:
        CoreException
      • retrieveXPathSchemaRaw

        public static IDataTable retrieveXPathSchemaRaw​(IContext context,
                                                        java.lang.String xpathQuery,
                                                        boolean shouldRetrieveCount,
                                                        IRetrievalSchema retrievalSchema)
                                                 throws CoreException
        Retrieves raw data (IDataTables) based on the XPath query and given schema (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        shouldRetrieveCount - indicates whether the total number object corresponding to the given schema should be included in the result.
        retrievalSchema - the schema to apply.
        Returns:
        the data table containing the raw data.
        Throws:
        CoreException
      • retrieveXPathSchema

        public static java.util.List<IMendixObject> retrieveXPathSchema​(IContext context,
                                                                        java.lang.String xpathQuery,
                                                                        IRetrievalSchema retrievalSchema,
                                                                        boolean shouldRetrieveCount)
                                                                 throws CoreException
        Retrieves objects based on the XPath query and given schema (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        retrievalSchema - the schema to apply.
        shouldRetrieveCount - indicates whether the total number object corresponding to the given schema should be included in the result.
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • retrieveXPathSchema

        public static java.util.List<IMendixObject> retrieveXPathSchema​(IContext context,
                                                                        java.lang.String xpathQuery,
                                                                        IRetrievalSchema retrievalSchema,
                                                                        boolean shouldRetrieveCount,
                                                                        boolean disableSecurity)
                                                                 throws CoreException
        Retrieves objects based on the XPath query and given schema (synchronously).
        Parameters:
        context - the context.
        xpathQuery - the XPath query to execute.
        retrievalSchema - the schema to apply.
        shouldRetrieveCount - indicates whether the total number object corresponding to the given schema should be included in the result.
        disableSecurity - indicates whether security should be applied when this query is being executed.
        Returns:
        the list of retrieved objects.
        Throws:
        CoreException
      • createRetrievalSchema

        public static IRetrievalSchema createRetrievalSchema()
        Create a new IRetrievalSchema.
        Returns:
        an IRetrievalSchema.
      • createXPathTextGetRequest

        public static IXPathTextGetRequest createXPathTextGetRequest()
        Create a new IXPathTextGetRequest. This class can be used to define an XPath retrieval query. The query must be set in textual form.
        Returns:
        an IXPathTextGetRequest.
      • createOQLTextGetRequest

        public static IOQLTextGetRequest createOQLTextGetRequest()
        Create a new IOQLTextGetRequest. This class can be used to define a textual OQL retrieval query.
        Returns:
        an IOQLTextGetRequest.
      • createOQLTextGetRequestFromDataSet

        public static IOQLTextGetRequest createOQLTextGetRequestFromDataSet​(java.lang.String dataSetQualifiedName)
        Instantiate IOQLTextGetRequest from given qualified DataSet name.

        Code examples

        Example OQL query without parameters

         
          private String getOqlQueryFromDataSet(String dataSetName) {
              final IOQLTextGetRequest oqlTextGetRequest = Core.createOQLTextGetRequestFromDataSet(dataSetName);
        
              return oqlTextGetRequest.getQuery();
          }
        
          public Report generateReport() {
              String oqlQuery = getOqlQueryFromDataSet();
              final IDataTable dataTable = Core.retrieveOQLDataTable(context, oqlQuery);
              final List<? extends IDataRow> rows = dataTable.getRows();
              Report report = new Report();
              report.addRow(rows.get(0));
        
              return report;
          }
         
         
        The above example first defines a getOqlQueryFromDataSet method at the top, which returns a OQL query in string format. It takes a qualified dataSetName which means DataSet name along with its module name separated by '.' character. For example, if the name of the DataSet is ReportGeneratorDataSet and it belongs to a module named Reporting then the qualified DataSet name will be Reporting.ReportGeneratorDataSet.
        This method is then used in generateReport method which retrieves a database data table from the OQL query.

        Example OQL query along with its parameters
         
         public Report generateReport(String dataSetName) {
             final IOQLTextGetRequest oqlTextGetRequest = Core.createOQLTextGetRequestFromDataSet(dataSetName);
             final IParameterMap newParameterMap = oqlTextGetRequest.createParameterMap();
             newParameterMap.put("ParGroupNumber", 4); // Set value of ParGroupNumber parameter to 4
             oqlTextGetRequest.setParameters(newParameterMap);
             final IDataTable dataTable = Core.retrieveOQLDataTable(context, oqlTextGetRequest);
             final List<? extends IDataRow> rows = dataTable.getRows();
             Report report = new Report();
             report.addRow(rows.get(0));
        
             return report;
         }
         
         
        The above example defines a similar generateReport method as shown in the previous example, however in this case the given DataSet has a OQL query which takes parameters. Let us consider that the given DataSet contains following OQL query with a parameter named ParGroupNumber -
         
           FROM CRM.Customers As CustomerObj
           INNER JOIN CustomerObj/CRM.Orders_Customer/CRM.Orders As OrderObj
           WHERE CustomerObj/CRM.Customer_Group/CRM.Group/GroupNumber = $ParGroupNumber
           GROUP BY CustomerObj/Name
           SELECT CustomerObj/Name As Name, SUM(OrderObj/TotalAmount) As TotalAmount
         
         
        Using the DataSet name generateReport method first creates a oqlTextGetRequest. Next, in order to set the ParGroupNumber parameter a new IParameterMap is instantiated and the value of ParGroupNumber parameter is specified, which in the above example would be 4. Finally we provide this newParameterMap to the setParameters method of IOQLTextGetRequest. This modified request is then used to retrieve a data table from the database, which in turn is used to generate a report.
        Parameters:
        dataSetQualifiedName - the qualified name of the DataSet containing OQL
        Returns:
        an instance of IOQLTextGetRequest if DataSet with OQL is found by given name
        Throws:
        java.lang.IllegalArgumentException - if given qualified name is null, has invalid format, found DataSet contains Java Action or DataSet is not found
      • createXPathQuery

        public static XPathQuery createXPathQuery​(java.lang.String xpathQuery)
        Creates an XPath query representation that can be built up in a fluent manner

        Can be used to create and execute XPath queries in a fluent manner. For example:

         
         public getObjectsWithValue(IContext context, ICore core, int value) {
             List<IMendixObject> results = core.createXPathQuery("//Entity[attribute=$value]")
                 .setVariable("value", 1)
                 .setAmount(500)
                 .setOffset(50)
                 .setDepth(1)
                 .execute(context);
             return results;
         }
         

        After the XPath query is built up, XPathQueryBase.execute(IContext) can be called to retrieve the results.

        Parameters:
        xpathQuery - the XPath query to execute. Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit)'.
        Returns:
        instance of XPathQuery that can be use to construct an XPath query
        Since:
        Mendix 7.17
      • retrieveOQLDataTableAsync

        public static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context,
                                                                                        java.lang.String oqlQuery)
        Retrieve raw data (IDataTable) using an OQL query (asynchronously).
        Parameters:
        context - context to be used to process this request
        oqlQuery - the OQL query to execute.
        Returns:
        the Future object.
      • retrieveOQLDataTableAsync

        public static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context,
                                                                                        IGetRequest request)
        Retrieve raw data (IDataTable) using an IGetRequest object (asynchronously).
        Parameters:
        context - context to be used to process this request
        request - the request object.
        Returns:
        the Future object.
      • retrieveOQLDataTableAsync

        public static java.util.concurrent.Future<IDataTable> retrieveOQLDataTableAsync​(IContext context,
                                                                                        java.lang.String oqlQuery,
                                                                                        int amount,
                                                                                        int offset)
        Retrieve raw data (IDataTable) using an OQL query (asynchronously).
        Parameters:
        context - context to be used to process this request
        oqlQuery - the OQL query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        Returns:
        the Future object.
      • retrieveOQLDataTable

        public static IDataTable retrieveOQLDataTable​(IContext context,
                                                      IGetRequest request)
                                               throws CoreException
        Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).
        Parameters:
        context - context to be used to process this request
        request - the request object.
        Returns:
        the data table containing the raw data.
        Throws:
        CoreException
      • retrieveOQLDataTable

        public static IDataTable retrieveOQLDataTable​(IContext context,
                                                      java.lang.String oqlQuery)
                                               throws CoreException
        Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).
        Parameters:
        context - context to be used to process this request
        oqlQuery - the OQL query to execute.
        Returns:
        the data table containing the raw data.
        Throws:
        CoreException
      • retrieveOQLDataTable

        public static IDataTable retrieveOQLDataTable​(IContext context,
                                                      java.lang.String oqlQuery,
                                                      int amount,
                                                      int offset)
                                               throws CoreException
        Retrieve raw data (IDataTable) using an OQL query (asynchronously).
        Parameters:
        context - context to be used to process this request
        oqlQuery - the OQL query to execute.
        amount - maximum number of objects to retrieve.
        offset - index of first object to retrieve.
        Returns:
        the data table containing the raw data.
        Throws:
        CoreException
      • retrieveXPathQueryAggregateAsync

        public static java.util.concurrent.Future<java.lang.Long> retrieveXPathQueryAggregateAsync​(IContext context,
                                                                                                   java.lang.String xpathQuery)
        Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (asynchronously).
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate xpath query (e.g. "COUNT(//System.User)").
        Returns:
        the Future object.
      • retrieveXPathQueryAggregate

        public static java.lang.Long retrieveXPathQueryAggregate​(IContext context,
                                                                 java.lang.String xpathQuery)
                                                          throws CoreException
        Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously).
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate xpath query (e.g. "COUNT(//System.User)").
        Returns:
        the Future object.
        Throws:
        CoreException
      • retrieveXPathQueryAggregateSchema

        public static java.lang.Long retrieveXPathQueryAggregateSchema​(IContext context,
                                                                       java.lang.String xpathQuery,
                                                                       IRetrievalSchema retrievalSchema)
                                                                throws CoreException
        Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function). (synchronously)
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate xpath query (e.g. "COUNT(//System.User)").
        retrievalSchema - the schema.
        Returns:
        the aggregate value.
        Throws:
        CoreException
      • retrieveXPathQueryAggregateSchema

        public static java.lang.Long retrieveXPathQueryAggregateSchema​(IContext context,
                                                                       java.lang.String xpathQuery,
                                                                       IRetrievalSchema retrievalSchema,
                                                                       boolean disableSecurity)
                                                                throws CoreException
        Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function). (synchronously)
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate xpath query (e.g. "COUNT(//System.User)").
        retrievalSchema - the schema.
        disableSecurity - whether security should be applied for this retrieval.
        Returns:
        the aggregate value.
        Throws:
        CoreException
      • retrieveXPathQueryAggregateAsyncDouble

        public static java.util.concurrent.Future<java.lang.Double> retrieveXPathQueryAggregateAsyncDouble​(IContext context,
                                                                                                           java.lang.String xpathQuery)
        Retrieves long value based on the given query (query should have an aggregate function as root element).
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate XPath query (e.g. "COUNT(//System.User)")
        Returns:
        returns Future object for action control and return of action result
      • retrieveXPathQueryAggregateDouble

        public static java.lang.Double retrieveXPathQueryAggregateDouble​(IContext context,
                                                                         java.lang.String xpathQuery)
                                                                  throws CoreException
        Retrieves double aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously).
        Parameters:
        context - context to be used to process this request
        xpathQuery - the aggregate XPath query (e.g. "COUNT(//System.User)")
        Returns:
        the Future object.
        Throws:
        CoreException
      • getFileDocumentContent

        public static java.io.InputStream getFileDocumentContent​(IContext context,
                                                                 IMendixObject fileDocument)
        Returns contents of a file document as an input stream.
        Parameters:
        context - the context.
        fileDocument - the file document from which the contents will be returned.
        Returns:
        the input stream of the file content of the given file document.
      • storeFileDocumentContent

        public static void storeFileDocumentContent​(IContext context,
                                                    IMendixObject fileDocument,
                                                    java.lang.String fileName,
                                                    java.io.InputStream inputStream)
        Physically stores a file using the given input stream and commits the file document.
        Parameters:
        context - the context.
        fileDocument - the file document to which the file to store is linked to.
        fileName - the original name of the file (will be stored in the Name attribute)
        inputStream - the content of the file
      • storeFileDocumentContent

        public static void storeFileDocumentContent​(IContext context,
                                                    IMendixObject fileDocument,
                                                    java.io.InputStream inputStream)
        Physically stores a file using the given input stream and commits the file document.
        Parameters:
        context - the context.
        fileDocument - the file document to which the file to store is linked to.
        inputStream - the content of the file
      • storeImageDocumentContent

        public static void storeImageDocumentContent​(IContext context,
                                                     IMendixObject imageDocument,
                                                     java.io.InputStream inputStream,
                                                     int thumbnailWidth,
                                                     int thumbnailHeight)
        Physically stores an image using the given input stream and commits the image document.
        Parameters:
        context - the context.
        imageDocument - the image document to which the image to store is linked to.
        inputStream - the content of the file
        thumbnailWidth - the width of the thumbnail to create for this image.
        thumbnailHeight - the width of the thumbnail to create for this image.
      • getImage

        public static java.io.InputStream getImage​(IContext context,
                                                   IMendixObject imageDocument,
                                                   boolean retrieveThumbnail)
        Retrieve contents of the given image document.
        Parameters:
        context - the context.
        imageDocument - the image document for which its contents are retrieved.
        retrieveThumbnail - indicates whether a thumbnail or the full image is retrieved.
        Returns:
        the image as an input stream.
      • isSubClassOf

        public static boolean isSubClassOf​(java.lang.String superClass,
                                           java.lang.String type)
        Checks whether a type is a subclass of or equal to a potential super class.
        Parameters:
        superClass - the name of the super class
        type - the name of the type to check
        Returns:
        returns true if type is a subclass of superClass or if type equals superClass
      • isSubClassOf

        public static boolean isSubClassOf​(IMetaObject superObject,
                                           IMetaObject type)
        Checks whether a type is a subclass of or equal to a potential super class.
        Parameters:
        superObject - the super object.
        type - the name of the type to check.
        Returns:
        returns true if type is a subclass of superClass or if type equals superClass.
      • isSubClassOf

        public static boolean isSubClassOf​(java.lang.String superClass,
                                           short typeHash)
        Checks whether a type is a subclass of or equal to a potential super class.
        Parameters:
        superClass - the name of the super class
        typeHash - the hash of the name of the type to check
        Returns:
        returns true if type is a subclass of superClass or if type equals superClass
      • getAllMendixObjects

        public static java.lang.Iterable<IMendixObject> getAllMendixObjects()
        Get all IMendixObject types.
        Returns:
        returns a list with all IMendixObjects (one object for each existing type)
      • getSubtypesOf

        public static java.util.List<java.lang.String> getSubtypesOf​(java.lang.String objectType)
        Get all subtypes for an object type (including subtypes of subtypes, etc.).
        Parameters:
        objectType - the object type.
        Returns:
        list of subtypes, in no particular order.
      • getMetaObject

        public static IMetaObject getMetaObject​(java.lang.String metaObjectName)
        Get the IMetaObject corresponding to the given meta object name.
        Parameters:
        metaObjectName - the meta object name.
        Returns:
        returns the IMetaObject for the given metaObjectName
      • getMetaPrimitive

        public static IMetaPrimitive getMetaPrimitive​(java.lang.String qualifiedAttributeName)
        Get the IMetaPrimtive based on a qualified attribute name (e.g. "System.User.Name").
        Parameters:
        qualifiedAttributeName - the qualified attribute name.
        Returns:
        the IMetaPrimtive.
      • getMetaObjects

        public static java.lang.Iterable<IMetaObject> getMetaObjects()
        Get all IMetaObjects.
        Returns:
        returns all IMetaObjects.
      • getMetaAssociations

        public static java.lang.Iterable<IMetaAssociation> getMetaAssociations()
        Get all IMetaAssociations.
        Returns:
        returns all IMetaAssociations.
      • getMetaAssociation

        public static IMetaAssociation getMetaAssociation​(java.lang.String association)
        Get the IMetaAssociation corresponding to the given association name.
        Parameters:
        association - the association name (e.g. "System.UserRoles").
        Returns:
        returns the IMetaAssociation for the given association name.
      • getDatabaseTableName

        public static java.lang.String getDatabaseTableName​(IMetaObject metaObject)
        Returns the name of the database table for the given entity type.
        Parameters:
        metaObject - the meta object to get the database table name for
        Returns:
        the name of the database table
      • getDatabaseTableName

        public static java.lang.String getDatabaseTableName​(IMetaAssociation metaAssociation)
        Returns the name of the database table for the given association. This table will contain two columns, to be able to store the id's of both sides of the association.
        Parameters:
        metaAssociation - the meta association to get the database table name for
        Returns:
        the name of the database table
      • getDatabaseColumnName

        public static java.lang.String getDatabaseColumnName​(IMetaPrimitive metaPrimitive)
        Returns the name of the database column for the given attribute.
        Parameters:
        metaPrimitive - the meta primitive to get the database column name for
        Returns:
        the name of the database column
      • getDatabaseChildColumnName

        public static java.lang.String getDatabaseChildColumnName​(IMetaAssociation metaAssociation)
        Returns the name of the database column for the child of the given association.
        Parameters:
        metaAssociation - the meta association to get the database child column name for
        Returns:
        the name of the database child column name
      • getDatabaseParentColumnName

        public static java.lang.String getDatabaseParentColumnName​(IMetaAssociation metaAssociation)
        Returns the name of the database column for the parent of the given association.
        Parameters:
        metaAssociation - the meta association to get the database parent column name for
        Returns:
        the name of the database parent column name
      • createSystemContext

        public static IContext createSystemContext()
        Returns the context of the system session (this is always a sudo context). The system session has no associated user or user roles.
        Returns:
        returns the system session context.
      • getSessionById

        public static ISession getSessionById​(java.util.UUID sessionId)
        Returns the session belonging to the given session id.
        Parameters:
        sessionId - A session id.
        Returns:
        The session belonging to the id. Returns null of not found.
      • createMendixIdentifier

        public static IMendixIdentifier createMendixIdentifier​(java.lang.String guid)
        Creates a IMendixIdentifier for the given guid.
        Parameters:
        guid - the guid.
        Returns:
        returns the created MendixIdentifier.
      • createMendixIdentifier

        public static IMendixIdentifier createMendixIdentifier​(long guid)
        Creates a new IMendixIdentifier for the given guid.
        Parameters:
        guid - the guid.
        Returns:
        returns the created MendixIdentifier.
      • authenticate

        public static boolean authenticate​(IContext context,
                                           IUser user,
                                           java.lang.String password)
                                    throws CoreException
        Authenticate the given user with the given password.
        Returns:
        returns true if authentication was successful.
        Throws:
        CoreException
      • login

        public static ISession login​(java.util.Map<java.lang.String,​? extends java.lang.Object> params)
                              throws CoreException
        Generic login method (can be used in modules in combination with LoginAction replacement).
        Parameters:
        params - the params.
        Returns:
        the created session if login was successful.
        Throws:
        CoreException
      • login

        public static ISession login​(java.lang.String userName,
                                     java.lang.String password)
                              throws CoreException
        Login user with the given user name and password.
        Parameters:
        userName - the user name.
        password - the password.
        Returns:
        the created session if login is successful.
        Throws:
        CoreException
      • login

        public static ISession login​(java.lang.String userName,
                                     java.lang.String password,
                                     java.lang.String currentSessionId)
                              throws CoreException
        Login user with the given parameters.
        Parameters:
        userName - the user name.
        password - the password.
        currentSessionId - current session UUID.
        Returns:
        the created session if login is successful.
        Throws:
        CoreException
      • login

        public static ISession login​(java.lang.String userName,
                                     java.lang.String password,
                                     com.mendix.m2ee.api.IMxRuntimeRequest request)
                              throws CoreException
        Throws:
        CoreException
      • logout

        public static void logout​(ISession session)
        Logout the given session. When the session is persistent it will be removed from the database. If the session is not persistent it will removed from the session cache.
        Parameters:
        session - the session to logout.
      • getUser

        public static IUser getUser​(IContext context,
                                    java.lang.String userName)
                             throws CoreException
        Returns a user using the given user name.
        Parameters:
        context - the context.
        userName - the user name to retrieve a user for.
        Returns:
        the retrieved user.
        Throws:
        CoreException
      • initializeSession

        public static ISession initializeSession​(IUser user,
                                                 java.lang.String currentSessionId)
                                          throws CoreException
        Initialize a new session for the given user.
        Parameters:
        user - the user for which the session should be initialized.
        currentSessionId - id of the current session, will be used to transfer data when current session is associated with a guest user.
        Returns:
        the created session.
        Throws:
        CoreException
      • initializeGuestSession

        public static ISession initializeGuestSession()
                                               throws CoreException
        Initialize a new session for a guest user.
        Returns:
        the created session
        Throws:
        CoreException
      • addRequestHandler

        public static void addRequestHandler​(java.lang.String path,
                                             RequestHandler requestHandler)
        Add a custom request handler to the Mendix Business Server. This request handler will process MxRuntimeRequests on the given path. Responses should be given by adding information to the MxRuntimeResponse.
        Parameters:
        path - the path for which request should be processed.
        requestHandler - the custom request handler.
      • getLogger

        public static com.mendix.logging.ILogNode getLogger​(java.lang.String name)
      • getConfiguration

        public static Configuration getConfiguration()
        Returns the current configuration.
        Returns:
        the configuration.
      • resolveTokens

        public static java.lang.Object resolveTokens​(IContext context,
                                                     java.lang.String text)
        Resolve tokens in the given text. Possible tokens: - [%CurrentDateTime%] - [%CurrentUser%] - [%SecondLength%] - [%MinuteLength%] - [%HourLength%] - [%DayLength%] - [%WeekLength%] - [%MonthLength%] - [%YearLength%] - [%BeginOfCurrentMinute%] - [%EndOfCurrentMinute%] - [%BeginOfCurrentHour%] - [%BeginOfCurrentDay%] - [%EndOfCurrentDay%] - [%BeginOfCurrentWeek%] - [%EndOfCurrentWeek%] - [%BeginOfCurrentMonth%] - [%EndOfCurrentMonth%] - [%BeginOfCurrentYear%] - [%EndOfCurrentYear%] - [%UserRole_%Name%%] (e.g. [%UserRole_Administrator%])
        Parameters:
        text - the text to resolve.
        context - the context.
        Returns:
        the resolved object.
      • getActiveActionCount

        public static int getActiveActionCount()
        Returns the current number of active actions. This number represents only the actions which were started asynchronously.
        Returns:
        number of current active actions.
      • getCompletedActionCount

        public static long getCompletedActionCount()
        Returns the number of completed actions since server startup. This number represents only the actions which were started asynchronously.
        Returns:
        number of completed actions
      • getActionQueueSize

        public static int getActionQueueSize()
        Returns the current action pool queue size.
        Returns:
        returns current queue size of action thread pool.
      • getCurrentPoolSize

        public static int getCurrentPoolSize()
        Returns the current action pool size.
        Returns:
        the current size of the action thread pool.
      • getLargestPoolSize

        public static int getLargestPoolSize()
        Returns the largest action pool size.
        Returns:
        the maximum number of threads the thread pool has ever ran.
      • getScheduledActionCount

        public static int getScheduledActionCount()
        Returns the number of actions currently scheduled for future execution.
        Returns:
        the number of scheduled actions.
      • getMaximumNumberConcurrentUsers

        public static int getMaximumNumberConcurrentUsers()
                                                   throws CoreException
        Returns the maximum number of concurrent users since the server was started.
        Returns:
        maximum number of concurrent users.
        Throws:
        CoreException
      • getNumberConcurrentSessions

        public static long getNumberConcurrentSessions()
        Returns current number of concurrent sessions.
      • getActiveSessions

        public static java.util.Collection<? extends ISession> getActiveSessions()
        Returns all active sessions.
        Returns:
        the active sessions.
      • getActiveSession

        public static ISession getActiveSession​(java.lang.String userName)
        Returns the active session for the user with the given user name.
        Parameters:
        userName - the user name associated with the session to search for.
        Returns:
        the session associated with the given user name if such a session exists, otherwise null.
      • getNamedUserCount

        public static long getNamedUserCount()
      • getConcurrentUserCount

        public static long getConcurrentUserCount​(boolean anonymous)
        The current number of concurrent users.
        Parameters:
        anonymous - whether anonymous users should be included in the count.
        Returns:
        the number of concurrent users.
      • getInternationalizedString

        public static java.lang.String getInternationalizedString​(IContext context,
                                                                  java.lang.String key,
                                                                  java.lang.Object... args)
        Returns the translated string for a certain key and context. The context is used to retrieve the language of the current user.
        Parameters:
        context - the context.
        key - the key referring to the translatable string.
        args - the arguments which should be applied to translatable string template.
        Returns:
        the translated string.
      • getInternationalizedString

        public static java.lang.String getInternationalizedString​(java.lang.String languageCode,
                                                                  java.lang.String key,
                                                                  java.lang.Object... args)
        Returns the translated string for a certain key and language code.
        Parameters:
        languageCode - the language code (ISO-639).
        key - the key referring to the translatable string.
        args - values which should replace possible templates in the translatable string ({1}, {2}, etc.).
        Returns:
        the translated string.
      • getDefaultLanguage

        public static ILanguage getDefaultLanguage()
        Returns the default language of the project.
        Returns:
        the default language.
      • getLanguage

        public static ILanguage getLanguage​(IContext context)
        Get the language for the current context. If the session linked with this context is a user session the language will be the language of the user, in case of a system session and in case there is no language configured for this user, it will be the default language. Related: getDefaultLanguage().
        Returns:
        Language of the user attached to this session or the default language.
      • getLocale

        public static java.util.Locale getLocale​(IContext context)
        Retrieve locale using the given context.
        Parameters:
        context - the context.
        Returns:
        the Locale.
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String languageCode)
        Retrieve locale using the given language code (e.g. en_US).
        Parameters:
        languageCode - the languageCode (ISO-639).
        Returns:
        the Locale.
      • getStartupDateTime

        public static java.util.Date getStartupDateTime()
        Returns the startup date time of the Mendix Business Server.
        Returns:
        the date time on which the Mendix Business Server was started.
      • registerLogSubscriber

        public static void registerLogSubscriber​(com.mendix.logging.LogSubscriber subscriber)
      • buildException

        public static void buildException​(java.lang.StringBuilder trace,
                                          java.lang.Throwable throwable)
        Prints the message and stacktrace of a Throwable and its cause(s).
        Parameters:
        trace - the StringBuilder the exception is printed to.
        throwable - the Throwable to print.
      • addUserAction

        public static void addUserAction​(java.lang.Class<? extends UserAction<?>> userActionClass)
        Add the action specified by the given action name to action registry. This enables calling Core.execute(actionName) for this action.
        Parameters:
        userActionClass - the fully qualified class name of the action (e.g. com.mendix.action.MyAction).
      • createDataType

        public static IDataType createDataType​(java.lang.String type)
        Creates a DataType based on a type.
        Possible types:
        - Boolean
        - Integer
        - Long
        - Float
        - String
        - Datetime
        - {code#id} (enumeration key)
        - ModuleName.ObjectName (IMendixObject)
        - [ModuleName.ObjectName] (List<IMendixObject>)
        Parameters:
        type - the type to base the IDataType on.
        Returns:
        the resulting IDataType.
      • createDataType

        public static IDataType createDataType​(java.lang.String objectType,
                                               java.lang.String attributeName)
        Creates a DataType based on an object type and a attribute name.
        Parameters:
        objectType - the object type (format: "ModuleName.EntityName").
        attributeName - the attribute to create the IDataType for (should be a member of above object type)
        Returns:
        the resulting IDataType
      • getProfiler

        public static IProfiler getProfiler()
      • unregisterProfiler

        public static void unregisterProfiler()
      • getProjectId

        public static java.util.UUID getProjectId()
        Returns the project identifier of the project.
        Returns:
        The project identifier of the project
      • getModelVersion

        public static java.lang.String getModelVersion()
        Returns the model version of the project.
        Returns:
        The model version of the project