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 Details

    • CrudController

      public CrudController()
  • Method Details

    • post

      @PostMapping(value="/{entityName}", produces="application/json", consumes="application/json") @ResponseStatus(CREATED) public T post(@PathVariable("entityName") String entityName, @RequestBody String request, @RequestParam(required=false) String reference)
    • 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 entity
      actionId - the ID of the action to execute
      request - the request body
      reference - optional entity model reference
      id - 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 entity
      id - the ID of the entity
      request - the message body
      reference - 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 entity
      id - the ID of the entity
      reference - 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 entity
      reference - 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 entity
      reference - 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 entity
      searchModel - the search request
      reference - an optional reference to the exact entity model
      Returns:
      a list of all the entities
    • delete

      @DeleteMapping("/{entityName}/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable("entityName") String entityName, @PathVariable("id") String id)