Class Grant

  • All Implemented Interfaces:
    com.simplicite.util.engine.CacheInterface, java.io.Serializable

    public class Grant
    extends GrantCore
    User rights
    One grant object is loaded for each user session
    See Also:
    Serialized Form
    • Constructor Detail

      • Grant

        public Grant()
        Default constructor. Using this constructor requires further initialization.
      • Grant

        public Grant​(java.lang.String login)
        Constructor with default initialization (e.g. for usage within unit testing).
        Parameters:
        login - Login
      • Grant

        public Grant​(java.lang.String login,
                     java.lang.String sessionId,
                     boolean web,
                     int endpoint,
                     boolean ws,
                     java.lang.String scope,
                     SessionInfo info)
        Constructor with initialization.
        Parameters:
        login - User login
        sessionId - Unique session ID (can be ad hoc session ID or web application session ID)
        endpoint - Endpoint (one of Gloabls.ENDPOINT_*)
        web - True if the user has UI access
        ws - True if the user has WebServices access
        scope - Optional requested scope
        info - Optional session info
    • Method Detail

      • getUUID

        public java.lang.String getUUID()
        Return instance UUID
        Returns:
        Instance UUID
      • clone

        public Grant clone​(java.lang.String sessionId,
                           int endpoint)
        Clone the Grant outside the user session
        Parameters:
        sessionId - private session Id (default prefixed with clone_)
        endpoint - Globals.ENDPOINT_*
        Returns:
        Duplicated rights for backend usage (long time process)
      • setSession

        public void setSession​(javax.servlet.http.HttpSession session)
        Set session (and servlet context if possible)
        Parameters:
        session - Session
      • getSession

        public javax.servlet.http.HttpSession getSession()
        Get session (if available)
        Returns:
        Session or null
      • setServletContext

        @Deprecated(forRemoval=true,
                    since="5")
        public void setServletContext​(javax.servlet.ServletContext servletcontext)
        Deprecated, for removal: This API element is subject to removal in a future version.
        No used anymore
      • getServletContext

        @Deprecated(forRemoval=true,
                    since="5")
        public javax.servlet.ServletContext getServletContext()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use Platform.getServletContext()
      • getSessionTimeout

        public int getSessionTimeout()
        Get session timeout (in seconds if session is available)
        Returns:
        Session timeout or 0
      • setSessionInfo

        public void setSessionInfo​(SessionInfo info)
        Set session info with authentication information
        Parameters:
        info - Session info with optional attributes and groups
      • getSessionInfo

        public SessionInfo getSessionInfo()
        Get session info with authentication information
        Returns:
        Session info with optional attributes and groups
      • getSessionAttribute

        public java.lang.Object getSessionAttribute​(java.lang.String name,
                                                    java.lang.Object def)
        Get session attribute (if session is available)
        Parameters:
        name - Name
        def - Default value
      • setSessionAttribute

        public void setSessionAttribute​(java.lang.String name,
                                        java.io.Serializable value)
        Set session attribute (if session is available)
        Parameters:
        name - Name
        value - Value
      • setPrimaryLogin

        public void setPrimaryLogin​(java.lang.String login)
        Set the primary login
      • getPrimaryLogin

        public java.lang.String getPrimaryLogin()
        Get the primary login
      • getWebServicesFactory

        public WebServicesFactory getWebServicesFactory​(boolean create)
        Get web services factory
        Parameters:
        create - Create?
        Returns:
        Web services factory
      • setWebServicesFactory

        public void setWebServicesFactory​(WebServicesFactory wsf)
        Set webservices factory
        Parameters:
        wsf - Web services factory
      • getAPI

        @Deprecated(forRemoval=true,
                    since="4.0")
        public APITool getAPI​(java.lang.String url,
                              java.lang.String login,
                              java.lang.String password,
                              java.lang.String encoding)
                       throws ParamsException,
                              HTTPException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use getAPIClient (with additional debug parameter)
        Throws:
        ParamsException
        HTTPException
      • getAPIClient

        public APITool getAPIClient​(java.lang.String url,
                                    java.lang.String login,
                                    java.lang.String password,
                                    java.lang.String encoding,
                                    boolean debug)
                             throws ParamsException,
                                    HTTPException
        Get Simplicite API client
        Parameters:
        url - Base URL
        login - Login
        password - Password
        encoding - Encoding
        debug - Debug mode?
        Throws:
        ParamsException
        HTTPException
      • getContextPath

        @Deprecated(forRemoval=true,
                    since="3.x")
        public java.lang.String getContextPath()
        Deprecated, for removal: This API element is subject to removal in a future version.
      • setContextPath

        @Deprecated(forRemoval=true,
                    since="3.x")
        public void setContextPath​(java.lang.String contextPath)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • getContextURL

        public java.lang.String getContextURL()
        Get the web application URL
        Returns:
        Context URL
      • setContextURL

        public void setContextURL​(java.lang.String url)
        Set the web application URL
        Parameters:
        url - Web application URL
      • getServerURL

        public java.lang.String getServerURL()
        Get server URL (context URL with context path removed)
        Returns:
        Server URL
      • init

        public void init​(java.lang.String login,
                         java.lang.String sessionId,
                         int endpoint,
                         boolean web,
                         java.lang.String lang,
                         Globals.InterfaceType interfaceType,
                         java.lang.String scope,
                         SessionInfo info)
        Initialize user rights
        Parameters:
        login - User login
        sessionId - Unique session ID (can be a dedicated session ID or the web application's session ID)
        endpoint - End point (one of Globals.ENDPOINT_*)
        web - Load web translations, texts, list of values, gadgets...
        lang - User language (if null login language will be used)
        interfaceType - Interface type or Globals property if null
        scope - Optional requested scope
        info - Optional session info
      • init

        public void init​(java.lang.String login,
                         java.lang.String sessionId,
                         int endpoint,
                         boolean web,
                         Globals.InterfaceType interfaceType,
                         java.lang.String scope,
                         SessionInfo info)
        Initialize user rights in a specific interface type
        Parameters:
        login - User login
        sessionId - Unique session ID (can be a dedicated session ID or the web application's session ID)
        endpoint - End point (one of Globals.ENDPOINT_*)
        web - Load web translations, texts, list of values, gadgets...
        interfaceType - Interface type or Globals property if null
        scope - Optional requested scope
        info - Optional session info
      • init

        public void init​(java.lang.String login,
                         java.lang.String sessionId,
                         int endpoint,
                         java.lang.String scope,
                         SessionInfo info)
        Initialize user rights with web full access
        Parameters:
        login - User login
        sessionId - Unique session ID (can be ad hoc session ID or web application session ID)
        endpoint - End point (one of Globals.ENDPOINT_*)
        scope - Optional requested scope
        info - Optional user info
      • isTechnicalUser

        public static boolean isTechnicalUser​(java.lang.String login)
        Is specified user a technical user?
        Parameters:
        login - User login
        Returns:
        True if technical user
      • isTechnicalUser

        public boolean isTechnicalUser()
        Is current user a technical user
        Returns:
        True if technical user
      • init

        public boolean init​(java.lang.String login,
                            javax.servlet.http.HttpServletRequest request,
                            int endpoint)
        Initialize user rights
        Parameters:
        login - User login for who rights are loaded
        request - HTTP request
        endpoint - End point (one of Globals.ENDPOINT_*)
        Returns:
        false if user is not active
      • reinit

        @Deprecated(forRemoval=true,
                    since="4.0")
        public void reinit​(java.lang.String login,
                           java.lang.String sessionId,
                           int endpoint,
                           boolean web,
                           java.lang.String scope,
                           SessionInfo info)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • reinit

        public final void reinit()
        Reinitialize UI rights of current session
      • reinit

        public void reinit​(java.lang.String login,
                           java.lang.String sessionId,
                           int endpoint,
                           boolean web,
                           java.lang.String lang,
                           java.lang.String scope,
                           SessionInfo info)
        Reinitialize user rights
        Parameters:
        login - User login
        sessionId - Unique session ID (can be ad hoc session ID or web application session ID)
        lang - Optional requested language
        scope - Optional requested scope
        info - Optional session info
      • getSystemAdmin

        public static Grant getSystemAdmin()
        Singleton to use system objects with Local access
        Be careful to use it in thread safe methods
        or only to read parameters, or to execute direct SQL queries/updates
        Returns:
        Admin user rights singleton
      • getAdmin

        public static Grant getAdmin​(Grant g)
        Get the system rights in a specific session
        Useful to update the system objects in isolated user session
        Parameters:
        g - Grant including the session id
        Returns:
        Admin user rights
      • getAdmin

        public Grant getAdmin()
        Get the system rights in a specific session
        Useful to update the system objects in isolated user session (same as static method getAdmin(Grant g))
        Returns:
        Admin user rights
      • getPublic

        public static Grant getPublic​(java.lang.String lang)
        Singleton to use public objects in a specific language
        Parameters:
        lang - Language (FRA, ENU...) or null to get default language of 'public' user
        Returns:
        Public user rights singleton
      • getPublic

        public static Grant getPublic()
        Singleton to use public objects in user 'public' language
        Returns:
        Public user rights singleton
      • isSystemUser

        public static boolean isSystemUser​(java.lang.String login)
        Is system login?
        Parameters:
        login - User login
        Returns:
        True if login is system
      • isSystemUser

        public boolean isSystemUser()
        Is current user the system user?
        Returns:
        True if the current user is ths system user
      • isPublicUser

        public static boolean isPublicUser​(java.lang.String login)
        Is public login?
        Parameters:
        login - User login
        Returns:
        True if login is public
      • isPublicUser

        public boolean isPublicUser()
        Is the current user the public user?
        Returns:
        True if the current user is the public user
      • isDesignerUser

        public static boolean isDesignerUser​(java.lang.String login)
        Is designer login?
        Parameters:
        login - User login
        Returns:
        True if login is designer
      • isDesignerUser

        public boolean isDesignerUser()
        Is the current user the designer user?
        Returns:
        True if the current user is the designer user
      • getUserLogin

        public static java.lang.String getUserLogin​(java.lang.String userId)
        Get user login for specified user ID
        Parameters:
        userId - User ID
        Returns:
        User login
      • getUserId

        public static java.lang.String getUserId​(java.lang.String login)
        Returns user ID for specified login
        Parameters:
        login - User login
        Returns:
        User ID
      • getUserModuleId

        public static java.lang.String getUserModuleId​(java.lang.String login)
        Returns module ID for specified login
        Parameters:
        login - User login
        Returns:
        User module ID
      • exists

        public static boolean exists​(java.lang.String login,
                                     boolean active)
        Checks if a user exists for specified login
        Parameters:
        login - User login
        active - check if user is active
        Returns:
        True if user exists (and is active if requested)
      • exists

        public static boolean exists​(java.lang.String login,
                                     java.lang.String status)
        Checks if a user exists for specified login and specified status
        Parameters:
        login - User login
        status - Status (one of Grant.USER_* constants)
        Returns:
        True if user exists ans is specified statues
      • exists

        public static boolean exists​(java.lang.String login,
                                     java.lang.String[] statuses)
        Checks if a user exists for specified login and specified statuses
        Parameters:
        login - User login
        statuses - Array of statuses (Grant.USER_* constants)
        Returns:
        True if user exists is in one of specified statuses
      • destroy

        public void destroy()
        To destroy properly a user session
      • getWorkingId

        public java.lang.String getWorkingId()
        Current working Id in table m_session
      • getWorkingTime

        public long getWorkingTime()
        Current working creation time
      • startWorking

        public void startWorking()
        Start working: update the last logon date in table m_user and create one history in m_session and/or log4j
      • stopWorking

        public void stopWorking()
        Stop working: set the duration in table m_session and/or log4j
      • getGroup

        public GroupDB getGroup​(java.lang.String group)
        Group info
        Parameters:
        group - Group name
        Returns:
        Group structure if known
      • getOrganization

        public java.util.List<java.lang.String> getOrganization​(java.lang.String group)
        Organization search
        Parameters:
        group - Group name = Organization root
        Returns:
        Search result containing the group and all children
      • getGroupParents

        public java.util.List<java.lang.String> getGroupParents​(java.lang.String group)
        Parents group search
        Parameters:
        group - Group name
        Returns:
        Search result containing all parents
      • getGroupChildren

        public java.util.List<java.lang.String> getGroupChildren​(java.lang.String group)
        Children group search
        Parameters:
        group - Group name
        Returns:
        Search result containing children
      • getGroupProfile

        public java.util.List<java.lang.String> getGroupProfile​(java.lang.String group)
        Profile group search
        Parameters:
        group - Group name
        Returns:
        Search result containing all children
      • getObjectLocation

        public java.lang.String getObjectLocation​(java.lang.String name)
        Get business object location
        Parameters:
        name - Business object name
        Returns:
        class location
      • getExternalObjectLocation

        public java.lang.String getExternalObjectLocation​(java.lang.String name)
        Get external object location
        Parameters:
        name - External object name
        Returns:
        class location
      • query

        public java.util.List<java.lang.String[]> query​(java.lang.String query)
        Database query using designated datasource
        Parameters:
        query - SQL query
        Returns:
        list of string array
      • query

        public java.util.List<java.lang.String[]> query​(java.lang.String datasource,
                                                        java.lang.String query)
        Database query using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query
        Returns:
        list of string array
      • query

        public java.util.List<java.lang.String[]> query​(java.lang.String query,
                                                        java.util.List<ObjectField> hosts)
        Database query using default datasource
        Parameters:
        query - SQL query with hosts values
        hosts - ObjectField list to set the hosts values in SQL query
        Returns:
        list of string array
      • query

        public java.util.List<java.lang.String[]> query​(java.lang.String datasource,
                                                        java.lang.String query,
                                                        java.util.List<ObjectField> hosts)
        Database query using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        hosts - ObjectField list to set the hosts values in SQL query
        Returns:
        list of string array
      • query

        public java.util.List<java.lang.String[]> query​(java.lang.String datasource,
                                                        java.lang.String query,
                                                        java.util.List<ObjectField> hosts,
                                                        int limit)
        Database query using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        hosts - ObjectField list to set the hosts values in SQL query
        limit - Nb max rows to return (0 means no limit)
        Returns:
        list of string array
      • queryWithHead

        public java.util.List<java.lang.String[]> queryWithHead​(java.lang.String query)
                                                         throws java.sql.SQLException
        Database query with column names using default datasource
        Parameters:
        query - SQL query with hosts values
        Returns:
        list of string array
        Throws:
        java.sql.SQLException
      • queryWithHead

        public java.util.List<java.lang.String[]> queryWithHead​(java.lang.String query,
                                                                java.util.List<ObjectField> host)
                                                         throws java.lang.Exception
        Database query with column names using default datasource
        Parameters:
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        list of string array
        Throws:
        java.lang.Exception
      • queryWithHead

        public java.util.List<java.lang.String[]> queryWithHead​(java.lang.String datasource,
                                                                java.lang.String query,
                                                                java.util.List<ObjectField> host)
                                                         throws java.sql.SQLException
        Database query with column names using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        list of string array
        Throws:
        java.sql.SQLException
      • queryWithHead

        public java.util.List<java.lang.String[]> queryWithHead​(java.lang.String datasource,
                                                                java.lang.String query,
                                                                java.util.List<ObjectField> host,
                                                                int limit)
                                                         throws java.sql.SQLException
        Database query with column names using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        limit - Nb max rows to return (0 means no limit)
        Returns:
        list of string array
        Throws:
        java.sql.SQLException
      • simpleQuery

        public java.lang.String simpleQuery​(java.lang.String query)
        Simple database query using default datasource
        Parameters:
        query - SQL query
        Returns:
        first column of the first record
      • simpleQuery

        public java.lang.String simpleQuery​(java.lang.String datasource,
                                            java.lang.String query)
        Simple database query using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query
        Returns:
        first column of the first record
      • simpleQuery

        public java.lang.String simpleQuery​(java.lang.String query,
                                            java.util.List<ObjectField> host)
        Simple database query with hosts values using default datasource
        Parameters:
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        first column of the first record
      • simpleQuery

        public java.lang.String simpleQuery​(java.lang.String datasource,
                                            java.lang.String query,
                                            java.util.List<ObjectField> host)
        Simple database query with hosts values using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        first column of the first record
      • simpleQuery

        public java.lang.String simpleQuery​(java.lang.String datasource,
                                            java.lang.String query,
                                            java.util.List<ObjectField> host,
                                            boolean silent)
                                     throws java.sql.SQLException
        Simple database query with hosts values using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        silent - Silent mode (throws exception)?
        Returns:
        first column of the first record
        Throws:
        java.sql.SQLException
      • simpleQueryAsLong

        public long simpleQueryAsLong​(java.lang.String query)
        Simple database query using default datasource, the result is parsed into long (typical usage is for count(*) queries)
        Parameters:
        query - SQL query
        Returns:
        first column of the first record as long
      • simpleQueryAsLong

        public long simpleQueryAsLong​(java.lang.String datasource,
                                      java.lang.String query)
        Simple database query using designated datasource, the result is parsed into long (typical usage is for count(*) queries)
        Parameters:
        datasource - Data source name
        query - SQL query
        Returns:
        first column of the first record as long
      • simpleQueryAsLong

        public long simpleQueryAsLong​(java.lang.String query,
                                      java.util.List<ObjectField> host)
        Simple database query using default datasource with hosts values, the result is parsed into long (typical usage is for count(*) queries)
        Parameters:
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        first column of the first record as long
      • simpleQueryAsLong

        public long simpleQueryAsLong​(java.lang.String datasource,
                                      java.lang.String query,
                                      java.util.List<ObjectField> host)
        Simple database query using designated datasource with hosts values, the result is parsed into long (typical usage is for count(*) queries)
        Parameters:
        datasource - Data source name
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        first column of the first record as long
      • simpleQueryAsDouble

        public double simpleQueryAsDouble​(java.lang.String query)
        Simple database query using default datasource, the result is parsed into double (typical usage is for avg(), sum() queries)
        Parameters:
        query - SQL query
        Returns:
        first column of the first record as long
      • querySingleRow

        public java.lang.String[] querySingleRow​(java.lang.String query)
        Single row database query using default datasource
        Parameters:
        query - SQL query
        Returns:
        String array or null if not found
      • querySingleRow

        public java.lang.String[] querySingleRow​(java.lang.String datasource,
                                                 java.lang.String query)
        Single row database query using designated datasource
        Parameters:
        datasource - Data source name
        query - SQL query
        Returns:
        String array or null if not found
      • querySingleRow

        public final java.lang.String[] querySingleRow​(java.lang.String query,
                                                       java.util.List<ObjectField> host)
        Single row database query with hosts values using default datasource
        Parameters:
        query - SQL query with hosts values
        host - ObjectField list to set the hosts values in SQL query
        Returns:
        String array or null if not found
      • querySingleRow

        public java.lang.String[] querySingleRow​(java.lang.String datasource,
                                                 java.lang.String query,
                                                 java.util.List<ObjectField> host)
        Single row database query with hosts values using designated datasource
        Parameters:
        datasource - Data-source name or null
        query - SQL query (with hosts values or not)
        host - ObjectField list to set the hosts values in SQL query (may be null)
        Returns:
        String array or null if not found
      • queryFirstColumn

        public java.lang.String[] queryFirstColumn​(java.lang.String query)
        Single column database query using default datasource
        Parameters:
        query - SQL query
        Returns:
        String array or null if not found
      • simpleBlob

        public final java.io.InputStream simpleBlob​(java.lang.String query)
        Get a document
        Parameters:
        query - SQL query (with hosts values or not)
        Returns:
        stream or null
      • simpleBlob

        public final java.io.InputStream simpleBlob​(java.lang.String query,
                                                    java.util.List<ObjectField> host,
                                                    java.lang.String path)
        Get a document
        Parameters:
        query - SQL query (with hosts values or not)
        host - ObjectField list to set the hosts values in SQL query (may be null)
        Returns:
        stream or null
      • simpleBlob

        public java.io.InputStream simpleBlob​(java.lang.String datasource,
                                              java.lang.String query,
                                              java.util.List<ObjectField> host,
                                              java.lang.String path)
        Get a document
        Parameters:
        datasource - Data-source name or null
        query - SQL query (with hosts values or not)
        host - ObjectField list to set the hosts values in SQL query (may be null)
        path - Optional path to DBDOC to stream file
        Returns:
        stream or null
      • getMaxId

        public final java.lang.String getMaxId​(java.lang.String table)
        Get the max standard row ID of a table using default datasource
        Parameters:
        table - Table name
        Returns:
        Max row ID
      • getMaxId

        public java.lang.String getMaxId​(java.lang.String datasource,
                                         java.lang.String table)
        Get the max standard row ID of a table using designated datasource
        Parameters:
        datasource - Data source name
        table - Table name
        Returns:
        Max row ID
      • getMaxIdWhere

        public final java.lang.String getMaxIdWhere​(java.lang.String table,
                                                    java.lang.String column,
                                                    java.lang.String where)
        Get the max custom row ID of a table using default datasource
        Parameters:
        table - Table name
        column - Custom row ID column name
        where - Where clause (or null for no where clause)
        Returns:
        Max custom row ID
      • getMaxIdWhere

        public java.lang.String getMaxIdWhere​(java.lang.String datasource,
                                              java.lang.String table,
                                              java.lang.String column,
                                              java.lang.String where)
        Get the max standard row ID of a table using designated datasource
        Parameters:
        datasource - Data source name
        table - Table name
        Returns:
        Max custom row ID
      • getNextIdForColumn

        public final java.lang.String getNextIdForColumn​(java.lang.String table,
                                                         java.lang.String column)
        Get the next value of an ID column of a table using default datasource
        Parameters:
        table - Table name
        column - Column name
        Returns:
        Next ID
      • getNextIdForColumn

        public java.lang.String getNextIdForColumn​(java.lang.String datasource,
                                                   java.lang.String table,
                                                   java.lang.String column)
        Get the next value of an ID column of a table using designated datasource
        Parameters:
        datasource - Data source name
        table - Table name
        column - Column name
        Returns:
        Next ID
      • getNextValueForColumnWhere

        public java.lang.String getNextValueForColumnWhere​(java.lang.String table,
                                                           java.lang.String column,
                                                           java.lang.String where)
        Get the next value of an integer column of a table using designated datasource
        Parameters:
        table - Table name
        column - Column name
        where - Where clause (or null for no where clause)
        Returns:
        Next value
      • getNextValueForColumnWhere

        public java.lang.String getNextValueForColumnWhere​(java.lang.String datasource,
                                                           java.lang.String table,
                                                           java.lang.String column,
                                                           java.lang.String where)
        Get the next value of an integer column of a table using designated datasource
        Parameters:
        datasource - Data source name
        table - Table name
        column - Column name
        where - Where clause (or null for no where clause)
        Returns:
        Next value
      • now

        @Deprecated(forRemoval=true,
                    since="4.0")
        public final java.lang.String now​(int type)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use Tool.getCurrentDate or getCurrentTime or detCurrentDatetime
      • getSystemParam

        public java.lang.String getSystemParam​(java.lang.String code)
        Get the value of a global (persistent) system parameter It's usually a better practice to use getParameter for which all values are loaded once in the session, rather than this method which requests the datasource at each call.
        Parameters:
        code - System parameter code
      • getSystemParam

        public java.lang.String getSystemParam​(java.lang.String code,
                                               java.lang.String defaultValue)
        see getSystemParam
        Parameters:
        code - System parameter code
        defaultValue - Default value if system parameter is unknown or empty
      • setSystemParam

        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value)
        Set the value of a global (persistent) system parameter
        Parameters:
        code - System parameter code
        value - Value for specified system parameter (delete the parameter if empty)
        Returns:
        System parameter Id
      • setSystemParam

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               boolean priv)
        Deprecated.
        Use setSystemParam with additional parameters
      • setSystemParam

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               boolean priv,
                                               boolean clearcache)
        Deprecated.
        Use setSystemParam with additional parameters
      • setSystemParam

        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               boolean priv,
                                               boolean clearcache,
                                               boolean override)
        Set the value of a global (persistent) system parameter
        Parameters:
        code - System parameter code
        value - Value for specified system parameter (delete the parameter if empty)
        priv - Private parameter (type=PRV) ?
        clearcache - Partial clear cache for system parameter ?
        override - true to override the value without changing the initial value
        Returns:
        System parameter Id
      • setSystemParam

        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               java.lang.String type,
                                               boolean clearcache,
                                               boolean override)
        Set the value of a global (persistent) system parameter
        Parameters:
        code - System parameter code
        value - Value for specified system parameter (delete the parameter if empty)
        type - Optional type from SYS_TYPE
        clearcache - Partial clear cache for system parameter ?
        override - true to override the value without changing the initial value
        Returns:
        System parameter Id
      • setRuntimeParam

        public java.lang.String setRuntimeParam​(java.lang.String code,
                                                java.lang.String value)
        Set the value of a runtime system parameter in DB (type=RUN)
        Parameters:
        code - System parameter code
        value - Value for specified system parameter (delete the parameter if empty)
        Returns:
        System parameter Id
      • removeSystemParam

        public void removeSystemParam​(java.lang.String code,
                                      boolean clearcache)
        Delete a (persistent) system parameter
        Parameters:
        code - System parameter code
        clearcache - Partial clear cache for system parameter ?
      • getNextSystemParamValue

        public java.lang.String getNextSystemParamValue​(java.lang.String code,
                                                        java.text.Format fmt)
        Get next value of a global (persistent) system parameter used as a sequence
        Parameters:
        code - Code of the system parameter holding the sequence
        fmt - Format (e.g. new DecimalFormat("ABC00000000"))
        Returns:
        next value of system parameter as formatted string
      • getNextSystemParamValue

        public long getNextSystemParamValue​(java.lang.String code)
        Get next value of a global (persistent) system parameter used as a sequence
        Parameters:
        code - Code of the system parameter holding the sequence
        Returns:
        next value of system parameter as long
      • getDBVendor

        public int getDBVendor()
        Get the DB vendor of default data source
      • getDBVendor

        public int getDBVendor​(java.lang.String datasource)
        Get the DB vendor of designated data source
        Parameters:
        datasource - Data source name
      • getDBVendorName

        public java.lang.String getDBVendorName()
        Get the DB vendor name of default data source
      • getDBVendorName

        public java.lang.String getDBVendorName​(java.lang.String datasource)
        Get the DB vendor name of designated data source
        Parameters:
        datasource - Data source name
      • getDBMetaData

        public java.sql.DatabaseMetaData getDBMetaData()
        Get the DB metadata of default data source
      • getDBMetaData

        public java.sql.DatabaseMetaData getDBMetaData​(java.lang.String datasource)
        Get the DB metadata of designated data source
        Parameters:
        datasource - Data source name
      • getDBOracleAliasLength

        public int getDBOracleAliasLength()
        Get Oracle alias length of default datasource
        Returns:
        Oracle alias length
      • getDBOracleAliasLength

        public int getDBOracleAliasLength​(java.lang.String datasource)
        Get Oracle alias length of designated data source.
        Parameters:
        datasource - Data source name
        Returns:
        Oracle alias length
      • getDBInfo

        public java.lang.String getDBInfo()
        Get the DB information (product name and version) of default data source
      • getDBInfo

        public java.lang.String getDBInfo​(java.lang.String datasource)
        Get the DB information (product name and version) of designated data source
        Parameters:
        datasource - Data source name
      • getDBDate

        public java.lang.String getDBDate()
        Get the database current datetime of default data source
        Returns:
        Database current datetime
      • getDBDate

        public java.lang.String getDBDate​(java.lang.String datasource)
        Get the database current datetime of designated data source
        Parameters:
        datasource - Data source name
        Returns:
        Database current datetime
      • getDBNow

        public java.lang.String getDBNow()
        Get the DB syntax of default data source to retrieve the current datetime
        Returns:
        sysdate, now(), current_timestamp...
      • getDBNow

        public java.lang.String getDBNow​(java.lang.String datasource)
        Get the DB syntax of designated data source to retrieve the current datetime
        Parameters:
        datasource - Data source name
        Returns:
        sysdate, now(), current_timestamp...
      • getDBToday

        public java.lang.String getDBToday()
        Get the DB syntax of default data source to retrieve the current date (without time)
        Returns:
        today, curdate(), current_date...
      • getDBToday

        public java.lang.String getDBToday​(java.lang.String datasource)
        Get the DB syntax of default data source to retrieve the current date (without time)
        Parameters:
        datasource - Data source name
        Returns:
        today, curdate(), current_date...
      • getDBColumnType

        public java.lang.String getDBColumnType​(int type,
                                                int size,
                                                int prec)
        Get database column type from field type, size and precision
        Parameters:
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • getDBColumnType

        public java.lang.String getDBColumnType​(java.lang.String datasource,
                                                int type,
                                                int size,
                                                int prec)
        Get database column type from field type, size and precision
        Parameters:
        datasource - Data source name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • getDBToDate

        public java.lang.String getDBToDate​(java.lang.String date)
        Get a date statement in a DB format for default data source
        Parameters:
        date - yyyy-MM-dd
        Returns:
        Date statement
      • getDBToDate

        public java.lang.String getDBToDate​(java.lang.String datasource,
                                            java.lang.String date)
        Get a date statement in a DB format for designated data source
        Parameters:
        datasource - Data source name
        date - yyyy-MM-dd
        Returns:
        Date statement
      • getDBToTime

        public java.lang.String getDBToTime​(java.lang.String time)
        Get a time statement in a DB format for default data source
        Parameters:
        time - HH:mm:ss
        Returns:
        Time statement
      • getDBToTime

        public java.lang.String getDBToTime​(java.lang.String datasource,
                                            java.lang.String time)
        Get a time statement in a DB format for designated data source
        Parameters:
        datasource - Data source name
        time - HH:mm:ss
        Returns:
        Time statement
      • getDBToDatetime

        public java.lang.String getDBToDatetime​(java.lang.String datetime)
        Get a datetime statement in a DB format for default data source
        Parameters:
        datetime - yyyy-MM-dd HH:mm:ss
        Returns:
        Datetime statement
      • getDBToDatetime

        public java.lang.String getDBToDatetime​(java.lang.String datasource,
                                                java.lang.String datetime)
        Get a datetime statement in a DB format for designated data source
        Parameters:
        datasource - Data source name
        datetime - yyyy-MM-dd HH:mm:ss
        Returns:
        Datetime statement
      • getDBConcat

        public java.lang.String getDBConcat​(java.lang.String str1,
                                            java.lang.String str2)
        Get string concatenation using DB syntax of default data source (ex: concat mysql
        Parameters:
        str1 - First DB string to concat
        str2 - Second DB string to concat
        Returns:
        Concatenation statement
      • getDBConcat

        public java.lang.String getDBConcat​(java.lang.String datasource,
                                            java.lang.String str1,
                                            java.lang.String str2)
        Get string concatenation statement using DB syntax of designated data source (ex: concat mysql)
        Parameters:
        datasource - Data source name
        str1 - First DB string to concat
        str2 - Second DB string to concat
        Returns:
        Concatenation statement
      • getDBFunction

        public java.lang.String getDBFunction​(java.lang.String datasource,
                                              java.lang.String name)
        Get function name for designated data source (e.g. substring)
        Parameters:
        datasource - Data source name
        name - Function name
        Returns:
        substring function name
      • update

        public int update​(java.lang.String query)
        SQL update in database using default data source
        Parameters:
        query - SQL insert/update/delete query
        Returns:
        Negative value if an error occurs
      • update

        public int update​(java.lang.String datasource,
                          java.lang.String query)
        SQL update in database using designated data source
        Parameters:
        datasource - Data source name
        query - SQL insert/update/delete query
        Returns:
        Negative value if an error occurs
      • update

        public int update​(java.lang.String query,
                          java.util.List<ObjectField> hosts)
        SQL update in database using default data source with hosts values
        Parameters:
        query - SQL insert/update/delete query
        hosts - ObjectField list
        Returns:
        Negative value if an error occurs
      • update

        public int update​(java.lang.String datasource,
                          java.lang.String query,
                          java.util.List<ObjectField> hosts)
        SQL update in database using designated data source with hosts values
        Parameters:
        datasource - Data source name
        query - SQL insert/update/delete query
        hosts - ObjectField list
        Returns:
        Negative value if an error occurs
      • update

        public int update​(java.lang.String datasource,
                          java.lang.String query,
                          java.util.List<ObjectField> hosts,
                          boolean silent)
                   throws java.sql.SQLException
        SQL update in database using designated data source with hosts values
        Parameters:
        datasource - Data source name
        query - SQL insert/update/delete query
        hosts - ObjectField list
        silent - Silent mode (throw exception)
        Returns:
        Negative value if an error occurs
        Throws:
        java.sql.SQLException
      • updateAll

        public int updateAll​(java.util.List<java.lang.String> queries)
        SQL transactional updates in database using default data source
        Parameters:
        queries - ordered insert/update/delete queries
        Returns:
        Negative value if an error occurs
      • updateAll

        public int updateAll​(java.lang.String datasource,
                             java.util.List<java.lang.String> queries)
        SQL transactional updates in database using designated data source
        Parameters:
        datasource - Data source name
        queries - ordered insert/update/delete queries
        Returns:
        Negative value if an error occurs
      • callProcedure

        public boolean callProcedure​(java.lang.String procedure,
                                     java.util.List<ObjectField> params)
        Call a stored procedure using default data source
        Parameters:
        procedure - Procedure name
        params - Optional IN parameters (OUT not supported)
        Returns:
        True upon success
      • callProcedure

        public boolean callProcedure​(java.lang.String datasource,
                                     java.lang.String procedure,
                                     java.util.List<ObjectField> params)
        Call a stored procedure using designated data source
        Parameters:
        datasource - Data source name
        procedure - Procedure name
        params - Optional IN parameters (OUT not supported)
        Returns:
        True upon success
      • updateBlob

        public int updateBlob​(java.lang.String query,
                              byte[] data,
                              java.io.InputStream src)
        Update a document
        Parameters:
        query - SQL update query with a single host '?'
        data - document
        src - or source file
      • updateBlob

        public int updateBlob​(java.lang.String datasource,
                              java.lang.String query,
                              byte[] data,
                              java.io.InputStream src)
        Update a document
        Parameters:
        datasource - Data source name
        query - SQL update query with a single host variable '?'
        data - document
        src - or source file
      • checkTable

        public boolean checkTable​(java.lang.String table)
        Checks if a table exists in default data source
        Parameters:
        table - Table
      • checkTable

        public boolean checkTable​(java.lang.String datasource,
                                  java.lang.String table)
        Checks if a table exists in designated data source
        Parameters:
        datasource - Data source name
      • checkColumn

        public boolean checkColumn​(java.lang.String table,
                                   java.lang.String column)
        Checks if the specified column exists in the specified table of default data source
        Parameters:
        table - Table
        column - Column
      • checkColumn

        public boolean checkColumn​(java.lang.String datasource,
                                   java.lang.String table,
                                   java.lang.String column)
        Checks if the specified column exists in the specified table of designated data source
        Parameters:
        datasource - Data source name
        table - Table
        column - Column
      • createTable

        public int createTable​(java.lang.String table,
                               ObjectField rowIdField)
        Create table with optional custom row ID field in default data source
        Parameters:
        table - Table name
        rowIdField - Optional custom row ID field (if null standard row ID field will be used)
        Returns:
        Update status
      • createTable

        public int createTable​(java.lang.String datasource,
                               java.lang.String table,
                               ObjectField rowIdField)
        Create table with optional custom row ID field in specified data source
        Parameters:
        datasource - Data source name
        table - Table name
        rowIdField - Optional custom row ID field (if null standard row ID field will be used)
        Returns:
        Update status
      • renameTable

        public final int renameTable​(java.lang.String oldname,
                                     java.lang.String newname)
        Rename table in default data source
        Parameters:
        oldname - Old table name
        newname - New table name
        Returns:
        Update status
      • renameTable

        public int renameTable​(java.lang.String datasource,
                               java.lang.String oldname,
                               java.lang.String newname)
        Rename table in designated data source
        Parameters:
        datasource - Data source name
        oldname - Old table name
        newname - New table name
        Returns:
        Update status
      • addColumn

        public int addColumn​(java.lang.String table,
                             java.lang.String column,
                             int type,
                             int size,
                             int prec)
        Add a column to a table of default data source
        Parameters:
        table - Table name
        column - Column name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • addColumn

        public int addColumn​(java.lang.String datasource,
                             java.lang.String table,
                             java.lang.String column,
                             int type,
                             int size,
                             int prec)
        Add a column to a table of designated data source
        Parameters:
        datasource - Data source name
        table - Table name
        column - Column name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • changeColumn

        public final int changeColumn​(java.lang.String table,
                                      java.lang.String oldcolumn,
                                      java.lang.String newcolumn,
                                      int type,
                                      int size,
                                      int prec)
        Change a column in a table of designated data source
        Parameters:
        table - Table name
        oldcolumn - Old column name
        newcolumn - New column name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • changeColumn

        public int changeColumn​(java.lang.String datasource,
                                java.lang.String table,
                                java.lang.String oldcolumn,
                                java.lang.String newcolumn,
                                int type,
                                int size,
                                int prec)
        Change a column in a table of designated data source
        Parameters:
        datasource - Data source name
        table - Table name
        oldcolumn - Old column name
        newcolumn - New column name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • createIndex

        public final java.lang.String createIndex​(java.lang.String datasource,
                                                  java.lang.String table,
                                                  java.lang.String indexName,
                                                  java.lang.String column)
                                           throws java.sql.SQLException
        Create a non-unique database index on single column
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        column - Column
        Throws:
        java.sql.SQLException
      • createIndex

        public final java.lang.String createIndex​(java.lang.String datasource,
                                                  java.lang.String table,
                                                  java.lang.String indexName,
                                                  java.lang.String column,
                                                  boolean apply)
                                           throws java.sql.SQLException
        Create a non-unique database index on single column
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        column - Column
        apply - Apply into DB or only get SQL
        Throws:
        java.sql.SQLException
      • createIndex

        public java.lang.String createIndex​(java.lang.String datasource,
                                            java.lang.String table,
                                            java.lang.String indexName,
                                            java.util.List<java.lang.String> columns,
                                            boolean uniq)
                                     throws java.sql.SQLException
        Create a database index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        columns - Columns
        uniq - Unique?
        Throws:
        java.sql.SQLException
      • createIndex

        public java.lang.String createIndex​(java.lang.String datasource,
                                            java.lang.String table,
                                            java.lang.String indexName,
                                            java.util.List<java.lang.String> columns,
                                            boolean uniq,
                                            boolean apply)
                                     throws java.sql.SQLException
        Create a database index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        columns - Columns
        uniq - Unique?
        apply - Apply into DB or only get SQL
        Throws:
        java.sql.SQLException
      • dropIndex

        public java.lang.String dropIndex​(java.lang.String datasource,
                                          java.lang.String table,
                                          java.lang.String indexName)
                                   throws java.sql.SQLException
        Drop a database index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        Throws:
        java.sql.SQLException
      • dropIndex

        public java.lang.String dropIndex​(java.lang.String datasource,
                                          java.lang.String table,
                                          java.lang.String indexName,
                                          boolean apply)
                                   throws java.sql.SQLException
        Drop a database index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        apply - Apply into DB or only get SQL
        Throws:
        java.sql.SQLException
      • createForeignKeyConstraint

        public java.lang.String createForeignKeyConstraint​(java.lang.String datasource,
                                                           java.lang.String table,
                                                           java.lang.String constraintName,
                                                           java.lang.String fkColumn,
                                                           java.lang.String refTable,
                                                           java.lang.String refColumn)
                                                    throws java.sql.SQLException
        Create a database foreign key constraint
        Parameters:
        datasource - Data source name
        table - Table
        constraintName - Constraint name
        fkColumn - Foreign key column
        refTable - Foreign key referenced table
        refColumn - Foreign key referenced column
        Throws:
        java.sql.SQLException
      • createForeignKeyConstraint

        public java.lang.String createForeignKeyConstraint​(java.lang.String datasource,
                                                           java.lang.String table,
                                                           java.lang.String constraintName,
                                                           java.lang.String fkColumn,
                                                           java.lang.String refTable,
                                                           java.lang.String refColumn,
                                                           boolean apply)
                                                    throws java.sql.SQLException
        Create a database foreign key constraint
        Parameters:
        datasource - Data source name
        table - Table
        constraintName - Constraint name
        fkColumn - Foreign key column
        refTable - Foreign key referenced table
        refColumn - Foreign key referenced column
        apply - Apply into DB or only get SQL
        Throws:
        java.sql.SQLException
      • dropForeignKeyConstraint

        public java.lang.String dropForeignKeyConstraint​(java.lang.String datasource,
                                                         java.lang.String table,
                                                         java.lang.String constraintName)
                                                  throws java.sql.SQLException
        Drop a database foreign key constraint
        Parameters:
        datasource - Data source name
        table - Table
        constraintName - Constraint name
        Throws:
        java.sql.SQLException
      • dropForeignKeyConstraint

        public java.lang.String dropForeignKeyConstraint​(java.lang.String datasource,
                                                         java.lang.String table,
                                                         java.lang.String constraintName,
                                                         boolean apply)
                                                  throws java.sql.SQLException
        Drop a database foreign key constraint
        Parameters:
        datasource - Data source name
        table - Table
        constraintName - Constraint name
        apply - Apply into DB or only get SQL
        Throws:
        java.sql.SQLException
      • getProcessus

        public Processus getProcessus​(java.lang.String name,
                                      java.lang.String pid)
        Gets the specified business process definition instance
        Parameters:
        name - Process name
        pid - Optional PID
        Returns:
        Business process instance
      • createProcessus

        public final Processus createProcessus​(java.lang.String name)
        Create a business process with a new PID
        Parameters:
        name - Process name
        Returns:
        Business process instance
      • getField

        public final ObjectField getField​(java.lang.String name)
        Gets the specified business field definition
        Parameters:
        name - Field name
        Returns:
        Business field instance
      • getField

        public ObjectField getField​(java.lang.String name,
                                    ObjectField f,
                                    boolean cache)
        Gets the specified business field definition
        Parameters:
        name - Field name
        f - Optional field (to load into this instance)
        cache - Cache the field definition or not
        Returns:
        Business field instance
      • loadAction

        public Action loadAction​(java.lang.String actionIdOrName)
        Gets the specified business action definition
        Parameters:
        actionIdOrName - Action id or name
      • getObjectInstances

        public final java.util.List<ObjectDB> getObjectInstances()
        List all objects instantiated for the user
        Returns:
        a list of objects
      • getObjectInstances

        public final java.util.List<ObjectDB> getObjectInstances​(java.lang.String name)
        List all objects instantiated for the user
        Parameters:
        name - optional object name
        Returns:
        a list of objects
      • getObjectInstances

        public java.util.List<ObjectDB> getObjectInstances​(java.lang.String name,
                                                           java.lang.String param,
                                                           java.lang.String value)
        List objects instantiated for the user and/or containing a parameter
        Parameters:
        name - optional object name
        param - optional parameter name
        value - optional parameter value
        Returns:
        a list of objets
      • getObject

        public ObjectDB getObject​(java.lang.String instance,
                                  java.lang.String name)
        Gets the specified business object definition instance
        Parameters:
        instance - Instance name
        name - Object name
        Returns:
        Business object instance
      • getExternalObject

        public ExternalObject getExternalObject​(java.lang.String instance,
                                                java.lang.String name)
        Gets the specified external object definition with a specified instance name
        Parameters:
        instance - External object instance name
        name - External object name
        Returns:
        External object
      • getExternalObject

        public ExternalObject getExternalObject​(java.lang.String name)
        Gets the specified external object definition (instance name is set as name)
        Parameters:
        name - External object name
        Returns:
        External object
      • getMainObject

        public ObjectDB getMainObject​(java.lang.String name)
        Gets the main business object definition instance (instance name is the_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object main instance
      • getPanelObject

        public ObjectDB getPanelObject​(java.lang.String name,
                                       java.lang.String refField)
        Gets the panel business object definition instance (instance name is panel_[ajax_]<object name>_<ref name>)
        Parameters:
        name - Object name
        refField - Reference field name
        Returns:
        Business object panel instance
      • getPanelObject

        @Deprecated(forRemoval=false,
                    since="4.0")
        public final ObjectDB getPanelObject​(java.lang.String name)
        Deprecated.
        Use getPanelObject(name, refField)
      • getRefObject

        public ObjectDB getRefObject​(java.lang.String name)
        Gets the reference business object definition instance (instance name is ref_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object ref instance
      • getDataMapObject

        public ObjectDB getDataMapObject​(java.lang.String name)
        Gets the datamap business object definition instance (instance name is datamap_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object datamap instance
      • getHomeObject

        public ObjectDB getHomeObject​(java.lang.String name)
        Gets the home business object definition instance (instance name is home_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object home instance
      • getBatchObject

        public ObjectDB getBatchObject​(java.lang.String name)
        Gets the batch business object definition instance (instance name is eai_<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object batch instance
      • getWebServiceObject

        public ObjectDB getWebServiceObject​(java.lang.String name)
        Gets the web service business object definition instance (instance name is ws_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object WS instance
      • getAjaxObject

        public ObjectDB getAjaxObject​(java.lang.String name)
        Gets the main Ajax business object definition instance (instance name is the_ajax_<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object AJAX instance
      • getTmpObject

        public ObjectDB getTmpObject​(java.lang.String name)
        Gets the temporary business object definition instance (instance name is tmp_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object tmp instance
      • getIsolatedObject

        public ObjectDB getIsolatedObject​(java.lang.String name)
        Gets a memory isolated business object definition instance (instance name is tmp_<object name>_<timestamp>)
        Beware, the Object GC cron must run to clean periodically the instances
        Parameters:
        name - Object name
        Returns:
        Business object tmp instance
      • getProcessObject

        public ObjectDB getProcessObject​(java.lang.String name)
        Gets the process business object definition instance (instance name is bpm_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object bpm instance
      • getJobObject

        public ObjectDB getJobObject​(java.lang.String name)
        Gets the job business object definition instance (instance name is job_<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object job instance
      • getCronObject

        public ObjectDB getCronObject​(java.lang.String name)
        Gets the cron business object definition instance (instance name is cron_<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object cron instance
      • getTreeviewObject

        public ObjectDB getTreeviewObject​(java.lang.String tree,
                                          java.lang.String name)
        Gets the treeview object definition instance (instance name is tree_[ajax_]<tree name>_<object name>)
        Parameters:
        tree - Tree name
        name - Object name
        Returns:
        Business object treeview instance
      • getAgendaObject

        public ObjectDB getAgendaObject​(java.lang.String name)
        Gets the agenda object definition instance (instance name is agenda_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object agenda instance
      • getModelObject

        public ObjectDB getModelObject​(java.lang.String name,
                                       java.lang.String template)
        Gets the modeler object definition instance (instance name is model_[ajax_]<object name>_<template name>)
        Parameters:
        name - Object name
        template - Template name of node, content or link
        Returns:
        Business object instance
      • getModelObject

        public ObjectDB getModelObject​(java.lang.String name)
      • getMergeObject

        public ObjectDB getMergeObject​(java.lang.String name)
        Gets the merge object definition instance (instance name is merge_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object instance
      • getMergePanelObject

        public ObjectDB getMergePanelObject​(java.lang.String name,
                                            java.lang.String refField)
        Gets the merge panel business object definition instance (instance name is mergepanel_[ajax_]<object name>_<ref name>)
        Parameters:
        name - Object name
        refField - Reference field name
        Returns:
        Business object panel instance
      • getExportObject

        public ObjectDB getExportObject​(java.lang.String name)
        Gets the export object definition instance (instance name is export_<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object export instance
      • getObjectLabel

        public java.lang.String getObjectLabel​(java.lang.String name)
        Object label in user language
        Parameters:
        name - Object name
        Returns:
        Object label
      • getObjectLabel

        public java.lang.String getObjectLabel​(java.lang.String name,
                                               boolean plural)
        Object label in user language
        Parameters:
        name - Object name
        plural - plural if exists
        Returns:
        Object label
      • clearCache

        @Deprecated(forRemoval=true,
                    since="4.0")
        public void clearCache​(boolean memory,
                               boolean core,
                               int preCompile)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use clearCache with cron argument
      • clearCache

        public void clearCache​(boolean memory,
                               boolean core,
                               boolean cron,
                               int preCompile)
        Clears all caches
        Parameters:
        memory - Memory?
        core - Core?
        cron - (Re)start cron?
        preCompile - Pre-compile?
      • getCacheInfo

        public int[] getCacheInfo()
        Get cache info: current and max size of objects
        Returns:
        Cache size info
      • clearCache

        public void clearCache​(java.lang.String login)
        Clears specified user's cache
        Parameters:
        login - User login
      • clearCache

        public void clearCache​(java.lang.String object,
                               java.lang.String instance)
        Clears specified business object's cache (optionally restricted to specified instance) from all users
        Parameters:
        object - Object name
        instance - Optional object instance name (null means all instances of the object)
      • clearCacheSession

        public void clearCacheSession()
        Clears session cache
      • loadLogEvent

        public void loadLogEvent()
        (Re)loads log events
      • loadDisposition

        public void loadDisposition​(java.lang.String disp)
        (Re)loads disposition
      • loadShortcuts

        public void loadShortcuts()
        (Re)loads shortcuts
      • loadResources

        public void loadResources​(java.lang.String obj,
                                  java.lang.String objId)
        (Re)loads resources
      • loadPredefinedSearches

        public void loadPredefinedSearches​(java.lang.String object)
        (Re)loads predefined searches
        Parameters:
        object - optional object name (all if null)
      • prepareExpression

        public java.lang.String prepareExpression​(java.lang.String content)
                                           throws ScriptException
        Prepare an expression by processing token substitutions: (see prepareExpression for details on tokens)
        Overrides:
        prepareExpression in class GrantCore
        Parameters:
        content - Script, template or expression including tokens to substitute
        Throws:
        ScriptException
      • prepareExpression

        public java.lang.String prepareExpression​(java.lang.String content,
                                                  java.lang.String sep,
                                                  boolean inlineValues,
                                                  boolean front)
                                           throws ScriptException
        Prepare an expression by processing token substitutions:
        - URL substitutions (see HTMLTool.prepareURLs for details)
        - [NOW] (deprecated) or [DATE[:day offset]] : current date in service format yyyy-MM-dd (with optional day offset)
        - [TIME[:millisecond offset]] : current time in internal format hh:mm:ss (with optional millisecond offset)
        - [DATETIME[:millisecond offset]] : current datetime in service format yyyy-MM-dd HH:mm:ss (with optional millisecond offset)
        - [YEAR[:year offset]] : current year in format YYYY (with optional year offset)
        - [MONTH] : current month in format MM
        - [WEEK] : current week in format WW
        - [LOV:<list name>:<code>] or [LISTVALUE:<list name>:<code>] : value of a list of values code
        - [TEXT:<code>] : static text in user language
        - [OBJECT:<object name>[:<object instance name>]] : the specified object (by default it uses temporary instance)
        - [OBJECTICON:<object name>] : the specified object's icon code
        - [VERSION[:<module name>]] : the specified module's version or the value of the VERSION system parameter
        NB : It first calls GrantCore.prepareExpression()
        Overrides:
        prepareExpression in class GrantCore
        Parameters:
        content - Script, template or expression including tokens to substitute
        sep - separator for String
        inlineValues - Replace with explicit value or with API. Ex: [LOGIN] will be replaced with explicit user login, or replaced by obj.getGrant().getLogin()
        Returns:
        Prepared expression
        Throws:
        ScriptException
      • prepareSQL

        public java.lang.String prepareSQL​(java.lang.String sql)
        Prepares a SQL statement applying following token substitutions:
        - [now] : current date (in appropriate format for target database)
        - [userid] : user ID
        - [login] : user login
        - [<lov>:<code>] : List of values value for code (surrounded by SQL quotes)
        NB : It first calls GrantCore.prepareSQL()
        Overrides:
        prepareSQL in class GrantCore
        Parameters:
        sql - SQL including tokens to substitute
        Returns:
        Prepared SQL statement
      • clearListOfValuesCache

        public void clearListOfValuesCache()
        Clears all lists of values from cache
      • clearListOfValuesCache

        public void clearListOfValuesCache​(java.lang.String name)
        Clears specified list of values from cache
        Parameters:
        name - List of values name
      • loadListOfValues

        public ListOfValuesData loadListOfValues​(ListOfValues lov,
                                                 java.lang.String lang,
                                                 java.lang.String name)
        Loads specified list of values with values in specified language. This method should not be used for common needs, the getListOfvalues() method should be used instead.
        Parameters:
        lov - List of values container to use
        name - List of values name
        Returns:
        List of values
      • getListOfValues

        public ListOfValues getListOfValues​(java.lang.String name)
        Get a new list of value container for specified name
        Parameters:
        name - List of value name
        Returns:
        List of value container
      • getLangsCodes

        public java.lang.String[] getLangsCodes()
        Shorthand that returns all available languages codes from the LANG list of values
        Returns:
        Array of available language codes
      • getLangsValues

        public java.lang.String[] getLangsValues()
        Shorthand that returns all available languages translated values from the LANG list of values
        Returns:
        Array of available language translated values
      • getListOfValuesValue

        public java.lang.String getListOfValuesValue​(java.lang.String name,
                                                     java.lang.String code)
        Shorthand that returns translated value from the specified list of values fro the specified code
        Parameters:
        name - List of values name
        code - Code
        Returns:
        Translated value for code
      • getLang_ISO_639_1

        public java.lang.String getLang_ISO_639_1​(java.lang.String lang)
        Set and get the ISO-639-1 code for specified internal language code
        Parameters:
        lang - Internal language code (3 digits uppercase, e.g. ENU)
        Returns:
        ISO639-1 language code (2 digits, e.g. en)
      • getLang_ISO_639_1

        public java.lang.String getLang_ISO_639_1()
        Get the ISO-639-1 code for the user's language
        Returns:
        ISO-639-1 language code (2 digits, e.g. en)
      • getEndpoint

        public int getEndpoint()
        Get endpoint (UI, API, I/O, Git)
        Returns:
        One of Globals.ENDPOINT_*
      • getEndpointName

        public java.lang.String getEndpointName()
        Get endpoint name
        Returns:
        One of the Globals.ENDPOINT_NAME array's value or null
      • isSystemEndpoint

        public boolean isSystemEndpoint()
        Is on the system endpoint?
        Returns:
        True if on the system endpoint
      • isUIEndpoint

        public boolean isUIEndpoint()
        Is on the UI endpoint?
        Returns:
        True if on the UI endpoint
      • isUIPublicEndpoint

        public boolean isUIPublicEndpoint()
        Is on the UI public endpoint?
        Returns:
        True if on the UI public endpoint
      • isAPIEndpoint

        public boolean isAPIEndpoint()
        Is on the API endpoint?
        Returns:
        True if on the API endpoint
      • isIOEndpoint

        public boolean isIOEndpoint()
        Is on the I/O endpoint?
        Returns:
        True if on the I/O endpoint
      • isGitEndpoint

        public boolean isGitEndpoint()
        Is on the Git endpoint?
        Returns:
        True if on the Git endpoint
      • isCronEndpoint

        public boolean isCronEndpoint()
        Is on the cron table endpoint?
        Returns:
        True if on the cron table endpoint
      • loadListOfValues

        public ListOfValuesData loadListOfValues​(ListOfValues lov,
                                                 java.lang.String name,
                                                 java.lang.String datasource,
                                                 java.lang.String sql)
        Loads specified list of values from a dedicated SQL statement (on specified datasource). This method should not be used for common needs, the getListOfvalues() method should be used instead.
        Parameters:
        lov - List of values container to use
        name - List of values name
        datasource - Data source name (null means default datasource)
        sql - SQL statement
      • getListOfValues

        public ListOfValues getListOfValues​(java.lang.String name,
                                            java.lang.String sql)
        Get list for specified name and SQL statement
      • getListOfValues

        public ListOfValues getListOfValues​(java.lang.String name,
                                            java.lang.String datasource,
                                            java.lang.String sql)
        Get list for specified name and SQL statement on specified datasource
      • getListOfValuesCode

        public java.lang.String getListOfValuesCode​(java.lang.String name,
                                                    java.lang.String value,
                                                    java.lang.String lang)
        Get the corresponding code from a list of values that matches a specified value (with a like value% operator)
        Parameters:
        name - List of values name
        value - Value to search
        lang - Language of value
        Returns:
        Code for value in the list of values
      • getLinkedListsOfValues

        public java.util.Map<java.lang.String,​ObjectFieldList.ListLink> getLinkedListsOfValues​(ObjectDB obj,
                                                                                                     ObjectFieldList flist)
        Returns linked lists for a contextual list field in an object
        Parameters:
        obj - Object
        flist - Contextual list field
      • registerMetaObjectField

        public void registerMetaObjectField​(java.lang.String object,
                                            java.lang.String field)
        Register a meta-object field
        Parameters:
        object - Object containing the object field
        field - TYPE_OBJECT field
      • getMetaObjectFields

        public java.util.List<java.lang.String> getMetaObjectFields()
        Get the all Meta-object fields
        Returns:
        list of object:inputs
      • updateMetaObjects

        public java.util.List<java.lang.String> updateMetaObjects​(java.lang.String oldObject,
                                                                  java.lang.String oldRowId,
                                                                  java.lang.String newObject,
                                                                  java.lang.String newRowId,
                                                                  boolean deleted,
                                                                  boolean checkOnly)
        Update meta-object fields
        Parameters:
        oldObject - Old object name
        oldRowId - Old row ID of the updated element
        newObject - New object name
        newRowId - New row ID of the updated element
        deleted - Row ID has been deleted ?
        checkOnly - true to check if update is allowed
        Returns:
        errors or null
      • isCronStarted

        public boolean isCronStarted()
        Start cron table
      • startCron

        public boolean startCron​(boolean lock)
        Start cron table
        Parameters:
        lock - true to unlock anyway and to lock with this platform
        Returns:
        false if cron could not be started (or was already started)
      • stopCron

        public boolean stopCron​(boolean unlock)
        Stop cron table
        Parameters:
        unlock - true to unlock if the cron has been launched by this platform
        Returns:
        false if cron could not be stopped (or was already stopped)
      • getView

        public View getView​(java.lang.String name)
        Get a view definition
        Parameters:
        name - View name
        Returns:
        View or null if not exists
      • changeScope

        public boolean changeScope​(java.lang.String view)
        Change the user home page + disposition + responsibilities
        Parameters:
        view - new Home name or null to restore rights
        Returns:
        true on success
      • changeLang

        public boolean changeLang​(java.lang.String lang,
                                  boolean pref)
        Change the user language
        Parameters:
        lang - Language FRA, ENU...
        pref - true to update also the preferred language
        Returns:
        true on success
      • canConnectAs

        public boolean canConnectAs()
        User can reconnect with any login?
        Returns:
        true if "god mode" is enables and granted (using GOD_MODE_USER system parameter)
      • canConnectAs

        public boolean canConnectAs​(java.lang.String clientId,
                                    java.lang.String login)
        Can reconnect with a specific login?
        Parameters:
        clientId - Unique client Id
        login - Connect as login
        Returns:
        true if granted ("god mode" enabled and granted or already logged with this login)
      • getUserSystemParam

        public java.lang.String getUserSystemParam​(java.lang.String param)
        Get current user's system parameter
        Parameters:
        param - Parameter name
        Returns:
        User's system parameter value if it exists
      • getUserSystemParam

        public static java.lang.String getUserSystemParam​(java.lang.String login,
                                                          java.lang.String param)
        Get a user's system parameter
        Parameters:
        login - User login
        param - Parameter name
        Returns:
        User's system parameter value if it exists
      • setUserSystemParam

        public void setUserSystemParam​(java.lang.String param,
                                       java.lang.String value,
                                       boolean clearCache)
        Upsert current user's system parameter
        Parameters:
        param - Parameter name
        value - Parameter value, null deletes the user's system parameter
        clearCache - Clear current user's cache?
      • setUserSystemParam

        public void setUserSystemParam​(java.lang.String login,
                                       java.lang.String param,
                                       java.lang.String value,
                                       boolean clearCache)
        Upsert a user's system parameter
        Parameters:
        login - User login
        param - Parameter name
        value - Parameter value, null deletes the user's system parameter
        clearCache - Clear the user's cache?
      • removeUserSystemParam

        public void removeUserSystemParam​(java.lang.String param,
                                          boolean clearCache)
        Delete current user's system parameter
        Parameters:
        param - Parameter name
        clearCache - Clear current user's cache?
      • removeUserSystemParam

        public void removeUserSystemParam​(java.lang.String login,
                                          java.lang.String param,
                                          boolean clearCache)
        Delete a user's system parameter
        Parameters:
        login - User login
        param - Parameter name
        clearCache - Clear the user's cache?
      • setRespEnable

        public void setRespEnable​(java.lang.String login,
                                  java.lang.String group,
                                  boolean enabled,
                                  boolean resetCache)
        Enable a user responsibility (update the end date)
        Parameters:
        login - User login
        group - Group name
        enabled - true to set the end date to null, or false to set the end date to yesterday
        resetCache - true to clear the user cache
      • getPreferenceList

        public Preference getPreferenceList​(java.lang.String object)
        Parse the LIST_PREFS
        Parameters:
        object - Object name
        Returns:
        List preference
      • setPreferenceList

        public void setPreferenceList​(java.lang.String object,
                                      java.lang.String data)
        Store List preference
        Parameters:
        object - Object name
        data - List of Fields to display
      • getPreferenceSearch

        public Preference getPreferenceSearch​(java.lang.String object)
        Parse the SEARCH_PREFS
        Parameters:
        object - Object name
        Returns:
        Search preference
      • setPreferenceSearch

        public void setPreferenceSearch​(java.lang.String object,
                                        java.lang.String data)
        Store Search preference
        Parameters:
        object - Object name
        data - List of Fields to display
      • getPreferenceAction

        public Preference getPreferenceAction​(java.lang.String object)
        Parse the ACTION_PREFS
        Parameters:
        object - Object name
        Returns:
        Action preference
      • setPreferenceAction

        public void setPreferenceAction​(java.lang.String object,
                                        java.lang.String data)
        Store Actions preference
        Parameters:
        object - Object name
        data - List of Actions to display
      • getPreferenceShortcut

        public Preference getPreferenceShortcut()
        List visible shortcuts
      • setPreference

        @Deprecated(forRemoval=true,
                    since="4.0")
        public void setPreference​(java.lang.String param,
                                  java.lang.String target,
                                  java.lang.String prefs)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Does nothing, use the Preference class
      • beginTransaction

        public final void beginTransaction()
        Start a transaction
      • beginTransaction

        public void beginTransaction​(java.lang.String datasource)
        Start a transaction
      • commitTransaction

        public final void commitTransaction()
        Commit and close the transaction
      • commitTransaction

        public void commitTransaction​(java.lang.String datasource)
        Commit and close the transaction
      • rollbackTransaction

        public void rollbackTransaction()
        Rollback and close the transaction
      • rollbackTransaction

        public void rollbackTransaction​(java.lang.String datasource)
        Rollback and close the transaction
      • addResponsibility

        public static boolean addResponsibility​(java.lang.String userId,
                                                java.lang.String groupName,
                                                java.lang.String startDate,
                                                java.lang.String endDate,
                                                boolean active,
                                                java.lang.String module)
        Add responsibility for the user
        Parameters:
        userId - user Id
        groupName - Group name
        startDate - Start date (internal format) for responsibility (today if null)
        endDate - End date (internal format) for responsibility (can be null)
        active - is enabled ?
        module - Optional module name
        Returns:
        True if responsibility was successfully added
      • addResponsibility

        public static boolean addResponsibility​(java.lang.String userId,
                                                java.lang.String groupName)
        Add responsibility for the user (active, with current date as start date, no end date, using same module as the user)
        Parameters:
        userId - user Id
        groupName - Group name
        Returns:
        True if responsibility was successfully added
      • addResponsibility

        public boolean addResponsibility​(java.lang.String groupName,
                                         java.lang.String startDate,
                                         java.lang.String endDate,
                                         boolean active,
                                         java.lang.String module)
        Add responsibility for the user
        Parameters:
        groupName - Group name
        startDate - Start date (yyyy-MM-dd or null=today)
        endDate - End date (yyyy-MM-dd or can be null)
        active - is enabled ?
        module - Module name
        Returns:
        True if responsibility was successfully added
      • addResponsibility

        public boolean addResponsibility​(java.lang.String groupName)
        Add responsibility for the user (active, with current date as start date, no end date, using same module as the user)
        Parameters:
        groupName - Group name
        Returns:
        True if responsibility was successfully added
      • removeResponsibility

        public static boolean removeResponsibility​(java.lang.String userId,
                                                   java.lang.String groupName)
        Remove responsibility for the specified user ID
        Parameters:
        userId - user Id
        groupName - Group name (if empty removes all groups)
        Returns:
        True if responsibility was successfully removed
      • removeResponsibility

        public boolean removeResponsibility​(java.lang.String groupName)
        Remove responsibility for the user
        Parameters:
        groupName - Group name
        Returns:
        True if responsibility was successfully removed
      • removeAllResponsibilities

        public static boolean removeAllResponsibilities​(java.lang.String userId)
        Remove all the responsibilities for the specified user ID
        Parameters:
        userId - user Id
        Returns:
        True if all responsibilities were successfully removed
      • removeAllResponsibilities

        public boolean removeAllResponsibilities()
        Remove all the responsibilities for the user
        Returns:
        True if all responsibilities were successfully removed
      • changePassword

        public java.lang.String changePassword​(java.lang.String login,
                                               java.lang.String password,
                                               boolean validate,
                                               boolean forceChange)
        Change password for specified login
        Parameters:
        login - Login (if empty current user login is used)
        password - Password (if empty random password is used)
        validate - Validate password ?
        forceChange - Force password change?
        Returns:
        Plain text password
      • isResponsive

        @Deprecated(forRemoval=true,
                    since="4.0")
        public boolean isResponsive()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Always true
      • getUserAgent

        public java.lang.String getUserAgent()
        Get browser user-agent. Note: this is retrieved from the session, thus not applicable for an API grant.
        Returns:
        Browser user agent if available
      • getRemoteAddress

        public java.lang.String getRemoteAddress()
        Get remote address. Note: this is retrieved from the session, thus not applicable for an API grant.
        Returns:
        Remote address if available
      • getPictureURL

        public java.lang.String getPictureURL()
        Get user picture URL
      • getPictureThumbnailURL

        public java.lang.String getPictureThumbnailURL()
        Get user picture thumbnail URL
      • getMobileDisp

        public java.lang.String getMobileDisp()
      • setDirectScope

        public java.lang.String setDirectScope​(java.lang.String url,
                                               java.lang.String scope,
                                               java.lang.Boolean mobile)
        Manage direct, mobile and scope access
        Parameters:
        url - Direct URL
        scope - Scope URL
        mobile - Mobile usage ?
        Returns:
        Work URL
      • getTranslateId

        public static java.lang.String getTranslateId​(char type,
                                                      java.lang.String rowId,
                                                      java.lang.String lang)
        Get translation row ID
        Parameters:
        type - Translation type
        rowId - Target row ID
        lang - Language
        Returns:
        Row ID of translation
      • getTranslateFieldId

        public static java.lang.String getTranslateFieldId​(java.lang.String rowId,
                                                           java.lang.String lang)
        Get field translation row ID
        Parameters:
        rowId - Field row ID
        lang - Language
        Returns:
        Row ID of field translation
      • getTranslateObjectId

        public static java.lang.String getTranslateObjectId​(java.lang.String rowId,
                                                            java.lang.String lang)
        Get business object translation row ID
        Parameters:
        rowId - Business object row ID
        lang - Language
        Returns:
        Row ID of business object translation
      • getTranslateProcessId

        public static java.lang.String getTranslateProcessId​(java.lang.String rowId,
                                                             java.lang.String lang)
        Get business process translation row ID
        Parameters:
        rowId - Business process row ID
        lang - Language
        Returns:
        Row ID of business object translation
      • getTranslateExternalId

        public static java.lang.String getTranslateExternalId​(java.lang.String rowId,
                                                              java.lang.String lang)
        Get external object translation row ID
        Parameters:
        rowId - External object row ID
        lang - Language
        Returns:
        Row ID of external object translation
      • setUserFilters

        public void setUserFilters​(UserSessionFilters uf)
        Assign global filters to user's session
        Parameters:
        uf - User filters
      • getUserFilters

        public UserSessionFilters getUserFilters()
        Get global filters of user's session
      • getBookmarks

        public Bookmarks getBookmarks()
        User's bookmarks
        Returns:
        Bookmarks instance
      • toJSONObject

        public org.json.JSONObject toJSONObject​(boolean resps,
                                                boolean sysparams)
        To JSON object
        Overrides:
        toJSONObject in class GrantCore
        Parameters:
        resps - Responsibilities?
        sysparams - System parameters?
        Returns:
        grant as JSON object
      • toJSONMenu

        public java.lang.String toJSONMenu​(boolean embedded)
        Menu as JSON
        Parameters:
        embedded - embedded in parent json?
        Returns:
        JSON
      • toJSON

        public java.lang.String toJSON​(boolean inlinePicture,
                                       boolean web,
                                       boolean texts,
                                       boolean inapp,
                                       java.lang.String acceptLang,
                                       boolean embedded)
        Full grant data as JSON string
        Parameters:
        inlinePicture - Inline picture content ?
        web - Add web menu, parameters... ?
        texts - inline static TEXTs with web properties ?
        inapp - in hybrid application (cordova)
        embedded - Embedded ?
        acceptLang - Accept language
        Returns:
        JSON string
      • toJSONApps

        public java.lang.String toJSONApps()
        Get home pages (scopes) as JSON string
        Returns:
        JSON string
      • toJSONShortcuts

        public java.lang.String toJSONShortcuts()
        Shortcuts as JSON string
        Returns:
        JSON string
      • toJSONTexts

        public java.lang.String toJSONTexts​(java.lang.String regex)
        Get all matching texts as a JSON object
        Parameters:
        regex - Optional filtering regular expression on codes