Class ScriptedObjectDB

  • All Implemented Interfaces:
    com.simplicite.util.engine.CacheInterface, java.io.Serializable
    Direct Known Subclasses:
    ObjectService

    public class ScriptedObjectDB
    extends ObjectDB
    Business object stored in database with scripted implementation
    See Also:
    Serialized Form
    • Field Detail

      • SCRIPTED_HOOKS

        public static final java.util.List<java.lang.String> SCRIPTED_HOOKS
        Scripted hooks list
    • Constructor Detail

      • ScriptedObjectDB

        public ScriptedObjectDB()
    • Method Detail

      • evalExpression

        public java.lang.Object evalExpression​(java.lang.String expr,
                                               int context,
                                               java.lang.String[] row,
                                               java.util.Map<java.lang.String,​java.lang.Object> in,
                                               java.util.Map<java.lang.String,​java.lang.Object> out)
                                        throws ScriptException
        Description copied from class: ObjectCore
        Prepare and evaluate an expression (see prepareExpression for details on tokens)
        Overrides:
        evalExpression in class ObjectCore
        Parameters:
        expr - Expression
        context - Context
        row - Row (null means selected item)
        in - Input variables to set before expression evaluation
        out - Output variables to retrieve after expression evaluation
        Returns:
        Expression evaluation result
        Throws:
        ScriptException
      • checkExpression

        public void checkExpression​(java.lang.String expr)
                             throws ScriptException
        Description copied from class: ObjectCore
        Prepares an expression and apply structural and elementary syntax checks, this method is only intended to this basic usage
        Overrides:
        checkExpression in class ObjectCore
        Parameters:
        expr - Expression
        Throws:
        ScriptException
      • postLoad

        public void postLoad()
        Description copied from class: ObjectDB
        Hook called after loading the object definition
        Overrides:
        postLoad in class ObjectDB
      • initCopy

        public void initCopy()
        Description copied from class: ObjectDB
        Hook to init the copy
        Overrides:
        initCopy in class ObjectDB
      • initCreate

        public void initCreate()
        Description copied from class: ObjectDB
        Hook to init the creation
        Overrides:
        initCreate in class ObjectDB
      • initUpdate

        public void initUpdate()
        Description copied from class: ObjectDB
        Hook to init the update
        Overrides:
        initUpdate in class ObjectDB
      • initDelete

        public void initDelete()
        Description copied from class: ObjectDB
        Hook to init the Delete before delete dialog
        Overrides:
        initDelete in class ObjectDB
      • initList

        public void initList​(ObjectDB parent)
        Description copied from class: ObjectDB
        Hook to init the list
        Overrides:
        initList in class ObjectDB
        Parameters:
        parent - Optional parent object
      • initRefSelect

        public void initRefSelect​(ObjectDB parent)
        Description copied from class: ObjectDB
        Hook to init the reference selection
        Overrides:
        initRefSelect in class ObjectDB
        Parameters:
        parent - Parent object (from which selection is made)
      • initAssociate

        public void initAssociate​(ObjectDB parent)
        Description copied from class: ObjectDB
        Hook to init the association
        Overrides:
        initAssociate in class ObjectDB
        Parameters:
        parent - Parent object (from which association is made)
      • initDataMapSelect

        public void initDataMapSelect​(java.lang.String dataMapName,
                                      ObjectDB parent)
        Description copied from class: ObjectDB
        Hook to init the data mapping selection
        Overrides:
        initDataMapSelect in class ObjectDB
        Parameters:
        dataMapName - Data mapping name
        parent - Parent object (from which selection is made)
      • initExport

        public void initExport()
        Description copied from class: ObjectDB
        Hook to init the Export before export dialog
        Overrides:
        initExport in class ObjectDB
      • initCrosstab

        public void initCrosstab​(java.lang.String crosstabName)
        Description copied from class: ObjectDB
        Hook to init a pivot table
        Overrides:
        initCrosstab in class ObjectDB
        Parameters:
        crosstabName - Pivot table name
      • initPrintTemplate

        public void initPrintTemplate​(java.lang.String printTemplateName)
        Description copied from class: ObjectDB
        Hook to init a publication template
        Overrides:
        initPrintTemplate in class ObjectDB
        Parameters:
        printTemplateName - Publication template name
      • initAgenda

        public void initAgenda​(Agenda agenda)
        Description copied from class: ObjectDB
        Hook to init an agenda
        Overrides:
        initAgenda in class ObjectDB
        Parameters:
        agenda - Agenda
      • initPlaceMap

        public void initPlaceMap​(PlaceMap placemap)
        Description copied from class: ObjectDB
        Hook to init a place map
        Overrides:
        initPlaceMap in class ObjectDB
        Parameters:
        placemap - Place map
      • initSearch

        public void initSearch()
        Description copied from class: ObjectDB
        Hook to init the search
        Overrides:
        initSearch in class ObjectDB
      • initAction

        public void initAction​(Action action)
        Description copied from class: ObjectDB
        Hook to init the Action fields before the confirm dialog.
        • By default field belonging to object are read only to confirm the value
        • Other fields are updatable and sent to the callback method(Map) with pairs of name:value
        Overrides:
        initAction in class ObjectDB
        Parameters:
        action - Action definition
      • preValidateSearch

        public java.util.List<java.lang.String> preValidateSearch()
        Description copied from class: ObjectDB
        Hook called before search validation with the fields filters
        It may be useful to check filters
        Overrides:
        preValidateSearch in class ObjectDB
      • postValidateSearch

        public java.util.List<java.lang.String> postValidateSearch()
        Description copied from class: ObjectDB
        Hook called after search validation with the fields filters
        It may be useful to check filters
        Overrides:
        postValidateSearch in class ObjectDB
      • preValidate

        public java.util.List<java.lang.String> preValidate()
        Description copied from class: ObjectDB
        Hook called before system validation
        It may be useful to force/calculate mandatory values
        Overrides:
        preValidate in class ObjectDB
        Returns:
        Error list, or empty/null when no business error
      • postValidate

        public java.util.List<java.lang.String> postValidate()
        Description copied from class: ObjectDB
        Hook called after system validation
        It may be useful to check specific rules before update
        Overrides:
        postValidate in class ObjectDB
        Returns:
        Error list, or empty/null when no business error
      • preStateTransition

        public java.util.List<java.lang.String> preStateTransition​(java.lang.String fromStatus,
                                                                   java.lang.String toStatus)
        Description copied from class: ObjectDB
        Hook called just before pre validate hook in case of a state transition
        It may be useful to isolate specific state transition pre validation rules from other pre validation rules
        Overrides:
        preStateTransition in class ObjectDB
        Parameters:
        fromStatus - From status
        toStatus - To status
        Returns:
        Error list, or empty/null when no business error
      • getCount

        public long getCount​(int maxRows)
        Description copied from class: ObjectDB
        Return the records count with the current search specification and filters
        Overrides:
        getCount in class ObjectDB
        Parameters:
        maxRows - Explicit maximum nb of rows when paginated, to be set to 0 for user's min/max row setting usage
        Returns:
        Number of records of object search
      • preCount

        public void preCount()
        Description copied from class: ObjectDB
        Hook called before count with the fields filters (by default it calls the preSearch hook)
        It may be useful to add some specific filters
        Overrides:
        preCount in class ObjectDB
      • preSearch

        public void preSearch()
        Description copied from class: ObjectDB
        Hook called before search with the fields filters
        It may be useful to add some specific filters
        Overrides:
        preSearch in class ObjectDB
      • postSearchRow

        public java.lang.String[] postSearchRow​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook called after search for each record
        It may be useful to calculate fields or to change the record values
        Overrides:
        postSearchRow in class ObjectDB
        Parameters:
        row - The database record
        Returns:
        The record values
      • postSearch

        public java.util.List<java.lang.String[]> postSearch​(java.util.List<java.lang.String[]> rows)
        Description copied from class: ObjectDB
        Hook called after search with the fields filters
        It may be useful to calculate fields or to change the records
        Overrides:
        postSearch in class ObjectDB
        Parameters:
        rows - The database result
        Returns:
        The search result
      • preCrosstabSearch

        public void preCrosstabSearch​(Crosstab ctb)
        Description copied from class: ObjectDB
        Hook called before pivot table search with the fields filters (by default it calls the preSearch hook)
        It may be useful to add some specific filters
        Overrides:
        preCrosstabSearch in class ObjectDB
        Parameters:
        ctb - Pivot table
      • postCrosstabSearch

        public java.util.List<java.lang.String[]> postCrosstabSearch​(Crosstab ctb,
                                                                     java.util.List<java.lang.String[]> rows)
        Description copied from class: ObjectDB
        Hook called after pivot table search with the fields filters (by default it calls the postSearch hook)
        It may be useful to calculate fields or to change the records
        Overrides:
        postCrosstabSearch in class ObjectDB
        Parameters:
        ctb - Pivot table
        rows - The database result
        Returns:
        The search result for the GUI
      • preObjectSearch

        public void preObjectSearch()
        Description copied from class: ObjectDB
        Hook called before search of object reference
        It may be useful to add some specific filters
        Overrides:
        preObjectSearch in class ObjectDB
      • postObjectSearch

        public java.util.List<java.lang.String[]> postObjectSearch​(java.util.List<java.lang.String[]> rows)
        Description copied from class: ObjectDB
        Hook called after search of object reference
        It may be useful to calculate fields or to change the records
        Overrides:
        postObjectSearch in class ObjectDB
        Parameters:
        rows - The database result
        Returns:
        The search result
      • preSelect

        public void preSelect​(java.lang.String rowId,
                              boolean copy)
        Description copied from class: ObjectDB
        Hook called before a single row selection
        Overrides:
        preSelect in class ObjectDB
        Parameters:
        rowId - The unique row ID to select
        copy - Indicate if it's a select for a future copy
      • postSelect

        public void postSelect​(java.lang.String rowId,
                               boolean copy)
        Description copied from class: ObjectDB
        Hook called after a single row selection
        Overrides:
        postSelect in class ObjectDB
        Parameters:
        rowId - The unique selected row ID
        copy - Indicate if it's a select for a future copy
      • preCreate

        public java.lang.String preCreate()
        Description copied from class: ObjectDB
        Hook called before the database creation
        Overrides:
        preCreate in class ObjectDB
        Returns:
        Message code or null
      • postCreate

        public java.lang.String postCreate()
        Description copied from class: ObjectDB
        Hook called after the database creation
        Overrides:
        postCreate in class ObjectDB
        Returns:
        Message code or null
      • preUpdate

        public java.lang.String preUpdate()
        Description copied from class: ObjectDB
        Hook called before the database update
        Overrides:
        preUpdate in class ObjectDB
        Returns:
        Message code or null
      • postUpdate

        public java.lang.String postUpdate()
        Description copied from class: ObjectDB
        Hook called after the database update
        Overrides:
        postUpdate in class ObjectDB
        Returns:
        Message code or null
      • preSave

        public java.lang.String preSave()
        Description copied from class: ObjectDB
        Hook called before the database save
        Overrides:
        preSave in class ObjectDB
        Returns:
        Message code or null
      • postSave

        public java.lang.String postSave()
        Description copied from class: ObjectDB
        Hook called after the database save
        Overrides:
        postSave in class ObjectDB
        Returns:
        Message code or null
      • preDelete

        public java.lang.String preDelete()
        Description copied from class: ObjectDB
        Hook called before the database deletion
        Overrides:
        preDelete in class ObjectDB
        Returns:
        Message code or null
      • postDelete

        public java.lang.String postDelete()
        Description copied from class: ObjectDB
        Hook called after the database deletion
        Overrides:
        postDelete in class ObjectDB
        Returns:
        Message or a redirect statement or null
      • canUpdateAll

        public boolean canUpdateAll​(ObjectField f)
        Description copied from class: ObjectDB
        True if the field is bulk updatable, to override for specific behavior
        By default, returns true if:
        - the field (or its foreign key) is visible and updatable,
        - not the single functional key in the object,
        - for status field, if the selection is in a same status
        Overrides:
        canUpdateAll in class ObjectDB
      • preUpdateAll

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String preUpdateAll()
        Deprecated.
        Use preUpdateAll with paramters
        Overrides:
        preUpdateAll in class ObjectDB
      • preUpdateAll

        public java.lang.String preUpdateAll​(Parameters params)
        Description copied from class: ObjectDB
        Hook called before bulk update
        Overrides:
        preUpdateAll in class ObjectDB
        Parameters:
        params - requested data
        Returns:
        Error code or null
      • postUpdateAll

        @Deprecated(forRemoval=false,
                    since="4.0")
        public void postUpdateAll()
        Deprecated.
        Use preUpdateAll with paramters
        Overrides:
        postUpdateAll in class ObjectDB
      • postUpdateAll

        public void postUpdateAll​(Parameters params)
        Description copied from class: ObjectDB
        Hook called after bulk update
        Overrides:
        postUpdateAll in class ObjectDB
        Parameters:
        params - requested data
      • preDeleteAll

        public java.lang.String preDeleteAll()
        Description copied from class: ObjectDB
        Hook called before bulk delete
        Overrides:
        preDeleteAll in class ObjectDB
        Returns:
        Error code or null
      • postDeleteAll

        public java.lang.String postDeleteAll()
        Description copied from class: ObjectDB
        Hook called after bulk delete
        Overrides:
        postDeleteAll in class ObjectDB
        Returns:
        Message or a redirect statement or null
      • initTimesheet

        public void initTimesheet​(Timesheet ts)
        Description copied from class: ObjectDB
        Hook to change timesheet before rendering
        Overrides:
        initTimesheet in class ObjectDB
        Parameters:
        ts - Timesheet
      • preSaveTimesheet

        public java.util.List<java.lang.String> preSaveTimesheet​(Timesheet ts)
        Description copied from class: ObjectDB
        Hook called before Timesheet save
        Overrides:
        preSaveTimesheet in class ObjectDB
        Parameters:
        ts - Timesheet
        Returns:
        Message codes or null
      • postSaveTimesheet

        public java.util.List<java.lang.String> postSaveTimesheet​(Timesheet ts)
        Description copied from class: ObjectDB
        Hook called after Timesheet save
        Overrides:
        postSaveTimesheet in class ObjectDB
        Parameters:
        ts - Timesheet
        Returns:
        Message codes or null
      • getPredefinedSearches

        public java.util.List<PredefinedSearch> getPredefinedSearches()
        Description copied from class: ObjectCore
        Hook to get accessible predefined searches.
        Overrides:
        getPredefinedSearches in class ObjectCore
        Returns:
        the granted public and private searches on object
      • preSavePredefinedSearch

        public java.lang.String preSavePredefinedSearch​(PredefinedSearch ps)
        Description copied from class: ObjectDB
        Hook called before predefined-search save
        Overrides:
        preSavePredefinedSearch in class ObjectDB
        Parameters:
        ps - Predefined search
        Returns:
        Error or null
      • preExport

        public void preExport()
        Description copied from class: ObjectDB
        Hook called before search in export of data
        It may be useful to add some specific filters
        Overrides:
        preExport in class ObjectDB
      • postExport

        public java.util.List<java.lang.String[]> postExport​(java.util.List<java.lang.String[]> rows)
        Description copied from class: ObjectDB
        Hook called after search in export of data.
        It may be useful to calculate fields or to change the records
        Overrides:
        postExport in class ObjectDB
        Parameters:
        rows - The database result
        Returns:
        The search result
      • preImport

        public java.lang.String preImport()
        Description copied from class: ObjectDB
        Hook called before processing object import
        It may be useful to add data to imported data

        (attention : imported data cannot be changed here)
        or to execute business rules before actually processing the import
        Overrides:
        preImport in class ObjectDB
        Returns:
        Error
      • postImport

        public java.lang.String postImport()
        Description copied from class: ObjectDB
        Hook called after processing object import
        It may be useful to execute business rules after actually processing the import
        Overrides:
        postImport in class ObjectDB
        Returns:
        Error
      • isActionEnable

        public boolean isActionEnable​(java.lang.String[] row,
                                      java.lang.String action)
        Description copied from class: ObjectDB
        Hook to check if one action is available for a specific record
        This method must be called to check if the action is available for the user
        Overrides:
        isActionEnable in class ObjectDB
        Parameters:
        row - Current record
        action - Action name
        Returns:
        True when the action is granted to the user (checks visibility if any)
      • isPrintTemplateEnable

        public boolean isPrintTemplateEnable​(java.lang.String[] row,
                                             java.lang.String printTemplate)
        Description copied from class: ObjectDB
        Hook to check if publication template is available for a specific record
        This method must be called to check if the publication template is available for the user
        Overrides:
        isPrintTemplateEnable in class ObjectDB
        printTemplate - Publication template name
        Returns:
        True when the publication template is granted to the user (check if publication template is enabled by default)
      • isMergeMaster

        public boolean isMergeMaster()
        Description copied from class: ObjectDB
        Hook to tell is current record the merge master ?
        Overrides:
        isMergeMaster in class ObjectDB
        Returns:
        True if is merge master
      • isMergeEnable

        public java.lang.String isMergeEnable​(java.util.List<java.lang.String> ids)
        Description copied from class: ObjectDB
        Hook to tell if selected ids are mergeable
        Overrides:
        isMergeEnable in class ObjectDB
        Parameters:
        ids - List of row IDs
        Returns:
        Error or null by default
      • isOpenEnable

        public boolean isOpenEnable​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to check if the open action is available for a specific record
        This method must be called to check if the action is available for the user
        Overrides:
        isOpenEnable in class ObjectDB
        Parameters:
        row - Current record
        Returns:
        True if open is granted to the user (by default read visibilities are checked, true is no visibility)
      • isCreateEnable

        public boolean isCreateEnable()
        Description copied from class: ObjectDB
        Hook to check if the create action is available
        This method must be called to check if the action is available for the user
        Overrides:
        isCreateEnable in class ObjectDB
        Returns:
        True if creation is granted to the user (not readonly, create constraints and visibilities are checked)
      • isCopyEnable

        public boolean isCopyEnable​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to check if the copy action is available for a specified record
        This method must be called to check if the action is available for the user and the specified record
        Overrides:
        isCopyEnable in class ObjectDB
        Parameters:
        row - Current record
        Returns:
        True if copy is granted to the user for the specified record (by default isCreateEnabled is called)
      • isUpdateEnable

        public boolean isUpdateEnable​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to check if the update action is available for a specified record
        This method must be called to check if the action is available for the user and the specified record
        Overrides:
        isUpdateEnable in class ObjectDB
        Parameters:
        row - Current record
        Returns:
        True if update is granted to the user for the specified record (not readonly, update constraints and visibilities are checked)
      • isStateTransitionEnable

        public boolean isStateTransitionEnable​(java.lang.String fromStatus,
                                               java.lang.String toStatus)
        Description copied from class: ObjectDB
        Hook called when building the list of possible state transition
        It may be useful to implement specific state transition condition rules
        Overrides:
        isStateTransitionEnable in class ObjectDB
        Parameters:
        fromStatus - From status
        toStatus - To status
        Returns:
        True when the state transition condition is fulfilled (true by default)
      • isDeleteEnable

        public boolean isDeleteEnable​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to check if the delete action is available for a specified record
        This method must be called to check if the action is available for the user and the specified record
        Overrides:
        isDeleteEnable in class ObjectDB
        Parameters:
        row - Current record
        Returns:
        True if deletion is granted to the user for the specified record (not readonly, delete constraints and visibilities are checked)
      • isCrosstabEnable

        public boolean isCrosstabEnable​(java.lang.String crosstab)
        Description copied from class: ObjectDB
        Hook to check if crosstab is available
        This method must be called to check if the crosstab is available for the user
        Overrides:
        isCrosstabEnable in class ObjectDB
        Parameters:
        crosstab - Crosstab name
        Returns:
        True when the crosstab is granted to the user (check if crosstab is enabled by default)
      • canFollowLink

        public boolean canFollowLink​(ObjectField field)
        Description copied from class: ObjectCore
        Allow follow a specific link ?
        Overrides:
        canFollowLink in class ObjectCore
        Parameters:
        field - Reference field (foreign key)
        Returns:
        true by default, to override to limit some link access
      • canCreateOnLink

        public boolean canCreateOnLink​(ObjectField field)
        Description copied from class: ObjectCore
        Allow create on specific link ?
        Overrides:
        canCreateOnLink in class ObjectCore
        Parameters:
        field - Reference field
        Returns:
        true by default, to override to limit some link creation
      • canReference

        public boolean canReference​(java.lang.String object,
                                    java.lang.String field)
        Description copied from class: ObjectDB
        Hook called to check if a referenced object or view can be displayed
        Overrides:
        canReference in class ObjectDB
        Parameters:
        object - Linked object name or view name
        field - Optional link's foreign key name (null in case of a view)
        Returns:
        True if the Link and its related View are visible
      • isHistoric

        public boolean isHistoric()
        Description copied from class: ObjectCore
        Is historization required?
        Overrides:
        isHistoric in class ObjectCore
        Returns:
        True if historization is required
      • printed

        public java.lang.Object printed​(PrintTemplate prt,
                                        java.lang.String rowId,
                                        java.lang.Object printed)
        Description copied from class: ObjectDB
        Callback hook when published. Useful to change the content or store the object before returning the publication result
        Overrides:
        printed in class ObjectDB
        Parameters:
        prt - Publication template
        rowId - Optional row ID
        printed - Published object (html, zip, pdf...)
        Returns:
        Published object (the same by default)
      • getTargetObject

        public java.lang.String[] getTargetObject​(java.lang.String rowId,
                                                  java.lang.String[] row)
        Description copied from class: ObjectCore
        Hook to substitute the current object/instance/rowId to another target object. Applied in case of row action (open, copy, print...). Useful in case of inheritance, redirection to another object or table.
        Overrides:
        getTargetObject in class ObjectCore
        Parameters:
        rowId - Target rowId
        row - Optional, current row if known, otherwise the record have to be selected with the rowId
        Returns:
        By default returns the current object itself. Return null if no target is possible. Otherwise an Array of 3 items: object name, instance name and row id.
      • invokeAction

        public java.lang.String invokeAction​(Action action,
                                             java.util.Map<java.lang.String,​java.lang.String> params)
                                      throws ActionException
        Description copied from class: ObjectDB
        Action call with optional parameters
        Overrides:
        invokeAction in class ObjectDB
        Parameters:
        action - Action
        params - Optional parameters
        Returns:
        Action result
        Throws:
        ActionException
      • invokePrint

        public java.lang.Object invokePrint​(PrintTemplate prt)
                                     throws PrintException
        Description copied from class: ObjectDB
        Publication method call. Warning: this only applies to a publication implemented as a method,
        For a publication based on a template (file or text) you should use:
        • prt.fillWithCurrentObject(this) for single record (form) publication
        • prt.fillWithCurrentList(this) for multiple record (list) publication
        Overrides:
        invokePrint in class ObjectDB
        Parameters:
        prt - Publication template
        Returns:
        Print result or null if publication template is not impemented as a method
        Throws:
        PrintException
      • invokeCallback

        public void invokeCallback​(java.lang.String callbackName,
                                   java.util.Map<java.lang.String,​java.lang.String> params)
                            throws MethodException
        Description copied from class: ObjectDB
        Simple callback method call
        Overrides:
        invokeCallback in class ObjectDB
        Parameters:
        callbackName - Callback name
        params - Optional parameters field:value
        Throws:
        MethodException
      • invokeMethod

        public java.lang.Object invokeMethod​(java.lang.String methodName,
                                             java.lang.Class<?>[] paramTypes,
                                             java.lang.Object[] paramValues)
                                      throws MethodException
        Description copied from class: ObjectDB
        Method call with args
        Overrides:
        invokeMethod in class ObjectDB
        Parameters:
        methodName - Method name
        paramTypes - Table of class types
        paramValues - Table of values
        Returns:
        Method result
        Throws:
        MethodException
      • isUndoable

        public boolean isUndoable​(java.lang.String action)
        Description copied from class: ObjectDB
        Hook to allow undo/redo on the object
        Overrides:
        isUndoable in class ObjectDB
        Parameters:
        action - Optional action ObjectXML.ACTION_*
        Returns:
        true by default for creation/deletion and update except status field (must use a valid transition)
      • preUndo

        public boolean preUndo()
        Description copied from class: ObjectDB
        Hook called before undo
        Overrides:
        preUndo in class ObjectDB
        Returns:
        true by default, return false to cancel the undo
      • postUndo

        public void postUndo()
        Description copied from class: ObjectDB
        Hook called after undo
        Overrides:
        postUndo in class ObjectDB
      • preRedo

        public boolean preRedo()
        Description copied from class: ObjectDB
        Hook called before redo
        Overrides:
        preRedo in class ObjectDB
        Returns:
        true by default, return false to cancel the redo
      • postRedo

        public void postRedo()
        Description copied from class: ObjectDB
        Hook called after redo
        Overrides:
        postRedo in class ObjectDB
      • getUserKeyLabel

        public java.lang.String getUserKeyLabel​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Build a custom label to represent the user key of the record
        If row is null, the selected fields are used. May be overridden to implement specific label
        Overrides:
        getUserKeyLabel in class ObjectDB
        Parameters:
        row - Any record, if row is null, the selected fields are used
        Returns:
        The user key label based on object title or functional keys
      • getUserKeySearch

        public java.lang.String getUserKeySearch​(java.lang.String[] row)
        Description copied from class: ObjectDB
        Build a label to represent the searchable fields
        If row is null, the selected fields are used. May be overrided to implement specific label
        Overrides:
        getUserKeySearch in class ObjectDB
        Parameters:
        row - Any record, if row is null, the selected fields are used
        Returns:
        The object summary with search values
      • getExportFileName

        public java.lang.String getExportFileName​(java.lang.String media,
                                                  java.lang.String name,
                                                  java.lang.String[] row)
        Description copied from class: ObjectDB
        Export file name: default is the object label or user key, this hook can be overridden to change the output name.
        Overrides:
        getExportFileName in class ObjectDB
        Parameters:
        media - Export type: CSV, XLSX, PDF, ZIP, XML... HTTPTool.MEDIA_*
        name - Default name: print template, crosstab name or object name
        row - Optional record in case of form export
        Returns:
        File name (if no extension specified, it will be set automatically from the mime-type)
      • isExportAllowed

        public java.lang.String isExportAllowed​(java.lang.String mode,
                                                java.lang.String media,
                                                java.lang.String rowId)
        Description copied from class: ObjectCore
        Is requested export allowed?
        Overrides:
        isExportAllowed in class ObjectCore
        Parameters:
        mode - ObjectXML.MODE_* full | form | list | pref
        media - ServletTool.MEDIA_*
        rowId - Optional ID (form export)
        Returns:
        Error to denied export, Warning to confirm on UI or null to allow export
      • getStyle

        public java.lang.String getStyle​(ObjectField f,
                                         java.lang.String[] row)
        Description copied from class: ObjectDB
        Gets specified field style from values array, by default call getStyle for the field value
        May be override to change the style with specific business rules
        Overrides:
        getStyle in class ObjectDB
        Parameters:
        f - Field
        row - Values array
        Returns:
        CSS class(es) empty by default
      • getStyle

        public java.lang.String getStyle​(ObjectField f,
                                         double d)
        Description copied from class: ObjectDB
        Hook to specify field style for a crosstab value
        Overrides:
        getStyle in class ObjectDB
        Parameters:
        f - Field
        d - Value
        Returns:
        CSS class(es), null by default
      • getStyleTree

        public java.lang.String getStyleTree​(TreeView tv,
                                             java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to assign a style to a treeview item
        Overrides:
        getStyleTree in class ObjectDB
        Parameters:
        tv - Treeview
        row - Values array
        Returns:
        CSS class(es), null by default
      • getImage

        public java.lang.String getImage​(ObjectField f,
                                         java.lang.String val)
        Description copied from class: ObjectDB
        Get the field icon from single value. May be override to change the style with specific business rules
        Overrides:
        getImage in class ObjectDB
        Parameters:
        f - Field
        val - Image value
        Returns:
        Icon name
      • getImage

        public java.lang.String getImage​(ObjectField f,
                                         java.lang.String[] row)
        Description copied from class: ObjectDB
        Get the field icon from values array. May be override to change the style with specific business rules
        Overrides:
        getImage in class ObjectDB
        Parameters:
        f - Field
        row - Values array
        Returns:
        Icon name
      • getImageTree

        public java.lang.String getImageTree​(TreeView tv,
                                             java.lang.String[] row)
        Description copied from class: ObjectDB
        Hook to assign one icon to a treeview item
        Overrides:
        getImageTree in class ObjectDB
        Parameters:
        tv - Treeview
        row - Values array
        Returns:
        Icon name
      • getHelp

        public java.lang.String getHelp()
        Description copied from class: ObjectCore
        Get main object help
        Overrides:
        getHelp in class ObjectCore
        Returns:
        Main object help
      • getCtxHelp

        public java.lang.String getCtxHelp​(java.lang.String helpContext)
        Description copied from class: ObjectCore
        Contextual help
        Overrides:
        getCtxHelp in class ObjectCore
        Parameters:
        helpContext - Help context (one of ObjectCtxHelp.CTXHELP_* constants)
      • preAlert

        public java.lang.String preAlert​(Alert a)
        Description copied from class: ObjectDB
        Hook before before sending the alert
        Overrides:
        preAlert in class ObjectDB
        Returns:
        Error code or null
      • customAlert

        public java.lang.String customAlert​(Alert a,
                                            java.lang.String subject,
                                            java.lang.String body,
                                            java.util.List<DocumentDB> attachments)
        Description copied from class: ObjectDB
        Hook for sending the alert using a custom media
        Overrides:
        customAlert in class ObjectDB
        Returns:
        Error code or null
      • postAlert

        public java.lang.String postAlert​(Alert a)
        Description copied from class: ObjectDB
        Hook before after sending the alert
        Overrides:
        postAlert in class ObjectDB
        Returns:
        Error code or null
      • getDeadlineDate

        public java.util.Date getDeadlineDate​(java.lang.String row_id,
                                              java.lang.String state,
                                              java.lang.String update_dt,
                                              int timeout)
        Description copied from class: ObjectDB
        Eval the timeout date of the object state (can be overrided with a specific rule)
        Overrides:
        getDeadlineDate in class ObjectDB
        Parameters:
        row_id - Row ID (to select the record if needed)
        state - Current state
        update_dt - Last update date in service format yyyy-MM-dd HH:mm:ss
        timeout - Default designed delay in seconds
        Returns:
        A date = update_dt+timeout
      • getEmailRecipientType

        public char getEmailRecipientType​(java.lang.String alert,
                                          java.lang.String email,
                                          char type)
        Description copied from class: ObjectDB
        Hook to override the recipient type (TO/CC/BCC)
        Overrides:
        getEmailRecipientType in class ObjectDB
        Parameters:
        alert - Alert name
        email - Email
        type - Default designed type
        Returns:
        Recipient type
      • getGroupEmailRecipientType

        public char getGroupEmailRecipientType​(java.lang.String alert,
                                               java.lang.String group,
                                               char type)
        Description copied from class: ObjectDB
        Hook to override the recipient type (TO/CC/BCC) of a group
        Overrides:
        getGroupEmailRecipientType in class ObjectDB
        Parameters:
        alert - Alert name
        group - Group name
        type - Default designed type
        Returns:
        Recipient type
      • spamEmail

        public boolean spamEmail​(java.lang.String alert,
                                 java.lang.String group,
                                 java.lang.String email)
        Description copied from class: ObjectDB
        Hook called to check if the email is a recipient of the alert
        Overrides:
        spamEmail in class ObjectDB
        Parameters:
        alert - Alert name
        group - Optional user group
        email - Email
        Returns:
        True by default
      • spamGroup

        public boolean spamGroup​(java.lang.String alert,
                                 java.lang.String group)
        Description copied from class: ObjectDB
        Hook called to check if the group is a recipient of the alert
        Overrides:
        spamGroup in class ObjectDB
        Parameters:
        alert - Alert name
        group - Group name
        Returns:
        True by default
      • fieldCompletion

        public java.util.List<java.lang.String> fieldCompletion​(java.lang.String field,
                                                                java.lang.String query,
                                                                java.lang.String context)
        Description copied from class: ObjectDB
        Hook to override the default field completion (Lucene or SQL search on field)
        - Usefull to implement an editable select-box, to call a WebService and/or to populate a specific list of choice
        - On client-side, use the field_completed(value) hook in the template to handle the selected value by user
        Overrides:
        fieldCompletion in class ObjectDB
        Parameters:
        field - Field to search
        query - User query/filter
        context - Field context = form, search or list
        Returns:
        null to use the default behavior (lucene or sql), empty list to ignore completion, or a list with values to display
      • applyStaticConstraints

        public void applyStaticConstraints()
        Description copied from class: ObjectDB
        Apply all static constraints on load
        Overrides:
        applyStaticConstraints in class ObjectDB
      • applyConstraints

        public void applyConstraints​(int context)
        Description copied from class: ObjectDB
        Apply all dynamic constraints
        Overrides:
        applyConstraints in class ObjectDB
        Parameters:
        context - Context
      • applyObjectConstraints

        public void applyObjectConstraints​(int context)
        Description copied from class: ObjectDB
        Apply all dynamic constraints on object
        Overrides:
        applyObjectConstraints in class ObjectDB
        Parameters:
        context - Context (one of ObjectCore.CONTEXT_*)
      • applyFieldConstraints

        public void applyFieldConstraints​(int context)
        Description copied from class: ObjectDB
        Apply all constraints on fields
        Overrides:
        applyFieldConstraints in class ObjectDB
        Parameters:
        context - Context
      • applyTargetConstraints

        public void applyTargetConstraints​(int context)
        Description copied from class: ObjectDB
        Apply all constraints on targets (action, link or view)
        Overrides:
        applyTargetConstraints in class ObjectDB
        Parameters:
        context - Context
      • checkObjectPropConstraints

        public boolean checkObjectPropConstraints​(int context,
                                                  char objectProp)
        Description copied from class: ObjectDB
        Check object constraints for property
        Overrides:
        checkObjectPropConstraints in class ObjectDB
        Parameters:
        context - Context
        objectProp - Property
        Returns:
        Constraint status
      • getMappedExportPath

        public java.lang.String getMappedExportPath​(java.lang.String[] row)
        Description copied from class: ObjectCore
        Get the mapped export file path
        Overrides:
        getMappedExportPath in class ObjectCore
        Parameters:
        row - Row
        Returns:
        Mapped export file path
      • getMappedFilePath

        public java.lang.String getMappedFilePath​(ObjectField f)
        Description copied from class: ObjectCore
        Get the mapped file path for specified field
        Overrides:
        getMappedFilePath in class ObjectCore
        Parameters:
        f - Document field
        Returns:
        Document mapped file path or null
      • unitTests

        public java.lang.String unitTests()
        Description copied from class: ObjectDB
        Unit tests
        Overrides:
        unitTests in class ObjectDB
        Returns:
        Unit tests results
      • getSocialShareData

        public SocialShareData getSocialShareData()
        Description copied from class: ObjectDB
        Hook to override share information to send to social medias. By default returns the user-key with a deep link to object (and the first image URL if any)
        Overrides:
        getSocialShareData in class ObjectDB
        Returns:
        Share data
      • getAgendaDay

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String getAgendaDay​(Agenda a,
                                             java.util.Date d)
        Deprecated.
        Overrides:
        getAgendaDay in class ObjectDB
      • getAgendaSelector

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String getAgendaSelector​(Agenda a,
                                                  java.lang.String selector)
        Deprecated.
        Overrides:
        getAgendaSelector in class ObjectDB
      • getAgendaValue

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String getAgendaValue​(Agenda a,
                                               ObjectField f,
                                               java.lang.String val)
        Deprecated.
        Overrides:
        getAgendaValue in class ObjectDB
      • getAgendaWeek

        @Deprecated(forRemoval=false,
                    since="4.0")
        public java.lang.String getAgendaWeek​(Agenda a,
                                              java.util.List<java.lang.String> days)
        Deprecated.
        Overrides:
        getAgendaWeek in class ObjectDB