Package org.dynamoframework.rest.crud
Class CrudController<ID,T extends AbstractEntity<ID>>
java.lang.Object
org.dynamoframework.rest.BaseController
org.dynamoframework.rest.crud.CrudController<ID,T>
@RestController
@RequestMapping("#{@\'dynamoframework-org.dynamoframework.configuration.DynamoConfigurationProperties\'.defaults.endpoints.crud}")
@CrossOrigin
public class CrudController<ID,T extends AbstractEntity<ID>>
extends BaseController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid<U extends AbstractEntity<ID>>
TExecutes an action defined in the entity modelRetrieve the details of a single entityInstantiates a new entityRetrieves a simple list of entities (without any sorting or filtering)Updates an existing entitysearch(String entityName, @Valid SearchModel searchModel, String reference) Executes a search requestMethods inherited from class org.dynamoframework.rest.BaseController
findClass, findEntityModel
-
Constructor Details
-
CrudController
public CrudController()
-
-
Method Details
-
post
-
executeAction
@PostMapping(value="/{entityName}/action/{actionId}", produces="application/json", consumes="application/json") @ResponseStatus(OK) public <U extends AbstractEntity<ID>> T executeAction(@PathVariable("entityName") String entityName, @PathVariable("actionId") String actionId, @RequestBody String request, @RequestParam(required=false) String reference, @RequestParam(required=false) String id) Executes an action defined in the entity model- Parameters:
entityName- the name of the entityactionId- the ID of the action to executerequest- the request bodyreference- optional entity model referenceid- optional ID of the entity to update (in case of update actions)- Returns:
- the result of the action (the updated or created entity)
-
put
@PutMapping(value="/{entityName}/{id}", produces="application/json", consumes="application/json") public T put(@PathVariable("entityName") String entityName, @PathVariable("id") String id, @RequestBody String request, @RequestParam(required=false) String reference) Updates an existing entity- Parameters:
entityName- the name of the entityid- the ID of the entityrequest- the message bodyreference- optional reference to specify the entity model to use- Returns:
- the entity after the update
-
get
@GetMapping(value="/{entityName}/{id}", produces="application/json", consumes="*/*") public T get(@PathVariable("entityName") String entityName, @PathVariable("id") String id, @RequestParam(required=false) String reference) Retrieve the details of a single entity- Parameters:
entityName- the name of the entityid- the ID of the entityreference- the entity model reference- Returns:
- the entity
-
init
@GetMapping(value="/{entityName}/init", produces="application/json", consumes="*/*") public T init(@PathVariable("entityName") String entityName, @RequestParam(required=false) String reference) Instantiates a new entity- Parameters:
entityName- the name of the entityreference- the entity model reference- Returns:
- the entity
-
list
@GetMapping(value="/{entityName}", produces="application/json", consumes="*/*") @ResponseStatus(OK) public List<T> list(@PathVariable("entityName") String entityName, @RequestParam(required=false) String reference) Retrieves a simple list of entities (without any sorting or filtering)- Parameters:
entityName- the name of the entityreference- an optional reference to the exact entity model- Returns:
- a list of all the entities
-
search
@PostMapping(value="/{entityName}/search", produces="application/json", consumes="application/json") public SearchResultsModel<T> search(@PathVariable("entityName") String entityName, @RequestBody @Valid @Valid SearchModel searchModel, @RequestParam(required=false) String reference) Executes a search request- Parameters:
entityName- the name of the entitysearchModel- the search requestreference- an optional reference to the exact entity model- Returns:
- a list of all the entities
-
delete
-