Class JsonDataAdapter<T>

java.lang.Object
com.groiss.smartclient.JsonDataAdapter<T>
All Implemented Interfaces:
JsonData
Direct Known Subclasses:
ObjectSelectProvider

public abstract class JsonDataAdapter<T> extends Object implements JsonData
Adapter that implements the JsonData interface.
  • Field Details

  • Constructor Details

    • JsonDataAdapter

      public JsonDataAdapter()
  • Method Details

    • init

      public void init(HttpServletRequest req, String params, String id, NavigationTreeNode configuration) throws Exception
      Description copied from interface: JsonData
      called once when initalizing the model
      Specified by:
      init in interface JsonData
      Parameters:
      req - the current servlet-request
      params - the trailing part of the REST-URL
      id - the id when using single-object-requests
      configuration - configuration node holding more information
      Throws:
      Exception
    • get

      protected T get(String objectId)
    • getData

      public final List<Map<String,Object>> getData() throws Exception
      Description copied from interface: JsonData
      Two cases: id is known, return the object with this id, else return all objects.
      Specified by:
      getData in interface JsonData
      Returns:
      all available data
      Throws:
      Exception
    • getData

      protected Map<String,Object> getData(T p) throws Exception
      Throws:
      Exception
    • onRowComplete

      protected void onRowComplete(T p, Map<String,Object> row)
      will be called once for each row
      Parameters:
      p -
      row -
    • getObjects

      protected abstract List<T> getObjects()
      get all required objects. basic filtering should be done here is called once
      Returns:
    • getFields

      protected abstract List<String> getFields()
      what object-properties should be used may be called multiple times
      Returns:
    • getValue

      protected abstract Object getValue(T object, String field) throws Exception
      will be called for each object and each field
      Parameters:
      object -
      field -
      Returns:
      Throws:
      Exception
    • getFavorites

      protected Map<String,Double> getFavorites()