Interface JsonDataService

  • All Known Implementing Classes:
    DefaultJsonDataService

    public interface JsonDataService
    Implements generic data operations which have parameters and json as an input and return results as json strings. Note the parameters, json input and generated json follow the Smartclient specs. See the Smartclient RestDataSource for more information.
    Author:
    mtaal
    • Method Detail

      • fetch

        String fetch​(Map<String,​String> parameters)
        Do a query for BaseOBObject objects and return the result as a json string. One parameter is mandatory: JsonConstants.ENTITYNAME. The possible query parameters can be found in JsonConstants, see the constants ending with _PARAMETER. All other request parameters which correspond to properties of the queried objects are considered to be filter properties. The result is a json string which contains paging information (startrow, endrow, rowcount) and the data itself. See the Smartclient RestDataSource for more information.
        Parameters:
        parameters - the parameters driving the query, one parameter is mandatory: JsonConstants.ENTITYNAME
        Returns:
        a json result string
      • remove

        String remove​(Map<String,​String> parameters)
        Remove an object, this method expects two parameters: JsonConstants.ID and JsonConstants.ENTITYNAME. If they are not present an error is returned.
        Parameters:
        parameters - two parameters should be present: id and entityName
        Returns:
        the id and entityname of the removed object is returned.
      • add

        String add​(Map<String,​String> parameters,
                   String content)
        Adds data passed as json. Note that this method currently forwards to the update(Map, String) method. The system follows this logic: if the json defines an id for an object and it exists in the database then it is updated, in all other cases an insert takes place.
        Parameters:
        parameters - contains extra parameters, not used by this implementation but can be convenient for extenders of this service.
        content - the json string containing the data, the expected format is the same as defined by the Smartclient RestDataSource
        Returns:
        the inserted objects as json or the an error json string
      • update

        String update​(Map<String,​String> parameters,
                      String content)
        Updates data passed as json. Note that this method currently both allows additions as well as updated. The system follows this logic: if the json defines an id for an object and it exists in the database then it is updated, in all other cases an insert takes place.
        Parameters:
        parameters - contains extra parameters, not used by this implementation but can be convenient for extenders of this service.
        content - the json string containing the data, the expected format is the same as defined by the Smartclient RestDataSource
        Returns:
        the inserted objects as json or the an error json string