diff --git a/DIST/XLSReport_mx7_5.1.mpk b/DIST/XLSReport_mx7_5.1.mpk new file mode 100644 index 0000000..90c1f57 Binary files /dev/null and b/DIST/XLSReport_mx7_5.1.mpk differ diff --git a/XLSReport.mpr b/XLSReport.mpr index a87459d..4cff102 100644 Binary files a/XLSReport.mpr and b/XLSReport.mpr differ diff --git a/javasource/com/mendix/core/Core.java b/javasource/com/mendix/core/Core.java deleted file mode 100644 index cd3a02a..0000000 --- a/javasource/com/mendix/core/Core.java +++ /dev/null @@ -1,1774 +0,0 @@ -package com.mendix.core; - -import java.io.InputStream; -import java.io.IOException; -import java.util.Collection; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Future; -import java.util.concurrent.RunnableScheduledFuture; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -import com.mendix.core.actionmanagement.ActionListener; -import com.mendix.core.actionmanagement.CoreAction; -import com.mendix.core.component.LocalComponent; -import com.mendix.core.component.InternalCore; -import com.mendix.core.conf.Configuration; -import com.mendix.externalinterface.connector.RequestHandler; -import com.mendix.integration.Integration; -import com.mendix.integration.WebserviceException; -import com.mendix.logging.ILogNode; -import com.mendix.logging.LogSubscriber; -import com.mendix.m2ee.api.IMxRuntimeRequest; -import com.mendix.systemwideinterfaces.MendixException; -import com.mendix.systemwideinterfaces.IWebserviceResponse; -import com.mendix.systemwideinterfaces.connectionbus.data.IDataTable; -import com.mendix.systemwideinterfaces.connectionbus.requests.IMetaAssociationSchema; -import com.mendix.systemwideinterfaces.connectionbus.requests.IRetrievalSchema; -import com.mendix.systemwideinterfaces.connectionbus.requests.types.IGetRequest; -import com.mendix.systemwideinterfaces.connectionbus.requests.types.IOQLTextGetRequest; -import com.mendix.systemwideinterfaces.connectionbus.requests.types.IXPathTextGetRequest; -import com.mendix.systemwideinterfaces.core.IContext; -import com.mendix.systemwideinterfaces.core.IDataType; -import com.mendix.systemwideinterfaces.core.ILanguage; -import com.mendix.systemwideinterfaces.core.IMendixIdentifier; -import com.mendix.systemwideinterfaces.core.IMendixObject; -import com.mendix.systemwideinterfaces.core.IProfiler; -import com.mendix.systemwideinterfaces.core.ISession; -import com.mendix.systemwideinterfaces.core.IUser; -import com.mendix.systemwideinterfaces.core.UserAction; -import com.mendix.systemwideinterfaces.core.meta.IMetaAssociation; -import com.mendix.systemwideinterfaces.core.meta.IMetaObject; -import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; - -public final class Core -{ - public Core() {} - - private static LocalComponent component; - private static Integration integration; - - public static void initialize(LocalComponent localComponent, Integration i) - { - component = localComponent; - integration = i; - } - - public static LocalComponent getComponent() - { - return component; - } - - public static boolean isInDevelopment() - { - return component.configuration().isInDevelopment(); - } - - /** - * Returns the id of this server instance. - * @return the server id in UUID format. - */ - public static String getXASId() - { - return component.core().getXASId(); - } - - /** - * Returns the names of all modeled microflows. - * @return all microflow names (format "ModuleName.MicroflowName"). - */ - public static Set getMicroflowNames() - { - return component.core().getMicroflowNames(); - } - - /** - * Returns all input parameter data types the specified action by name. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @return data types by input parameter name. - */ - public static Map getInputParameters(String actionName) - { - return component.core().getInputParameters(actionName); - } - - /** - * Returns the return type of the specified action. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @return the return data type of the specified action. - */ - public static IDataType getReturnType(String actionName) - { - return component.core().getReturnType(actionName); - } - - /** - * Evaluate the given (microflow)expression. - * @param context the context - * @param variables name of variables referenced in the expression (without '$') and their values. - * @param expression the expression - * @return the evaluated value of the expression. - */ - public static Object evaluateExpression(IContext context, Map variables, String expression) - { - return component.core().evaluateExpression(context, variables, expression); - } - - /** - * 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. - * @param action type, subclass of CoreAction. - * @param result type of the action, can be any object. - * @param action the action to execute. - * @return the Future object. - * - */ - public static ,R> Future execute(T action) - { - return component.core().execute(action); - } - - /** - * Execute an action synchronously. - * @param action type, subclass of CoreAction. - * @param result type of action, can be any object. - * @param action the action to execute. - * @return return value of the specified action. - */ - public static ,R> R executeSync(T action) throws CoreException - { - return component.core().executeSync(action); - } - - /** - * Execute the specified action (synchronously). - * @param context the context for this action. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @param params for microflows: add IMendixObject, IMendixIdentifier or primitive parameters. - * for Java actions: add any object parameters. - * @return return value of the specified action. - */ - public static R execute(IContext context, String actionName, Object ... params) throws CoreException - { - return (R)component.core().execute(context, actionName, params); - } - - /** - * Execute the specified action (asynchronously). Use only to call other Java actions (not microflows)! - * When calling microflows use {@link #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. - * @param context the context for this action. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @param params ordered params for the Java action. - * @return the Future object. - */ - public static Future executeAsync(IContext context, String actionName, Object ... params) throws CoreException - { - return component.core().executeAsync(context, actionName, params); - } - - /** - * Execute the specified microflow (asynchronously). - * - * @param context the context for this microflow. - * @param microflowName the name of the microflow (format "ModuleName.ActionName"). - * @param executeInTransaction defines whether the microflow should be executed in a transaction (enables rolling back changes when exceptions are raised). - * @param params microflow parameters by name. - * @return return value of the specified microflow. - */ - public static Future executeAsync( - IContext context, - String microflowName, - boolean executeInTransaction, - Map params) throws CoreException - { - return component.core().executeAsync(context, microflowName, -1, executeInTransaction, params); - } - - /** - * Execute the specified action (synchronously). - * @param context the context for this action. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @param params action parameters by name. - * @return return value of the specified action. - */ - public static R execute(IContext context, String actionName, Map params) throws CoreException - { - return (R)component.core().execute(context, actionName, params); - } - - /** - * Execute the specified action (synchronously). - * @param context the context for this action. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @param executeInTransaction defines whether the action should be execute in a transaction (enables rolling back changes when exceptions are raised). - * @param params action parameters by name. - * @return return value of the specified action. - */ - public static R execute(IContext context, String actionName, boolean executeInTransaction, Map params) throws CoreException - { - return (R)component.core().execute(context, actionName, executeInTransaction, params); - } - - /** - * Execute the specified action (asynchronously). - * @param result type of the action, can be any object. - * @param action type, subclass of CoreAction. - * @param action the action to execute. - */ - public static ,R> void executeVoid(T action) - { - component.core().executeVoid(action); - } - - /** - * Schedule an action on a certain date. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName") - * @param date the date and time on which the action should be executed - * @return the RunnableScheduledFuture object for keeping track of the result - */ - public static RunnableScheduledFuture schedule(String actionName, Date date) throws CoreException - { - return component.core().schedule(actionName, date); - } - - /** - * Schedule an action on a certain delay from now. - * @param action the action to execute. - * @param delay the delay after which the action should be executed. - * @param timeUnit time unit in which the delay is specified. - * @return returns RunnableScheduleFuture object for keeping track of the result. - */ - public static RunnableScheduledFuture schedule(CoreAction action, long delay, TimeUnit timeUnit) - { - return component.core().schedule(action, delay, timeUnit); - } - - /** - * 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. - * @param actionName the name of a microflow or java action (format "ModuleName.ActionName"). - * @param firstRun the date on which the action will be executed the first time. - * @param period the period between each start of the execution of the action. - * @param timeUnit the timeUnit in which the initialDelay and the period is specified. - * @param name the name of the scheduled event. - * @param description the description of the scheduled event. - */ - public static void scheduleAtFixedRate(String actionName, Date firstRun, long period, TimeUnit timeUnit, String name, String description) - { - component.core().scheduleAtFixedRate(actionName, firstRun, period, timeUnit, name, description); - } - - /** - * 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. - * @param action the action to execute. - * @param initialDelay the delay after which the action will be executed the first time. - * @param period the period between each start of the execution of the action. - * @param timeUnit the timeUnit in which the initialDelay and the period is specified. - */ - public static void scheduleAtFixedRate(CoreAction action, long initialDelay, long period, TimeUnit timeUnit) - { - component.core().scheduleAtFixedRate(action, initialDelay, period, 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. - * @param action the action to execute - * @param firstRun the Date/time on which the action will be executed the first time - * @param period the period between each start of the execution of the action - * @param timeUnit the timeUnit in which the period is specified - */ - public static void scheduleAtFixedRate(CoreAction action, Date firstRun, long period, TimeUnit timeUnit) - { - component.core().scheduleAtFixedRate(action, firstRun, period, 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. - * @param action the action to execute. - * @param initialDelay the delay after which the action will be executed the first time. - * @param delay the delay between the end of the execution of the action and the start of the next time the action will be executed. - * @param timeUnit the timeUnit in which the initialDelay and the delay is specified. - */ - public static void scheduleWithFixedDelay(CoreAction action, long initialDelay, long delay, TimeUnit timeUnit) - { - component.core().scheduleWithFixedDelay(action, initialDelay, delay, timeUnit); - } - - /** - * Remove scheduled future. - * @param scheduledFuture the RunnableScheduledFuture to remove. - * @return whether removing the RunnableScheduledFuture was successful. - */ - public static boolean removeScheduledFuture(RunnableScheduledFuture scheduledFuture) - { - return component.core().removeScheduledFuture(scheduledFuture); - } - - /** - * Reschedule an action with a new delay. - * @param scheduledFuture the scheduledFuture (old action) to remove from the queue. - * @param action the action to reschedule. - * @param newDelay the new delay. - * @param timeUnit time unit of the delay. - * @return scheduled future object. - */ - public static ScheduledFuture reschedule(RunnableScheduledFuture scheduledFuture, CoreAction action, long newDelay, TimeUnit timeUnit) - { - return component.core().reschedule(scheduledFuture, action, newDelay, timeUnit); - } - - /** - * Registers the given ActionListener to the ActionManager. - * @param al the ActionListener to add. - */ - public static > void addListener(ActionListener al) - { - component.core().addListener(al); - } - - /** - * 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. - * @param context the context. - * @param object the IMendixObject to commit. - * @return returns a list of future objects with committed object lists, one for each entity type. - */ - public static List>> commitAsync(IContext context, List objects) - { - return component.core().commitAsync(context, objects); - } - - /** - * 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. - * @param context the context. - * @param object the IMendixObject to commit. - * @return returns committed object if commit was successful, otherwise null. - */ - public static IMendixObject commit(IContext context, IMendixObject object) throws CoreException - { - return component.core().commit(context, object); - } - - /** - * 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. - * @param context the context. - * @param objectsToCommit the objects to commit. - * @return returns committed objects if commits was successful, otherwise an empty list. - */ - public static List commit(IContext context, List objects) - { - return component.core().commit(context, objects); - } - - /** - * 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. - * @param context the context. - * @param object the IMendixObject to commit. - * @return returns committed object if commit was successful, otherwise null. - */ - public static IMendixObject commitWithoutEvents(IContext context, IMendixObject object) - { - return component.core().commitWithoutEvents(context, object); - } - - /** - * Commit 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. - * @param context the context. - * @param objects the objects to commit. - * @return returns true if commit was successful, otherwise false. - */ - public static List commitWithoutEvents(IContext context, List objects) - { - return component.core().commitWithoutEvents(context, objects); - } - - /** - * 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. - * @param context the context. - * @param objectType type of object to create (e.g. "System.User"). - * @return returns the Future object. - */ - public static Future instantiateAsync(IContext context, String objectType) - { - return component.core().instantiateAsync(context, 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. - * @param context the context. - * @param objectType type of object to create (e.g. "System.User"). - * @return returns the newly created object. - */ - public static IMendixObject instantiate(IContext context, String objectType) - { - return component.core().instantiate(context, objectType); - } - - /** - * 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. - * @param context the context. - * @param object the object to change. - * @param changes contains changes by member name (e.g. <"Name", "User1">). - * @return returns whether the change succeeded or not. - */ - public static boolean change(IContext context, IMendixObject object, Map changes) throws CoreException - { - return component.core().change(context, object, changes); - } - - /** - * Changes the object (asynchronously). Object will be stored in cache. - * This action is not executed in a transaction. - * @param context the context. - * @param obj the MendixObject to change - * @param changes contains changes by member name (e.g. <"Name", "User1">). - * @return returns the Future object. - */ - public static Future changeAsync(IContext context, IMendixObject obj, Map changes) - { - return component.core().changeAsync(context, obj, changes); - } - - /** - * 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. - * @param context the context. - * @param id the identifier of the object to rollback. - * @return returns the Future object. - */ - public static Future rollbackAsync(IContext context, IMendixObject object) - { - return component.core().rollbackAsync(context, object); - } - - /** - * 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. - * @param context the context. - * @param id the identifier of the object to rollback. - * @return returns the Future object. - */ - public static IMendixObject rollback(IContext context, IMendixObject object) throws CoreException - { - return component.core().rollback(context, object); - } - - /** - * Deletes the given objects from the database and server cache (synchronously). - * This action is executed in a transaction. - * @param context the context. - * @param objects the objects to delete. - * @return returns whether the delete succeeded. - */ - public static boolean delete(IContext context, IMendixObject... objects) - { - return component.core().delete(context, objects); - } - - /** - * Deletes the given objects from the database and server cache (synchronously). - * This action is executed in a transaction. - * @param context the context. - * @param objectList the objects to delete. - * @return returns whether the delete succeeded. - */ - public static boolean delete(IContext context, List objectList) - { - return component.core().delete(context, objectList); - } - - /** - * Deletes the given objects from the database and server cache (synchronously) without events - * This action is executed in a transaction. - * @param context the context. - * @param objects the objects to delete. - * @return returns whether the delete succeeded. - */ - public static boolean deleteWithoutEvents(IContext context, List objects, boolean useDeleteBehavior) - { - return component.core().deleteWithoutEvents(context, objects, useDeleteBehavior); - } - - /** - * Deletes the given object from the database and server cache (asynchronously). - * This action is not executed in a transaction. - * @param context the context. - * @param object the object to delete. - * @param useDeleteBehavior whether to use delete behavior. - * @return returns a list of future booleans, one for each entity type. - */ - public static List> deleteAsync(IContext context, IMendixObject object, boolean useDeleteBehavior) - { - return component.core().deleteAsync(context, object, useDeleteBehavior); - } - - /** - * Deletes the given object from the database and server cache (asynchronously). - * This action is not executed in a transaction. - * @param context the context. - * @param object the object to delete. - * @param useDeleteBehavior whether to use delete behavior. - * @return returns a list of future booleans, one for each entity type. - */ - public static List> deleteAsync(IContext context, List objects, boolean useDeleteBehavior) - { - return component.core().deleteAsync(context, objects, useDeleteBehavior); - } - - /** - * 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. - * @param context the context. - * @param ids ids of the objects to retrieve. - * @return returns the Future object. - */ - public static Future> retrieveIdListAsync(IContext context, List ids) - { - return component.core().retrieveIdListAsync(context, ids); - } - - /** - * 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. - * @param context the context. - * @param ids ids of the objects to retrieve. - * @param amount the maximum number of objects to retrieve from the database. - * @param offset offset of returned objects when retrieved from the database. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @return returns the Future object. - */ - public static List retrieveIdList(IContext context, List ids, int amount, int offset, Map sort) throws CoreException - { - return component.core().retrieveIdList(context, ids, amount, offset, sort); - } - - /** - * 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. - * @param context the context. - * @param ids ids of the objects to retrieve. - * @return returns the objects of the given ids. - */ - public static List retrieveIdList(IContext context, List ids) throws CoreException - { - return component.core().retrieveIdList(context, ids); - } - - /** - * 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. - * @param context the context. - * @param id id of the object to retrieve. - * @return returns the Future object. - */ - public static Future retrieveIdAsync(IContext context, IMendixIdentifier id) - { - return component.core().retrieveIdAsync(context, id); - } - - /** - * 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. - * @param context the context. - * @param id id of the object to retrieve. - * @return returns the Future object. - */ - public static IMendixObject retrieveId(IContext context, IMendixIdentifier id) throws CoreException - { - return component.core().retrieveId(context, id); - } - - /** - * Retrieves objects using the given object and path. - * - * @param context the context. - * @param mxObject the start point of the path. - * @param path the path (association) to the objects to retrieve. - * @return the list of retrieved objects. - */ - public static List retrieveByPath(IContext context, IMendixObject mxObject, String path) - { - return component.core().retrieveByPath(context, mxObject, path); - } - - /** - * Retrieves objects using the given object and path. - * - * @param context the context. - * @param mxObject the start point of the path. - * @param path the path (association) to the objects to retrieve. - * @param isSelfAssociationChild defines whether the mxObject instance is the child of the path of a self association. - * @return the list of retrieved objects. - */ - public static List retrieveByPath(IContext context, IMendixObject mxObject, String path, boolean isSelfAssociationChild) - { - return component.core().retrieveByPath(context, mxObject, path, isSelfAssociationChild); - } - - /** - * Retrieves object list based on the given XPath query (asynchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @param depth indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject. - * @return the Future object. - */ - public static Future> retrieveXPathQueryAsync(IContext context, String xpathQuery, int amount, int offset, Map sort, int depth) - { - return component.core().retrieveXPathQueryAsync(context, xpathQuery, amount, offset, sort, depth); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @param depth indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject. - * @return the list of retrieved objects. - */ - public static List retrieveXPathQuery(IContext context, String xpathQuery, int amount, int offset, Map sort, int depth) throws CoreException - { - return component.core().retrieveXPathQuery(context, xpathQuery, amount, offset, sort, depth); - } - - /** - * Retrieves raw data (IDataTables) based on the given XPath query (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @param depth indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject. - * @return the data table containing the raw data. - */ - public static IDataTable retrieveXPathQueryRaw(IContext context, String xpathQuery, int amount, int offset, Map sort, int depth) throws CoreException - { - return component.core().retrieveXPathQueryRaw(context, xpathQuery, amount, offset, sort, depth); - } - - /** - * Retrieves raw data (IDataTables) based on the XPath query and given schema (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param shouldRetrieveCount indicates whether the total number object corresponding to the given schema should be included in the result. - * @param retrievalSchema the schema to apply. - * @return the data table containing the raw data. - */ - public static IDataTable retrieveXPathSchemaRaw(IContext context, String xpathQuery, boolean shouldRetrieveCount, IRetrievalSchema retrievalSchema) throws CoreException - { - return component.core().retrieveXPathSchemaRaw(context, xpathQuery, shouldRetrieveCount, retrievalSchema); - } - - /** - * Retrieves objects based on the XPath query and given schema (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param retrievalSchema the schema to apply. - * @param shouldRetrieveCount indicates whether the total number object corresponding to the given schema should be included in the result. - * @return the list of retrieved objects. - */ - public static List retrieveXPathSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount) throws CoreException - { - return component.core().retrieveXPathSchema(context, xpathQuery, retrievalSchema, shouldRetrieveCount, false); - } - - /** - * Retrieves objects based on the XPath query and given schema (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param retrievalSchema the schema to apply. - * @param shouldRetrieveCount indicates whether the total number object corresponding to the given schema should be included in the result. - * @param disableSecurity indicates whether security should be applied when this query is being executed. - * @return the list of retrieved objects. - */ - public static List retrieveXPathSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, boolean disableSecurity) throws CoreException - { - return component.core().retrieveXPathSchema(context, xpathQuery, retrievalSchema, shouldRetrieveCount, disableSecurity); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @return the list of retrieved objects. - */ - public static List retrieveXPathQuery(IContext context, String xpathQuery, int amount, int offset, Map sort) throws CoreException - { - return Core.retrieveXPathQuery(context, xpathQuery, amount, offset, sort, 0); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @param depth indicates the level until which each reference (IMendixIdentifier) is also retrieved as an IMendixObject. - * @return the list of retrieved objects. - */ - public static List retrieveXPathQuery(IContext context, String xpathQuery, int depth) throws CoreException - { - return Core.retrieveXPathQuery(context, xpathQuery, -1, -1, new LinkedHashMap(), depth); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathQuery the XPath query to execute. - * @return the list of retrieved objects. - */ - public static List retrieveXPathQuery(IContext context, String xpathQuery) throws CoreException - { - return Core.retrieveXPathQuery(context, xpathQuery, -1, -1, new LinkedHashMap(), 0); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathFormat the XPath query to execute with %s for each param to escape. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @param sort sorting of returned objects when retrieved from the database (e.g. <"Name", "ASC">, <"Age", "DESC">). - * @param depth depth of the retrieval (0 is all attributes and association guids, 1 is also all attributes of 1-deep associations and 2-deep associaton guids etc.). - * @param params xpath arguments. - * @return the list of retrieved objects. - */ - public static List retrieveXPathQueryEscaped(IContext context, String xpathFormat, int amount, int offset, Map sort, int depth, String... params) throws CoreException - { - return component.core().retrieveXPathQueryEscaped(context, xpathFormat, amount, offset, sort, depth, params); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathFormat the XPath query to execute with %s for each param to escape. - * @param retrievalSchema the schema to apply. - * @param shouldRetrieveCount indicates whether the total number object corresponding to the given schema should be included in the result. - * @param params a collection of parameters for each %s in xpathFormat. - * @return the list of retrieved objects. - */ - public static List retrieveXPathSchemaEscaped(IContext context, String xpathFormat, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, String... params) throws CoreException - { - return Core.retrieveXPathSchemaEscaped(context, xpathFormat, retrievalSchema, shouldRetrieveCount, false, params); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathFormat the XPath query to execute with %s for each param to escape. - * @param retrievalSchema the schema to apply. - * @param shouldRetrieveCount indicates whether the total number object corresponding to the given schema should be included in the result. - * @param disableSecurity indicates whether security should be disabled when executing this query. - * @param params a collection of parameters for each %s in xpathFormat. - * @return the list of retrieved objects. - */ - public static List retrieveXPathSchemaEscaped(IContext context, String xpathFormat, IRetrievalSchema retrievalSchema, boolean shouldRetrieveCount, boolean disableSecurity, String... params) throws CoreException - { - return component.core().retrieveXPathSchemaEscaped(context, xpathFormat, retrievalSchema, shouldRetrieveCount, disableSecurity, params); - } - - /** - * Retrieves object list based on the given XPath query (synchronously). - * @param context the context. - * @param xpathFormat the XPath query to execute with %s for each param to escape. - * @param params a collection of parameters for each %s in xpathFormat. - * @return the list of retrieved objects. - */ - public static List retrieveXPathQueryEscaped(IContext context, String xpathFormat, String... params) throws CoreException - { - return Core.retrieveXPathQueryEscaped(context, xpathFormat, -1, -1, new LinkedHashMap(), 0, params); - } - - /** - * Create a new IRetrievalSchema. - * @return an IRetrievalSchema. - */ - public static IRetrievalSchema createRetrievalSchema() - { - return component.core().createRetrievalSchema(); - } - - /** - * Create a new IMetaAssociationSchema to specify which associations must be retrieved. - * An IMetaAssociationSchema can be added to a request by the method IRetrievalSchema.addMetaAssociationSchema(..). - * - * @param metaAssociationName the name of the meta association of this schema - * @param retrievalSchema the retrieval schema of the associated meta object - * @return an IMetaAssociationSchema - */ - public static IMetaAssociationSchema createMetaAssociationSchema(String metaAssociationName, IRetrievalSchema retrievalSchema) { - return component.core().createMetaAssociationSchema(metaAssociationName, retrievalSchema); - } - - /** - * Create a new IXPathTextGetRequest. This class can be used to define an XPath retrieval query. The query must be set in textual form. - * @return an IXPathTextGetRequest. - */ - public static IXPathTextGetRequest createXPathTextGetRequest() - { - return component.core().createXPathTextGetRequest(); - } - - /** - * Create a new IOQLTextGetRequest. This class can be used to define a textual OQL retrieval query. - * @return an IOQLTextGetRequest. - */ - public static IOQLTextGetRequest createOQLTextGetRequest() - { - return component.core().createOQLTextGetRequest(); - } - - /** - * Retrieve raw data (IDataTable) using an OQL query (asynchronously). - * @param context the context. - * @param oqlQuery the OQL query to execute. - * @return the Future object. - */ - public static Future retrieveOQLDataTableAsync(IContext context, String oqlQuery) - { - return retrieveOQLDataTableAsync(context, oqlQuery, -1, -1); - } - - /** - * Retrieve raw data (IDataTable) using an IGetRequest object (asynchronously). - * @param context the context. - * @param request the request object. - * @return the Future object. - */ - public static Future retrieveOQLDataTableAsync(IContext context, IGetRequest request) - { - return component.core().retrieveOQLDataTableAsync(context, request); - } - - /** - * Retrieve raw data (IDataTable) using an OQL query (asynchronously). - * @param context the context. - * @param oqlQuery the OQL query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @return the Future object. - */ - public static Future retrieveOQLDataTableAsync(IContext context, String oqlQuery, int amount, int offset) - { - return component.core().retrieveOQLDataTableAsync(context, oqlQuery, amount, offset); - } - - /** - * Retrieve raw data (IDataTable) using an IGetRequest object (synchronously). - * @param context the context. - * @param request the request object. - * @return the data table containing the raw data. - */ - public static IDataTable retrieveOQLDataTable(IContext context, IGetRequest request) throws CoreException - { - return component.core().retrieveOQLDataTable(context, request); - } - - /** - * Retrieve raw data (IDataTable) using an IGetRequest object (synchronously). - * @param context the context. - * @param oqlQuery the OQL query to execute. - * @return the data table containing the raw data. - */ - public static IDataTable retrieveOQLDataTable(IContext context, String oqlQuery) throws CoreException - { - return retrieveOQLDataTable(context, oqlQuery, -1, -1); - } - - /** - * Retrieve raw data (IDataTable) using an OQL query (asynchronously). - * @param context the context. - * @param oqlQuery the OQL query to execute. - * @param amount maximum number of objects to retrieve. - * @param offset index of first object to retrieve. - * @return the data table containing the raw data. - */ - public static IDataTable retrieveOQLDataTable(IContext context, String oqlQuery, int amount, int offset) throws CoreException - { - return component.core().retrieveOQLDataTable(context, oqlQuery, amount, offset); - } - - /** - * Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (asynchronously). - * @param context the context. - * @param xpathQuery the aggregate xpath query (e.g. "COUNT(//System.User)"). - * @return the Future object. - */ - public static Future retrieveXPathQueryAggregateAsync(IContext context, String xpathQuery) - { - return component.core().retrieveXPathQueryAggregateAsync(context, xpathQuery); - } - - /** - * Retrieves long aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously). - * @param context the context. - * @param xpathQuery the aggregate xpath query (e.g. "COUNT(//System.User)"). - * @return the Future object. - */ - public static Long retrieveXPathQueryAggregate(IContext context, String xpathQuery) throws CoreException - { - return component.core().retrieveXPathQueryAggregate(context, xpathQuery); - } - - /** - * Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function) (asynchronously). - * @param context the context. - * @param xpathQuery the aggregate xpath query (e.g. "COUNT(//System.User)"). - * @param retrievalSchema the schema. - * @return the aggregate value. - */ - public static Long retrieveXPathQueryAggregateSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema) throws CoreException - { - return component.core().retrieveXPathQueryAggregateSchema(context, xpathQuery, retrievalSchema); - } - - /** - * Retrieves long aggregate value based on the given query and schema (root element of the query should be an aggregate function) (asynchronously). - * @param context the context. - * @param xpathQuery the aggregate xpath query (e.g. "COUNT(//System.User)"). - * @param retrievalSchema the schema. - * @param disableSecurity whether security should be applied for this retrieval. - * @return the aggregate value. - */ - public static Long retrieveXPathQueryAggregateSchema(IContext context, String xpathQuery, IRetrievalSchema retrievalSchema, boolean disableSecurity) throws CoreException - { - return component.core().retrieveXPathQueryAggregateSchema(context, xpathQuery, retrievalSchema, disableSecurity); - } - - /** - * Retrieves long value based on the given query (query should have an aggregate function as root element) - * @param context - * @param xpathQuery - * @return returns Future object for action control and return of action result - */ - public static Future retrieveXPathQueryAggregateAsyncDouble(IContext context, String xpathQuery) - { - return component.core().retrieveXPathQueryAggregateAsyncDouble(context, xpathQuery); - } - - /** - * Retrieves double aggregate value based on the given query (root element of the query should be an aggregate function) (synchronously). - * @param context the context. - * @param xpathQuery the aggregate xpath query (e.g. "COUNT(//System.User)"). - * @return the Future object. - */ - public static Double retrieveXPathQueryAggregateDouble(IContext context, String xpathQuery) throws CoreException - { - return component.core().retrieveXPathQueryAggregateDouble(context, xpathQuery); - } - - /** - * Returns contents of a file document as an input stream. - * @param context the context. - * @param fileDocument the file document from which the contents will be returned. - * @return the input stream of the file content of the given file document. - */ - public static InputStream getFileDocumentContent(IContext context, IMendixObject fileDocument) - { - return component.core().getFileDocumentContent(context, fileDocument); - } - - /** - * Physically stores a file using the given input stream and commits the file document. - * @param context the context. - * @param fileDocument the file document to which the file to store is linked to. - * @param fileName the original name of the file (will be stored in the Name attribute) - * @param inputStream the content of the file - */ - public static void storeFileDocumentContent(IContext context, IMendixObject fileDocument, String fileName, InputStream inputStream) - { - component.core().storeFileDocumentContent(context, fileDocument, fileName, inputStream); - } - - /** - * Physically stores a file using the given input stream and commits the file document. - * @param context the context. - * @param fileDocument the file document to which the file to store is linked to. - * @param inputStream the content of the file - */ - public static void storeFileDocumentContent(IContext context, IMendixObject fileDocument, InputStream inputStream) - { - component.core().storeFileDocumentContent(context, fileDocument, inputStream); - } - - /** - * Physically stores an image using the given input stream and commits the image document. - * @param context the context. - * @param imageDocument the image document to which the image to store is linked to. - * @param inputStream the content of the file - * @param thumbnailWidth the width of the thumbnail to create for this image. - * @param thumbnailHeight the width of the thumbnail to create for this image. - */ - public static void storeImageDocumentContent(IContext context, IMendixObject imageDocument, InputStream inputStream, int thumbnailWidth, int thumbnailHeight) - { - component.core().storeImageDocumentContent(context, imageDocument, inputStream, thumbnailWidth, thumbnailHeight); - } - - /** - * Retrieve contents of the given image document. - * @param context the context. - * @param imageDocument the image document for which its contents are retrieved. - * @param retrieveThumbnail indicates whether a thumbnail or the full image is retrieved. - * @return the image as an input stream. - */ - public static InputStream getImage(IContext context, IMendixObject imageDocument, boolean retrieveThumbnail) - { - return component.core().getImage(context, imageDocument, retrieveThumbnail); - } - - /** - * Checks whether a type is a subclass of or equal to a potential super class. - * @param superClass the name of the super class - * @param type the name of the type to check - * @return returns true if type is a subclass of superClass or if type equals superClass - */ - public static boolean isSubClassOf(String superClass, String type) - { - return component.core().isSubClassOf(superClass, type); - } - - /** - * Checks whether a type is a subclass of or equal to a potential super class. - * @param superObject the super object. - * @param type the name of the type to check. - * @return returns true if type is a subclass of superClass or if type equals superClass. - */ - public static boolean isSubClassOf(IMetaObject superObject, IMetaObject type) - { - return component.core().isSubClassOf(superObject, type); - } - - /** - * Checks whether a type is a subclass of or equal to a potential super class. - * @param superClass the name of the super class - * @param typeHash the hash of the name of the type to check - * @return returns true if type is a subclass of superClass or if type equals superClass - * @throws CoreException - */ - public static boolean isSubClassOf(String superClass, short typeHash) - { - return component.core().isSubClassOf(superClass, typeHash); - } - - /** - * Get all IMendixObject types. - * @return returns a list with all IMendixObjects (one object for each existing type) - */ - public static Iterable getAllMendixObjects() - { - return component.core().getAllMendixObjects(); - } - - /** - * Get all subtypes for an object type (including subtypes of subtypes, etc.). - * @param objectType the object type. - * @return list of subtypes, in no particular order. - */ - public static List getSubtypesOf(String objectType) - { - return component.core().getSubtypesOf(objectType); - } - - /** - * Get the IMetaObject corresponding to the given meta object name. - * @param metaObjectName the meta object name. - * @return returns the IMetaObject for the given metaObjectName - */ - public static IMetaObject getMetaObject(String metaObjectName) - { - return component.core().getMetaObject(metaObjectName); - } - - /** - * Get the IMetaPrimtive based on a qualified attribute name (e.g. "System.User.Name"). - * @param qualifiedAttributeName the qualified attribute name. - * @return the IMetaPrimtive. - */ - public static IMetaPrimitive getMetaPrimitive(String qualifiedAttributeName) - { - return component.core().getMetaPrimitive(qualifiedAttributeName); - } - - /** - * Get all IMetaObjects. - * @return returns all IMetaObjects. - */ - public static Iterable getMetaObjects() - { - return component.core().getMetaObjects(); - } - - /** - * Get all IMetaAssociations. - * @return returns all IMetaAssociations. - */ - public static Iterable getMetaAssociations() - { - return component.core().getMetaAssociations(); - } - - /** - * Get the IMetaAssociation corresponding to the given association name. - * @param association the association name (e.g. "System.UserRoles"). - * @return returns the IMetaAssociation for the given association name. - */ - public static IMetaAssociation getMetaAssociation(String association) - { - return component.core().getMetaAssociation(association); - } - - /** - * @param iMetaObject the meta object to get the database table name for - * @return the name of the database table - */ - public static String getDatabaseTableName(IMetaObject iMetaObject) { - return component.core().getDatabaseTableName(iMetaObject); - } - - /** - * @param iMetaAssociation the meta association to get the database table name for - * @return the name of the database table - */ - public static String getDatabaseTableName(IMetaAssociation iMetaAssociation) { - return component.core().getDatabaseTableName(iMetaAssociation); - } - - /** - * @param iMetaPrimitive the meta primitive to get the database column name for - * @return the name of the database column - */ - public static String getDatabaseColumnName(IMetaPrimitive iMetaPrimitive) { - return component.core().getDatabaseColumnName(iMetaPrimitive); - } - - /** - * @param iMetaAssociation the meta association to get the database child column name for - * @return the name of the database child column name - */ - public static String getDatabaseChildColumnName(IMetaAssociation iMetaAssociation) { - return component.core().getDatabaseChildColumnName(iMetaAssociation); - } - - /** - * @param iMetaAssociation the meta association to get the database parent column name for - * @return the name of the database parent column name - */ - public static String getDatabaseParentColumnName(IMetaAssociation iMetaAssociation) { - return component.core().getDatabaseParentColumnName(iMetaAssociation); - } - - /** - * Returns the context of the system session (this is always a sudo context). - * The system session has no associated user or user roles. - * @return returns the system session context. - */ - public static IContext createSystemContext() - { - return component.core().createSystemContext(); - } - - /** - * Creates a IMendixIdentifier for the given guid. - * @param guid the guid. - * @return returns the created MendixIdentifier. - */ - public static IMendixIdentifier createMendixIdentifier(String guid) - { - return component.core().createMendixIdentifier(guid); - } - - /** - * Creates a new IMendixIdentifier for the given guid. - * @param guid the guid. - * @return returns the created MendixIdentifier. - */ - public static IMendixIdentifier createMendixIdentifier(long guid) - { - return component.core().createMendixIdentifier(guid); - } - - /** - * Authenticate the given user with the given password. - * @param context - * @param user the user. - * @param password the password. - * @return returns true if authentication was successful. - */ - public static boolean authenticate(IContext context, IUser user, String password) throws CoreException - { - return component.core().authenticate(context, user, password); - } - - /** - * Generic login method (can be used in modules in combination with LoginAction replacement). - * @param params the params. - * @return the created session if login was successful. - */ - public static ISession login(Map params) throws CoreException - { - return component.core().login(params); - } - - /** - * Login user with the given user name and password. - * @param userName the user name. - * @param password the password. - * @return the created session if login is successful. - */ - public static ISession login(String userName, String password) throws CoreException - { - return component.core().login(userName, password); - } - - /** - * Login user with the given parameters. - * @param userName the user name. - * @param password the password. - * @param currentSessionId current session UUID. - * @return the created session if login is successful. - */ - public static ISession login(String userName, String password, String currentSessionId) throws CoreException - { - return component.core().login(userName, password, currentSessionId); - } - - public static ISession login(String userName, String password, IMxRuntimeRequest request) throws CoreException - { - return component.core().login(userName, password, request); - } - - /** - * 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. - * @param session the session to logout. - */ - public static void logout(ISession session) - { - component.core().logout(session); - } - - /** - * Returns a user using the given user name. - * @param context the context. - * @param userName the user name to retrieve a user for. - * @return the retrieved user. - */ - public static IUser getUser(IContext context, String userName) throws CoreException - { - return component.core().getUser(context, userName); - } - - /** - * Initialize a new session for the given user. - * @param user the user for which the session should be initialized. - * @param currentSessionId id of the current session, will be used to transfer data when current session is associated with a guest user. - * @return the created session. - */ - public static ISession initializeSession(IUser user, String currentSessionId) throws CoreException - { - return component.core().initializeSession(user, currentSessionId); - } - - /** - * Initialize a new session for a guest user - * @return the created session - * @throws CoreException - */ - public static ISession initializeGuestSession() throws CoreException - { - return component.core().initializeGuestSession(); - } - - /** - * Import an xml stream, map this stream to domain objects and store those object in the Mendix database. - * @param context the context. - * @param xmlStream the xml stream to map and store. - * @param importMappingName name of the mapping from xml to domain objects (as defined in the Mendix Modeler, e.g. "Orders.MyMapping"). - * @param mappingParameter parameter object used during the mapping (optional) - * @param shouldValidate whether the xml should be validated. - */ - public static void importXmlStream(IContext context, InputStream xmlStream, String importMappingName, IMendixObject mappingParameter, boolean shouldValidate) - { - integration.importXmlStream(context, xmlStream, importMappingName, mappingParameter, shouldValidate); - } - - /** - * Import an xml stream, map this stream to domain objects and store those object in the Mendix database. - * @param context the context. - * @param xmlStream the xml stream to map and store. - * @param importMappingName name of the mapping from xml to domain objects (as defined in the Mendix Modeler, e.g. "Orders.MyMapping"). - * @param mappingParameter parameter object used during the mapping (optional) - * @param storeResultInVariable whether to store the result of the xml mapping in variable which will be returned by this method. - * @param hasListReturnValue indicates whether the return value of the xml mapping is of type List. - * @param shouldValidate whether the xml should be validated. - */ - public static Object importXmlStream(IContext context, InputStream xmlStream, String importMappingName, IMendixObject mappingParameter, - boolean storeResultInVariable, boolean hasListReturnValue, boolean shouldValidate) - { - return integration.importXmlStream(context, xmlStream, importMappingName, mappingParameter, storeResultInVariable, -1, hasListReturnValue, shouldValidate); - } - - /** - * Call a webservice - * Post method headers: - * - Content-Type: text/xml - * - Host: location host (e.g. www.w3schools.com) - * - SoapAction: soapAction (e.g. http://tempuri.com/FahrenheitToCelsius) - * @param location the webservice location url - * @param soapAction the webservice soap action - * @param soapRequestMessage - *
-	 * {@code
-	 * 
-	 *	
-	 *		
-	 *			
-	 *				 username 
-	 *				 password 
-	 *			
-	 *		
-     *		
-     *   		
-     *       		5
-     *       		5.0
-     *   		
-     *		
-	 * 
-	 * }
-	 * 
- * @return a soap envelope response stream, e.g.: - *
-	 * {@code
-	 * 
-	 * 
-  	 * 		
-     * 			
-     * 				string
-     * 			
-     * 		
-	 *	
-	 *}
-	 *
- * @throws WebserviceException - * @throws IOException - * @deprecated Don't use this, it will be removed in the future. If you want to build your own custom web - * service calls, you can fully implement this yourself. - */ - @Deprecated - public static IWebserviceResponse callWebservice(String location, String soapAction, String soapRequestMessage) - { - return integration.callWebservice(location, soapAction, soapRequestMessage); - } - - /** - * Call a webservice - * Post method headers: - * - Content-Type: text/xml - * - Host: location host (e.g. www.w3schools.com) - * - SoapAction: soapAction (e.g. http://tempuri.com/FahrenheitToCelsius) - * @param location the webservice location url - * @param soapAction the webservice soap action - * @param soapRequestMessage - *
-	 * {@code 
-	 * 
-	 *	
-	 *		
-	 *			
-	 *				 username 
-	 *				 password 
-	 *			
-	 *		
-     *		
-     *   		
-     *       		5
-     *       		5.0
-     *   		
-     *		
-	 * 
-	 * }
-	 * 
- * @return a soap envelope response stream, e.g.: - *
-	 * {@code
-	 * 
-	 * 
-  	 * 		
-     * 			
-     * 				string
-     * 			
-     * 		
-	 *	
-	 *}
-	 *
- * @throws WebserviceException - * @throws IOException - * @deprecated Don't use this, it will be removed in the future. If you want to build your own custom web - * service calls, you can fully implement this yourself. - */ - @Deprecated - public static IWebserviceResponse callWebservice(String location, String soapAction, InputStream soapRequestMessage) - { - return integration.callWebservice(location, soapAction, soapRequestMessage); - } - - /** - * 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. - * @param path the path for which request should be processed. - * @param requestHandler the custom request handler. - */ - public static void addRequestHandler(String path, RequestHandler requestHandler) - { - component.runtime().getConnector().addRequestHandler(path, requestHandler); - } - - public static ILogNode getLogger(String name) - { - return component.core().getLogger(name); - } - - /** - * Returns the current configuration. - * @return the configuration. - */ - public static Configuration getConfiguration() - { - return component.core().getConfiguration(); - } - - /** - * 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%]) - * @param text the text to resolve. - * @param context the context. - * @return the resolved object. - */ - public static Object resolveTokens(IContext context, String text) - { - return component.core().resolveTokens(context, text); - } - - /////////////// ActionManager statistics ////////////////////////////// - - /** - * Returns the current number of active actions. This number represents only the actions - * which were started asynchronously. - * @return number of current active actions. - */ - public static int getActiveActionCount() - { - return component.core().getActiveActionCount(); - } - - /** - * Returns the number of completed actions since server startup. This number represents - * only the actions which were started asynchronously. - * @return number of completed actions - */ - public static long getCompletedActionCount() - { - return component.core().getCompletedActionCount(); - } - - /** - * Returns the current action pool queue size. - * @return returns current queue size of action thread pool. - */ - public static int getActionQueueSize() - { - return component.core().getActionQueueSize(); - } - - /** - * Returns the current action pool size. - * @return the current size of the action thread pool. - */ - public static int getCurrentPoolSize() - { - return component.core().getCurrentPoolSize(); - } - - /** - * Returns the largest action pool size. - * @return the maximum number of threads the thread pool has ever ran. - */ - public static int getLargestPoolSize() - { - return component.core().getLargestPoolSize(); - } - - /** - * Returns the number of actions currently scheduled for future execution. - * @return the number of scheduled actions. - */ - public static int getScheduledActionCount() - { - return component.core().getScheduledActionCount(); - } - - /** - * Returns the maximum number of concurrent users since the server was started. - * @return maximum number of concurrent users. - */ - public static int getMaximumNumberConcurrentUsers() throws CoreException - { - return component.core().getMaximumNumberConcurrentUsers(); - } - - /** - * Returns current number of concurrent sessions. - */ - public static long getNumberConcurrentSessions() - { - return component.core().getNumberConcurrentSessions(); - } - - /** - * @return the active sessions. - */ - public static Collection getActiveSessions() - { - return component.core().getActiveSessions(); - } - - /** - * @param userName the user name associated with the session to search for. - * @return the session associated with the given user name if such a session exists, otherwise null. - */ - public static ISession getActiveSession(String userName) - { - return component.core().getActiveSession(userName); - } - - public static long getNamedUserCount() - { - return component.core().getNamedUserCount(); - } - - /** - * The current number of concurrent users. - * @param anonymous whether anonymous users should be included in the count. - * @return the number of concurrent users. - */ - public static long getConcurrentUserCount(boolean anonymous) - { - return component.core().getConcurrentUserCount(anonymous); - } - - /** - * Returns the translated string for a certain key and context. The context is used - * to retrieve the language of the current user. - * @param context the context. - * @param key the key referring to the translatable string. - * @param args the arguments which should be applied to translatable string template. - * @return the translated string. - */ - public static String getInternationalizedString(IContext context, String key, Object ...args) - { - return component.core().getInternationalizedString(context, key, args); - } - - /** - * Returns the translated string for a certain key and language code. - * @param languageCode the language code (ISO-639). - * @param key the key referring to the translatable string. - * @param args values which should replace possible templates in the translatable string ({1}, {2}, etc.). - * @return the translated string. - */ - public static String getInternationalizedString(String languageCode, String key, Object ... args) - { - return component.core().getInternationalizedString(languageCode, key, args); - } - - /** - * Returns the default language of the loaded project. - * @return the default langauge. - */ - public static ILanguage getDefaultLanguage() - { - return component.core().getDefaultLanguage(); - } - - /** - * Retrieve locale using the given context. - * @param context the context. - * @return the Locale. - */ - public static Locale getLocale(IContext context) - { - return component.core().getLocale(context); - } - - /** - * Retrieve locale using the given language code (e.g. en_US). - * @param languageCode the languageCode (ISO-639). - * @return the Locale. - */ - public static Locale getLocale(String languageCode) - { - return component.core().getLocale(languageCode); - } - - /** - * Returns the startup date time of the Mendix Business Server. - * @return the date time on which the Mendix Business Server was started. - */ - public static Date getStartupDateTime() - { - return component.core().getStartupDateTime(); - } - - public static void registerLogSubscriber(LogSubscriber subscriber) - { - component.core().registerLogSubscriber(subscriber); - } - - /** - * Prints the message and stacktrace of a Throwable and its cause(s). - * @param trace the StringBuilder the exception is printed to. - * @param e the Throwable to print. - */ - public static void buildException(StringBuilder trace, Throwable e) - { - component.core().buildException(trace, e); - } - - /** - * Add the action specified by the given action name to action registry. This enables calling - * Core.execute(actionName) for this action. - * @param actionName the fully qualified class name of the action (e.g. com.mendix.action.MyAction). - */ - public static void addUserAction(Class> userActionClass) - { - component.core().addUserAction(userActionClass); - } - - /** - * 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)
- * @param type the type to base the IDataType on. - * @return the resulting IDataType. - */ - public static IDataType createDataType(String type) - { - return component.core().createDataType(type); - } - - /** - * Creates a DataType based on an object type and a attribute name - * @param objectType the object type (format: "ModuleName.EntityName"). - * @param attributeName the attribute to create the IDataType for (should be a member of above object type) - * @return the resulting IDataType - */ - public static IDataType createDataType(String objectType, String attributeName) - { - return component.core().createDataType(objectType, attributeName); - } - - public static IProfiler getProfiler() - { - return component.core().getProfiler(); - } - - public static void registerProfiler(IProfiler profiler) throws MendixException - { - component.core().registerProfiler(profiler); - } - - public static void unregisterProfiler() - { - component.core().unregisterProfiler(); - } -} diff --git a/javasource/excelimporter/actions/GetHeaderInformationFromExcelFile.java b/javasource/excelimporter/actions/GetHeaderInformationFromExcelFile.java index 811d716..a67cade 100644 --- a/javasource/excelimporter/actions/GetHeaderInformationFromExcelFile.java +++ b/javasource/excelimporter/actions/GetHeaderInformationFromExcelFile.java @@ -18,7 +18,7 @@ * Synchronise all excel columns and add/update/remove the existing columns from the template in the parameter. * The return value is irrelevant and will be always true */ -public class GetHeaderInformationFromExcelFile extends CustomJavaAction +public class GetHeaderInformationFromExcelFile extends CustomJavaAction { private IMendixObject __TemplateObject; private excelimporter.proxies.Template TemplateObject; @@ -33,7 +33,7 @@ public GetHeaderInformationFromExcelFile(IContext context, IMendixObject Templat } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { this.TemplateObject = __TemplateObject == null ? null : excelimporter.proxies.Template.initialize(getContext(), __TemplateObject); @@ -49,7 +49,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "GetHeaderInformationFromExcelFile"; } diff --git a/javasource/excelimporter/actions/RefreshClass.java b/javasource/excelimporter/actions/RefreshClass.java index f7e253d..dfd507b 100644 --- a/javasource/excelimporter/actions/RefreshClass.java +++ b/javasource/excelimporter/actions/RefreshClass.java @@ -13,21 +13,18 @@ import com.mendix.webui.CustomJavaAction; import com.mendix.webui.FeedbackHelper; -/** - * - */ -public class RefreshClass extends CustomJavaAction +public class RefreshClass extends CustomJavaAction { - private String objectType; + private java.lang.String objectType; - public RefreshClass(IContext context, String objectType) + public RefreshClass(IContext context, java.lang.String objectType) { super(context); this.objectType = objectType; } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE FeedbackHelper.addRefreshClass(getContext(), this.objectType); @@ -39,7 +36,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "RefreshClass"; } diff --git a/javasource/excelimporter/actions/StartImportByTemplate.java b/javasource/excelimporter/actions/StartImportByTemplate.java index 07874c0..42235bd 100644 --- a/javasource/excelimporter/actions/StartImportByTemplate.java +++ b/javasource/excelimporter/actions/StartImportByTemplate.java @@ -22,7 +22,7 @@ * * The return value is irrelevant and will be always true */ -public class StartImportByTemplate extends CustomJavaAction +public class StartImportByTemplate extends CustomJavaAction { private IMendixObject __TemplateObject; private excelimporter.proxies.Template TemplateObject; @@ -39,7 +39,7 @@ public StartImportByTemplate(IContext context, IMendixObject TemplateObject, IMe } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { this.TemplateObject = __TemplateObject == null ? null : excelimporter.proxies.Template.initialize(getContext(), __TemplateObject); @@ -60,7 +60,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "StartImportByTemplate"; } diff --git a/javasource/mxmodelreflection/actions/ReplaceToken.java b/javasource/mxmodelreflection/actions/ReplaceToken.java index d02e3ef..2410d0b 100644 --- a/javasource/mxmodelreflection/actions/ReplaceToken.java +++ b/javasource/mxmodelreflection/actions/ReplaceToken.java @@ -18,14 +18,14 @@ /** * Search the parameter text for the token from the parameter TokenObject, replace the value with a value from the parameter ValueObject. */ -public class ReplaceToken extends CustomJavaAction +public class ReplaceToken extends CustomJavaAction { private IMendixObject __TokenObject; private mxmodelreflection.proxies.Token TokenObject; private IMendixObject ValueObject; - private String TextToReplace; + private java.lang.String TextToReplace; - public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject ValueObject, String TextToReplace) + public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject ValueObject, java.lang.String TextToReplace) { super(context); this.__TokenObject = TokenObject; @@ -34,7 +34,7 @@ public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject V } @Override - public String executeAction() throws Exception + public java.lang.String executeAction() throws Exception { this.TokenObject = __TokenObject == null ? null : mxmodelreflection.proxies.Token.initialize(getContext(), __TokenObject); @@ -47,7 +47,7 @@ public String executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "ReplaceToken"; } diff --git a/javasource/mxmodelreflection/actions/SyncObjects.java b/javasource/mxmodelreflection/actions/SyncObjects.java index 33c20df..06a5af4 100644 --- a/javasource/mxmodelreflection/actions/SyncObjects.java +++ b/javasource/mxmodelreflection/actions/SyncObjects.java @@ -25,7 +25,7 @@ * * (The return value from this action can be ignored) */ -public class SyncObjects extends CustomJavaAction +public class SyncObjects extends CustomJavaAction { public SyncObjects(IContext context) { @@ -33,7 +33,7 @@ public SyncObjects(IContext context) } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE Builder builder = new Builder(); @@ -55,7 +55,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "SyncObjects"; } diff --git a/javasource/mxmodelreflection/actions/TestThePattern.java b/javasource/mxmodelreflection/actions/TestThePattern.java index 4c3ac7e..92f671b 100644 --- a/javasource/mxmodelreflection/actions/TestThePattern.java +++ b/javasource/mxmodelreflection/actions/TestThePattern.java @@ -18,10 +18,7 @@ import com.mendix.webui.FeedbackHelper; import com.mendix.systemwideinterfaces.core.IMendixObject; -/** - * - */ -public class TestThePattern extends CustomJavaAction +public class TestThePattern extends CustomJavaAction { private IMendixObject __TestPatternObj; private mxmodelreflection.proxies.TestPattern TestPatternObj; @@ -33,7 +30,7 @@ public TestThePattern(IContext context, IMendixObject TestPatternObj) } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { this.TestPatternObj = __TestPatternObj == null ? null : mxmodelreflection.proxies.TestPattern.initialize(getContext(), __TestPatternObj); @@ -81,7 +78,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "TestThePattern"; } diff --git a/javasource/mxmodelreflection/actions/ValidateTokensInMessage.java b/javasource/mxmodelreflection/actions/ValidateTokensInMessage.java index b91df0b..5202153 100644 --- a/javasource/mxmodelreflection/actions/ValidateTokensInMessage.java +++ b/javasource/mxmodelreflection/actions/ValidateTokensInMessage.java @@ -19,11 +19,11 @@ */ public class ValidateTokensInMessage extends CustomJavaAction> { - private String Text; + private java.lang.String Text; private java.util.List __TokenList; private java.util.List TokenList; - public ValidateTokensInMessage(IContext context, String Text, java.util.List TokenList) + public ValidateTokensInMessage(IContext context, java.lang.String Text, java.util.List TokenList) { super(context); this.Text = Text; @@ -48,7 +48,7 @@ public java.util.List executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "ValidateTokensInMessage"; } diff --git a/javasource/odm/actions/Sleep.java b/javasource/odm/actions/Sleep.java index b3e1839..f4ff9cb 100644 --- a/javasource/odm/actions/Sleep.java +++ b/javasource/odm/actions/Sleep.java @@ -13,21 +13,18 @@ import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; -/** - * - */ -public class Sleep extends CustomJavaAction +public class Sleep extends CustomJavaAction { - private Long SleepTime; + private java.lang.Long SleepTime; - public Sleep(IContext context, Long SleepTime) + public Sleep(IContext context, java.lang.Long SleepTime) { super(context); this.SleepTime = SleepTime; } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE Thread.sleep(this.SleepTime); @@ -39,7 +36,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "Sleep"; } diff --git a/javasource/system/actions/VerifyPassword.java b/javasource/system/actions/VerifyPassword.java index 766070d..f302808 100644 --- a/javasource/system/actions/VerifyPassword.java +++ b/javasource/system/actions/VerifyPassword.java @@ -17,12 +17,12 @@ /** * Verifies that the specified user name/password combination is valid. */ -public class VerifyPassword extends CustomJavaAction +public class VerifyPassword extends CustomJavaAction { - private String userName; - private String password; + private java.lang.String userName; + private java.lang.String password; - public VerifyPassword(IContext context, String userName, String password) + public VerifyPassword(IContext context, java.lang.String userName, java.lang.String password) { super(context); this.userName = userName; @@ -30,7 +30,7 @@ public VerifyPassword(IContext context, String userName, String password) } @Override - public Boolean executeAction() throws Exception + public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE IUser user = Core.getUser(getContext(), userName); @@ -42,7 +42,7 @@ public Boolean executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "VerifyPassword"; } diff --git a/javasource/xlsreport/actions/GenerateExcelDoc.java b/javasource/xlsreport/actions/GenerateExcelDoc.java index c274062..b110cd1 100644 --- a/javasource/xlsreport/actions/GenerateExcelDoc.java +++ b/javasource/xlsreport/actions/GenerateExcelDoc.java @@ -31,9 +31,6 @@ import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; -/** - * - */ public class GenerateExcelDoc extends CustomJavaAction { private IMendixObject __TemplateObject; @@ -155,7 +152,7 @@ public IMendixObject executeAction() throws Exception * Returns a string representation of this action */ @Override - public String toString() + public java.lang.String toString() { return "GenerateExcelDoc"; } diff --git a/javasource/xlsreport/report/export/ExportExcel.java b/javasource/xlsreport/report/export/ExportExcel.java index 42791e4..d4cfad0 100644 --- a/javasource/xlsreport/report/export/ExportExcel.java +++ b/javasource/xlsreport/report/export/ExportExcel.java @@ -5,7 +5,14 @@ import java.util.Date; import java.util.List; +import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.openxml4j.opc.PackageAccess; +import org.apache.poi.poifs.crypt.EncryptionInfo; +import org.apache.poi.poifs.crypt.EncryptionMode; +import org.apache.poi.poifs.crypt.Encryptor; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; @@ -38,6 +45,8 @@ public class ExportExcel extends Export private Workbook book; private boolean customExcel = false; private InputStream stream; + private MxTemplate template; + public ExportExcel(IContext context, MxTemplate template, IMendixObject inputObject) throws CoreException, IOException { @@ -76,7 +85,8 @@ public ExportExcel(IContext context, MxTemplate template, IMendixObject inputObj // Initialize all the styling items for the excel this.styling = new Styling(template); - this.styling.setAllStyles(context, template, this.book); + this.styling.setAllStyles(context, template, this.book); + this.template = template; } @Override @@ -166,12 +176,46 @@ public void buildExportFile(MxSheet mxSheet, List ColumnPresetList @Override public void writeData(FileDocument outputDocument) throws Exception { - try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { - this.book.write(out); - try (ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) { - Core.storeFileDocumentContent(context, outputDocument.getMendixObject(), inputStream); - } - } + File tmpFile = File.createTempFile("xlsreport-", template.getDocumentType().toString().toLowerCase()); + FileOutputStream tmpFos = new FileOutputStream(tmpFile); + + try { + if (template.getPasswordProtect()) { + if (template.getPassword() == null || template.getPassword().isEmpty()) { + throw new RuntimeException("No password has been set."); + } + + switch (template.getDocumentType()) { + case XLS: + Biff8EncryptionKey.setCurrentUserPassword(template.getPassword()); + this.book.write(tmpFos); + tmpFos.close(); + Biff8EncryptionKey.setCurrentUserPassword(null); + break; + case XLSX: + + POIFSFileSystem fs = new POIFSFileSystem(); + EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile); + Encryptor enc = info.getEncryptor(); + enc.confirmPassword(template.getPassword()); + OutputStream os = enc.getDataStream(fs); + this.book.write(os); + os.close(); + fs.writeFilesystem(tmpFos); + tmpFos.close(); + break; + default: + throw new RuntimeException("Unable to apply password protection because the format doesn't allow it: " + template.getDocumentType().toString()); + } + } + Core.storeFileDocumentContent(context, outputDocument.getMendixObject(), new FileInputStream(tmpFile)); + + } finally { + try { tmpFos.close(); } catch (Exception e) {} + tmpFile.delete(); + } + + } private void processStaticData(List StaticList, Sheet sheet, Aggregator aggr) throws CoreException