Package com.simplicite.util
Class ObjectDB
- java.lang.Object
-
- com.simplicite.util.ObjectCore
-
- com.simplicite.util.ObjectDB
-
- All Implemented Interfaces:
com.simplicite.util.engine.CacheInterface
,java.io.Serializable
- Direct Known Subclasses:
ScriptedObjectDB
public class ObjectDB extends ObjectCore
Business object stored in database
The object definition is loaded from repository using user language and rights
The object is associated to a physical storage in the database (table in general)
By default, the object has a unique 'row_id' field which is always the first of them
Before the creation, the row ID must be set to 0
After creation, the row_id is always greater than 0
The object may have a timestamp, in this case 4 fields are added:
- 'created_dt' creation datetime
- 'created_by' creation user login
- 'updated_dt' last update datetime
- 'updated_by' last update user login
The object must have:
- a functional key based on one or more fields
- translation in each language with online helps
- function for CRUD to grant actions to the user groups
The object also may have:
- some graphs and crosstables based on the fields
- publication templates to many output formats
- scripted hooks to override some core methods
- constraints to change the object/fields rules on the fly
- etc.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ObjectDB.SearchCallback<T>
Search callback interface
-
Field Summary
-
Fields inherited from class com.simplicite.util.ObjectCore
CONTEXT_ACTION, CONTEXT_AGENDA, CONTEXT_ASSOCIATE, CONTEXT_COPY, CONTEXT_CREATE, CONTEXT_CROSSTAB, CONTEXT_DATAMAPSELECT, CONTEXT_DELETE, CONTEXT_EXPORT, CONTEXT_IMPORT, CONTEXT_LIST, CONTEXT_NONE, CONTEXT_PANELLIST, CONTEXT_PLACEMAP, CONTEXT_POSTVALIDATE, CONTEXT_PREVALIDATE, CONTEXT_PRINTTMPL, CONTEXT_REFSELECT, CONTEXT_SEARCH, CONTEXT_STATETRANSITION, CONTEXT_UPDATE, CONTEXT_UPDATEALL, DB_DERBY, DB_H2, DB_HSQLDB, DB_MSSQL, DB_MYSQL, DB_ORACLE, DB_POSTGRESQL, DB_UNKNOWN, DEL_CASCAD, DEL_IGNORE, DEL_NULL, DEL_RESTRICT, FORM_LAYOUT_COMPACT, FORM_LAYOUT_DEFAULT, LIST_EDIT_ADD, LIST_EDIT_ROWS, LIST_EDIT_UPSERT, PREDEF_SEARCH_NONE, PREDEF_SEARCH_ONLIST, PREDEF_SEARCH_USE_EDIT, PREDEF_SEARCH_USE_ONLY, SEARCH_DIALOG, SEARCH_DOCK, SEARCH_HIDE, SEARCH_LIST, TIMESTAMP_BLOKING, TIMESTAMP_NON_BLOKING, TIMESTAMP_NONE, TIMESTAMP_OPTIMISTIC, TYPE_QUERY, TYPE_SERVICE, TYPE_SERVICE_LDAP, TYPE_SERVICE_MONGODB, TYPE_SERVICE_OPENDATASOFT, TYPE_SERVICE_REST, TYPE_SERVICE_SALESFORCE, TYPE_SERVICE_SERVICENOW, TYPE_SERVICE_SIMPLICITE, VIEW_MODE_ACCORDION, VIEW_MODE_COLLAPSED, VIEW_MODE_EXTENDED, VIEW_MODE_TABS, VIEW_MODE_TABS_VERTICAL
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Link
addLink(ObjectDB object, ObjectField fk, java.lang.String display, java.lang.String help, java.lang.String card, int order, boolean copy, char associate, boolean visible, boolean inline, char cascad, java.lang.String icon)
Add dynamically a link (and its single view) to the objectLink
addLinkMetaObject(ObjectDB object, int order)
Add dynamically a meta-object link (ant its single view) to the objectvoid
applyConstraints(int context)
Apply all dynamic constraintsvoid
applyFieldConstraints(int context)
Apply all constraints on fieldsvoid
applyObjectConstraints(int context)
Apply all dynamic constraints on objectvoid
applyStaticConstraints()
Apply all static constraints on loadvoid
applyTargetConstraints(int context)
Apply all constraints on targets (action, link or view)void
buildTreeList(ObjectNode node, java.util.List<ObjectNode> v)
boolean
canReference(java.lang.String target, java.lang.String foreignKey)
Hook called to check if a referenced object can be displayedboolean
canUpdateAll(ObjectField f)
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 statusboolean
canUpdateAllEnum(ObjectField f)
Enable status/enum for bulk update only if all the status/parent linked values are the same in the current search/selectionboolean
checkCreateConstraints()
Apply all create constraints on objectboolean
checkCreateVisibilities()
Check create visibilitiesjava.util.List<java.lang.String>[]
checkDelete()
Deprecated, for removal: This API element is subject to removal in a future version.Use delete() method onlyboolean
checkDeleteConstraints()
Apply all delete constraints on objectboolean
checkDeleteVisibilities(java.lang.String[] row)
Check delete visibilitiesboolean
checkObjectPropConstraints(int context, char objectProp)
Check object constraints for propertyboolean
checkUpdateConstraints()
Apply all update constraints on objectboolean
checkUpdateVisibilities(java.lang.String[] row)
Check update visibilitiesvoid
clear()
Clear console and script agentjava.util.List<java.lang.String>
completeForeignKeys()
Try to complete the references (ids of foreign keys) with the field valuesjava.util.List<java.lang.String>
completeForeignKeys(boolean err)
Try to complete the references (ids of foreign keys) with the field valueslong
count()
Alias to getCountjava.lang.String
create()
Insert the object field values in the database Call the pre/postCreation.java.lang.String
customAlert(Alert a, java.lang.String subject, java.lang.String body, java.util.List<DocumentDB> attachments)
Hook for sending the alert using a custom mediajava.lang.String
del()
Delete the current row and dependencies (same as delete but for scripting usage)java.lang.String
delete()
Delete the current row and dependencies
This version use all the ObjectDB hooks
checkDelete() has not to be called firstjava.lang.String
delete(java.util.List<java.lang.String> request)
Deprecated, for removal: This API element is subject to removal in a future version.Use delete() method onlyvoid
deleteTree(ObjectNode tree, java.lang.String id)
void
docuSign(DocSignProvider.DocSignStatus data)
DocuSign web-hook https://developers.docusign.com/esign-rest-api/code-examples/webhook-statusboolean
editTemplateUsage()
Object is used in the template editor?void
evalCalculatedFields(int context)
Persistent field evaluationsvoid
evalCalculatedFields(int context, java.lang.String[] row)
Non persistent field evaluationsjava.lang.String
evalNextRowId(java.lang.String table)
Hook called before the database creation to send a specific unique id
(i.e.void
evalObjectCalculatedFields()
Other object field evaluationsjava.util.List<java.lang.String>
fieldCompletion(java.lang.String input, java.lang.String query, java.lang.String context)
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 userjava.lang.String
getAgendaDay(Agenda a, java.util.Date d)
Deprecated.java.lang.String
getAgendaLabel(Agenda a, ObjectField f)
Deprecated.java.lang.String
getAgendaSelector(Agenda a, java.lang.String selector)
Deprecated.java.lang.String
getAgendaValue(Agenda a, ObjectField f, java.lang.String val)
Deprecated.java.lang.String
getAgendaWeek(Agenda a, java.util.List<java.lang.String> days)
Deprecated.Alert
getAlert(java.lang.String name, int type)
Get the Alert definitionConsole
getConsole()
Get consolelong
getCount()
Return the records count with the current search specification and filters
This method is not supposed to be overriddenlong
getCount(int maxRows)
Return the records count with the current search specification and filterslong
getCountGroupBy(int maxRows)
Return the grouped records count with the current search specification and filtersjava.util.Date
getDeadlineDate(java.lang.String rowId, java.lang.String state, java.lang.String update_dt, int timeout)
Eval the timeout date of the object state (can be overrided with a specific rule)java.lang.String
getDirectURL(boolean form)
Get external access URL to objectchar
getEmailRecipientType(java.lang.String alert, java.lang.String email, char type)
Hook to override the recipient type (TO/CC/BCC)java.lang.String
getExportFileName(java.lang.String type, java.lang.String name, java.lang.String[] row)
Export file name: default is the object label or user key, this hook can be overridden to change the output name.java.lang.String
getFieldDefaultValue(ObjectField fld)
Eval a default valuejava.lang.String
getFileName(java.lang.String docId)
Get the filename of a document stored in m_documentjava.lang.String
getFilePath(java.lang.String docId)
Get the relative path (from DOCDIR) of a document stored in m_documentjava.lang.String
getFirstRowId()
The method gives the first row ID in a search contextchar
getGroupEmailRecipientType(java.lang.String alert, java.lang.String group, char type)
Hook to override the recipient type (TO/CC/BCC) of a groupjava.lang.String
getImage(ObjectField f, java.lang.String val)
Get the field icon from single value.java.lang.String
getImage(ObjectField f, java.lang.String[] row)
Get the field icon from values array.java.lang.String
getImageTree(TreeView tv, java.lang.String[] row)
Hook to assign one icon to a treeview itemcom.simplicite.util.engine.ObjectInterface
getInterface()
Get the interface to manipulate objects (Local EJB, Remote EJB, WebService, Direct)
Accessing context updates the last usage of objectjava.lang.String
getLastRowId()
The method gives the last row ID in a search contextjava.lang.String
getNextRowId()
The method gives the next row ID of the current record in a search contextObjectDB
getParentObject()
Get the parent object for child listsjava.lang.String
getPreviousRowId()
The method gives the previous row ID of the current record in a search contextjava.lang.String
getQuery(java.util.List<ObjectField> host)
Return the SQL select statement with current filterlong
getRefCalc(java.lang.String refObject, java.lang.String refField, java.lang.String valueField, int operator)
Return the records operation (sum, average, min, max) of a linked object (relation 0,n)long
getRefCount(java.lang.String refObject, java.lang.String refField)
Return the records count of a linked object (relation 0,n)java.lang.String
getSearchSpec(java.lang.String s)
Eval the search specificationSocialShareData
getSocialShareData()
Hook to override share information to send to social medias.java.lang.String
getStyle(ObjectField f, double val)
Hook to specify field style for a crosstab valuejava.lang.String
getStyle(ObjectField f, java.lang.String val)
Gets specified field style for single value
May be override to change the style with specific business rulesjava.lang.String
getStyle(ObjectField f, java.lang.String[] row)
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 rulesjava.lang.String
getStyleTree(TreeView tv, java.lang.String[] row)
Hook to assign a style to a treeview itemBusinessObjectTool
getTool()
Get a business object tool wrapper for the objectjava.lang.String
getUserKeyLabel(java.lang.String[] row)
Build a custom label to represent the user key of the record
If row is null, the selected fields are used.java.lang.String
getUserKeyList(java.lang.String[] row, boolean excludeUserKey, int maxLength)
Build a label based on list fieldsjava.lang.String
getUserKeySearch(java.lang.String[] row)
Build a label to represent the searchable fields
If row is null, the selected fields are used.boolean
hasFieldConstraints(char effect)
Object contains fields impact ?boolean
hasTargetConstraints(char effect)
Object contains target (action, view, area) impact ?ObjectDB
init(java.lang.String name, Grant grant)
Load the object definition from the repositoryvoid
initAction(Action action)
Hook to init the Action fields before the confirm dialog.void
initAgenda(Agenda agenda)
Hook to init an agendavoid
initAssociate(ObjectDB parent)
Hook to init the associationvoid
initCopy()
Hook to init the copyvoid
initCreate()
Hook to init the creationvoid
initCrosstab(java.lang.String crosstabName)
Hook to init a pivot tablevoid
initDataMapSelect(java.lang.String datamapName, ObjectDB parent)
Hook to init the data mapping selectionvoid
initDelete()
Hook to init the Delete before delete dialogvoid
initExport()
Hook to init the Export before export dialogvoid
initFromTable(java.lang.String table, Grant grant)
Load the object definition from the database table (beta)void
initList(ObjectDB parent)
Hook to init the listvoid
initPlaceMap(PlaceMap placemap)
Hook to init a place mapvoid
initPrintTemplate(java.lang.String prtName)
Hook to init a publication templatevoid
initRefSelect(ObjectDB parent)
Hook to init the reference selectionvoid
initSearch()
Hook to init the searchvoid
initTimesheet(Timesheet ts)
Hook to change timesheet before renderingvoid
initUpdate()
Hook to init the updatevoid
initUpdateAll()
Hook to init the blulk updatevoid
insertTree(ObjectNode parent, int depth)
Search and add children to parent nodejava.lang.String
invokeAction(Action action)
Action call without parametersjava.lang.String
invokeAction(Action action, java.util.Map<java.lang.String,java.lang.String> params)
Action call with optional parametersjava.lang.String
invokeAction(java.lang.String actionName)
Action call with optional parametersjava.lang.String
invokeAction(java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> params)
Action call with optional parametersvoid
invokeCallback(java.lang.String callbackName)
Simple callback method callvoid
invokeCallback(java.lang.String callbackName, java.util.Map<java.lang.String,java.lang.String> params)
Simple callback method calljava.lang.Object
invokeMethod(java.lang.String methodName, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues)
Method call with argsjava.lang.Object
invokePrint(PrintTemplate prt)
Publication method call.java.lang.Object
invokePrint(java.lang.String prtName)
Publication method call.boolean
isActionEnable(java.lang.String[] row, java.lang.String action)
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 userboolean
isCopyEnable(java.lang.String[] row)
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 recordboolean
isCreateEnable()
Hook to check if the create action is available
This method must be called to check if the action is available for the userboolean
isCrosstabEnable(java.lang.String crosstab)
Hook to check if crosstab is available
This method must be called to check if the crosstab is available for the userboolean
isDeleteEnable(java.lang.String[] row)
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 recordjava.lang.String
isMergeEnable(java.util.List<java.lang.String> ids)
Hook to tell if selected ids are mergeableboolean
isMergeMaster()
Hook to tell is current record the merge master ?boolean
isOpenEnable(java.lang.String[] row)
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 userboolean
isPrintTemplateEnable(java.lang.String[] row, java.lang.String printTemplate)
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 userboolean
isStateTransitionEnable(java.lang.String fromStatus, java.lang.String toStatus)
Hook called when building the list of possible state transition
It may be useful to implement specific state transition condition rulesboolean
isUndoable(java.lang.String action)
Hook to allow undo/redo on the objectboolean
isUpdateEnable(java.lang.String[] row)
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 recordjava.lang.String
javascript(java.lang.String js)
Alias to sendJavaScriptObjectDB
load(Grant grant)
Object definition loadingObjectDB
load(Grant grant, java.lang.String obj)
Default object definition loading, called by load(Grant)void
makeTree(ObjectNode root, java.lang.String parentId, java.util.List<java.lang.String[]> rows, int depth)
Build the partial treejava.util.List<java.lang.String>
merge(java.util.List<java.lang.String> ids, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> map)
Merge all records and linksjava.util.List<java.lang.String>
merge(java.util.List<java.lang.String> ids, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> map, org.json.JSONObject linkIds)
Merge all records and linksvoid
populate(boolean complete)
Populate all fields with the references, parent or default valuesvoid
populate(ObjectField field)
Populate a field with the reference, the contextual or its default value
This method is not supposed to be overriddenvoid
populate(ObjectField field, boolean complete)
Populate a field with the reference, the contextual or its default valueboolean
populateForeignKey(java.lang.String refField, java.lang.String refId)
Populate all fields joined to a foreign keyboolean
populateForeignKey(java.lang.String refField, java.lang.String refId, boolean useSearchSpec, boolean reset)
Populate all fields joined to a foreign keyboolean
populateForeignKey(java.lang.String fkName, java.lang.String refId, boolean useSearchSpec, boolean reset, ObjectField field)
Populate all fields joined to a foreign keyjava.lang.String
postAlert(Alert a)
Hook before after sending the alertjava.lang.String
postCreate()
Hook called after the database creationjava.util.List<java.lang.String[]>
postCrosstabSearch(Crosstab ctb, java.util.List<java.lang.String[]> rows)
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 recordsjava.lang.String
postDelete()
Hook called after the database deletionjava.lang.String
postDeleteAll()
Hook called after bulk deletejava.util.List<java.lang.String[]>
postExport(java.util.List<java.lang.String[]> rows)
Hook called after search in export of data.java.lang.String
postImport()
Hook called after processing object import
It may be useful to execute business rules after actually processing the importvoid
postLoad()
Hook called after loading the object definitionjava.util.List<java.lang.String[]>
postObjectSearch(java.util.List<java.lang.String[]> rows)
Hook called after search of object reference
It may be useful to calculate fields or to change the recordsvoid
postRedo()
Hook called after redojava.lang.String
postSave()
Hook called after the database savevoid
postSavePredefinedSearch(PredefinedSearch ps)
Hook called after predefined-search savejava.util.List<java.lang.String>
postSaveTimesheet(Timesheet ts)
Hook called after Timesheet savejava.util.List<java.lang.String[]>
postSearch(java.util.List<java.lang.String[]> rows)
Hook called after search with the fields filters
It may be useful to calculate fields or to change the recordsjava.lang.String[]
postSearchRow(java.lang.String[] row)
Hook called after search for each record
It may be useful to calculate fields or to change the record valuesvoid
postSelect(java.lang.String rowId, boolean copy)
Hook called after a single row selectionvoid
postUndo()
Hook called after undojava.lang.String
postUpdate()
Hook called after the database updatevoid
postUpdateAll()
Deprecated.Use postUpdateAll with paramtersvoid
postUpdateAll(Parameters params)
Hook called after bulk updatejava.util.List<java.lang.String>
postValidate()
Hook called after system validation
It may be useful to check specific rules before updatejava.util.List<java.lang.String>
postValidateSearch()
Hook called after search validation with the fields filters
It may be useful to check filtersjava.lang.String
preAlert(Alert a)
Hook before before sending the alertvoid
preCount()
Hook called before count with the fields filters (by default it calls the preSearch hook)
It may be useful to add some specific filtersjava.lang.String
preCreate()
Hook called before the database creationvoid
preCrosstabSearch(Crosstab ctb)
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 filtersjava.lang.String
preDelete()
Hook called before the database deletionjava.lang.String
preDeleteAll()
Hook called before bulk deletevoid
preExport()
Hook called before search in export of data
It may be useful to add some specific filtersjava.lang.String
preImport()
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 importvoid
preLoad()
Hook called before loading the object definitionvoid
preObjectSearch()
Hook called before search of object reference
It may be useful to add some specific filtersjava.lang.String
prepareActionURL(java.lang.String url, java.lang.String[] row)
Prepare action URL (substitute [object], [inst] and optionally [row_id] tags)boolean
preRedo()
Hook called before redojava.lang.String
preSave()
Hook called before the database savejava.lang.String
preSavePredefinedSearch(PredefinedSearch ps)
Hook called before predefined-search savejava.util.List<java.lang.String>
preSaveTimesheet(Timesheet ts)
Hook called before Timesheet savevoid
preSearch()
Hook called before search with the fields filters
It may be useful to add some specific filtersvoid
preSelect(java.lang.String rowId, boolean copy)
Hook called before a single row selectionjava.util.List<java.lang.String>
preStateTransition(java.lang.String fromStatus, java.lang.String toStatus)
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 rulesboolean
preUndo()
Hook called before undojava.lang.String
preUpdate()
Hook called before the database updatejava.lang.String
preUpdateAll()
Deprecated.Use preUpdateAll with paramtersjava.lang.String
preUpdateAll(Parameters params)
Hook called before bulk updatejava.util.List<java.lang.String>
preValidate()
Hook called before system validation
It may be useful to force/calculate mandatory valuesjava.util.List<java.lang.String>
preValidateSearch()
Hook called before search validation with the fields filters
It may be useful to check filtersjava.lang.Object
printed(PrintTemplate pt, java.lang.String rowId, java.lang.Object printed)
Callback hook when published.java.lang.String
redirect(java.lang.String url)
Alias to sendRedirectvoid
resetParentContext()
Reset parent object contextjava.lang.String
save()
This method calls the preSave first,
then if the row ID is equals to '0', it calls the create method,
otherwise it calls the update method
Finally the method calls the postSave methodjava.lang.String
save(boolean timestamp)
This method calls the preSave first,
then if the row ID is equals to '0', it calls the create method,
otherwise it calls the update method
Finally the method calls the postSave methodjava.util.List<java.lang.String[]>
search()
Retrieve the database records with the currents search specification
and the field filters (without pagination)java.util.List<java.lang.String[]>
search(boolean pagine)
Retrieve the database records with the currents search specification and the field filtersjava.util.List<java.lang.String[]>
search(boolean pagine, int maxRows)
Retrieve the database records with the currents search specification
and the field filters.java.util.List<java.lang.String[]>
search(boolean pagine, int maxRows, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage)
Retrieve the database records with the currents search specification
and the field filters.java.util.List<java.lang.String[]>
searchCrosstab(Crosstab c)
Same as a search but for a crosstab calculation and optimizationjava.util.List<java.lang.String[]>
searchExport()
Deprecated, for removal: This API element is subject to removal in a future version.Use searchExport with argumentsjava.util.List<java.lang.String[]>
searchExport(boolean pagine, int maxRows, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage)
Same as a search but for the export of data by pagejava.util.List<java.lang.String[]>
searchGroupBy(boolean pagine)
Search with group by and countjava.util.List<java.lang.String[]>
searchGroupBy(boolean pagine, int maxRows)
Search with group by and countjava.lang.String
searchRowId()
Search with the current fields a matching record in the database
This method is not supposed to be overridenjava.lang.String
searchRowId(java.lang.String notId)
Search with the current fields a matching record in the databaseboolean
select(ObjectField[] fields, boolean copy)
Selects a single record and loads the specified valued fields into the object fields (either for simple selection or for copy)boolean
select(java.lang.String rowId)
Selects a single record and loads the values into the object fieldsboolean
select(java.lang.String rowId, boolean copy)
Selects a single record and loads the values into the object fields (either for simple selection or for copy)boolean
selectWithoutFilters(java.lang.String rowId, boolean copy)
Same as a select without filters (only defaultSearchSpec is applied).boolean
selectWithoutFilters(java.lang.String rowId, boolean copy, boolean ignoreSearchSpec)
Same as a select without filters The previous filters and current SearcSpec are restored after selection.java.lang.String
sendJavaScript(java.lang.String js)
Generate a JavaScript statement to be returned by an action methodjava.lang.String
sendRedirect(java.lang.String url)
Generate a redirect statement to be returned by an action methodvoid
setConsole(Console console)
Set consolevoid
setConstraint(Constraint c)
Prepare the constraintboolean
spamEmail(java.lang.String alert, java.lang.String group, java.lang.String email)
Hook called to check if the email is a recipient of the alertboolean
spamGroup(java.lang.String alert, java.lang.String name)
Hook called to check if the group is a recipient of the alertObjectDB
storeParentContext(ObjectDB parent, java.lang.String refField, java.lang.String[] values)
Store parent object context / must be called before any count/search of child liststatic ObjectDB
storeParentContext(java.lang.String prefix, ObjectDB parent, java.lang.String childObject, java.lang.String childField, java.lang.String[] values)
Store parent object context / must be called before any count/search of child listjava.lang.String
toCSV(java.util.List<java.lang.String[]> rows)
Deprecated.Use toCSV with writer argumentvoid
toCSV(java.util.List<java.lang.String[]> rows, java.io.PrintWriter out)
Publish rows to raw CSV on specified print writerjava.lang.String
toTSV(java.util.List<java.lang.String[]> rows)
Deprecated.Use toTSV with writer argumentvoid
toTSV(java.util.List<java.lang.String[]> rows, java.io.PrintWriter out)
Publish rows to raw TSV on specified print writerjava.lang.String
toXML()
Publish an XML upsert blockjava.lang.String
unitTests()
Unit testsjava.lang.String
update()
Update the field values in the database
Call the pre/postUpdate methodsjava.lang.String
update(boolean timestamp)
Update the field values in the database
Call the pre/postUpdate methodsjava.util.List<java.lang.String>
validate()
Core system validation (unicity, field format, mandatory...)
Must be called before any creation or update
It calls the preValidate and the postValidate methods
This method only returns errors and fatals, use validate(false) to also return infos and warningsjava.util.List<java.lang.String>
validate(boolean onlyErrors)
Core system validation (unicity, field format, mandatory...)
Must be called before any creation or update
It calls the preValidate and the postValidate methodsjava.util.List<java.lang.String>
validateSearch()
Core system search validation (mandatory...)
Must be called before any search
It calls the preValidateSearch and the postValidateSearch methods
This method is not supposed to be overridden-
Methods inherited from class com.simplicite.util.ObjectCore
addAgenda, addCrosstab, addDataMap, addDefaultValues, addLinkDataMap, addListOperationField, addMenuListField, addMenuTrayField, addPlaceMap, addPredefinedSearch, addPrintTemplate, addReflexiveLink, addResource, addScript, addSharedScript, addTimesheet, buildInsertSQL, canClose, canCopy, canCreateOnLink, canCreateOnLinks, canDeleteAll, canExport, canExportTimestamp, canFollowLink, canFollowLink, canFollowLinks, canGroupByFields, canListAccessNewForm, canListAccessNewLine, canListAccessNewLoop, canPreview, canPrint, canSave, canSaveAndClose, canSaveAndCopy, canSaveAndNew, canSelectRow, canUpdateAll, checkExpression, clearMenuTrayFields, convertFilterToService, convertGuiToService, convertServiceToFilter, convertServiceToGui, destroy, enableGC, evalExpression, evalExpression, evalExpression, evalExpression, evalInputDisplayOldValue, evalInputDisplayValue, evalInputOldValue, evalInputValue, filtersToJson, freeListTree, garbageCollection, genAction, genCommonActions, getAction, getActions, getAgenda, getAgendas, getAlias, getBooleanParameter, getCacheFrom, getCacheKey, getCacheSelect, getClassName, getCode, getCodes, getConfig, getConfirmField, getConfirmFieldValue, getContext, getContextTitle, getCopyId, getCreatedBy, getCreatedDate, getCrosstab, getCrosstabs, getCtxHelp, getCtxHelps, getCurrentAction, getCurrentItem, getCurrentList, getCurrentPage, getCurrentPos, getCurrentRowId, getCurrentTransition, getCurrentView, getData, getDataMap, getDataSource, getDataSourceVendor, getDbField, getDBField, getDbIndex, getDBIndex, getDBName, getDefaultLink, getDefaultSearchSpec, getDesc, getDisplay, getDisplay, getDisplay, getDisplayFromDB, getDocFields, getDoubleParameter, getEndDateField, getField, getField, getField, getFieldArea, getFieldArea, getFieldAreas, getFieldAtIndex, getFieldByObjectFieldId, getFieldByTranslation, getFieldDisplayOldValue, getFieldDisplayOldValue, getFieldDisplayValue, getFieldDisplayValue, getFieldDisplayValue, getFieldFilter, getFieldFromColumn, getFieldFromColumn, getFieldIndex, getFieldIndex, getFieldOldValue, getFieldOldValue, getFieldOrder, getFields, getFields, getFieldsByType, getFieldsDocument, getFieldValue, getFieldValue, getFieldValue, getFieldValues, getFieldValues, getFilters, getFilters, getFlagParameter, getFloatParameter, getFonctId, getForeignKeys, getFormLayout, getFullInput, getFullInput, getFullInputIndex, getFullInputIndex, getFunctId, getGrant, getGroupByFields, getHelp, getHistoricDBName, getHistoricName, getIconCode, getId, getImageField, getIndex, getIndex, getInheritedObjects, getInput, getInput, getInputAtIndex, getInputIndex, getInputIndex, getInstanceName, getIntParameter, getLabel, getLastUpdatedBy, getLastUpdatedDate, getLink, getLinkDataMap, getLinks, getListEditMode, getListOperationFields, getListSearchMode, getListSize, getListTree, getLock, getLongParameter, getMappedExportPath, getMappedFilePath, getMaxPage, getMaxRows, getMenuListFields, getMenuSearch, getMenuTrayFields, getMinRows, getModuleId, getModuleId, getModuleIdByName, getModuleName, getName, getObjectId, getObjectLocation, getObjectName, getObjectParameter, getObjectTable, getOldStatus, getOldValues, getOldValues, getPageSize, getParameter, getParameter, getParameters, getParentField, getParentIdx, getParentObjectRefField, getParentValues, getPlaceMap, getPlaceMaps, getPluralDisplay, getPluralLabel, getPredefinedSearch, getPredefinedSearches, getPredefinedSearchIndex, getPredefSearch, getPrintTemplate, getPrintTemplates, getRefField, getRefFields, getReflexiveLink, getReflexiveLinks, getRefObjects, getResource, getResources, getRootField, getRowId, getRowId, getRowIdField, getRowIdFieldIndex, getScript, getScriptId, getScripts, getSearchLimit, getSearchSpec, getSelectedIds, getSharedScript, getSharedScripts, getStartDateField, getStatus, getStatus, getStatusField, getStatusIndex, getTable, getTableAlias, getTargetObject, getTemplateId, getTemplateName, getTimesheet, getTimesheets, getTitle, getTitle, getUIMiniature, getUITemplate, getUserKeyValues, getUserKeyValues, getValues, getValues, getView, getView, getViewMode, getViews, hasChanged, hasField, hasFieldType, hasFullInput, hasIndexableFields, hasInput, hasMenuDashboard, hasMenuStates, hasMenuTray, hasMoreOnForm, hasMoreOnList, hasMoreOnSearch, hasSearchLimitError, haveMore, initLists, initLists, isAgendaInstance, isAjaxInstance, isAreaVisible, isAreaVisibleOnList, isBatchInstance, isBookmark, isChildOf, isChildOf, isCopied, isCronInstance, isCustomRowId, isDataMapInstance, isDataMappedFrom, isDate, isDistinct, isExportAllowed, isExportInstance, isFieldForbidden, isFieldSearchable, isFieldUpdatable, isFieldVisible, isFieldVisibleJSON, isFiltered, isHistoric, isHistoricLog, isHistoricPost, isHistoricRedoLog, isHomeInstance, isIDEInstance, isIndexable, isInstanceOf, isInternalRowId, isJavaImplemented, isLimit, isListEditable, isListSearch, isListSearchVisible, isListTree, isListUpsertable, isLoaded, isMainInstance, isMergeable, isMergeInstance, isModelerInstance, isMoreForm, isMoreFormEnable, isMoreListEnable, isMoreOnForm, isMoreOnList, isMoreRows, isMoreSearch, isNew, isOrdered, isPanelInstance, isPanelOf, isPanelOf, isPredefSearch, isPredefSearchOnList, isPrintInstance, isProcessInstance, isQuerySpecific, isReadOnly, isReadOnlyFields, isRefCount, isReferencedFrom, isReferencedFrom, isRefInstance, isScripted, isServiceSpecific, isSocial, isSocialInline, isSocialPopup, isSocialShare, isSortableOnList, isTimestampBlocking, isTimestampNonBlocking, isTimestampOptimistic, isTmpInstance, isTreeviewInstance, isUIInstance, isUndoableInstance, isUnique, isUnique, isWebServiceInstance, lastUsage, listSelectAll, listSelectId, listSelectId, listSelectPage, listUnselectAll, listUnselectId, parseDataSourceName, parseTableName, prepareExpression, preparePagination, prepareSQL, removeField, removeLink, removeParameter, removeParameters, removeView, resetAllFields, resetAllFieldsRequired, resetAllFieldsSearch, resetAllFieldsSearchRequired, resetAllFieldsUpdatable, resetContextDefaultValues, resetFilter, resetFilters, resetFilters, resetFiltersOrdersAndCalcDefaults, resetGroupBy, resetOrders, resetOrders, resetRequireds, resetSearchables, resetSelectedIds, resetUpdatables, resetValues, resetValues, resetValues, resetVisibilities, selectCurrentItemFromList, selectItemFromList, setAlias, setAllFieldsUpdatable, setAreaVisibleOnList, setBookmark, setCacheFrom, setCacheSelect, setClassName, setClose, setConfig, setConfirmFieldValue, setContext, setCopy, setCopy, setCopyId, setCreateOnLinks, setCrosstabVisibility, setCtxHelp, setCtxHelps, setCurrentAction, setCurrentList, setCurrentPage, setCurrentPos, setCurrentPos, setCurrentTransition, setCurrentView, setData, setDataSource, setDataSourceVendor, setDBName, setDefaultLink, setDefaultSearchSpec, setDeleteAll, setDeleteAll, setDesc, setDisplay, setDistinct, setEndDateField, setExport, setExport, setExportTimestamp, setFieldFilter, setFieldOldValue, setFieldOrder, setFields, setFieldValue, setFilters, setFilters, setFilters, setFilters, setFilters, setFilters, setFollowLinks, setForm, setFormLayout, setFunctId, setGrant, setGroupByFields, setHaveMore, setHelp, setHistoric, setHistoricLog, setHistoricPost, setHistoricRedoLog, setIconCode, setId, setIndexable, setInheritedObject, setInstanceName, setLabel, setLimit, setListAccessNewForm, setListAccessNewLine, setListAccessNewLine, setListEdit, setListEdit, setListEditable, setListEditable, setListEditMode, setListSearch, setListSearchMode, setListSearchVisible, setListSize, setListTree, setListUpsertable, setMaxPage, setMaxRows, setMenuDashboard, setMenuSearch, setMenuStates, setMenuTray, setMergeable, setMergeable, setMinRows, setModuleId, setModuleName, setMoreForm, setMoreOnForm, setMoreOnList, setMoreRows, setMoreSearch, setName, setOldValues, setOldValues, setOldValues, setPageSize, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParentObject, setParentObjectRefField, setParentValues, setPluralDisplay, setPluralLabel, setPredefinedSearchIndex, setPredefSearch, setPredefSearch, setPredefSearch, setPredefSearchOnList, setPrint, setPrintTemplateVisibility, setQuerySpecific, setQuerySpecific, setReadOnly, setRefCount, setRowId, setSave, setSaveAndClose, setSaveAndCopy, setSaveAndNew, setScriptId, setSearchCreatedBy, setSearchCreatedDate, setSearchLimit, setSearchLimitError, setSearchSpec, setSearchSpec, setSearchUpdatedBy, setSearchUpdatedDate, setSelectedIds, setSelectRow, setServiceSpecific, setServiceSpecific, setSocial, setSocial, setSortableOnList, setStartDateField, setStatus, setStatus, setStatus, setStatusField, setTable, setTimestamp, setTitle, setUIMiniature, setUITemplate, setUpdateAll, setUpdateAll, setUserKeyValues, setUserKeyValues, setValues, setValues, setValues, setValues, setValues, setValues, setValues, setValues, setValuesFromJSONObject, setValuesFromJSONObject, setViewMode, testData, testData, toHTML, toHTML, toHTML, toJSON, toJSON, toJSON, toJSON, toJSON, toJSON, toJSON, toJSON, toJSONArray, toJSONObject, toJSONObject, toJSONObject, toString, toString, useForm, useLimit, useTimestamp, useTimeStamp
-
-
-
-
Constructor Detail
-
ObjectDB
public ObjectDB()
Default constructor, should not be used.Grant.getXxxObject
methods should be preferred to benefit from cache mechanisms.
-
ObjectDB
public ObjectDB(Grant grant, java.lang.String name, java.lang.String instanceName)
Constructor, should not be used.Grant.getXxxObject
methods should be preferred to benefit from cache mechanisms.- Parameters:
grant
- Grantname
- Object name (e.g. "DummyObject")instanceName
- Object instance name (e.g. "my_DummyObject")
-
-
Method Detail
-
getInterface
public com.simplicite.util.engine.ObjectInterface getInterface()
Get the interface to manipulate objects (Local EJB, Remote EJB, WebService, Direct)
Accessing context updates the last usage of object- Returns:
- Interface context
-
getPreviousRowId
public java.lang.String getPreviousRowId()
The method gives the previous row ID of the current record in a search context- Returns:
- Previous row ID
-
getFirstRowId
public java.lang.String getFirstRowId()
The method gives the first row ID in a search context- Returns:
- First row ID
-
getNextRowId
public java.lang.String getNextRowId()
The method gives the next row ID of the current record in a search context- Returns:
- Next row ID
-
getLastRowId
public java.lang.String getLastRowId()
The method gives the last row ID in a search context- Returns:
- Last row ID
-
load
public ObjectDB load(Grant grant)
Object definition loading- Parameters:
grant
- User rights- Returns:
- Object definition
-
load
public final ObjectDB load(Grant grant, java.lang.String obj)
Default object definition loading, called by load(Grant)- Parameters:
grant
- User rightsobj
- Object name- Returns:
- Object definition
-
init
public ObjectDB init(java.lang.String name, Grant grant)
Load the object definition from the repository- Parameters:
name
- Object namegrant
- User rights- Returns:
- Object definition
-
initFromTable
public void initFromTable(java.lang.String table, Grant grant)
Load the object definition from the database table (beta)- Parameters:
table
- Table namegrant
- User rights
-
preLoad
public void preLoad()
Hook called before loading the object definition
-
postLoad
public void postLoad()
Hook called after loading the object definition
-
getSearchSpec
public java.lang.String getSearchSpec(java.lang.String s)
Eval the search specification
-
getFieldDefaultValue
public java.lang.String getFieldDefaultValue(ObjectField fld)
Eval a default value
-
populate
public void populate(boolean complete)
Populate all fields with the references, parent or default values- Parameters:
complete
- True to try to solve/complete the missing referenced data with the known fields
-
populate
public final void populate(ObjectField field)
Populate a field with the reference, the contextual or its default value
This method is not supposed to be overridden- Parameters:
field
- Object field
-
populate
public void populate(ObjectField field, boolean complete)
Populate a field with the reference, the contextual or its default value- Parameters:
field
- Object fieldcomplete
- True to try to solve/complete the missing referenced data with the known fields
-
populateForeignKey
public boolean populateForeignKey(java.lang.String refField, java.lang.String refId)
Populate all fields joined to a foreign key- Parameters:
refField
- Foreign key fieldrefId
- Referenced object id- Returns:
- true if the field is a foreign key and has been correctly set
-
populateForeignKey
public boolean populateForeignKey(java.lang.String refField, java.lang.String refId, boolean useSearchSpec, boolean reset)
Populate all fields joined to a foreign key- Parameters:
refField
- Foreign key fieldrefId
- Referenced object iduseSearchSpec
- False to disable any search spec on referenced objectreset
- Reset related fields if not found- Returns:
- true if the field is a foreign key and has been correctly set
-
populateForeignKey
public boolean populateForeignKey(java.lang.String fkName, java.lang.String refId, boolean useSearchSpec, boolean reset, ObjectField field)
Populate all fields joined to a foreign key- Parameters:
fkName
- Foreign key namerefId
- Referenced object iduseSearchSpec
- False to disable any search spec on referenced objectreset
- Reset related fields if not foundfield
- Optional referenced field- Returns:
- true if the field is a foreign key and has been correctly set
-
completeForeignKeys
public final java.util.List<java.lang.String> completeForeignKeys()
Try to complete the references (ids of foreign keys) with the field values
-
completeForeignKeys
public java.util.List<java.lang.String> completeForeignKeys(boolean err)
Try to complete the references (ids of foreign keys) with the field values- Parameters:
err
- trace errors?
-
preUpdateAll
public java.lang.String preUpdateAll(Parameters params)
Hook called before bulk update- Parameters:
params
- requested data- Returns:
- Error code or null
-
preUpdateAll
@Deprecated(forRemoval=false, since="4.0") public java.lang.String preUpdateAll()
Deprecated.Use preUpdateAll with paramters
-
postUpdateAll
public void postUpdateAll(Parameters params)
Hook called after bulk update- Parameters:
params
- requested data
-
postUpdateAll
@Deprecated(forRemoval=false, since="4.0") public void postUpdateAll()
Deprecated.Use postUpdateAll with paramters
-
preDeleteAll
public java.lang.String preDeleteAll()
Hook called before bulk delete- Returns:
- Error code or null
-
postDeleteAll
public java.lang.String postDeleteAll()
Hook called after bulk delete- Returns:
- Message or a redirect statement or null
-
preValidate
public java.util.List<java.lang.String> preValidate()
Hook called before system validation
It may be useful to force/calculate mandatory values- Returns:
- Error list, or empty/null when no business error
-
isStateTransitionEnable
public boolean isStateTransitionEnable(java.lang.String fromStatus, java.lang.String toStatus)
Hook called when building the list of possible state transition
It may be useful to implement specific state transition condition rules- Parameters:
fromStatus
- From statustoStatus
- To status- Returns:
- True when the state transition condition is fulfilled (true by default)
-
preStateTransition
public java.util.List<java.lang.String> preStateTransition(java.lang.String fromStatus, java.lang.String toStatus)
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- Parameters:
fromStatus
- From statustoStatus
- To status- Returns:
- Error list, or empty/null when no business error
-
postValidate
public java.util.List<java.lang.String> postValidate()
Hook called after system validation
It may be useful to check specific rules before update- Returns:
- Error list, or empty/null when no business error
-
validate
public final java.util.List<java.lang.String> validate()
Core system validation (unicity, field format, mandatory...)
Must be called before any creation or update
It calls the preValidate and the postValidate methods
This method only returns errors and fatals, use validate(false) to also return infos and warnings- Returns:
- Message list or empty/null when no business info or error
-
validate
public java.util.List<java.lang.String> validate(boolean onlyErrors)
Core system validation (unicity, field format, mandatory...)
Must be called before any creation or update
It calls the preValidate and the postValidate methods- Parameters:
onlyErrors
- True to retrieve only error/fatal level- Returns:
- Info, Warn, Error, Fatal lists or empty/null when no business message
-
count
public final long count()
Alias to getCount
-
getCount
public final long getCount()
Return the records count with the current search specification and filters
This method is not supposed to be overridden- Returns:
- Number of records of object search
-
getCount
public long getCount(int maxRows)
Return the records count with the current search specification and filters- 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
-
getCountGroupBy
public long getCountGroupBy(int maxRows)
Return the grouped records count with the current search specification and filters- 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 grouped records
-
getRefCount
public long getRefCount(java.lang.String refObject, java.lang.String refField)
Return the records count of a linked object (relation 0,n)- Parameters:
refObject
- Linked object namerefField
- Foreign key field (containing the row ID value of current object)- Returns:
- Number of linked records
-
getRefCalc
public long getRefCalc(java.lang.String refObject, java.lang.String refField, java.lang.String valueField, int operator)
Return the records operation (sum, average, min, max) of a linked object (relation 0,n)- Parameters:
refObject
- Linked object namerefField
- Foreign key field (containing the row ID value of current object)valueField
- Field that contains the value on which the operation is to be done in the linked objectoperator
- Operator (one of ObjectField.LIST_SUM/AVG/MIN/MAX)- Returns:
- Operation result on linked records
-
searchRowId
public final java.lang.String searchRowId()
Search with the current fields a matching record in the database
This method is not supposed to be overriden- Returns:
- null if not found, otherwise the row ID
-
searchRowId
public java.lang.String searchRowId(java.lang.String notId)
Search with the current fields a matching record in the database- Parameters:
notId
- The row ID to exclude- Returns:
- null if not found, otherwise the row ID
-
preExport
public void preExport()
Hook called before search in export of data
It may be useful to add some specific filters
-
postExport
public java.util.List<java.lang.String[]> postExport(java.util.List<java.lang.String[]> rows)
Hook called after search in export of data.
It may be useful to calculate fields or to change the records- Parameters:
rows
- The database result- Returns:
- The search result
-
preImport
public java.lang.String preImport()
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- Returns:
- Error
-
postImport
public java.lang.String postImport()
Hook called after processing object import
It may be useful to execute business rules after actually processing the import- Returns:
- Error
-
preObjectSearch
public void preObjectSearch()
Hook called before search of object reference
It may be useful to add some specific filters
-
postObjectSearch
public java.util.List<java.lang.String[]> postObjectSearch(java.util.List<java.lang.String[]> rows)
Hook called after search of object reference
It may be useful to calculate fields or to change the records- Parameters:
rows
- The database result- Returns:
- The search result
-
preValidateSearch
public java.util.List<java.lang.String> preValidateSearch()
Hook called before search validation with the fields filters
It may be useful to check filters
-
postValidateSearch
public java.util.List<java.lang.String> postValidateSearch()
Hook called after search validation with the fields filters
It may be useful to check filters
-
validateSearch
public final java.util.List<java.lang.String> validateSearch()
Core system search validation (mandatory...)
Must be called before any search
It calls the preValidateSearch and the postValidateSearch methods
This method is not supposed to be overridden- Returns:
- Message list or empty/null when no business info or error
-
preCount
public void preCount()
Hook called before count with the fields filters (by default it calls the preSearch hook)
It may be useful to add some specific filters
-
preSearch
public void preSearch()
Hook called before search with the fields filters
It may be useful to add some specific filters
-
postSearchRow
public java.lang.String[] postSearchRow(java.lang.String[] row)
Hook called after search for each record
It may be useful to calculate fields or to change the record values- 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)
Hook called after search with the fields filters
It may be useful to calculate fields or to change the records- Parameters:
rows
- The database result- Returns:
- The search result
-
preCrosstabSearch
public void preCrosstabSearch(Crosstab ctb)
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- Parameters:
ctb
- Pivot table
-
postCrosstabSearch
public java.util.List<java.lang.String[]> postCrosstabSearch(Crosstab ctb, java.util.List<java.lang.String[]> rows)
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- Parameters:
ctb
- Pivot tablerows
- The database result- Returns:
- The search result for the GUI
-
getQuery
public java.lang.String getQuery(java.util.List<ObjectField> host)
Return the SQL select statement with current filter- Parameters:
host
- Valued hosts- Returns:
- SQL select of object
-
search
public final java.util.List<java.lang.String[]> search()
Retrieve the database records with the currents search specification
and the field filters (without pagination)- Returns:
- Records: ArrayList of table of Strings, ordered with the sort context
-
search
public final java.util.List<java.lang.String[]> search(boolean pagine)
Retrieve the database records with the currents search specification and the field filters- Parameters:
pagine
- True to limit the search size (with min/max user properties)- Returns:
- Records: ArrayList of table of Strings, ordered with the sort context
-
search
public java.util.List<java.lang.String[]> search(boolean pagine, int maxRows)
Retrieve the database records with the currents search specification
and the field filters. Load the result in the object current list- Parameters:
pagine
- True to limit the search size (with min/max user properties)maxRows
- Limit to avoid a full table loading- Returns:
- Records: List of table of Strings, ordered with the sort context
-
search
public java.util.List<java.lang.String[]> search(boolean pagine, int maxRows, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage) throws SearchInterruptedException
Retrieve the database records with the currents search specification
and the field filters. Load the result in the object current list- Parameters:
pagine
- True to limit the search size (with min/max user properties)maxRows
- Limit to avoid a full table loadingonPage
- optional callback(rows) called for each page of rows- Returns:
- Records if not paginated: List of table of Strings, ordered with the sort context
- Throws:
SearchInterruptedException
- to break the pagination
-
searchExport
@Deprecated(forRemoval=true, since="4.0") public java.util.List<java.lang.String[]> searchExport()
Deprecated, for removal: This API element is subject to removal in a future version.Use searchExport with arguments
-
searchExport
public java.util.List<java.lang.String[]> searchExport(boolean pagine, int maxRows, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage) throws SearchInterruptedException
Same as a search but for the export of data by page- Parameters:
pagine
- Paginated searchmaxRows
- Page sizeonPage
- optional callback(rows) called for each page of rows- Returns:
- Records if not paginated
- Throws:
SearchInterruptedException
- to break the pagination
-
searchGroupBy
public final java.util.List<java.lang.String[]> searchGroupBy(boolean pagine)
Search with group by and count- Parameters:
pagine
- True to limit the search size (with min/max properties)- Returns:
- Records
-
searchGroupBy
public java.util.List<java.lang.String[]> searchGroupBy(boolean pagine, int maxRows)
Search with group by and count- Parameters:
pagine
- True to limit the search size (with min/max user properties)maxRows
- Limit to avoid a full table loading- Returns:
- Records
-
searchCrosstab
public java.util.List<java.lang.String[]> searchCrosstab(Crosstab c)
Same as a search but for a crosstab calculation and optimization- Parameters:
c
- The crosstable definition- Returns:
- Records
-
preSelect
public void preSelect(java.lang.String rowId, boolean copy)
Hook called before a single row selection- Parameters:
rowId
- The unique row ID to selectcopy
- Indicate if it's a select for a future copy
-
postSelect
public void postSelect(java.lang.String rowId, boolean copy)
Hook called after a single row selection- Parameters:
rowId
- The unique selected row IDcopy
- Indicate if it's a select for a future copy
-
select
public boolean select(java.lang.String rowId, boolean copy)
Selects a single record and loads the values into the object fields (either for simple selection or for copy)- Parameters:
rowId
- Unique row ID of the recordcopy
- Indicate whether the select is done for a future copy- Returns:
- True if the record exists
-
selectWithoutFilters
public final boolean selectWithoutFilters(java.lang.String rowId, boolean copy)
Same as a select without filters (only defaultSearchSpec is applied). The previous filters and current SearcSpec are restored after selection.- Parameters:
rowId
- Unique row ID of the recordcopy
- Indicate whether the select is done for a future copy- Returns:
- True if the record exists
-
selectWithoutFilters
public final boolean selectWithoutFilters(java.lang.String rowId, boolean copy, boolean ignoreSearchSpec)
Same as a select without filters The previous filters and current SearcSpec are restored after selection.- Parameters:
rowId
- Unique row ID of the recordcopy
- Indicate whether the select is done for a future copyignoreSearchSpec
- ignore also the current search spec (only defaultSearchSpec is applied)?- Returns:
- True if the record exists
-
select
public final boolean select(java.lang.String rowId)
Selects a single record and loads the values into the object fields- Parameters:
rowId
- Unique row ID of the record- Returns:
- True if the record exists
-
select
public boolean select(ObjectField[] fields, boolean copy)
Selects a single record and loads the specified valued fields into the object fields (either for simple selection or for copy)- Parameters:
fields
- Valued fieldscopy
- Indicate whether the select is done for a future copy- Returns:
- True if the record exists
-
getParentObject
public ObjectDB getParentObject()
Get the parent object for child lists- Overrides:
getParentObject
in classObjectCore
- Returns:
- Parent object or null
-
initSearch
public void initSearch()
Hook to init the search
-
initList
public void initList(ObjectDB parent)
Hook to init the list- Parameters:
parent
- Optional parent object
-
initCreate
public void initCreate()
Hook to init the creation
-
initCopy
public void initCopy()
Hook to init the copy
-
initUpdate
public void initUpdate()
Hook to init the update
-
initUpdateAll
public void initUpdateAll()
Hook to init the blulk update
-
initDelete
public void initDelete()
Hook to init the Delete before delete dialog
-
initExport
public void initExport()
Hook to init the Export before export dialog
-
initRefSelect
public void initRefSelect(ObjectDB parent)
Hook to init the reference selection- Parameters:
parent
- Parent object (from which selection is made)
-
initAssociate
public void initAssociate(ObjectDB parent)
Hook to init the association- Parameters:
parent
- Parent object (from which association is made)
-
initDataMapSelect
public void initDataMapSelect(java.lang.String datamapName, ObjectDB parent)
Hook to init the data mapping selection- Parameters:
datamapName
- Data mapping nameparent
- Parent object (from which selection is made)
-
initCrosstab
public void initCrosstab(java.lang.String crosstabName)
Hook to init a pivot table- Parameters:
crosstabName
- Pivot table name
-
initPrintTemplate
public void initPrintTemplate(java.lang.String prtName)
Hook to init a publication template- Parameters:
prtName
- Publication template name
-
initAgenda
public void initAgenda(Agenda agenda)
Hook to init an agenda- Parameters:
agenda
- Agenda
-
initPlaceMap
public void initPlaceMap(PlaceMap placemap)
Hook to init a place map- Parameters:
placemap
- Place map
-
initAction
public void initAction(Action action)
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
- Parameters:
action
- Action definition
-
evalNextRowId
public java.lang.String evalNextRowId(java.lang.String table)
Hook called before the database creation to send a specific unique id
(i.e. database sequence, String algorithm, timestamp...)- Parameters:
table
- Table name- Returns:
- Specific next row ID or null (to use the default behavior max+1)
-
preCreate
public java.lang.String preCreate()
Hook called before the database creation- Returns:
- Message code or null
-
postCreate
public java.lang.String postCreate()
Hook called after the database creation- Returns:
- Message code or null
-
create
public java.lang.String create()
Insert the object field values in the database Call the pre/postCreation.- Returns:
- Message code or null
-
preUpdate
public java.lang.String preUpdate()
Hook called before the database update- Returns:
- Message code or null
-
postUpdate
public java.lang.String postUpdate()
Hook called after the database update- Returns:
- Message code or null
-
update
public final java.lang.String update()
Update the field values in the database
Call the pre/postUpdate methods- Returns:
- Message code or null
-
update
public java.lang.String update(boolean timestamp)
Update the field values in the database
Call the pre/postUpdate methods- Parameters:
timestamp
- check and update the timestamp if any- Returns:
- Message code or null
-
preSave
public java.lang.String preSave()
Hook called before the database save- Returns:
- Message code or null
-
postSave
public java.lang.String postSave()
Hook called after the database save- Returns:
- Message code or null
-
save
public final java.lang.String save()
This method calls the preSave first,
then if the row ID is equals to '0', it calls the create method,
otherwise it calls the update method
Finally the method calls the postSave method- Returns:
- Message code or null
-
save
public java.lang.String save(boolean timestamp)
This method calls the preSave first,
then if the row ID is equals to '0', it calls the create method,
otherwise it calls the update method
Finally the method calls the postSave method- Parameters:
timestamp
- check and update the timestamp if any- Returns:
- Message code or null
-
canReference
public boolean canReference(java.lang.String target, java.lang.String foreignKey)
Hook called to check if a referenced object can be displayed- Parameters:
target
- Linked object name or view nameforeignKey
- Field name of foreign key (optional in case of object view)- Returns:
- True if the Link has been set to visible
-
preDelete
public java.lang.String preDelete()
Hook called before the database deletion- Returns:
- Message code or null
-
postDelete
public java.lang.String postDelete()
Hook called after the database deletion- Returns:
- Message or a redirect statement or null
-
isOpenEnable
public boolean isOpenEnable(java.lang.String[] row)
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- Parameters:
row
- Current record- Returns:
- True if open is granted to the user (by default read visibilities are checked, true is no visibility)
-
checkCreateVisibilities
public final boolean checkCreateVisibilities()
Check create visibilities
-
isCreateEnable
public boolean isCreateEnable()
Hook to check if the create action is available
This method must be called to check if the action is available for the user- Returns:
- True if creation is granted to the user (not readonly, create constraints and visibilities are checked)
-
checkUpdateVisibilities
public final boolean checkUpdateVisibilities(java.lang.String[] row)
Check update visibilities
-
isUpdateEnable
public boolean isUpdateEnable(java.lang.String[] row)
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- 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)
-
checkDeleteVisibilities
public final boolean checkDeleteVisibilities(java.lang.String[] row)
Check delete visibilities
-
isDeleteEnable
public boolean isDeleteEnable(java.lang.String[] row)
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- 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)
-
isCopyEnable
public boolean isCopyEnable(java.lang.String[] row)
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- Parameters:
row
- Current record- Returns:
- True if copy is granted to the user for the specified record (by default isCreateEnabled is called)
-
getConsole
public Console getConsole()
Get console- Returns:
- Console
-
setConsole
public void setConsole(Console console)
Set console- Parameters:
console
- Console
-
clear
public void clear()
Clear console and script agent
-
editTemplateUsage
public boolean editTemplateUsage()
Object is used in the template editor?- Returns:
- true if the object is used in the template editor
-
setConstraint
public void setConstraint(Constraint c)
Prepare the constraint- Parameters:
c
- Constraint
-
applyStaticConstraints
public void applyStaticConstraints()
Apply all static constraints on load
-
applyConstraints
public void applyConstraints(int context)
Apply all dynamic constraints- Parameters:
context
- Context
-
applyObjectConstraints
public void applyObjectConstraints(int context)
Apply all dynamic constraints on object- Parameters:
context
- Context (one of ObjectCore.CONTEXT_*)
-
checkCreateConstraints
public final boolean checkCreateConstraints()
Apply all create constraints on object- Returns:
- Constraint status
-
checkUpdateConstraints
public final boolean checkUpdateConstraints()
Apply all update constraints on object- Returns:
- Constraint status
-
checkDeleteConstraints
public final boolean checkDeleteConstraints()
Apply all delete constraints on object- Returns:
- Constraint status
-
checkObjectPropConstraints
public boolean checkObjectPropConstraints(int context, char objectProp)
Check object constraints for property- Parameters:
context
- ContextobjectProp
- Property- Returns:
- Constraint status
-
hasFieldConstraints
public boolean hasFieldConstraints(char effect)
Object contains fields impact ?- Parameters:
effect
- constraint side effect Constraint.EFFECT_*- Returns:
- Constraint status
-
applyFieldConstraints
public void applyFieldConstraints(int context)
Apply all constraints on fields- Parameters:
context
- Context
-
hasTargetConstraints
public boolean hasTargetConstraints(char effect)
Object contains target (action, view, area) impact ?- Parameters:
effect
- constraint side effect Constraint.EFFECT_*
-
applyTargetConstraints
public void applyTargetConstraints(int context)
Apply all constraints on targets (action, link or view)- Parameters:
context
- Context
-
isMergeMaster
public boolean isMergeMaster()
Hook to tell is current record the merge master ?- Returns:
- True if is merge master
-
isMergeEnable
public java.lang.String isMergeEnable(java.util.List<java.lang.String> ids)
Hook to tell if selected ids are mergeable- Parameters:
ids
- List of row IDs- Returns:
- Error or null by default
-
isActionEnable
public boolean isActionEnable(java.lang.String[] row, java.lang.String action)
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- Parameters:
row
- Current recordaction
- Action name- Returns:
- True when the action is granted to the user (checks visibility if any)
-
isCrosstabEnable
public boolean isCrosstabEnable(java.lang.String crosstab)
Hook to check if crosstab is available
This method must be called to check if the crosstab is available for the user- Parameters:
crosstab
- Crosstab name- Returns:
- True when the crosstab is granted to the user (check if crosstab is enabled by default)
-
isPrintTemplateEnable
public boolean isPrintTemplateEnable(java.lang.String[] row, java.lang.String printTemplate)
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- Parameters:
printTemplate
- Publication template name- Returns:
- True when the publication template is granted to the user (check if publication template is enabled by default)
-
printed
public java.lang.Object printed(PrintTemplate pt, java.lang.String rowId, java.lang.Object printed)
Callback hook when published. Useful to change the content or store the object before returning the publication result- Parameters:
pt
- Publication templaterowId
- Optional row IDprinted
- Published object (html, zip, pdf...)- Returns:
- Published object (the same by default)
-
checkDelete
@Deprecated(forRemoval=true, since="3.x") public final java.util.List<java.lang.String>[] checkDelete()
Deprecated, for removal: This API element is subject to removal in a future version.Use delete() method only
-
delete
@Deprecated(forRemoval=true, since="3.x") public final java.lang.String delete(java.util.List<java.lang.String> request)
Deprecated, for removal: This API element is subject to removal in a future version.Use delete() method only
-
delete
public java.lang.String delete()
Delete the current row and dependencies
This version use all the ObjectDB hooks
checkDelete() has not to be called first- Returns:
- Message code or null
-
del
public final java.lang.String del()
Delete the current row and dependencies (same as delete but for scripting usage)
-
merge
public final java.util.List<java.lang.String> merge(java.util.List<java.lang.String> ids, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> map)
Merge all records and links- Parameters:
ids
- Row IDs to merge in the current objectmap
- Id indexes per field (keep current value when absent) and per link (removed if absent, moved if present)- Returns:
- Error codes or null
-
merge
public java.util.List<java.lang.String> merge(java.util.List<java.lang.String> ids, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> map, org.json.JSONObject linkIds)
Merge all records and links- Parameters:
ids
- Row IDs to merge in the current objectmap
- Id indexes per field (keep current value when absent) and per link (removed if absent, moved if present)linkIds
- optional explicit IDs per link and index to preserve- Returns:
- Error codes or null
-
getFileName
public java.lang.String getFileName(java.lang.String docId)
Get the filename of a document stored in m_document- Parameters:
docId
- Document ID- Returns:
- Document name
-
getFilePath
public java.lang.String getFilePath(java.lang.String docId)
Get the relative path (from DOCDIR) of a document stored in m_document- Parameters:
docId
- Document ID- Returns:
- Document full path
-
preAlert
public java.lang.String preAlert(Alert a)
Hook before before sending the alert- 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)
Hook for sending the alert using a custom media- Returns:
- Error code or null
-
postAlert
public java.lang.String postAlert(Alert a)
Hook before after sending the alert- Returns:
- Error code or null
-
spamEmail
public boolean spamEmail(java.lang.String alert, java.lang.String group, java.lang.String email)
Hook called to check if the email is a recipient of the alert- Parameters:
alert
- Alert namegroup
- Optional user groupemail
- Email- Returns:
- True by default
-
spamGroup
public boolean spamGroup(java.lang.String alert, java.lang.String name)
Hook called to check if the group is a recipient of the alert- Parameters:
alert
- Alert namename
- Group name- Returns:
- True by default
-
getEmailRecipientType
public char getEmailRecipientType(java.lang.String alert, java.lang.String email, char type)
Hook to override the recipient type (TO/CC/BCC)- Parameters:
alert
- Alert nameemail
- Emailtype
- Default designed type- Returns:
- Recipient type
-
getGroupEmailRecipientType
public char getGroupEmailRecipientType(java.lang.String alert, java.lang.String group, char type)
Hook to override the recipient type (TO/CC/BCC) of a group- Parameters:
alert
- Alert namegroup
- Group nametype
- Default designed type- Returns:
- Recipient type
-
getDeadlineDate
public java.util.Date getDeadlineDate(java.lang.String rowId, java.lang.String state, java.lang.String update_dt, int timeout)
Eval the timeout date of the object state (can be overrided with a specific rule)- Parameters:
rowId
- Row ID (to select the record if needed)state
- Current stateupdate_dt
- Last update date in service format yyyy-MM-dd HH:mm:sstimeout
- Default designed delay in seconds- Returns:
- A date = update_dt+timeout
-
getAlert
public Alert getAlert(java.lang.String name, int type)
Get the Alert definition- Parameters:
name
- Alert nametype
- Warn or Info- Returns:
- The alert or null if unknown or disabled
-
prepareActionURL
public java.lang.String prepareActionURL(java.lang.String url, java.lang.String[] row)
Prepare action URL (substitute [object], [inst] and optionally [row_id] tags)- Parameters:
url
- URL to preparerow
- Optional row- Returns:
- Prepared URL
-
invokeAction
public final java.lang.String invokeAction(java.lang.String actionName) throws ActionException
Action call with optional parameters- Parameters:
actionName
- Action name- Returns:
- Action result
- Throws:
ActionException
-
invokeAction
public final java.lang.String invokeAction(Action action) throws ActionException
Action call without parameters- Parameters:
action
- Action- Returns:
- Action result
- Throws:
ActionException
-
invokeAction
public final java.lang.String invokeAction(java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> params) throws ActionException
Action call with optional parameters- Parameters:
actionName
- Action nameparams
- Optional parameters- Returns:
- Action result
- Throws:
ActionException
-
invokeAction
public java.lang.String invokeAction(Action action, java.util.Map<java.lang.String,java.lang.String> params) throws ActionException
Action call with optional parameters- Parameters:
action
- Actionparams
- Optional parameters- Returns:
- Action result
- Throws:
ActionException
-
invokePrint
public final java.lang.Object invokePrint(java.lang.String prtName) throws PrintException
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:getPrintTemplate(prtName).fillWithCurrentObject(this)
for single record (form) publicationgetPrintTemplate(prtName).fillWithCurrentList(this)
for multiple record (list) publication
- Parameters:
prtName
- Publication template name- Returns:
- Print result or null if publication template is not impemented as a method
- Throws:
PrintException
-
invokePrint
public java.lang.Object invokePrint(PrintTemplate prt) throws PrintException
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) publicationprt.fillWithCurrentList(this)
for multiple record (list) publication
- Parameters:
prt
- Publication template- Returns:
- Print result or null if publication template is not impemented as a method
- Throws:
PrintException
-
invokeMethod
public java.lang.Object invokeMethod(java.lang.String methodName, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues) throws MethodException
Method call with args- Parameters:
methodName
- Method nameparamTypes
- Table of class typesparamValues
- Table of values- Returns:
- Method result
- Throws:
MethodException
-
invokeCallback
public void invokeCallback(java.lang.String callbackName) throws MethodException
Simple callback method call- Parameters:
callbackName
- Callback name- Throws:
MethodException
-
invokeCallback
public void invokeCallback(java.lang.String callbackName, java.util.Map<java.lang.String,java.lang.String> params) throws MethodException
Simple callback method call- Parameters:
callbackName
- Callback nameparams
- Optional parameters field:value- Throws:
MethodException
-
getAgendaLabel
@Deprecated(forRemoval=false, since="4.0") public java.lang.String getAgendaLabel(Agenda a, ObjectField f)
Deprecated.
-
getAgendaValue
@Deprecated(forRemoval=false, since="4.0") public java.lang.String getAgendaValue(Agenda a, ObjectField f, java.lang.String val)
Deprecated.
-
getAgendaDay
@Deprecated(forRemoval=false, since="4.0") public java.lang.String getAgendaDay(Agenda a, java.util.Date d)
Deprecated.
-
getAgendaWeek
@Deprecated(forRemoval=false, since="4.0") public java.lang.String getAgendaWeek(Agenda a, java.util.List<java.lang.String> days)
Deprecated.
-
getAgendaSelector
@Deprecated(forRemoval=false, since="4.0") public java.lang.String getAgendaSelector(Agenda a, java.lang.String selector)
Deprecated.
-
evalCalculatedFields
public void evalCalculatedFields(int context)
Persistent field evaluations
-
evalObjectCalculatedFields
public void evalObjectCalculatedFields()
Other object field evaluations
-
evalCalculatedFields
public void evalCalculatedFields(int context, java.lang.String[] row)
Non persistent field evaluations- Parameters:
row
- a record
-
getUserKeyLabel
public java.lang.String getUserKeyLabel(java.lang.String[] row)
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- 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)
Build a label to represent the searchable fields
If row is null, the selected fields are used. May be overrided to implement specific label- Parameters:
row
- Any record, if row is null, the selected fields are used- Returns:
- The object summary with search values
-
getUserKeyList
public java.lang.String getUserKeyList(java.lang.String[] row, boolean excludeUserKey, int maxLength)
Build a label based on list fields- Parameters:
row
- Any record, if row is null, the selected fields are usedexcludeUserKey
- Exclude user-key fields ?maxLength
- to truncate text- Returns:
- The object summary with list values
-
getExportFileName
public java.lang.String getExportFileName(java.lang.String type, java.lang.String name, java.lang.String[] row)
Export file name: default is the object label or user key, this hook can be overridden to change the output name.- Parameters:
type
- Export type: CSV, XLSX, PDF, ZIP, XML... HTTPTool.MEDIA_*name
- Default name: print template, crosstab name or object namerow
- Optional record in case of form export- Returns:
- File name (if no extension specified, it will be set automatically from the mime-type)
-
isUndoable
public boolean isUndoable(java.lang.String action)
Hook to allow undo/redo on the object- 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()
Hook called before undo- Returns:
- true by default, return false to cancel the undo
-
postUndo
public void postUndo()
Hook called after undo
-
preRedo
public boolean preRedo()
Hook called before redo- Returns:
- true by default, return false to cancel the redo
-
postRedo
public void postRedo()
Hook called after redo
-
canUpdateAll
public boolean canUpdateAll(ObjectField f)
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
-
canUpdateAllEnum
public boolean canUpdateAllEnum(ObjectField f)
Enable status/enum for bulk update only if all the status/parent linked values are the same in the current search/selection- Parameters:
f
- Object field- Returns:
- true if status/parent enum is constant
-
storeParentContext
public static ObjectDB storeParentContext(java.lang.String prefix, ObjectDB parent, java.lang.String childObject, java.lang.String childField, java.lang.String[] values)
Store parent object context / must be called before any count/search of child list- Parameters:
prefix
- Object prefix for child (e.g. "panel_")parent
- Parent objectchildObject
- Child object namechildField
- Foreign key namevalues
- Values (if null current parent values are used)
-
storeParentContext
public ObjectDB storeParentContext(ObjectDB parent, java.lang.String refField, java.lang.String[] values)
Store parent object context / must be called before any count/search of child list- Parameters:
parent
- Parent objectrefField
- Foreign key namevalues
- Values (if null current parent values are used)
-
resetParentContext
public void resetParentContext()
Reset parent object context
-
makeTree
public void makeTree(ObjectNode root, java.lang.String parentId, java.util.List<java.lang.String[]> rows, int depth)
Build the partial tree- Parameters:
root
- Tree rootparentId
- Node row IDrows
- List of records to add to parentdepth
- Deep search depth
-
insertTree
public void insertTree(ObjectNode parent, int depth)
Search and add children to parent node- Parameters:
parent
- Parent nodedepth
- Deep search depth
-
deleteTree
public void deleteTree(ObjectNode tree, java.lang.String id)
-
buildTreeList
public void buildTreeList(ObjectNode node, java.util.List<ObjectNode> v)
-
fieldCompletion
public java.util.List<java.lang.String> fieldCompletion(java.lang.String input, java.lang.String query, java.lang.String context)
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- Parameters:
input
- Field to searchquery
- User query/filtercontext
- 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
-
addLink
public Link addLink(ObjectDB object, ObjectField fk, java.lang.String display, java.lang.String help, java.lang.String card, int order, boolean copy, char associate, boolean visible, boolean inline, char cascad, java.lang.String icon)
Add dynamically a link (and its single view) to the object- Parameters:
object
- Child object with a reference to this objectfk
- Foreign key field in the child objectdisplay
- View displayhelp
- Optional helpcard
- Cardinality 0,norder
- View orderingcopy
- Allows cascad copy ?associate
- Alows bulk associations ?visible
- View is visible ?inline
- In inline (in case of 0,1 ou 1,1)cascad
- From ObjectDB.DEL_*icon
- Optional icon code- Returns:
- Created link
-
addLinkMetaObject
public Link addLinkMetaObject(ObjectDB object, int order)
Add dynamically a meta-object link (ant its single view) to the object- Parameters:
object
- Child object with a meta-objet field (reference to this object)order
- View ordering- Returns:
- Created link
-
getStyle
public java.lang.String getStyle(ObjectField f, java.lang.String val)
Gets specified field style for single value
May be override to change the style with specific business rules- Parameters:
f
- Fieldval
- Value- Returns:
- CSS class(es) empty by default
-
getStyle
public java.lang.String getStyle(ObjectField f, java.lang.String[] row)
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- Parameters:
f
- Fieldrow
- Values array- Returns:
- CSS class(es) empty by default
-
getStyle
public java.lang.String getStyle(ObjectField f, double val)
Hook to specify field style for a crosstab value- Parameters:
f
- Fieldval
- Value- Returns:
- CSS class(es), null by default
-
getStyleTree
public java.lang.String getStyleTree(TreeView tv, java.lang.String[] row)
Hook to assign a style to a treeview item- Parameters:
tv
- Treeviewrow
- Values array- Returns:
- CSS class(es), null by default
-
getImage
public java.lang.String getImage(ObjectField f, java.lang.String val)
Get the field icon from single value. May be override to change the style with specific business rules- Parameters:
f
- Fieldval
- Image value- Returns:
- Icon name
-
getImage
public java.lang.String getImage(ObjectField f, java.lang.String[] row)
Get the field icon from values array. May be override to change the style with specific business rules- Parameters:
f
- Fieldrow
- Values array- Returns:
- Icon name
-
getImageTree
public java.lang.String getImageTree(TreeView tv, java.lang.String[] row)
Hook to assign one icon to a treeview item- Parameters:
tv
- Treeviewrow
- Values array- Returns:
- Icon name
-
sendRedirect
public java.lang.String sendRedirect(java.lang.String url)
Generate a redirect statement to be returned by an action method- Parameters:
url
- URL to redirect to
-
redirect
public java.lang.String redirect(java.lang.String url)
Alias to sendRedirect- Parameters:
url
- URL to redirect to
-
sendJavaScript
public java.lang.String sendJavaScript(java.lang.String js)
Generate a JavaScript statement to be returned by an action method- Parameters:
js
- JavaScript statement
-
javascript
public java.lang.String javascript(java.lang.String js)
Alias to sendJavaScript- Parameters:
js
- JavaScript statement
-
toXML
public java.lang.String toXML()
Publish an XML upsert block- Returns:
- XML upsert block
-
toCSV
@Deprecated(forRemoval=false, since="4.0") public java.lang.String toCSV(java.util.List<java.lang.String[]> rows)
Deprecated.Use toCSV with writer argument
-
toCSV
public void toCSV(java.util.List<java.lang.String[]> rows, java.io.PrintWriter out)
Publish rows to raw CSV on specified print writer
- Parameters:
rows
- Rowsout
- Print writer
-
toTSV
@Deprecated(forRemoval=false, since="4.0") public java.lang.String toTSV(java.util.List<java.lang.String[]> rows)
Deprecated.Use toTSV with writer argument
-
toTSV
public void toTSV(java.util.List<java.lang.String[]> rows, java.io.PrintWriter out)
Publish rows to raw TSV on specified print writer
- Parameters:
rows
- Rowsout
- Print writer
-
unitTests
public java.lang.String unitTests()
Unit tests- Returns:
- Unit tests results
-
docuSign
public void docuSign(DocSignProvider.DocSignStatus data)
DocuSign web-hook https://developers.docusign.com/esign-rest-api/code-examples/webhook-status
-
getDirectURL
public java.lang.String getDirectURL(boolean form)
Get external access URL to object- Parameters:
form
- form or list- Returns:
- Absolute URL
-
getSocialShareData
public SocialShareData getSocialShareData()
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)- Returns:
- Share data
-
initTimesheet
public void initTimesheet(Timesheet ts)
Hook to change timesheet before rendering- Parameters:
ts
- Timesheet
-
preSaveTimesheet
public java.util.List<java.lang.String> preSaveTimesheet(Timesheet ts)
Hook called before Timesheet save- Parameters:
ts
- Timesheet- Returns:
- Message codes or null
-
postSaveTimesheet
public java.util.List<java.lang.String> postSaveTimesheet(Timesheet ts)
Hook called after Timesheet save- Parameters:
ts
- Timesheet- Returns:
- Message codes or null
-
preSavePredefinedSearch
public java.lang.String preSavePredefinedSearch(PredefinedSearch ps)
Hook called before predefined-search save- Parameters:
ps
- Predefined search- Returns:
- Error or null
-
postSavePredefinedSearch
public void postSavePredefinedSearch(PredefinedSearch ps)
Hook called after predefined-search save- Parameters:
ps
- Predefined search
-
getTool
public BusinessObjectTool getTool()
Get a business object tool wrapper for the object- Returns:
- Business object tool wrapper
-
-