Class Grant

  • All Implemented Interfaces:
    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
      • 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 init
        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

      • getSession

        public javax.servlet.http.HttpSession getSession()
        Get session (if available)
      • setSession

        public void setSession​(javax.servlet.http.HttpSession session)
        Set session
      • getSessionTimeout

        public int getSessionTimeout()
        Get session timeout (in seconds if available)
      • getSessionInfo

        public SessionInfo getSessionInfo()
        Get session info with AUTH 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
      • getAPI

        public APITool getAPI​(java.lang.String url,
                              java.lang.String login,
                              java.lang.String password,
                              java.lang.String encoding)
                       throws java.lang.Exception
        Get Simplicite API client
        Parameters:
        url - Base URL
        login - Login
        password - Password
        encoding - Encoding
        Throws:
        java.lang.Exception
      • getContextPath

        @Deprecated
        public java.lang.String getContextPath()
        Deprecated.
      • setContextPath

        @Deprecated
        public void setContextPath​(java.lang.String contextPath)
        Deprecated.
      • getContextURL

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

        public void setContextURL​(java.lang.String u)
        Set the web application URL
      • getServerURL

        public java.lang.String getServerURL()
        Get server URL (context URL with context path removed)
      • 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)
      • 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

        public void reinit​(java.lang.String login,
                           java.lang.String sessionId,
                           int endpoint,
                           boolean web,
                           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)
        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()
        Singleton to use public objects
        Returns:
        Public user rights
      • destroy

        public void destroy()
        To destroy properly a user session
      • 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.lang.Exception
        Database query with column names using default datasource
        Parameters:
        query - SQL query with hosts values
        Returns:
        list of string array
        Throws:
        java.lang.Exception
      • 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.lang.Exception
        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.lang.Exception
      • 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.lang.Exception
        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.lang.Exception
      • 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
      • 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
      • 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
      • simpleBlob

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

        public final java.io.InputStream simpleBlob​(java.lang.String query,
                                                    java.util.List<ObjectField> host,
                                                    java.lang.String path)
                                             throws java.lang.Exception
        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
        Throws:
        java.lang.Exception
      • simpleBlob

        public java.io.InputStream simpleBlob​(java.lang.String datasource,
                                              java.lang.String query,
                                              java.util.List<ObjectField> host,
                                              java.lang.String path)
                                       throws java.lang.Exception
        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
        Throws:
        java.lang.Exception
      • 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 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
        public final java.lang.String now​(int what)
        Deprecated.
        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
        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               boolean priv)
        Deprecated.
        Use setSystemParam with additional parameters
      • setSystemParam

        public java.lang.String setSystemParam​(java.lang.String code,
                                               java.lang.String value,
                                               boolean priv,
                                               boolean clearcache)
        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 ?
        clearcache - Partial clear cache for system parameter ?
        Returns:
        System parameter Id
      • 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 datasource
      • getDBVendor

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

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

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

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

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

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

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

        @Deprecated
        public final java.lang.String getNow()
        Deprecated.
        Use getDBNow
      • getDBDate

        public java.lang.String getDBDate()
        Get the DB current date of default datasource
      • getDBDate

        public java.lang.String getDBDate​(java.lang.String datasource)
        Get the DB current date of designated datasource
        Parameters:
        datasource - Data source name
      • getDBNow

        public java.lang.String getDBNow()
        Get the DB syntax of default datasource to retrieve the current date
        Returns:
        sysdate, now(), currenttimestamp...
      • getDBNow

        public java.lang.String getDBNow​(java.lang.String datasource)
        Get the DB syntax of designated datasource to retrieve the current date
        Parameters:
        datasource - Data source name
        Returns:
        sysdate, now(), currenttimestamp...
      • 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 - Datasource
        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 datasource
        Parameters:
        date - yyyy-MM-dd
        Returns:
        db format
      • getDBToDate

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

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

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

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

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

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

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

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

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

        public int update​(java.lang.String query,
                          java.util.List<ObjectField> hosts)
        SQL update in database using default datasource with hosts values
        Parameters:
        query - SQL insert/update/delete query
        hosts - ObjectField list
        Returns:
        negative 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 datasource with hosts values
        Parameters:
        datasource - Data source name
        query - SQL insert/update/delete query
        hosts - ObjectField list
        Returns:
        negative 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.lang.Exception
        SQL update in database using designated datasource with hosts values
        Parameters:
        datasource - Data source name
        query - SQL insert/update/delete query
        hosts - ObjectField list
        silent - Silent mode (throw exception)
        Returns:
        negative if an error occurs
        Throws:
        java.lang.Exception
      • updateAll

        public int updateAll​(java.util.List<java.lang.String> queries)
        SQL transactional updates in database using default datasource
        Parameters:
        queries - ordered insert/update/delete queries
        Returns:
        negative 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 datasource
        Parameters:
        datasource - Data source name
        queries - ordered insert/update/delete queries
        Returns:
        negative if an error occurs
      • callProcedure

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

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

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

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

        public boolean checkTable​(java.lang.String datasource,
                                  java.lang.String table)
        Checks if a table exists in designated datasource
        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 datasource
        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 datasource
        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
        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 datasource
        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 int renameTable​(java.lang.String oldname,
                               java.lang.String newname)
        Rename table
        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 of designated datasource
        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 datasource
        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 datasource
        Parameters:
        datasource - Datasource
        table - Table name
        column - Column name
        type - Field type (one of ObjectField.TYPE_*)
        size - Size
        prec - Precision
      • changeColumn

        public 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 datasource
        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 datasource
        Parameters:
        datasource - Datasource
        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.lang.Exception
        Create a non-unique DB index on single column
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        column - Column
        Throws:
        java.lang.Exception
      • 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.lang.Exception
        Create a DB index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        columns - Columns
        uniq - Unique?
        Throws:
        java.lang.Exception
      • dropIndex

        public java.lang.String dropIndex​(java.lang.String datasource,
                                          java.lang.String table,
                                          java.lang.String indexName)
                                   throws java.lang.Exception
        Drop a DB index
        Parameters:
        datasource - Data source name
        table - Table
        indexName - Index name
        Throws:
        java.lang.Exception
      • 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.lang.Exception
        Create a DB 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.lang.Exception
      • dropForeignKeyConstraint

        public java.lang.String dropForeignKeyConstraint​(java.lang.String datasource,
                                                         java.lang.String table,
                                                         java.lang.String constraintName)
                                                  throws java.lang.Exception
        Drop a DB foreign key constraint
        Parameters:
        datasource - Data source name
        table - Table
        constraintName - Constraint name
        Throws:
        java.lang.Exception
      • 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 name)
        Gets the specified external object definition
        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
        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)
        Gets the modeler object definition instance (instance name is model_[ajax_]<object name>)
        Parameters:
        name - Object name
        Returns:
        Business object 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

        public void clearCache​(boolean memory,
                               boolean core,
                               int preCompile)
        Clears all caches
      • getCacheInfo

        public int[] getCacheInfo()
        Get cache info: current and max size of objects and grants
      • 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
      • loadWebZones

        public void loadWebZones()
        (Re)loads web zones
      • loadResources

        public void loadResources​(java.lang.String obj,
                                  java.lang.String objId)
        (Re)loads resources
      • 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)
        - [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)
        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
      • getListOfValues

        public ListOfValues getListOfValues​(java.lang.String name)
        Get list for specified name
      • getLangsCodes

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

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

        public java.lang.String getListOfValuesValue​(java.lang.String name,
                                                     java.lang.String code)
        Shorthand that returns display value from the specified list of values fro the specified code
      • getLang_ISO_639_1

        public java.lang.String getLang_ISO_639_1​(java.lang.String lang)
        Get the ISO639-1 code for specified language
      • getLang_ISO_639_1

        public java.lang.String getLang_ISO_639_1()
        Get the ISO639-1 code user language
      • getEndpoint

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

        public boolean isSystemEndpoint()
        Is on the system endpoint?
      • isUIEndpoint

        public boolean isUIEndpoint()
        Is on the UI endpoint?
      • isUIPublicEndpoint

        public boolean isUIPublicEndpoint()
        Is on the UI public endpoint?
      • isAPIEndpoint

        public boolean isAPIEndpoint()
        Is on the UI endpoint?
      • isIOEndpoint

        public boolean isIOEndpoint()
        Is on the UI endpoint?
      • isGitEndpoint

        public boolean isGitEndpoint()
        Is on the UI endpoint?
      • isCronEndpoint

        public boolean isCronEndpoint()
        Is 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 input)
        Register a meta-object field
        Parameters:
        object - Object containing the object field
        input - 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
      • getUserSystemParam

        public 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:
        Parameter value if it exists
      • setUserSystemParam

        public void setUserSystemParam​(java.lang.String login,
                                       java.lang.String param,
                                       java.lang.String value,
                                       boolean resetCache)
        Upsert a user's system parameter
        Parameters:
        login - User login
        param - Parameter name
        value - Parameter value
        resetCache - true to clear the user cache
      • removeUserSystemParam

        public void removeUserSystemParam​(java.lang.String login,
                                          java.lang.String param,
                                          boolean resetCache)
        Delete a user's system parameter
        Parameters:
        login - User login
        param - Parameter name
        resetCache - true to clear the user 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
      • getPreferenceExtra

        public Preference getPreferenceExtra()
        Parse the EXTRA_PREFS
        Returns:
        Extra preference
      • setPreferenceExtra

        public void setPreferenceExtra​(java.lang.String data)
        Store Extra gadgets preference
        Parameters:
        data - List of gadgets to display
      • getPreferenceShortcut

        public Preference getPreferenceShortcut()
        List visible shortcuts
      • setPreference

        @Deprecated
        public void setPreference​(java.lang.String param,
                                  java.lang.String target,
                                  java.lang.String prefs)
        Deprecated.
      • 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 - Module name
        Returns:
        true if succesful
      • 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
      • removeResponsibility

        public static boolean removeResponsibility​(java.lang.String userId,
                                                   java.lang.String groupName)
        Remove responsibility for the user
        Parameters:
        userId - user Id
        groupName - Group name
        Returns:
        true if succesful
      • removeResponsibility

        public boolean removeResponsibility​(java.lang.String groupName)
        Remove responsibility for the user
        Parameters:
        groupName - Group name
        Returns:
        true if succesful
      • changePassword

        @Deprecated
        public java.lang.String changePassword​(java.lang.String login,
                                               java.lang.String password,
                                               boolean forceChange)
        Deprecated.
        Use changePassword with addtional arguments
      • 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

        public boolean isResponsive()
        Is user on responsive UI ?
      • isMobile

        @Deprecated
        public boolean isMobile()
        Deprecated.
        use isResponsive
      • getUserAgent

        public java.lang.String getUserAgent()
        Get browser user-agent
      • getPictureURL

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

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

        public Navigator getNavigator()
        Get navigator
        Returns:
        Navigator
      • 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
      • toJSONObject

        public org.json.JSONObject toJSONObject​(boolean resps,
                                                boolean sysparams)
        Description copied from class: GrantCore
        Generates a JSON object representation of grant
        Overrides:
        toJSONObject in class GrantCore
        Parameters:
        resps - Add responsibilities
        sysparams - Add system parameters
        Returns:
        grant as JSON object