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 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 BusinessObjectTool.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
del()
Alias to delete (naming suitable for script usage)BusinessObjectTool.ReturnMessage
delete()
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
getForCreate()
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(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 recordvoid
getForDelete(java.lang.String rowId)
Helper method to process row selection for delete throwing exception in case of errorvoid
getForUpdate(java.lang.String rowId)
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(org.json.JSONObject filters)
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 errorjava.util.List<java.lang.String[]>
search()
Helper method to process search 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 errorjava.util.List<java.lang.String[]>
search(org.json.JSONObject filters)
Helper method to process a filtered 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 getForCreateOrUpdatevoid
selectForCopy(java.lang.String rowId)
Alias of getForCopyvoid
selectForCreate()
Alias of getForCreateboolean
selectForCreateOrUpdate(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdateboolean
selectForCreateOrUpdate(org.json.JSONObject filters)
Alias to getForCreateOrUpdatevoid
selectForDelete(java.lang.String rowId)
Alias to getForDeletevoid
selectForUpdate(java.lang.String rowId)
Alias to getForUpdateboolean
selectForUpsert(java.util.Map<java.lang.String,java.lang.String> filters)
Alias to getForCreateOrUpdateboolean
selectForUpsert(org.json.JSONObject filters)
Alias to getForCreateOrUpdateBusinessObjectTool.ReturnMessage
update()
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>
validateAndSave()
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)
-
-
-
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
-
selectForCreate
public void selectForCreate() throws GetException
Alias of getForCreate- 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
-
selectForCopy
public void selectForCopy(java.lang.String rowId) throws GetException
Alias of getForCopy- Parameters:
rowId
- Row ID of row to copy from- 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
-
selectForUpdate
public void selectForUpdate(java.lang.String rowId) throws GetException
Alias to getForUpdate- Parameters:
rowId
- Row ID of row to get- 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 getForCreateOrUpdate- 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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
getForDelete
public void getForDelete(java.lang.String rowId) throws GetException
Helper method to process row selection for delete throwing exception in case of error- Parameters:
rowId
- Row ID of row to get- 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
-
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
-
search
public java.util.List<java.lang.String[]> search() throws SearchException
Helper method to process search throwing exception in case of error- Throws:
SearchException
-
search
public java.util.List<java.lang.String[]> search(org.json.JSONObject filters) throws SearchException
Helper method to process a filtered search throwing exception in case of error- Parameters:
filters
- Filters JSON object (allows webservice naming)- 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- Throws:
SearchException
-
validate
public java.util.List<BusinessObjectTool.ReturnMessage> validate() throws ValidateException
Helper method to process validation throwing exception in case of error(s)- Throws:
ValidateException
-
save
public BusinessObjectTool.ReturnMessage save() throws SaveException
Helper method to process save (create or update) throwing appropriate exception in case of error- 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- Throws:
CreateException
-
update
public BusinessObjectTool.ReturnMessage update() throws UpdateException
Helper method to process update save throwing exception in case of error- Throws:
UpdateException
-
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)- 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- 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)- Throws:
ValidateException
UpdateException
-
delete
public BusinessObjectTool.ReturnMessage delete() throws DeleteException
Helper method to process deletion throwing exception in case of error- Throws:
DeleteException
-
del
public final BusinessObjectTool.ReturnMessage del() throws DeleteException
Alias to delete (naming suitable for script usage)- 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
-
-