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 Deprecated Methods Modifier and Type Method Description ActionResponse
action(ActionRequest request)
Response
copy(long id)
Response
export(Request request, Charset charset)
Response
export(Request request, Charset charset, Locale locale, char separator)
Response
fetch(long id, Request request)
Response
fields()
protected String[]
filterPermitted(Object bean, String... names)
Filters given field names so that only base fields and readable related fields remains.protected void
filterPermitted(Consumer<String> permitted, Consumer<String> notPermitted, Object bean, String... names)
Class<?>
getModel()
Returns the resource class.Response
getRecordName(Request request)
Get the name of the record.boolean
isPermitted(JpaSecurity.AccessType accessType, Long id)
static Response
models(Request request)
Response
perms()
Response
perms(Long id)
Response
perms(Long id, String perm)
Deprecated.Response
perms(String perm, Long... ids)
Response
read(long id)
Response
remove(long id, Request request)
Response
remove(Request request)
protected void
removeNotPermitted(Map<String,Object> map, String... names)
Removes not permitted fields in specified map.Response
save(Request request)
Response
search(Request request)
static Map<String,Object>
toMap(Object bean, String... names)
static Map<String,Object>
toMapCompact(Object bean)
Response
updateMass(Request request)
Response
verify(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()
-
perms
@Deprecated public Response perms(Long id, String perm)
Deprecated.
-
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)
-
-