T
- SERVICE
- public abstract class BaseController<T extends CdmBase,SERVICE extends IService<T>> extends AbstractController<T,SERVICE>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<T> |
baseClass |
DEFAULT_BATCH_THREAD_PRIORITY, DEFAULT_INIT_STRATEGY, DEFAULT_PAGE_SIZE, INCLUDE_UNPUBLISHED, initializationStrategy, NO_UNPUBLISHED, service, userHelper
Constructor and Description |
---|
BaseController() |
Modifier and Type | Method and Description |
---|---|
protected <S extends IPublishable> |
checkExistsAccessType(IPublishable publishable,
boolean includeUnpublished,
java.lang.Class<S> clazz,
javax.servlet.http.HttpServletResponse response) |
protected <S extends IPublishable> |
checkExistsAndAccess(S publishable,
boolean includeUnpublished,
javax.servlet.http.HttpServletResponse response)
Checks if an
IPublishable was found and if it is publish. |
protected <CDM_BASE extends CdmBase> |
complementInitStrategy(java.lang.Class<CDM_BASE> clazz,
java.util.List<java.lang.String> pathProperties)
Implementations of the BaseController can override this method to
extend the
pathProperties to for example avoid
LazyInitializationExceptions which can happen when
doGetMethod(UUID, Integer, Integer, Integer, Integer, HttpServletRequest, HttpServletResponse) is being used. |
T |
doGet(java.util.UUID uuid,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
java.lang.Object |
doGetMethod(java.util.UUID uuid,
java.lang.Integer pageNumber,
java.lang.Integer pageSize,
java.lang.Integer start,
java.lang.Integer limit,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected <CDM_BASE extends CdmBase> |
getCdmBaseInstance(java.lang.Class<CDM_BASE> clazz,
IService<CDM_BASE> service,
java.util.UUID uuid,
javax.servlet.http.HttpServletResponse response,
java.util.List<java.lang.String> pathProperties) |
protected <SUB_T extends T> |
getCdmBaseInstance(java.lang.Class<SUB_T> clazz,
java.util.UUID uuid,
javax.servlet.http.HttpServletResponse response,
java.util.List<java.lang.String> pathProperties) |
protected <SUB_T extends T> |
getCdmBaseInstance(java.lang.Class<SUB_T> clazz,
java.util.UUID uuid,
javax.servlet.http.HttpServletResponse response,
java.lang.String pathProperty) |
protected T |
getCdmBaseInstance(java.util.UUID uuid,
javax.servlet.http.HttpServletResponse response,
java.util.List<java.lang.String> pathProperties) |
protected T |
getCdmBaseInstance(java.util.UUID uuid,
javax.servlet.http.HttpServletResponse response,
java.lang.String pathProperty) |
java.lang.Object |
getCdmBaseProperty(java.util.UUID uuid,
java.lang.String property,
javax.servlet.http.HttpServletResponse response) |
protected Classification |
getClassificationOrError(java.util.UUID classificationUuid,
IClassificationService classificationService,
javax.servlet.http.HttpServletResponse response) |
protected TaxonNode |
getSubtreeOrError(java.util.UUID subtreeUuid,
ITaxonNodeService taxonNodeService,
javax.servlet.http.HttpServletResponse response) |
void |
initBinder(org.springframework.web.bind.WebDataBinder binder) |
protected java.lang.Object |
pageFromCollection(java.util.Collection<? extends CdmBase> c,
java.lang.Integer pageNumber,
java.lang.Integer pageSize,
java.lang.Integer start,
java.lang.Integer limit,
javax.servlet.http.HttpServletResponse response)
Returns a sub-collection of
c . |
getInitializationStrategy, readPathParameter, requestPathAndQuery, setInitializationStrategy, setService
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
@RequestMapping(method=GET) public T doGet(@PathVariable(value="uuid") java.util.UUID uuid, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
@RequestMapping(value="*", method=GET) public java.lang.Object doGetMethod(@PathVariable(value="uuid") java.util.UUID uuid, @RequestParam(value="pageNumber",required=false) java.lang.Integer pageNumber, @RequestParam(value="pageSize",required=false) java.lang.Integer pageSize, @RequestParam(value="start",required=false) java.lang.Integer start, @RequestParam(value="limit",required=false) java.lang.Integer limit, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
uuid
- request
- response
- java.io.IOException
- TODO implement bulk version of this methodprotected java.lang.Object pageFromCollection(java.util.Collection<? extends CdmBase> c, java.lang.Integer pageNumber, java.lang.Integer pageSize, java.lang.Integer start, java.lang.Integer limit, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
c
. A pager object will be returned if the pageNumber
and
pageSize
are given. Otherwise a List
in case of start
and limit
.pageNumber
- pageSize
- start
- limit
- response
- objectFromProperty
- java.io.IOException
public java.lang.Object getCdmBaseProperty(java.util.UUID uuid, java.lang.String property, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
protected final <SUB_T extends T> SUB_T getCdmBaseInstance(java.lang.Class<SUB_T> clazz, java.util.UUID uuid, javax.servlet.http.HttpServletResponse response, java.util.List<java.lang.String> pathProperties) throws java.io.IOException
SUB_T
- clazz
- uuid
- response
- pathProperties
- java.io.IOException
protected final <SUB_T extends T> SUB_T getCdmBaseInstance(java.lang.Class<SUB_T> clazz, java.util.UUID uuid, javax.servlet.http.HttpServletResponse response, java.lang.String pathProperty) throws java.io.IOException
SUB_T
- clazz
- uuid
- response
- pathProperty
- java.io.IOException
protected final T getCdmBaseInstance(java.util.UUID uuid, javax.servlet.http.HttpServletResponse response, java.lang.String pathProperty) throws java.io.IOException
uuid
- response
- pathProperty
- java.io.IOException
protected final T getCdmBaseInstance(java.util.UUID uuid, javax.servlet.http.HttpServletResponse response, java.util.List<java.lang.String> pathProperties) throws java.io.IOException
uuid
- response
- pathProperties
- java.io.IOException
protected final <CDM_BASE extends CdmBase> CDM_BASE getCdmBaseInstance(java.lang.Class<CDM_BASE> clazz, IService<CDM_BASE> service, java.util.UUID uuid, javax.servlet.http.HttpServletResponse response, java.util.List<java.lang.String> pathProperties) throws java.io.IOException
CDM_BASE
- clazz
- service
- uuid
- response
- pathProperties
- java.io.IOException
protected <CDM_BASE extends CdmBase> java.util.List<java.lang.String> complementInitStrategy(java.lang.Class<CDM_BASE> clazz, java.util.List<java.lang.String> pathProperties)
pathProperties
to for example avoid
LazyInitializationExceptions
which can happen when
doGetMethod(UUID, Integer, Integer, Integer, Integer, HttpServletRequest, HttpServletResponse)
is being used.clazz
- pathProperties
- protected <S extends IPublishable> S checkExistsAndAccess(S publishable, boolean includeUnpublished, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
IPublishable
was found and if it is publish.
If not the according http messages
are added to response.publishable
- includeUnpublished
- response
- java.io.IOException
protected <S extends IPublishable> S checkExistsAccessType(IPublishable publishable, boolean includeUnpublished, java.lang.Class<S> clazz, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
protected TaxonNode getSubtreeOrError(java.util.UUID subtreeUuid, ITaxonNodeService taxonNodeService, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
subtreeUuid
- response
- java.io.IOException
protected Classification getClassificationOrError(java.util.UUID classificationUuid, IClassificationService classificationService, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
Copyright © 2007-2020 EDIT. All Rights Reserved.