Class BusinessObjectTool


  • public class BusinessObjectTool
    extends java.lang.Object
    Helper class to manipulate business objects in specific code
    • 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 save
      BusinessObjectTool.ReturnMessage del()
      Alias to delete (naming suitable for script usage)
      BusinessObjectTool.ReturnMessage delete()
      Helper method to process deletion throwing exception in case of error
      void get​(java.lang.String rowId)
      Helper method to process row selection throwing exception in case of error
      java.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 record
      java.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 record
      void getForCopy​(java.lang.String rowId)
      Helper method to process row selection for copy throwing exception in case of error
      void getForCreate()
      Helper method to process row initialization for create throwing exception in case of error
      boolean 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 record
      boolean 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 record
      void getForDelete​(java.lang.String rowId)
      Helper method to process row selection for delete throwing exception in case of error
      void getForUpdate​(java.lang.String rowId)
      Helper method to process row selection for update throwing exception in case of error
      boolean getForUpsert​(java.util.Map<java.lang.String,​java.lang.String> filters)
      Alias to getForCreateOrUpdate
      boolean getForUpsert​(org.json.JSONObject filters)
      Alias to getForCreateOrUpdate
      ObjectDB getObject()
      Get object
      void 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 error
      java.util.List<java.lang.String[]> search()
      Helper method to process search throwing exception in case of error
      java.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 error
      java.util.List<java.lang.String[]> search​(org.json.JSONObject filters)
      Helper method to process a filtered search throwing exception in case of error
      void select​(java.lang.String rowId)
      Alias of get
      java.lang.String select​(java.util.Map<java.lang.String,​java.lang.String> filters)
      Alias to getForCreateOrUpdate
      java.lang.String select​(org.json.JSONObject filters)
      Alias to getForCreateOrUpdate
      void selectForCopy​(java.lang.String rowId)
      Alias of getForCopy
      void selectForCreate()
      Alias of getForCreate
      boolean selectForCreateOrUpdate​(java.util.Map<java.lang.String,​java.lang.String> filters)
      Alias to getForCreateOrUpdate
      boolean selectForCreateOrUpdate​(org.json.JSONObject filters)
      Alias to getForCreateOrUpdate
      void selectForDelete​(java.lang.String rowId)
      Alias to getForDelete
      void selectForUpdate​(java.lang.String rowId)
      Alias to getForUpdate
      boolean selectForUpsert​(java.util.Map<java.lang.String,​java.lang.String> filters)
      Alias to getForCreateOrUpdate
      boolean selectForUpsert​(org.json.JSONObject filters)
      Alias to getForCreateOrUpdate
      BusinessObjectTool.ReturnMessage update()
      Helper method to process update save throwing exception in case of error
      java.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 validateAndSave
      java.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 error
      java.util.List<BusinessObjectTool.ReturnMessage> validateAndUpdate()
      Helper method to process validation and update save throwing appropriate exception in case of error(s)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 - Grant
        objectName - Object name
        objectIntanceName - 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
      • 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
      • 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
      • 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 - Method
        e - Any Platform exception