Class Resource<T extends Model>

java.lang.Object
com.axelor.rpc.Resource<T>

public class Resource<T extends Model> extends Object
This class defines CRUD like interface.
  • Constructor Details

  • Method Details

    • getModel

      public Class<?> getModel()
      Returns the resource class.
    • fields

      public Response fields()
    • models

      public static Response models(Request request)
    • perms

      public Response perms()
    • perms

      public Response perms(Long id)
    • perms

      public Response perms(String perm, Long... ids)
    • search

      public Response search(Request request)
    • export

      public Response export(Request request, Charset charset)
    • export

      public Response export(Request request, Charset charset, Locale locale, char separator)
    • read

      public Response read(long id)
    • fetch

      public Response fetch(long id, Request request)
    • verify

      public Response verify(Request request)
    • save

      public Response save(Request request)
    • updateMass

      public Response updateMass(Request request)
    • remove

      public Response remove(long id, Request request)
    • remove

      public Response remove(Request request)
    • copy

      public Response copy(long id)
    • action

      public ActionResponse action(ActionRequest request)
    • getRecordName

      public Response getRecordName(Request request)
      Get the name of the record. This method should be used to get the value of name field if it's a function field.
      Parameters:
      request - the request containing the current values of the record
      Returns:
      response with the updated values with record name
    • isPermitted

      public boolean isPermitted(JpaSecurity.AccessType accessType, Long id)
    • removePasswordFields

      public static Map<String,Object> removePasswordFields(Map<String,Object> data, Class<?> modelClass)
      Removes password field values from the given record map, including dotted field names and nested record maps of relational fields.

      The given map is not modified, a cleaned copy is returned.

      Parameters:
      data - the record map to clean up
      modelClass - the model class of the record
      Returns:
      a copy of the given map with password fields removed
    • removeNotPermitted

      protected void removeNotPermitted(Map<String,Object> map, String... names)
      Removes not permitted fields in specified map.
      Parameters:
      map - data
      names - field names
    • filterPermitted

      protected String[] filterPermitted(Object bean, String... names)
      Filters given field names so that only base fields and readable related fields remains.
      Parameters:
      bean - object
      names - field names
      Returns:
      readable field names
    • filterPermitted

      protected void filterPermitted(Consumer<String> permitted, Consumer<String> notPermitted, Object bean, String... names)
    • toMap

      public static Map<String,Object> toMap(Object bean, String... names)
    • toMapCompact

      public static Map<String,Object> toMapCompact(Object bean)