Interface ICore
Core is a good starting point to find functionality. This class provides amongst other functionality: all object actions (create, change, commit, delete, rollback), authentication and sign-in functionality and file document handling.
This is an internal interface that is not to be used and may change any time.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMendixCookies
(IMxRuntimeRequest request, IMxRuntimeResponse response, ISession session, boolean useAuthToken) Writes cookies used by the Mendix platform to the response.void
addRequestHandler
(String path, IRequestHandler requestHandler) Add a custom request handler to the Mendix runtime server.void
addSessionCookies
(IMxRuntimeResponse response, ISession session, String path, boolean useAuthToken) Deprecated.since 10.16.void
addUserAction
(Class<? extends UserAction<?>> userActionClass) Add the action specified by the given action name to action registry.void
addWebSocketEndpoint
(String path, javax.websocket.Endpoint endpoint) Registers an instance ofEndpoint
to handle web socket requests on a path.void
addWebSocketEndpoint
(String path, javax.websocket.Endpoint endpoint, WebSocketEndpointConfiguration configuration) Registers an instance ofEndpoint
to handle web socket requests on a path.boolean
authenticate
(IContext context, IUser user, String password) Authenticate the given user with the given password.void
buildException
(StringBuilder trace, Throwable throwable) Prints the message and stacktrace of a Throwable and its cause(s).boolean
Changes the given object in the state store (synchronously).changeAsync
(IContext context, IMendixObject obj, Map<String, String> changes) Deprecated.since 9.24.commit
(IContext context, IMendixObject object) Commits the given object.commit
(IContext context, IMendixObject object, int queryTimeout) Commits the given object.commit
(IContext context, List<IMendixObject> objects) Commits the given objects.commit
(IContext context, List<IMendixObject> objects, int queryTimeout) Commits the given objects.commitAsync
(IContext context, List<IMendixObject> objects) Deprecated.since 9.24.commitWithoutEvents
(IContext context, IMendixObject object) Commits the given object without events.commitWithoutEvents
(IContext context, IMendixObject object, int queryTimeout) Commits the given object without events.commitWithoutEvents
(IContext context, List<IMendixObject> objects) Commits the given objects without events.commitWithoutEvents
(IContext context, List<IMendixObject> objects, int queryTimeout) Commits the given objects without events.createDataType
(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>)createDataType
(String objectType, String attributeName) Creates a DataType based on an object type and an attribute name.createMendixIdentifier
(long guid) Creates a new IMendixIdentifier for the given guid.createMendixIdentifier
(String guid) Creates a IMendixIdentifier for the given guid.Create a new IOQLTextGetRequest.createOQLTextGetRequestFromDataSet
(String dataSetQualifiedName) InstantiateIOQLTextGetRequest
from given qualified DataSet name.Create a new IRetrievalSchema.Returns the context of the system session (this is always a sudo context).createXPathQuery
(String xpathQuery) Creates an XPath query representation that can be built up in a fluent mannerCreate a new IXPathTextGetRequest.boolean
delete
(IContext context, int queryTimeout, IMendixObject... objects) Deletes the given objects from the database and server state store (synchronously).boolean
delete
(IContext context, IMendixObject... objects) Deletes the given objects from the database and server state store (synchronously).boolean
delete
(IContext context, List<IMendixObject> objectList) Deletes the given objects from the database and server state store (synchronously).boolean
delete
(IContext context, List<IMendixObject> objectList, boolean useDeleteBehavior) Deletes the given objects from the database and server state store (synchronously).deleteAsync
(IContext context, IMendixObject object, boolean useDeleteBehavior) Deprecated.since 9.24.deleteAsync
(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) Deprecated.since 9.24.boolean
deleteWithoutEvents
(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) Deletes the given objects from the database and server state store (synchronously) without events This action is executed in a transaction.Evaluate the given (microflow)expression.<T extends ICoreAction<R>,
R>
Future<R> execute
(T action) Execute an action asynchronously, result is given and/or exceptions are raised when calling Future.get().<R> Future
<R> executeAsync
(IContext context, String actionName, boolean executeInTransaction, Map<String, Object> params) Execute the specified microflow (asynchronously).<R> Future
<R> executeAsync
(IContext context, String actionName, Object... params) Execute the specified action (asynchronously), result is given and/or exceptions are raised when calling Future.get().<T extends ICoreAction<R>,
R>
RexecuteSync
(T action) Execute an action synchronously.<T extends ICoreAction<R>,
R>
voidexecuteVoid
(T action) Execute the specified action (asynchronously).int
Returns the current action pool queue size.int
Returns the current number of active actions.getActiveSession
(String userName) Returns the active session for the user with the given username.Collection
<? extends ISession> Returns all active sessions.Get all IMendixObject types.long
Returns the number of completed actions since server startup.long
getConcurrentUserCount
(boolean anonymous) The current number of concurrent users.Returns the current configuration.int
Returns the current action pool size.getDatabaseChildColumnName
(IMetaAssociation metaAssociation) Returns the name of the database column for the child of the given association.getDatabaseColumnName
(IMetaPrimitive metaPrimitive) Returns the name of the database column for the given attribute.getDatabaseParentColumnName
(IMetaAssociation metaAssociation) Returns the name of the database column for the parent of the given association.getDatabaseTableName
(IMetaAssociation metaAssociation) Returns the name of the database table for the given association.getDatabaseTableName
(IMetaObject metaObject) Returns the name of the database table for the given entity type.Returns the default language of the loaded project.getFileDocumentContent
(IContext context, IMendixObject fileDocument) Returns contents of a file document as an input stream.getImage
(IContext context, IMendixObject imageDocument, boolean retrieveThumbnail) Retrieve contents of the given image document.getInputParameters
(String actionName) Returns all input parameter data types the specified action by name.getInternationalizedString
(IContext context, String key, Object... args) Returns the translated string for a certain key and context.getInternationalizedString
(String languageCode, String key, Object... args) Returns the translated string for a certain key and language code.getLanguage
(IContext context) Get the language for the current context.int
Returns the largest action pool size.Returns an instance ofListenersRegistry
which can be used to register callbacks on system events for all persistable entities in the application.Retrieve locale using the given context.Retrieve locale using the given language code (e.g.Returns the logger corresponding to the specified name.int
Returns the maximum number of concurrent users since the server was started.getMetaAssociation
(String association) Get the IMetaAssociation corresponding to the given association name.Get all IMetaAssociations.getMetaObject
(String metaObjectName) Get the IMetaObject corresponding to the given metaobject name.Get all IMetaObjects.getMetaPrimitive
(String qualifiedAttributeName) Get the IMetaPrimitive based on a qualified attribute name (e.g.Returns the names of all modeled microflows.Returns the model version of the project.long
Returns the number of named, active users, excluding the admin user.long
Returns current number of concurrent sessions.Deprecated.since 10.18.Returns the project identifier of the project.getReturnType
(String actionName) Returns the return type of the specified action.int
Returns the number of actions currently scheduled for future execution.getSessionById
(UUID sessionId) Returns the session belonging to the given session id.Returns the startup date time of the Mendix runtime server.getSubtypesOf
(String objectType) Get all subtypes for an object type (including subtypes of subtypes, etc.).Returns a user using the given username.getXASId()
Returns the id of this server instance.Initialize a new session for a guest user.initializeSession
(IUser user, String currentSessionId) Initialize a new session for the given user.instantiate
(IContext context, String objectType) Creates a new IMendixObject with the given object type (synchronously).instantiateAsync
(IContext context, String objectType) Deprecated.since 9.24.boolean
Returns whether this runtime server is running in development mode.boolean
isSubClassOf
(IMetaObject superObject, IMetaObject type) Deprecated.since 9.24.boolean
isSubClassOf
(String superClass, short typeHash) Deprecated.since 9.24.boolean
isSubClassOf
(String superClass, String type) Deprecated.since 9.24.Login user with the given username and password.login
(String userName, String password, IMxRuntimeRequest request) Login user with the given parameters.Login user with the given parameters.Generic login method (can be used in modules in combination with LoginAction replacement).void
Logout the given session.microflowCall
(String name) Prepare to call a microflow.void
registerLogSubscriber
(LogSubscriber subscriber) Register the specified subscriber for receiving log events.void
registerProfiler
(IProfiler profiler) Deprecated.since 10.18.boolean
removeScheduledFuture
(RunnableScheduledFuture<?> scheduledFuture) Remove scheduled future.<R> ScheduledFuture
<?> reschedule
(RunnableScheduledFuture<R> scheduledFuture, ICoreAction<R> action, long newDelay, TimeUnit timeUnit) Reschedule an action with a new delay.resolveTokens
(IContext context, String text) Resolve tokens (Mendix system variables) in the given text.retrieveByPath
(IContext context, IMendixObject mxObject, String path) Retrieves objects using the given object and path.retrieveByPath
(IContext context, IMendixObject mxObject, String path, boolean isSelfAssociationChild) Retrieves objects using the given object and path.retrieveByPath
(IContext context, IMendixObject mxObject, String path, String entity, boolean isSelfAssociationChild) Retrieves objects using the given object and path.retrieveId
(IContext context, IMendixIdentifier id) Retrieves object with the given id (synchronously).retrieveIdAsync
(IContext context, IMendixIdentifier id) Retrieves object with the given id (asynchronously).retrieveIdList
(IContext context, List<IMendixIdentifier> ids) Retrieves objects with the given ids (synchronously).retrieveIdList
(IContext context, List<IMendixIdentifier> ids, int amount, int offset, Map<String, String> sort) Retrieves objects with the given ids (synchronously).retrieveIdListAsync
(IContext context, List<IMendixIdentifier> ids) Retrieves objects with the given ids (asynchronously).retrieveOQLDataTable
(IContext context, IGetRequest request) Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).retrieveOQLDataTable
(IContext context, String oqlQuery) Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).retrieveOQLDataTable
(IContext context, String oqlQuery, int amount, int offset) Retrieve raw data (IDataTable) using an OQL query (asynchronously).retrieveOQLDataTableAsync
(IContext context, IGetRequest request) Retrieve raw data (IDataTable) using an IGetRequest object (asynchronously).retrieveOQLDataTableAsync
(IContext context, String oqlQuery) Retrieve raw data (IDataTable) using an OQL query (asynchronously).retrieveOQLDataTableAsync
(IContext context, String oqlQuery, int amount, int offset) Retrieve raw data (IDataTable) using an OQL query (asynchronously).retrieveXPathQuery
(IContext context, String xpathQuery) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQuery
(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQuery
(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAggregate
(IContext context, String xpathQuery) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAggregateAsync
(IContext context, String xpathQuery) Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (asynchronously).retrieveXPathQueryAggregateAsyncDouble
(IContext context, String xpathQuery) Retrieves long value based on the given query (query should have an aggregate function as root element).retrieveXPathQueryAggregateDecimal
(IContext context, String xpathQuery) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAggregateDouble
(IContext context, String xpathQuery) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAggregateSchema
(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAggregateSchema
(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean disableSecurity) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathQueryAsync
(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) Retrieves object list based on the given XPath query (asynchronously).retrieveXPathQueryRaw
(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathSchema
(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, boolean disableSecurity) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesretrieveXPathSchemaRaw
(IContext context, String xpathQuery, boolean shouldRetrieveCount, IRetrievalSchema retrievalSchema) Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesrollback
(IContext context, IMendixObject object) Rollback changes of the object with the given id (synchronously).rollbackAsync
(IContext context, IMendixObject object) Deprecated.since 9.24.<R> RunnableScheduledFuture
<?> schedule
(ICoreAction<R> action, long delay, TimeUnit timeUnit) Schedule an action on adelay
measured intimeUnit
from now.Schedule a microflow action / java action / registered action on a certain date.<R> void
scheduleAtFixedRate
(ICoreAction<R> action, long initialDelay, long period, 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.<R> void
scheduleAtFixedRate
(ICoreAction<R> action, Date firstRun, long period, 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.void
scheduleAtFixedRate
(String actionName, Date firstRun, long period, TimeUnit timeUnit, String name, 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.<R> void
scheduleWithFixedDelay
(ICoreAction<R> action, long initialDelay, long delay, 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.void
storeFileDocumentContent
(IContext context, IMendixObject fileDocument, InputStream inputStream) Physically stores a file using the given input stream and commits the file document.void
storeFileDocumentContent
(IContext context, IMendixObject fileDocument, String fileName, InputStream inputStream) Physically stores a file using the given input stream and commits the file document.void
storeImageDocumentContent
(IContext context, IMendixObject imageDocument, InputStream inputStream, int thumbnailWidth, int thumbnailHeight) Physically stores an image using the given input stream and commits the image document.void
Deprecated.since 10.18.userActionCall
(String name) Prepare to call a Java action.
-
Method Details
-
getListenersRegistry
ListenersRegistry getListenersRegistry()Returns an instance ofListenersRegistry
which can be used to register callbacks on system events for all persistable entities in the application.- Returns:
- the register of listeners
- Since:
- 7.6
-
addUserAction
Add the action specified by the given action name to action registry. This enables callingexecute(actionName)
for this action.- Parameters:
userActionClass
- the action (e.g. com.mendix.action.MyAction)
-
authenticate
Authenticate the given user with the given password.- Parameters:
context
- the context for executing the authentication actionuser
- the user to authenticatepassword
- the password of the user to authenticate- Returns:
- returns true if authentication was successful
- Throws:
CoreException
-
buildException
Prints the message and stacktrace of a Throwable and its cause(s).- Parameters:
trace
- the StringBuilder the exception is printed tothrowable
- the Throwable to print
-
change
boolean change(IContext context, IMendixObject object, Map<String, String> changes) throws CoreExceptionChanges the given object in the state store (synchronously). When the object is not in the state store yet, the object will be retrieved from the database and put in the state store. This action is executed in a transaction.The 'changed by' and 'changed date' system attributes will be updated, independently of if there's an actual change. This is different behavior than in microflows.
- Parameters:
context
- the contextobject
- the object to changechanges
- contains changes by member name (e.g. <"Name", "User1">)- Returns:
- returns whether the change succeeded or not
- Throws:
CoreException
-
changeAsync
@Deprecated Future<Boolean> changeAsync(IContext context, IMendixObject obj, Map<String, String> changes) Deprecated.since 9.24. Usechange(IContext, IMendixObject, Map)
instead.Changes the object (asynchronously). Object will be stored in the state store. This action is not executed in a transaction.The 'changed by' and 'changed date' system attributes will be updated, independently of if there's an actual change. This is different behavior than in microflows.
- Parameters:
context
- the contextobj
- the MendixObject to changechanges
- contains changes by member name (e.g. <"Name", "User1">)- Returns:
- returns the Future object
-
commit
Commits the given object. This will store the object in the database and remove it from the server state store. This action is executed in a transaction.- Parameters:
context
- the contextobject
- the IMendixObject to commit- Returns:
- returns committed object
- Throws:
CoreRuntimeException
- if commit failsCoreException
-
commit
Commits the given objects. This will store the objects in the database and remove them from the server state store. 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 contextobjects
- the objects to commit- Returns:
- returns committed objects
- Throws:
CoreRuntimeException
- if commit fails
-
commit
Commits the given object. This will store the object in the database and remove it from the server state store. This action is executed in a transaction.- Parameters:
context
- the contextobject
- the IMendixObject to commitqueryTimeout
- the timeout for queries related to this commit- Returns:
- returns committed object
- Throws:
CoreRuntimeException
- if commit fails
-
commit
Commits the given objects. This will store the objects in the database and remove them from the server state store. 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 contextobjects
- the objects to commitqueryTimeout
- the timeout for queries related to this commit- Returns:
- returns committed objects
- Throws:
CoreRuntimeException
- if commit fails
-
commitAsync
@Deprecated List<Future<List<IMendixObject>>> commitAsync(IContext context, List<IMendixObject> objects) Deprecated.since 9.24. Usecommit(IContext, List)
instead.Commits the given object (asynchronously). This will store the object in the database and remove it from the server state store. This action is not executed in a transaction.- Parameters:
context
- the contextobjects
- the instances of IMendixObject to commit- Returns:
- returns a list of future objects with committed object lists, one for each entity type
-
commitWithoutEvents
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 contextobject
- the IMendixObject to commit- Returns:
- returns committed object
- Throws:
CoreRuntimeException
- if commit fails
-
commitWithoutEvents
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 contextobject
- the IMendixObject to commitqueryTimeout
- the timeout for queries related to this commit- Returns:
- returns committed object
- Throws:
CoreRuntimeException
- if commit fails
-
commitWithoutEvents
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 contextobjects
- the objects to commit- Returns:
- returns committed objects
- Throws:
CoreRuntimeException
- if commit fails
-
commitWithoutEvents
List<IMendixObject> commitWithoutEvents(IContext context, List<IMendixObject> objects, int queryTimeout) 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 contextobjects
- the objects to commitqueryTimeout
- the query timeout- Returns:
- returns committed objects
- Throws:
CoreRuntimeException
- if commit fails
-
createDataType
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
Creates a DataType based on an object type and an 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
-
createMendixIdentifier
Creates a new IMendixIdentifier for the given guid.- Parameters:
guid
- the guid- Returns:
- returns the created MendixIdentifier
-
createMendixIdentifier
Creates a IMendixIdentifier for the given guid.- Parameters:
guid
- the guid- Returns:
- returns the created MendixIdentifier
-
createOQLTextGetRequest
IOQLTextGetRequest createOQLTextGetRequest()Create a new IOQLTextGetRequest. This class can be used to define a textual OQL retrieval query.- Returns:
- an IOQLTextGetRequest
-
createOQLTextGetRequestFromDataSet
InstantiateIOQLTextGetRequest
from given qualified DataSet name.Code examples
Example OQL query without parametersprivate 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; }
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 isReportGeneratorDataSet
and it belongs to a module namedReporting
then the qualified DataSet name will beReporting.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 parameterspublic 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; }
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 namedParGroupNumber
-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
generateReport
method first creates a oqlTextGetRequest. Next, in order to set theParGroupNumber
parameter a new IParameterMap is instantiated and the value ofParGroupNumber
parameter is specified, which in the above example would be4
. Finally, we provide this newParameterMap to thesetParameters
method ofIOQLTextGetRequest
. 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:
IllegalArgumentException
- if given qualified name is null, has invalid format, found DataSet contains Java Action or DataSet is not found
-
createRetrievalSchema
IRetrievalSchema createRetrievalSchema()Create a new IRetrievalSchema.- Returns:
- an IRetrievalSchema
-
createSystemContext
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
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
-
createXPathTextGetRequest
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
-
createXPathQuery
Creates an XPath query representation that can be built up in a fluent mannerCan 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)'. If variables are declared inside the XPath query, they can be set usingXPathQuery.setVariable(java.lang.String, java.math.BigDecimal)
Unset variables are treated as NULL.- Returns:
- instance of
XPathQuery
that can be used to construct an XPath query - Since:
- Mendix 7.17
-
delete
Deletes the given objects from the database and server state store (synchronously). This action is executed in a transaction.- Parameters:
context
- the contextobjects
- the objects to delete- Returns:
- returns whether delete succeeded
-
delete
Deletes the given objects from the database and server state store (synchronously). This action is executed in a transaction.- Parameters:
context
- the contextqueryTimeout
- the timeout for queries related to this deleteobjects
- the objects to delete- Returns:
- returns whether delete succeeded
-
delete
Deletes the given objects from the database and server state store (synchronously). This action is executed in a transaction.- Parameters:
context
- the contextobjectList
- the objects to delete- Returns:
- returns whether delete succeeded
-
delete
Deletes the given objects from the database and server state store (synchronously). This action is executed in a transaction.- Parameters:
context
- the contextobjectList
- the objects to deleteuseDeleteBehavior
- whether to use delete behavior- Returns:
- returns whether the delete succeeded
-
deleteAsync
@Deprecated List<Future<Boolean>> deleteAsync(IContext context, IMendixObject object, boolean useDeleteBehavior) Deprecated.since 9.24. Usedelete(IContext, List, boolean)
instead.Deletes the given object from the database and server state store (asynchronously). This action is not executed in a transaction.- Parameters:
context
- the contextobject
- the object to deleteuseDeleteBehavior
- whether to use delete behavior- Returns:
- returns a list of future booleans, one for each entity type
-
deleteAsync
@Deprecated List<Future<Boolean>> deleteAsync(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) Deprecated.since 9.24. Usedelete(IContext, List, boolean)
instead.Deletes the given object from the database and server state store (asynchronously). This action is not executed in a transaction.- Parameters:
context
- the contextobjects
- the objects to deleteuseDeleteBehavior
- whether to use delete behavior- Returns:
- returns a list of future booleans, one for each entity type
-
deleteWithoutEvents
boolean deleteWithoutEvents(IContext context, List<IMendixObject> objects, boolean useDeleteBehavior) Deletes the given objects from the database and server state store (synchronously) without events This action is executed in a transaction.- Parameters:
context
- the contextobjects
- the objects to deleteuseDeleteBehavior
- whether to use delete behavior- Returns:
- returns whether delete succeeded
-
evaluateExpression
Evaluate the given (microflow)expression.- Parameters:
context
- the contextvariables
- name of variables referenced in the expression (without '$') and their valuesexpression
- the expression- Returns:
- the evaluated value of the expression
-
microflowCall
Prepare to call a microflow. Parameters and transaction properties can be set and specified microflow can be called using the returned object.Core.microflowCall("AModule.SomeMicroflow") .inTransaction(true) .withParam("Param1", "Value1") .withParam("Param2", "Value2") .execute(context);
- Parameters:
name
- the name of the microflow to prepare- Returns:
- a builder for constructing the microflow
- See Also:
-
userActionCall
Prepare to call a Java action. Parameters can be set and specified action can be called using the returned object.Core.userActionCall("AModule.SomeJavaAction") .withParams("Value1", "Value2") .execute(context);
- Parameters:
name
- the name of the user action to prepare- Returns:
- a builder for constructing the user action
- See Also:
-
execute
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 CoreActionR
- result type of the action, which should match the return value of the action- Parameters:
action
- the action to execute- Returns:
- the Future object
-
executeAsync
<R> Future<R> executeAsync(IContext context, String actionName, boolean executeInTransaction, Map<String, Object> params) throws CoreExceptionExecute the specified microflow (asynchronously).- Type Parameters:
R
- result type of the action, which should match the return value of the action- Parameters:
context
- the context for this microflowactionName
- 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
-
executeAsync
<R> Future<R> executeAsync(IContext context, String actionName, Object... params) throws CoreException Execute the specified 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.Note that when called with a microflow, primitives will not be passed and multiple arguments that are a subtype of a microflow parameter will not work as expected.
When calling microflows use
executeAsync(IContext, String, boolean, Map)
instead.- Type Parameters:
R
- result type of the action, which should match the return value of the action- Parameters:
context
- the context for this actionactionName
- the name of a microflow or Java action (format "ModuleName.ActionName")params
- for microflows: add IMendixObject, IMendixIdentifier or primitive parameters for Java actions: add any object parameters.- Returns:
- the Future object
- Throws:
CoreException
-
executeSync
Execute an action synchronously.- Type Parameters:
T
- action type, subclass of CoreActionR
- result type of the action, which should match the return value of the action- Parameters:
action
- the action to execute- Returns:
- return value of the specified action
- Throws:
CoreException
-
executeVoid
Execute the specified action (asynchronously).- Type Parameters:
T
- action type, subclass of CoreActionR
- result type of the action, which should be Object- Parameters:
action
- the action to execute
-
getActionQueueSize
int getActionQueueSize()Returns the current action pool queue size.- Returns:
- returns current queue size of action thread pool
-
getActiveActionCount
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
-
getActiveSession
Returns the active session for the user with the given username.- Parameters:
userName
- the username associated with the session to search for- Returns:
- the session associated with the given username if such a session exists, otherwise null
-
getActiveSessions
Collection<? extends ISession> getActiveSessions()Returns all active sessions.- Returns:
- the active sessions
-
getAllMendixObjects
Iterable<IMendixObject> getAllMendixObjects()Get all IMendixObject types.- Returns:
- returns a list with all IMendixObjects (one object for each existing type)
-
getCompletedActionCount
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
-
getConcurrentUserCount
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
-
getConfiguration
Configuration getConfiguration()Returns the current configuration.- Returns:
- the configuration
-
getCurrentPoolSize
int getCurrentPoolSize()Returns the current action pool size.- Returns:
- the current size of the action thread pool
-
getDatabaseChildColumnName
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
-
getDatabaseColumnName
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
-
getDatabaseParentColumnName
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
-
getDatabaseTableName
Returns the name of the database table for the given entity type.- Parameters:
metaObject
- the metaobject to get the database table name for- Returns:
- the name of the database table
-
getDatabaseTableName
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
-
getDefaultLanguage
ILanguage getDefaultLanguage()Returns the default language of the loaded project.- Returns:
- the default language
-
getLanguage
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.- Parameters:
context
- the context to retrieve the language from- Returns:
- Language of the user attached to this session or the default language
- See Also:
-
getFileDocumentContent
Returns contents of a file document as an input stream. The returned stream must be closed when it is not needed anymore. No security checks will be performed.- Parameters:
context
- the contextfileDocument
- the file document from which the contents will be returned- Returns:
- the input stream of the file content of the given file document
-
getImage
Retrieve contents of the given image document. The returned stream must be closed when it is not needed anymore. No security checks will be performed.- Parameters:
context
- the contextimageDocument
- the image document for which its contents are retrievedretrieveThumbnail
- indicates whether a thumbnail or the full image is retrieved- Returns:
- the image as an input stream
-
getInputParameters
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
-
getInternationalizedString
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 contextkey
- the key referring to the translatable stringargs
- the arguments which should be applied to translatable string template- Returns:
- the translated string
-
getInternationalizedString
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 stringargs
- values which should replace possible templates in the translatable string ({1}, {2}, etc.)- Returns:
- the translated string
-
getLargestPoolSize
int getLargestPoolSize()Returns the largest action pool size.- Returns:
- the maximum number of threads the thread pool has ever ran
-
getLocale
Retrieve locale using the given context.- Parameters:
context
- the context- Returns:
- the Locale
-
getLocale
Retrieve locale using the given language code (e.g. en_US).- Parameters:
languageCode
- the languageCode (ISO-639)- Returns:
- the Locale
-
getMaximumNumberConcurrentUsers
Returns the maximum number of concurrent users since the server was started.- Returns:
- maximum number of concurrent users
- Throws:
CoreException
-
getMetaAssociation
Get the IMetaAssociation corresponding to the given association name. This method will return null for "System.owner" and "System.changedBy", as all instances of these associations will have the same name.- Parameters:
association
- the association name (e.g. "System.UserRoles")- Returns:
- returns the IMetaAssociation for the given association name
-
getMetaAssociations
Iterable<IMetaAssociation> getMetaAssociations()Get all IMetaAssociations.- Returns:
- returns all IMetaAssociations
-
getMetaObject
Get the IMetaObject corresponding to the given metaobject name.- Parameters:
metaObjectName
- the metaobject name- Returns:
- returns the IMetaObject for the given metaObjectName
-
getMetaObjects
Iterable<IMetaObject> getMetaObjects()Get all IMetaObjects.- Returns:
- returns all IMetaObjects
-
getMetaPrimitive
Get the IMetaPrimitive based on a qualified attribute name (e.g. "System.User.Name").- Parameters:
qualifiedAttributeName
- the qualified attribute name- Returns:
- the IMetaPrimitive
-
getMicroflowNames
Returns the names of all modeled microflows.- Returns:
- all microflow names (format "ModuleName.MicroflowName")
-
getNamedUserCount
long getNamedUserCount()Returns the number of named, active users, excluding the admin user.- Returns:
- the number of users
-
getNumberConcurrentSessions
long getNumberConcurrentSessions()Returns current number of concurrent sessions.- Returns:
- the number of concurrent sessions
-
getProfiler
Deprecated.since 10.18. No replacement. This feature will be removed in the future.Returns the currently registered profiler (if any).- Returns:
- the profiler if one is registered; null otherwise
-
getReturnType
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
-
getScheduledActionCount
int getScheduledActionCount()Returns the number of actions currently scheduled for future execution.- Returns:
- the number of scheduled actions
-
getStartupDateTime
Date getStartupDateTime()Returns the startup date time of the Mendix runtime server.- Returns:
- the date time on which the Mendix runtime server was started
-
getSubtypesOf
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
-
getUser
Returns a user using the given username.- Parameters:
context
- the contextuserName
- the username to retrieve a user for- Returns:
- the retrieved user
- Throws:
CoreException
-
getXASId
String getXASId()Returns the id of this server instance.- Returns:
- the server id in UUID format
-
getLogger
Returns the logger corresponding to the specified name. If no logger with that name exists yet, it is created.- Parameters:
name
- the name of te logger- Returns:
- the log node
-
initializeGuestSession
Initialize a new session for a guest user.- Returns:
- the created session
- Throws:
CoreException
- if something goes wrong during the initializing a guest session
-
initializeSession
Initialize a new session for the given user.- Parameters:
user
- the user for which the session should be initializedcurrentSessionId
- 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
-
instantiate
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 contextobjectType
- type of object to create (e.g. "System.User")- Returns:
- returns the newly created object
-
instantiateAsync
Deprecated.since 9.24. Useinstantiate(IContext, String)
instead.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 contextobjectType
- type of object to create (e.g. "System.User")- Returns:
- returns the Future object
-
isInDevelopment
boolean isInDevelopment()Returns whether this runtime server is running in development mode.- Returns:
- true if the server is in development mode; false otherwise
-
isSubClassOf
Deprecated.since 9.24. Below are a few alternative methods you can use instead.- If you have an instance of
IMetaObject
then you can useIMetaObject.isSubClassOf(IMetaObject)
. - If you have an instance of
IMetaObject
and the name of the super IMetaObject, then you can useIMetaObject.isSubClassOf(String)
. - If you have an instance of
IMendixObject
then you can useIMendixObject.isInstanceOf(IMetaObject)
. - If you have an instance of
IMendixObject
and the name of the super IMetaObject, then you can useIMendixObject.isInstanceOf(String)
)}.
Checks whether a type is a subclass of or equal to a potential super class.- Parameters:
superObject
- the super objecttype
- the name of the type to check- Returns:
- returns true if type is a subclass of superClass or if type equals superClass
- If you have an instance of
-
isSubClassOf
Deprecated.since 9.24. Below are a few alternative methods you can use instead.- If you have an instance of
IMetaObject
then you can useIMetaObject.isSubClassOf(IMetaObject)
. - If you have an instance of
IMetaObject
and the name of the super IMetaObject, then you can useIMetaObject.isSubClassOf(String)
. - If you have an instance of
IMendixObject
then you can useIMendixObject.isInstanceOf(IMetaObject)
. - If you have an instance of
IMendixObject
and the name of the super IMetaObject, then you can useIMendixObject.isInstanceOf(String)
)}.
Checks whether a type is a subclass of or equal to a potential super class.- Parameters:
superClass
- the name of the super classtypeHash
- 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
- If you have an instance of
-
isSubClassOf
Deprecated.since 9.24. Below are a few alternative methods you can use instead.- If you have an instance of
IMetaObject
then you can useIMetaObject.isSubClassOf(IMetaObject)
. - If you have an instance of
IMetaObject
and the name of the super IMetaObject, then you can useIMetaObject.isSubClassOf(String)
. - If you have an instance of
IMendixObject
then you can useIMendixObject.isInstanceOf(IMetaObject)
. - If you have an instance of
IMendixObject
and the name of the super IMetaObject, then you can useIMendixObject.isInstanceOf(String)
)}.
Checks whether a type is a subclass of or equal to a potential super class.- Parameters:
superClass
- the name of the super classtype
- the name of the type to check- Returns:
- returns true if type is a subclass of superClass or if type equals superClass
- If you have an instance of
-
login
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
- when the login fails
-
login
Login user with the given username and password.- Parameters:
userName
- the usernamepassword
- the password- Returns:
- the created session if login is successful
- Throws:
CoreException
- when the login fails
-
login
Login user with the given parameters.- Parameters:
userName
- the usernamepassword
- the passwordrequest
- the HTTP request- Returns:
- the created session if login is successful
- Throws:
CoreException
- when the login fails
-
login
Login user with the given parameters.- Parameters:
userName
- the usernamepassword
- the passwordcurrentSessionId
- current session UUID- Returns:
- the created session if login is successful
- Throws:
CoreException
- when the login fails
-
logout
Logout the given session. When the session is persistent it will be removed from the database. If the session is not persistent it will be removed from the session state.- Parameters:
session
- the session to logout
-
registerLogSubscriber
Register the specified subscriber for receiving log events.- Parameters:
subscriber
- the subscriber to register
-
registerProfiler
Deprecated.since 10.18. No replacement. This feature will be removed in the future.Registers the specified profiler for receiving profiling events.- Parameters:
profiler
- the profiler to register- Throws:
IllegalArgumentException
- if a profiler is already registeredMendixException
-
removeScheduledFuture
Remove scheduled future.- Parameters:
scheduledFuture
- the RunnableScheduledFuture to remove- Returns:
- whether removing the RunnableScheduledFuture was successful
-
reschedule
<R> ScheduledFuture<?> reschedule(RunnableScheduledFuture<R> scheduledFuture, ICoreAction<R> action, long newDelay, TimeUnit timeUnit) Reschedule an action with a new delay.- Type Parameters:
R
- result type of the action, which should be Object- Parameters:
scheduledFuture
- the scheduledFuture (old action) to remove from the queueaction
- the action to reschedulenewDelay
- the new delaytimeUnit
- time unit of the delay- Returns:
- scheduled future object
-
resolveTokens
Resolve tokens (Mendix system variables) 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:
context
- the contexttext
- the text to resolve- Returns:
- the resolved object
-
retrieveByPath
Retrieves objects using the given object and path.- Parameters:
context
- the contextmxObject
- the start point of the pathpath
- the path (association) to the objects to retrieve- Returns:
- the list of retrieved objects
-
retrieveByPath
List<IMendixObject> retrieveByPath(IContext context, IMendixObject mxObject, String path, boolean isSelfAssociationChild) Retrieves objects using the given object and path.- Parameters:
context
- the contextmxObject
- the start point of the pathpath
- the path (association) to the objects to retrieveisSelfAssociationChild
- defines whether the mxObject instance is the child of the path of a self association- Returns:
- the list of retrieved objects
-
retrieveByPath
List<IMendixObject> retrieveByPath(IContext context, IMendixObject mxObject, String path, String entity, boolean isSelfAssociationChild) Retrieves objects using the given object and path.- Parameters:
context
- the contextmxObject
- the start point of the pathpath
- the path (association) to the objects to retrieveentity
- the specialization entity to limit the results toisSelfAssociationChild
- defines whether the mxObject instance is the child of the path of a self association- Returns:
- the list of retrieved objects
-
retrieveId
Retrieves object with the given id (synchronously). First, the object is attempted to be retrieved from the state store. When the object cannot be retrieved from the state store it will be retrieved from the database.- Parameters:
context
- the contextid
- id of the object to retrieve- Returns:
- returns the Future object
- Throws:
CoreException
-
retrieveIdAsync
Retrieves object with the given id (asynchronously). First, the object is attempted to be retrieved from the state store. When the object cannot be retrieved from the state store it will be retrieved from the database.- Parameters:
context
- the contextid
- id of the object to retrieve- Returns:
- returns the Future object
-
retrieveIdList
List<IMendixObject> retrieveIdList(IContext context, List<IMendixIdentifier> ids) throws CoreException Retrieves objects with the given ids (synchronously). First, objects are attempted to be retrieved from the state store. When an object cannot be retrieved from the state store it will be retrieved from the database.- Parameters:
context
- the contextids
- ids of the objects to retrieve- Returns:
- returns the objects of the given ids
- Throws:
CoreException
-
retrieveIdList
List<IMendixObject> retrieveIdList(IContext context, List<IMendixIdentifier> ids, int amount, int offset, Map<String, String> sort) throws CoreExceptionRetrieves objects with the given ids (synchronously). First, objects are attempted to be retrieved from the state store. When an object cannot be retrieved from the state store 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 contextids
- ids of the objects to retrieveamount
- the maximum number of objects to retrieve from the databaseoffset
- offset of returned objects when retrieved from the databasesort
- sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">)- Returns:
- returns the Future object
- Throws:
CoreException
-
retrieveIdListAsync
Retrieves objects with the given ids (asynchronously). First, objects are attempted to be retrieved from the state store. When an object cannot be retrieved from the state store it will be retrieved from the database.- Parameters:
context
- the contextids
- ids of the objects to retrieve- Returns:
- returns the Future object
-
retrieveOQLDataTable
IDataTable retrieveOQLDataTable(IContext context, 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 requestoqlQuery
- the OQL query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrieve- Returns:
- the data table containing the raw data
- Throws:
CoreException
-
retrieveOQLDataTable
Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).- Parameters:
context
- context to be used to process this requestrequest
- the request object- Returns:
- the data table containing the raw data
- Throws:
CoreException
-
retrieveOQLDataTable
Retrieve raw data (IDataTable) using an IGetRequest object (synchronously).- Parameters:
context
- context to be used to process this requestoqlQuery
- the OQL query to execute- Returns:
- the data table containing the raw data
- Throws:
CoreException
-
retrieveOQLDataTableAsync
Retrieve raw data (IDataTable) using an OQL query (asynchronously).- Parameters:
context
- context to be used to process this requestoqlQuery
- the OQL query to execute- Returns:
- the Future object
-
retrieveOQLDataTableAsync
Retrieve raw data (IDataTable) using an IGetRequest object (asynchronously).- Parameters:
context
- context to be used to process this requestrequest
- the request object- Returns:
- the Future object
-
retrieveOQLDataTableAsync
Future<IDataTable> retrieveOQLDataTableAsync(IContext context, String oqlQuery, int amount, int offset) Retrieve raw data (IDataTable) using an OQL query (asynchronously).- Parameters:
context
- context to be used to process this requestoqlQuery
- the OQL query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrieve- Returns:
- the Future object
-
retrieveXPathQuery
@Deprecated List<IMendixObject> retrieveXPathQuery(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort) throws CoreExceptionDeprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves object list based on the given XPath query (synchronously).- Parameters:
context
- context to be used to process this requestxpathQuery
- the XPath query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrievesort
- sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">)- Returns:
- the list of retrieved objects
- Throws:
CoreException
-
retrieveXPathQuery
@Deprecated List<IMendixObject> retrieveXPathQuery(IContext context, String xpathQuery) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves object list based on the given XPath query (synchronously).- Parameters:
context
- context to be used to process this requestxpathQuery
- the XPath query to execute- Returns:
- the list of retrieved objects
- Throws:
CoreException
-
retrieveXPathQuery
@Deprecated List<IMendixObject> retrieveXPathQuery(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) throws CoreExceptionDeprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves object list based on the given XPath query (synchronously).- Parameters:
context
- context to be used to process this requestxpathQuery
- the XPath query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrievesort
- 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
-
retrieveXPathQueryAggregate
@Deprecated Long retrieveXPathQueryAggregate(IContext context, String xpathQuery) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves a long aggregate value based on the given query.The root element of the query should be an aggregate function.
- Parameters:
context
- context to be used to process this requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")- Returns:
- the aggregated result
- Throws:
CoreException
-
retrieveXPathQueryAggregateDouble
@Deprecated Double retrieveXPathQueryAggregateDouble(IContext context, String xpathQuery) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves a double aggregate value based on the given query.The root element of the query should be an aggregate function.
- Parameters:
context
- context to be used to process this requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")- Returns:
- the aggregated result
- Throws:
CoreException
-
retrieveXPathQueryAggregateDecimal
Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves a Decimal aggregate value based on the given query.The root element of the query should be an aggregate function.
- Parameters:
context
- context to be used to process this requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")- Returns:
- the aggregated result
-
retrieveXPathQueryRaw
@Deprecated IDataTable retrieveXPathQueryRaw(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) throws CoreExceptionDeprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves raw data (IDataTables) based on the given XPath query (synchronously).- Parameters:
context
- context to be used to process this requestxpathQuery
- the XPath query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrievesort
- 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
-
retrieveXPathQueryAggregateSchema
@Deprecated Long retrieveXPathQueryAggregateSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves 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 requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")retrievalSchema
- the schema- Returns:
- the aggregate value
- Throws:
CoreException
-
retrieveXPathQueryAggregateSchema
@Deprecated Long retrieveXPathQueryAggregateSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean disableSecurity) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves 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 requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")retrievalSchema
- the schemadisableSecurity
- whether security should be applied for this retrieval- Returns:
- the aggregate value
- Throws:
CoreException
-
retrieveXPathQueryAggregateAsyncDouble
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 requestxpathQuery
- the aggregate XPath query (e.g. "COUNT(//System.User)")- Returns:
- returns Future object for action control and return of action result
-
retrieveXPathQueryAggregateAsync
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 requestxpathQuery
- the aggregate xpath query (e.g. "COUNT(//System.User)")- Returns:
- the Future object
-
retrieveXPathQueryAsync
Future<List<IMendixObject>> retrieveXPathQueryAsync(IContext context, String xpathQuery, int amount, int offset, Map<String, String> sort, int depth) Retrieves object list based on the given XPath query (asynchronously).- Parameters:
context
- the contextxpathQuery
- the XPath query to executeamount
- maximum number of objects to retrieveoffset
- index of first object to retrievesort
- 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
-
retrieveXPathSchema
@Deprecated List<IMendixObject> retrieveXPathSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, boolean disableSecurity) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves objects based on the XPath query and given schema (synchronously).- Parameters:
context
- the contextxpathQuery
- the XPath query to executeretrievalSchema
- the schema to applyshouldRetrieveCount
- 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
-
retrieveXPathSchemaRaw
@Deprecated IDataTable retrieveXPathSchemaRaw(IContext context, String xpathQuery, boolean shouldRetrieveCount, IRetrievalSchema retrievalSchema) throws CoreException Deprecated.UsecreateXPathQuery(java.lang.String)
to execute XPath queriesRetrieves raw data (IDataTables) based on the XPath query and given schema (synchronously).- Parameters:
context
- the contextxpathQuery
- the XPath query to executeshouldRetrieveCount
- 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
-
rollback
Rollback changes of the object with the given id (synchronously). When the object's state is NORMAL: Removes the object from the state store, 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 contextobject
- the object to rollback- Returns:
- returns the Future object
- Throws:
CoreException
-
rollbackAsync
Deprecated.since 9.24. Userollback(IContext, IMendixObject)
instead.Rollback changes of the object with the given id (asynchronously). When the object's state is NORMAL: Removes the object from the state store, 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 contextobject
- the object to rollback- Returns:
- returns the Future object
-
schedule
Schedule a microflow action / java action / registered action on a certain date. The execution will be tracked using aSystem.ScheduledEventInformation
instance.- 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
Schedule an action on adelay
measured intimeUnit
from now. The execution will not be tracked using aSystem.ScheduledEventInformation
instance.- Type Parameters:
R
- result type of the action, which should match the return value of the action- Parameters:
action
- the action to executedelay
- the delay after which the action should be executedtimeUnit
- time unit in which the delay is specified- Returns:
- returns RunnableScheduleFuture object for keeping track of the result
-
scheduleAtFixedRate
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. The execution will not be tracked using aSystem.ScheduledEventInformation
instance.
No result will be returned.- Type Parameters:
R
- result type of the action, which should be Object- Parameters:
action
- the action to executefirstRun
- the Date/time on which the action will be executed the first timeperiod
- the period between each start of the execution of the actiontimeUnit
- the timeUnit in which the period is specified
-
scheduleAtFixedRate
<R> void scheduleAtFixedRate(ICoreAction<R> action, long initialDelay, long period, 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. The execution will not be tracked using aSystem.ScheduledEventInformation
instance.- Type Parameters:
R
- result type of the action, which should be Object- Parameters:
action
- the action to executeinitialDelay
- the delay after which the action will be executed the first timeperiod
- the period between each start of the execution of the actiontimeUnit
- the timeUnit in which the initialDelay and the period is specified
-
scheduleAtFixedRate
void scheduleAtFixedRate(String actionName, Date firstRun, long period, TimeUnit timeUnit, String name, 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. The execution will be tracked using aSystem.ScheduledEventInformation
instance.- 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 timeperiod
- the period between each start of the execution of the actiontimeUnit
- the timeUnit in which the initialDelay and the period is specifiedname
- the name of the scheduled eventdescription
- the description of the scheduled event
-
scheduleWithFixedDelay
<R> void scheduleWithFixedDelay(ICoreAction<R> action, long initialDelay, long delay, 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. The execution will not be tracked using aSystem.ScheduledEventInformation
instance.- Type Parameters:
R
- result type of the action, which should be Object- Parameters:
action
- the action to executeinitialDelay
- the delay after which the action will be executed the first timedelay
- 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
-
storeFileDocumentContent
void storeFileDocumentContent(IContext context, IMendixObject fileDocument, InputStream inputStream) Physically stores a file using the given input stream and commits the file document. The passed input stream will be closed automatically. No security checks will be performed.- Parameters:
context
- the contextfileDocument
- the file document to which the file to store is linked toinputStream
- the content of the file
-
storeFileDocumentContent
void storeFileDocumentContent(IContext context, IMendixObject fileDocument, String fileName, InputStream inputStream) Physically stores a file using the given input stream and commits the file document. The passed input stream will be closed automatically. User should have write access to "Name" attribute.- Parameters:
context
- the contextfileDocument
- the file document to which the file to store is linked tofileName
- the original name of the file (will be stored in the Name attribute)inputStream
- the content of the file
-
storeImageDocumentContent
void storeImageDocumentContent(IContext context, IMendixObject imageDocument, InputStream inputStream, int thumbnailWidth, int thumbnailHeight) Physically stores an image using the given input stream and commits the image document. The passed input stream will be closed automatically. User should have read access to "Name" attribute.- Parameters:
context
- the contextimageDocument
- the image document to which the image to store is linked toinputStream
- the content of the filethumbnailWidth
- the width of the thumbnail to create for this imagethumbnailHeight
- the width of the thumbnail to create for this image
-
unregisterProfiler
Deprecated.since 10.18. No replacement. This feature will be removed in the future.Unregisters the current profiler. If no profiler is registered, nothing happens. -
addRequestHandler
Add a custom request handler to the Mendix runtime 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 processedrequestHandler
- the custom request handler
-
addWebSocketEndpoint
void addWebSocketEndpoint(String path, javax.websocket.Endpoint endpoint) throws javax.websocket.DeploymentException Registers an instance ofEndpoint
to handle web socket requests on a path.- Parameters:
path
- the path for which web socket requests should be processed. Must start with '/'endpoint
- the endpoint to register- Throws:
javax.websocket.DeploymentException
-
addWebSocketEndpoint
void addWebSocketEndpoint(String path, javax.websocket.Endpoint endpoint, WebSocketEndpointConfiguration configuration) throws javax.websocket.DeploymentException Registers an instance ofEndpoint
to handle web socket requests on a path. An instance ofWebSocketEndpointConfiguration
can be passed to configure the web socket endpoint, for example the subprotocols or handshake.- Parameters:
path
- the path for which web socket requests should be processed. Must start with '/'endpoint
- the endpoint to registerconfiguration
- the WebSocketEndpointConfiguration that is used to configure the WebSocket endpoint- Throws:
javax.websocket.DeploymentException
- Since:
- 10.18.0
-
getProjectId
UUID getProjectId()Returns the project identifier of the project.- Returns:
- The project identifier of the project
-
getModelVersion
String getModelVersion()Returns the model version of the project.- Returns:
- The model version of the project
-
addSessionCookies
@Deprecated void addSessionCookies(IMxRuntimeResponse response, ISession session, String path, boolean useAuthToken) Deprecated.since 10.16. UseaddMendixCookies(IMxRuntimeRequest, IMxRuntimeResponse, ISession, boolean)
instead.Writes session-related cookies to the response.- Parameters:
response
- the response to which cookies will be addedsession
- the sessionpath
- path for the cookie to which the client should return the cookieuseAuthToken
- defines whether to generate an authentication token
-
addMendixCookies
void addMendixCookies(IMxRuntimeRequest request, IMxRuntimeResponse response, ISession session, boolean useAuthToken) Writes cookies used by the Mendix platform to the response.- Parameters:
request
- the current request, used to retrieve the current application pathresponse
- the response to which cookies will be addedsession
- the sessionuseAuthToken
- defines whether to generate an authentication token
-