Package com.simplicite.util.tools
Class BusinessObjectTool
- java.lang.Object
-
- com.simplicite.util.tools.BusinessObjectTool
-
public class BusinessObjectTool extends java.lang.Object
Helper class to manipulate business objects in specific code
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BusinessObjectTool.ReturnMessage
Return message
-
Constructor Summary
Constructors Constructor Description BusinessObjectTool(Grant grant, java.lang.String objectName, java.lang.String objectIntanceName)
ConstructorBusinessObjectTool(ObjectDB object)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count()
Helper method to process a count (with current filters) throwing exception in case of errorlong
count(java.util.Map<java.lang.String,java.lang.String> filters)
Helper method to process a filtered count (with current filters) throwing exception in case of errorlong
count(org.json.JSONObject filters)
Helper method to process a filtered count throwing exception in case of errorBusinessObjectTool.ReturnMessage
create()
Helper method to process create save throwing exception in case of error
Forces row ID at objectField.DEFAULT_ROW_ID and calls saveBusinessObjectTool.ReturnMessage
create(boolean undoredo)
Helper method to process create save throwing exception in case of error
Forces row ID at objectField.DEFAULT_ROW_ID and calls saveBusinessObjectTool.ReturnMessage
del()
Alias to delete (naming suitable for script usage)BusinessObjectTool.ReturnMessage
del(boolean undoredo)
Alias to delete (naming suitable for script usage)BusinessObjectTool.ReturnMessage
delete()
Helper method to process deletion throwing exception in case of errorBusinessObjectTool.ReturnMessage
delete(boolean undoredo)
Helper method to process deletion throwing exception in case of errorvoid
get(java.lang.String rowId)
Helper method to process row selection throwing exception in case of errorjava.lang.String
get(java.util.Map<java.lang.String,java.lang.String> filters)
Helper method to process a single row selection throwing exception in case of error or if the passed filters returns more than one recordjava.lang.String
get(org.json.JSONObject filters)
Helper method to process a single row selection throwing exception in case of error or if the passed filters returns more than one recordvoid
getForCopy(java.lang.String rowId)
Helper method to process row selection for copy throwing exception in case of errorvoid
getForCopy(java.lang.String rowId, boolean init)
Helper method to process row selection for copy throwing exception in case of errorvoid
getForCreate()
Helper method to process row initialization for create throwing exception in case of errorvoid
getForCreate(boolean init)
Helper method to process row initialization for create throwing exception in case of errorboolean
getForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters)
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one recordboolean
getForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters, boolean init)
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one recordboolean
getForCreateOrUpdate(org.json.JSONObject filters)
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one recordboolean
getForCreateOrUpdate(org.json.JSONObject filters, boolean init)
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one recordboolean
getForCreateOrUpdate(org.json.JSONObject filters, boolean init, boolean functIdOnly)
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one recordvoid
getForDelete(java.lang.String rowId)
Helper method to process row selection for deletion throwing exception in case of errorvoid
getForDelete(java.lang.String rowId, boolean init)
Helper method to process row selection for deletion throwing exception in case of errorvoid
getForUpdate(java.lang.String rowId)
Helper method to process row selection for update throwing exception in case of errorvoid
getForUpdate(java.lang.String rowId, boolean init)
Helper method to process row selection for update throwing exception in case of errorboolean
getForUpsert(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdateboolean
getForUpsert(java.util.Map<java.lang.String,java.lang.String> filters, boolean init)
Alias to getForCreateOrUpdateboolean
getForUpsert(org.json.JSONObject filters)
Alias to getForCreateOrUpdateboolean
getForUpsert(org.json.JSONObject filters, boolean init)
Alias to getForCreateOrUpdateObjectDB
getObject()
Get objectvoid
log(java.lang.String method, PlatformException e)
Helper method to handle a platform exception as a log entry (for code EXCEPTION)BusinessObjectTool.ReturnMessage
save()
Helper method to process save (create or update) throwing appropriate exception in case of errorBusinessObjectTool.ReturnMessage
save(boolean timestamp)
Helper method to process save (create or update) throwing appropriate exception in case of errorBusinessObjectTool.ReturnMessage
save(boolean timestamp, boolean undoredo)
Helper method to process save (create or update) throwing appropriate exception in case of errorjava.util.List<java.lang.String[]>
search()
Helper method to process a non paginated search (with current filters) throwing exception in case of errorjava.util.List<java.lang.String[]>
search(int pageSize, int page)
Helper method to process an paginated search (with current filters) throwing exception in case of errorvoid
search(int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage)
Helper method to process a paginated search (with current filters) throwing exception in case of errorjava.util.List<java.lang.String[]>
search(java.util.Map<java.lang.String,java.lang.String> filters)
Helper method to process a filtered search throwing exception in case of errorvoid
search(java.util.Map<java.lang.String,java.lang.String> filters, int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage)
Helper method to process a filtered paginated search throwing exception in case of errorjava.util.List<java.lang.String[]>
search(org.json.JSONObject filters)
Helper method to process a filtered non paginated search throwing exception in case of errorjava.util.List<java.lang.String[]>
search(org.json.JSONObject filters, int pageSize, int page)
Helper method to process a paginated filtered search throwing exception in case of errorvoid
search(org.json.JSONObject filters, int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage)
Helper method to process a filtered paginated search throwing exception in case of errorvoid
select(java.lang.String rowId)
Alias of getjava.lang.String
select(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdatejava.lang.String
select(org.json.JSONObject filters)
Alias to getvoid
selectForCopy(java.lang.String rowId)
Alias of getForCopyvoid
selectForCopy(java.lang.String rowId, boolean init)
Alias of getForCopyvoid
selectForCreate()
Alias of getForCreatevoid
selectForCreate(boolean init)
Alias of getForCreateboolean
selectForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdateboolean
selectForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters, boolean init)
Alias to getForCreateOrUpdateboolean
selectForCreateOrUpdate(org.json.JSONObject filters)
Alias to getForCreateOrUpdateboolean
selectForCreateOrUpdate(org.json.JSONObject filters, boolean init)
Alias to getForCreateOrUpdatevoid
selectForDelete(java.lang.String rowId)
Alias to getForDeletevoid
selectForDelete(java.lang.String rowId, boolean init)
Alias to getForDeletevoid
selectForUpdate(java.lang.String rowId)
Alias to getForUpdatevoid
selectForUpdate(java.lang.String rowId, boolean init)
Alias to getForUpdateboolean
selectForUpsert(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdateboolean
selectForUpsert(java.util.Map<java.lang.String,java.lang.String> filters, boolean init)
Alias to getForCreateOrUpdateboolean
selectForUpsert(org.json.JSONObject filters)
Alias to getForCreateOrUpdateboolean
selectForUpsert(org.json.JSONObject filters, boolean init)
Alias to getForCreateOrUpdatejava.util.List<BusinessObjectTool.ReturnMessage>
selectValidateAndSave(java.lang.String rowId, boolean copy, boolean timestamp, boolean redolog, org.json.JSONObject fieldValues)
Helper to force access rights, select a record, set values, validate and save and restore rights access, in a synchronized block.java.util.List<BusinessObjectTool.ReturnMessage>
selectValidateAndSave(java.lang.String rowId, boolean copy, boolean timestamp, java.util.Map<java.lang.String,java.lang.String> fieldValues)
Helper to force access rights, select a record, set values, validate and save and restore rights access, in a synchronized block.double
sum(java.lang.String field, java.util.List<java.lang.String[]> rows)
Helper method to process sum for a given field from given rows throwing exception in case of errordouble
sum(java.lang.String field, java.util.Map<java.lang.String,java.lang.String> filters)
Helper method to process sum for a given field from a filtered search throwing exception in case of errordouble
sum(java.lang.String field, org.json.JSONObject filters)
Helper method to process sum for a given field from a filtered search throwing exception in case of errorBusinessObjectTool.ReturnMessage
update()
Helper method to process update save throwing exception in case of errorBusinessObjectTool.ReturnMessage
update(boolean timestamp)
Helper method to process update save throwing exception in case of errorBusinessObjectTool.ReturnMessage
update(boolean timestamp, boolean undoredo)
Helper method to process update save throwing exception in case of errorjava.util.List<BusinessObjectTool.ReturnMessage>
validate()
Helper method to process validation throwing exception in case of error(s)java.util.List<BusinessObjectTool.ReturnMessage>
validateAndCreate()
Helper method to process validation and create save throwing appropriate exception in case of error(s)
Forces row ID at objectField.DEFAULT_ROW_ID and calls validateAndSavejava.util.List<BusinessObjectTool.ReturnMessage>
validateAndCreate(boolean undoredo)
Helper method to process validation and create save throwing appropriate exception in case of error(s)
Forces row ID at objectField.DEFAULT_ROW_ID and calls validateAndSavejava.util.List<BusinessObjectTool.ReturnMessage>
validateAndSave()
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)java.util.List<BusinessObjectTool.ReturnMessage>
validateAndSave(boolean timestamp)
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)java.util.List<BusinessObjectTool.ReturnMessage>
validateAndSave(boolean timestamp, boolean undoredo)
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)java.util.List<java.lang.String[]>
validateAndSearch()
Helper method to process search validation and search throwing exception in case of errorjava.util.List<BusinessObjectTool.ReturnMessage>
validateAndUpdate()
Helper method to process validation and update save throwing appropriate exception in case of error(s)java.util.List<BusinessObjectTool.ReturnMessage>
validateAndUpdate(boolean timestamp)
Helper method to process validation and update save throwing appropriate exception in case of error(s)java.util.List<BusinessObjectTool.ReturnMessage>
validateAndUpdate(boolean timestamp, boolean undoredo)
Helper method to process validation and update save throwing appropriate exception in case of error(s)
-
-
-
Constructor Detail
-
BusinessObjectTool
public BusinessObjectTool(ObjectDB object)
Constructor- Parameters:
object
- Business object
-
BusinessObjectTool
public BusinessObjectTool(Grant grant, java.lang.String objectName, java.lang.String objectIntanceName)
Constructor- Parameters:
grant
- GrantobjectName
- Object nameobjectIntanceName
- Object instance name
-
-
Method Detail
-
getObject
public ObjectDB getObject()
Get object- Returns:
- Object
-
get
public void get(java.lang.String rowId) throws GetException
Helper method to process row selection throwing exception in case of error- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
select
public void select(java.lang.String rowId) throws GetException
Alias of get- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
getForCreate
public void getForCreate() throws GetException
Helper method to process row initialization for create throwing exception in case of error- Throws:
GetException
-
getForCreate
public void getForCreate(boolean init) throws GetException
Helper method to process row initialization for create throwing exception in case of error- Parameters:
init
- Call the creation init hook?- Throws:
GetException
-
selectForCreate
public void selectForCreate() throws GetException
Alias of getForCreate- Throws:
GetException
-
selectForCreate
public void selectForCreate(boolean init) throws GetException
Alias of getForCreate- Parameters:
init
- Call the creation init hook?- Throws:
GetException
-
getForCopy
public void getForCopy(java.lang.String rowId) throws GetException
Helper method to process row selection for copy throwing exception in case of error- Parameters:
rowId
- Row ID of row to copy from- Throws:
GetException
-
getForCopy
public void getForCopy(java.lang.String rowId, boolean init) throws GetException
Helper method to process row selection for copy throwing exception in case of error- Parameters:
rowId
- Row ID of row to copy frominit
- Call the copy init hook?- Throws:
GetException
-
selectForCopy
public void selectForCopy(java.lang.String rowId) throws GetException
Alias of getForCopy- Parameters:
rowId
- Row ID of row to copy from- Throws:
GetException
-
selectForCopy
public void selectForCopy(java.lang.String rowId, boolean init) throws GetException
Alias of getForCopy- Parameters:
rowId
- Row ID of row to copy frominit
- Call the copy init hook?- Throws:
GetException
-
getForUpdate
public void getForUpdate(java.lang.String rowId) throws GetException
Helper method to process row selection for update throwing exception in case of error- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
getForUpdate
public void getForUpdate(java.lang.String rowId, boolean init) throws GetException
Helper method to process row selection for update throwing exception in case of error- Parameters:
rowId
- Row ID of row to getinit
- Call the update init hook?- Throws:
GetException
-
selectForUpdate
public void selectForUpdate(java.lang.String rowId) throws GetException
Alias to getForUpdate- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
selectForUpdate
public void selectForUpdate(java.lang.String rowId, boolean init) throws GetException
Alias to getForUpdate- Parameters:
rowId
- Row ID of row to getinit
- Call the update init hook?- Throws:
GetException
-
get
public java.lang.String get(org.json.JSONObject filters) throws GetException
Helper method to process a single row selection throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- the row ID of the found row
- Throws:
GetException
- if no record or more than one row is found
-
select
public java.lang.String select(org.json.JSONObject filters) throws GetException
Alias to get- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- the row ID of the found row
- Throws:
GetException
- if no record or more than one row is found
-
get
public java.lang.String get(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Helper method to process a single row selection throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- the row ID of the found row
- Throws:
GetException
- if no record or more than one row is found
-
select
public java.lang.String select(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Throws:
GetException
- if no record or more than one row is found
-
getForCreateOrUpdate
public boolean getForCreateOrUpdate(org.json.JSONObject filters) throws GetException
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForCreateOrUpdate
public boolean getForCreateOrUpdate(org.json.JSONObject filters, boolean init) throws GetException
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForCreateOrUpdate
public boolean getForCreateOrUpdate(org.json.JSONObject filters, boolean init, boolean functIdOnly) throws GetException
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?functIdOnly
- Search only with functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForCreateOrUpdate
public boolean selectForCreateOrUpdate(org.json.JSONObject filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForCreateOrUpdate
public boolean selectForCreateOrUpdate(org.json.JSONObject filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForUpsert
public boolean getForUpsert(org.json.JSONObject filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForUpsert
public boolean getForUpsert(org.json.JSONObject filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForUpsert
public boolean selectForUpsert(org.json.JSONObject filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForUpsert
public boolean selectForUpsert(org.json.JSONObject filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters JSON object (allows webservice naming), should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForCreateOrUpdate
public boolean getForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters map, should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForCreateOrUpdate
public boolean getForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters, boolean init) throws GetException
Helper method to process row selection for create or update (upsert) throwing exception in case of error or if the passed filters returns more than one record- Parameters:
filters
- Filters map, should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForCreateOrUpdate
public boolean selectForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForCreateOrUpdate
public boolean selectForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForUpsert
public boolean getForUpsert(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForUpsert
public boolean getForUpsert(java.util.Map<java.lang.String,java.lang.String> filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForUpsert
public boolean selectForUpsert(java.util.Map<java.lang.String,java.lang.String> filters) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fields- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
selectForUpsert
public boolean selectForUpsert(java.util.Map<java.lang.String,java.lang.String> filters, boolean init) throws GetException
Alias to getForCreateOrUpdate- Parameters:
filters
- Filters map, should at least include filters on all functional key fieldsinit
- Call the creation/updat init hook?- Returns:
- True if an existing record was selected for update and false if record was initialized for creation
- Throws:
GetException
-
getForDelete
public void getForDelete(java.lang.String rowId) throws GetException
Helper method to process row selection for deletion throwing exception in case of error- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
getForDelete
public void getForDelete(java.lang.String rowId, boolean init) throws GetException
Helper method to process row selection for deletion throwing exception in case of error- Parameters:
rowId
- Row ID of row to getinit
- Call the deletion init hook?- Throws:
GetException
-
selectForDelete
public void selectForDelete(java.lang.String rowId) throws GetException
Alias to getForDelete- Parameters:
rowId
- Row ID of row to get- Throws:
GetException
-
selectForDelete
public void selectForDelete(java.lang.String rowId, boolean init) throws GetException
Alias to getForDelete- Parameters:
rowId
- Row ID of row to getinit
- Call the deletion init hook?- Throws:
GetException
-
validateAndSearch
public java.util.List<java.lang.String[]> validateAndSearch() throws ValidateSearchException, SearchException
Helper method to process search validation and search throwing exception in case of error- Returns:
- Search result
- Throws:
ValidateSearchException
SearchException
-
count
public long count() throws SearchException
Helper method to process a count (with current filters) throwing exception in case of error- Returns:
- Count result
- Throws:
SearchException
-
count
public long count(org.json.JSONObject filters) throws SearchException
Helper method to process a filtered count throwing exception in case of error- Parameters:
filters
- Filters JSON object (allows webservice naming)- Returns:
- Count result
- Throws:
SearchException
-
count
public long count(java.util.Map<java.lang.String,java.lang.String> filters) throws SearchException
Helper method to process a filtered count (with current filters) throwing exception in case of error- Parameters:
filters
- Filters map- Returns:
- Count result
- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search() throws SearchException
Helper method to process a non paginated search (with current filters) throwing exception in case of error- Returns:
- Search result
- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search(int pageSize, int page) throws SearchException
Helper method to process an paginated search (with current filters) throwing exception in case of error- Parameters:
pageSize
- Page sizepage
- Page number (0 is first page, -1 means non paginated)- Returns:
- Search result
- Throws:
SearchException
-
search
public void search(int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage) throws SearchException
Helper method to process a paginated search (with current filters) throwing exception in case of error- Parameters:
pageSize
- Page sizeonPage
- Page handler called for each page- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search(org.json.JSONObject filters) throws SearchException
Helper method to process a filtered non paginated search throwing exception in case of error- Parameters:
filters
- Filters JSON object (allows webservice naming)- Returns:
- Search result
- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search(org.json.JSONObject filters, int pageSize, int page) throws SearchException
Helper method to process a paginated filtered search throwing exception in case of error- Parameters:
filters
- Filters JSON object (allows webservice naming)pageSize
- Page sizepage
- Page number (0 is first page, -1 means non paginated)- Returns:
- Search result
- Throws:
SearchException
-
search
public void search(org.json.JSONObject filters, int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage) throws SearchException
Helper method to process a filtered paginated search throwing exception in case of error- Parameters:
filters
- Filters JSON object (allows webservice naming)pageSize
- Page sizeonPage
- Page handler called for each page- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search(java.util.Map<java.lang.String,java.lang.String> filters) throws SearchException
Helper method to process a filtered search throwing exception in case of error- Parameters:
filters
- Filters map- Returns:
- Search result
- Throws:
SearchException
-
search
public void search(java.util.Map<java.lang.String,java.lang.String> filters, int pageSize, ObjectDB.SearchCallback<java.util.List<java.lang.String[]>> onPage) throws SearchException
Helper method to process a filtered paginated search throwing exception in case of error- Parameters:
filters
- Filters mappageSize
- Page sizeonPage
- Page handler called for each page- Throws:
SearchException
-
sum
public double sum(java.lang.String field, org.json.JSONObject filters) throws ParamsException, SearchException
Helper method to process sum for a given field from a filtered search throwing exception in case of error- Parameters:
field
- Field namefilters
- Filters JSON object (allows webservice naming)- Returns:
- Sum result
- Throws:
ParamsException
SearchException
-
sum
public double sum(java.lang.String field, java.util.Map<java.lang.String,java.lang.String> filters) throws ParamsException, SearchException
Helper method to process sum for a given field from a filtered search throwing exception in case of error- Parameters:
field
- Field namefilters
- Filters map- Returns:
- Sum result
- Throws:
ParamsException
SearchException
-
sum
public double sum(java.lang.String field, java.util.List<java.lang.String[]> rows) throws ParamsException, SearchException
Helper method to process sum for a given field from given rows throwing exception in case of error- Parameters:
field
- Field namerows
- Rows- Returns:
- Sum result
- Throws:
ParamsException
SearchException
-
validate
public java.util.List<BusinessObjectTool.ReturnMessage> validate() throws ValidateException
Helper method to process validation throwing exception in case of error(s)- Returns:
- Information/warning messages or null
- Throws:
ValidateException
-
save
public BusinessObjectTool.ReturnMessage save() throws SaveException
Helper method to process save (create or update) throwing appropriate exception in case of error- Returns:
- Information/warning message or null
- Throws:
SaveException
-
save
public BusinessObjectTool.ReturnMessage save(boolean timestamp) throws SaveException
Helper method to process save (create or update) throwing appropriate exception in case of error- Parameters:
timestamp
- check and update the timestamp if any- Returns:
- Information/warning message or null
- Throws:
SaveException
-
save
public BusinessObjectTool.ReturnMessage save(boolean timestamp, boolean undoredo) throws SaveException
Helper method to process save (create or update) throwing appropriate exception in case of error- Parameters:
timestamp
- check and update the timestamp if anyundoredo
- create the redolog if any- Returns:
- Information/warning message or null
- Throws:
SaveException
-
create
public BusinessObjectTool.ReturnMessage create() throws CreateException
Helper method to process create save throwing exception in case of error
Forces row ID at objectField.DEFAULT_ROW_ID and calls save- Returns:
- Information/warning message or null
- Throws:
CreateException
-
create
public BusinessObjectTool.ReturnMessage create(boolean undoredo) throws CreateException
Helper method to process create save throwing exception in case of error
Forces row ID at objectField.DEFAULT_ROW_ID and calls save- Parameters:
undoredo
- create the redolog if any- Returns:
- Information/warning message or null
- Throws:
CreateException
-
update
public BusinessObjectTool.ReturnMessage update() throws UpdateException
Helper method to process update save throwing exception in case of error- Throws:
UpdateException
-
update
public BusinessObjectTool.ReturnMessage update(boolean timestamp) throws UpdateException
Helper method to process update save throwing exception in case of error- Parameters:
timestamp
- check and update the timestamp if any- Returns:
- Information/warning message or null
- Throws:
UpdateException
-
update
public BusinessObjectTool.ReturnMessage update(boolean timestamp, boolean undoredo) throws UpdateException
Helper method to process update save throwing exception in case of error- Parameters:
timestamp
- check and update the timestamp if anyundoredo
- create the redolog if any- Returns:
- Information/warning message or null
- Throws:
UpdateException
-
selectValidateAndSave
public java.util.List<BusinessObjectTool.ReturnMessage> selectValidateAndSave(java.lang.String rowId, boolean copy, boolean timestamp, java.util.Map<java.lang.String,java.lang.String> fieldValues) throws GetException, ValidateException, SaveException
Helper to force access rights, select a record, set values, validate and save and restore rights access, in a synchronized block.- Parameters:
rowId
- Row ID to selectcopy
- Select for copy?timestamp
- Check and update the timestamp if anyfieldValues
- Pairs of field / value- Returns:
- Information/warning messages or null
- Throws:
GetException
ValidateException
SaveException
-
selectValidateAndSave
public java.util.List<BusinessObjectTool.ReturnMessage> selectValidateAndSave(java.lang.String rowId, boolean copy, boolean timestamp, boolean redolog, org.json.JSONObject fieldValues) throws GetException, ValidateException, SaveException
Helper to force access rights, select a record, set values, validate and save and restore rights access, in a synchronized block.- Parameters:
rowId
- Row ID to selectcopy
- Select for copy?timestamp
- Check and update the timestamp if anyredolog
- Create the redolog if anyfieldValues
- Pairs of field / value- Returns:
- Information/warning messages or null
- Throws:
GetException
ValidateException
SaveException
-
validateAndSave
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndSave() throws ValidateException, SaveException
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)- Returns:
- Information/warning messages or null
- Throws:
ValidateException
SaveException
-
validateAndSave
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndSave(boolean timestamp) throws ValidateException, SaveException
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)- Parameters:
timestamp
- check and update the timestamp if any- Returns:
- Information/warning messages or null
- Throws:
ValidateException
SaveException
-
validateAndSave
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndSave(boolean timestamp, boolean undoredo) throws ValidateException, SaveException
Helper method to process validation and save (create or update) throwing appropriate exception in case of error(s)- Parameters:
timestamp
- check and update the timestamp if anyundoredo
- create the redolog if any- Returns:
- Information/warning messages or null
- Throws:
ValidateException
SaveException
-
validateAndCreate
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndCreate() throws ValidateException, CreateException
Helper method to process validation and create save throwing appropriate exception in case of error(s)
Forces row ID at objectField.DEFAULT_ROW_ID and calls validateAndSave- Returns:
- Information/warning messages or null
- Throws:
ValidateException
CreateException
-
validateAndCreate
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndCreate(boolean undoredo) throws ValidateException, CreateException
Helper method to process validation and create save throwing appropriate exception in case of error(s)
Forces row ID at objectField.DEFAULT_ROW_ID and calls validateAndSave- Parameters:
undoredo
- create the redolog if any- Returns:
- Information/warning messages or null
- Throws:
ValidateException
CreateException
-
validateAndUpdate
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndUpdate() throws ValidateException, UpdateException
Helper method to process validation and update save throwing appropriate exception in case of error(s)- Returns:
- Information/warning messages or null
- Throws:
ValidateException
UpdateException
-
validateAndUpdate
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndUpdate(boolean timestamp) throws ValidateException, UpdateException
Helper method to process validation and update save throwing appropriate exception in case of error(s)- Parameters:
timestamp
- Check and update the timestamp if any- Returns:
- Information/warning messages or null
- Throws:
ValidateException
UpdateException
-
validateAndUpdate
public java.util.List<BusinessObjectTool.ReturnMessage> validateAndUpdate(boolean timestamp, boolean undoredo) throws ValidateException, UpdateException
Helper method to process validation and update save throwing appropriate exception in case of error(s)- Parameters:
timestamp
- Check and update the timestamp if anyundoredo
- create the redolog if any- Returns:
- Information/warning messages or null
- Throws:
ValidateException
UpdateException
-
del
public final BusinessObjectTool.ReturnMessage del() throws DeleteException
Alias to delete (naming suitable for script usage)- Returns:
- Information/warning message or null
- Throws:
DeleteException
-
del
public final BusinessObjectTool.ReturnMessage del(boolean undoredo) throws DeleteException
Alias to delete (naming suitable for script usage)- Parameters:
undoredo
- create the redolog if any- Returns:
- Information/warning message or null
- Throws:
DeleteException
-
delete
public BusinessObjectTool.ReturnMessage delete() throws DeleteException
Helper method to process deletion throwing exception in case of error- Returns:
- Information/warning message or null
- Throws:
DeleteException
-
delete
public BusinessObjectTool.ReturnMessage delete(boolean undoredo) throws DeleteException
Helper method to process deletion throwing exception in case of error- Parameters:
undoredo
- create the redolog if any- Returns:
- Information/warning message or null
- Throws:
DeleteException
-
log
public void log(java.lang.String method, PlatformException e)
Helper method to handle a platform exception as a log entry (for code EXCEPTION)- Parameters:
method
- Methode
- Any Platform exception
-
-