Package com.axelor.rpc
Class Resource<T extends Model>
- java.lang.Object
-
- com.axelor.rpc.Resource<T>
-
-
Constructor Summary
Constructors Constructor Description Resource(TypeLiteral<T> typeLiteral, javax.inject.Provider<JpaSecurity> security, Event<PreRequest> preRequest, Event<PostRequest> postRequest)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ActionResponseaction(ActionRequest request)Responsecopy(long id)Responseexport(Request request, Charset charset)Responseexport(Request request, Charset charset, Locale locale, char separator)Responsefetch(long id, Request request)Responsefields()protected String[]filterPermitted(Object bean, String... names)Filters given field names so that only base fields and readable related fields remains.protected voidfilterPermitted(Consumer<String> permitted, Consumer<String> notPermitted, Object bean, String... names)Class<?>getModel()Returns the resource class.ResponsegetRecordName(Request request)Get the name of the record.booleanisPermitted(JpaSecurity.AccessType accessType, Long id)static Responsemodels(Request request)Responseperms()Responseperms(Long id)Responseperms(String perm, Long... ids)Responseread(long id)Responseremove(long id, Request request)Responseremove(Request request)protected voidremoveNotPermitted(Map<String,Object> map, String... names)Removes not permitted fields in specified map.Responsesave(Request request)Responsesearch(Request request)static Map<String,Object>toMap(Object bean, String... names)static Map<String,Object>toMapCompact(Object bean)ResponseupdateMass(Request request)Responseverify(Request request)
-
-
-
Constructor Detail
-
Resource
@Inject public Resource(TypeLiteral<T> typeLiteral, javax.inject.Provider<JpaSecurity> security, Event<PreRequest> preRequest, Event<PostRequest> postRequest)
-
-
Method Detail
-
getModel
public Class<?> getModel()
Returns the resource class.
-
fields
public Response fields()
-
perms
public Response perms()
-
read
public Response read(long id)
-
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)
-
removeNotPermitted
protected void removeNotPermitted(Map<String,Object> map, String... names)
Removes not permitted fields in specified map.- Parameters:
map- datanames- 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- objectnames- field names- Returns:
- readable field names
-
filterPermitted
protected void filterPermitted(Consumer<String> permitted, Consumer<String> notPermitted, Object bean, String... names)
-
-