Class CrudController<MANAGED_ENTITY_ID_TYPE extends java.io.Serializable,MANAGED_ENTITY_TYPE extends BaseEntity<MANAGED_ENTITY_ID_TYPE>,CREATE_INPUT_TYPE,UPDATE_INPUT_TYPE,SEARCH_INPUT_TYPE extends SearchInput,SERVICE_TYPE extends CrudService<MANAGED_ENTITY_ID_TYPE,MANAGED_ENTITY_TYPE,?>>
- java.lang.Object
-
- com.alon.spring.crud.api.controller.CrudController<MANAGED_ENTITY_ID_TYPE,MANAGED_ENTITY_TYPE,CREATE_INPUT_TYPE,UPDATE_INPUT_TYPE,SEARCH_INPUT_TYPE,SERVICE_TYPE>
-
- Direct Known Subclasses:
CachedCrudController
public abstract class CrudController<MANAGED_ENTITY_ID_TYPE extends java.io.Serializable,MANAGED_ENTITY_TYPE extends BaseEntity<MANAGED_ENTITY_ID_TYPE>,CREATE_INPUT_TYPE,UPDATE_INPUT_TYPE,SEARCH_INPUT_TYPE extends SearchInput,SERVICE_TYPE extends CrudService<MANAGED_ENTITY_ID_TYPE,MANAGED_ENTITY_TYPE,?>> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE>createInputMapperprotected booleandisableContentCachingprotected java.lang.Class<MANAGED_ENTITY_TYPE>managedEntityClassprotected ProjectionServiceprojectionServiceprotected Propertiespropertiesprotected SERVICE_TYPEserviceprotected InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE>updateInputMapper
-
Constructor Summary
Constructors Modifier Constructor Description CrudController(SERVICE_TYPE service)CrudController(SERVICE_TYPE service, boolean disableContentCaching)protectedCrudController(SERVICE_TYPE service, InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> createInputMapper, InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> updateInputMapper)protectedCrudController(SERVICE_TYPE service, InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> createInputMapper, InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> updateInputMapper, boolean disableContentCaching)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity.BodyBuilderbuildResponseEntity(org.springframework.http.HttpStatus status)protected org.springframework.http.ResponseEntitycreate(CREATE_INPUT_TYPE input, java.lang.String projection)voiddelete(MANAGED_ENTITY_ID_TYPE id)protected java.lang.StringgetCollectionDefaultProjection()java.util.List<ProjectionRepresentation>getRepresentations()protected java.lang.StringgetSingleDefaultProjection()protected voidnormalizeCollectionOptions(Options options)protected java.lang.StringnormalizeCollectionProjection(java.lang.String projectionName)protected java.util.List<java.lang.String>normalizeExpand(java.lang.String projectionName, java.util.List<java.lang.String> receivedExpand)protected voidnormalizeSingleOptions(Options options)protected java.lang.StringnormalizeSingleProjection(java.lang.String projectionName)org.springframework.http.ResponseEntityread(MANAGED_ENTITY_ID_TYPE id, Options options, org.springframework.web.context.request.ServletWebRequest request)protected org.springframework.data.jpa.domain.SpecificationresolveFilter(SEARCH_INPUT_TYPE filter)org.springframework.http.ResponseEntitysearch(SEARCH_INPUT_TYPE filter, org.springframework.data.domain.Pageable pageable, Options options, org.springframework.web.context.request.ServletWebRequest request)org.springframework.http.ResponseEntityupdate(MANAGED_ENTITY_ID_TYPE id, UPDATE_INPUT_TYPE input, java.lang.String projection)
-
-
-
Field Detail
-
service
protected final SERVICE_TYPE extends CrudService<MANAGED_ENTITY_ID_TYPE,MANAGED_ENTITY_TYPE,?> service
-
projectionService
@Autowired protected ProjectionService projectionService
-
properties
@Autowired protected Properties properties
-
createInputMapper
protected InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE extends BaseEntity<MANAGED_ENTITY_ID_TYPE>> createInputMapper
-
updateInputMapper
protected InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE extends BaseEntity<MANAGED_ENTITY_ID_TYPE>> updateInputMapper
-
disableContentCaching
protected final boolean disableContentCaching
-
managedEntityClass
protected java.lang.Class<MANAGED_ENTITY_TYPE extends BaseEntity<MANAGED_ENTITY_ID_TYPE>> managedEntityClass
-
-
Constructor Detail
-
CrudController
public CrudController(SERVICE_TYPE service)
-
CrudController
public CrudController(SERVICE_TYPE service, boolean disableContentCaching)
-
CrudController
protected CrudController(SERVICE_TYPE service, InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> createInputMapper, InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> updateInputMapper)
-
CrudController
protected CrudController(SERVICE_TYPE service, InputMapper<CREATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> createInputMapper, InputMapper<UPDATE_INPUT_TYPE,MANAGED_ENTITY_TYPE> updateInputMapper, boolean disableContentCaching)
-
-
Method Detail
-
search
@GetMapping("${com.alon.spring.crud.path.search:}") public org.springframework.http.ResponseEntity search(SEARCH_INPUT_TYPE filter, org.springframework.data.domain.Pageable pageable, Options options, org.springframework.web.context.request.ServletWebRequest request)
-
read
@GetMapping("${com.alon.spring.crud.path.read:/{id}}") public org.springframework.http.ResponseEntity read(@PathVariable MANAGED_ENTITY_ID_TYPE id, Options options, org.springframework.web.context.request.ServletWebRequest request) throws ReadException- Throws:
ReadException
-
create
@PostMapping("${com.alon.spring.crud.path.create:}") protected org.springframework.http.ResponseEntity create(@RequestBody @Valid CREATE_INPUT_TYPE input, @RequestParam(required=false) java.lang.String projection) throws CreateException- Throws:
CreateException
-
update
@PutMapping("${com.alon.spring.crud.path.update:/{id}}") public org.springframework.http.ResponseEntity update(@PathVariable MANAGED_ENTITY_ID_TYPE id, @RequestBody @Valid UPDATE_INPUT_TYPE input, @RequestParam(required=false) java.lang.String projection) throws UpdateException- Throws:
UpdateException
-
delete
@DeleteMapping("${com.alon.spring.crud.path.delete:/{id}}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable MANAGED_ENTITY_ID_TYPE id) throws DeleteException- Throws:
DeleteException
-
getRepresentations
@GetMapping("/projections") public java.util.List<ProjectionRepresentation> getRepresentations()
-
buildResponseEntity
public org.springframework.http.ResponseEntity.BodyBuilder buildResponseEntity(org.springframework.http.HttpStatus status)
-
getSingleDefaultProjection
protected java.lang.String getSingleDefaultProjection()
-
getCollectionDefaultProjection
protected java.lang.String getCollectionDefaultProjection()
-
normalizeSingleOptions
protected void normalizeSingleOptions(Options options)
-
normalizeCollectionOptions
protected void normalizeCollectionOptions(Options options)
-
normalizeSingleProjection
protected java.lang.String normalizeSingleProjection(java.lang.String projectionName)
-
normalizeCollectionProjection
protected java.lang.String normalizeCollectionProjection(java.lang.String projectionName)
-
normalizeExpand
protected java.util.List<java.lang.String> normalizeExpand(java.lang.String projectionName, java.util.List<java.lang.String> receivedExpand)
-
resolveFilter
protected org.springframework.data.jpa.domain.Specification resolveFilter(SEARCH_INPUT_TYPE filter)
-
-