Package ubic.gemma.rest.util.args
Class AbstractEntityArgService<T extends Identifiable,S extends FilteringService<T>>
java.lang.Object
ubic.gemma.rest.util.args.AbstractEntityArgService<T,S>
- All Implemented Interfaces:
EntityArgService<T,S>
- Direct Known Subclasses:
CompositeSequenceArgService,DatabaseEntryArgService,DatasetArgService,ExpressionAnalysisResultSetArgService,GeneArgService,PlatformArgService,QuantitationTypeArgService,TaxonArgService
public abstract class AbstractEntityArgService<T extends Identifiable,S extends FilteringService<T>>
extends Object
implements EntityArgService<T,S>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TcheckEntity(AbstractEntityArg<?, T, S> entityArg, T entity) Checks whether the given object is null, and throws an appropriate exception if necessary.protected AbstractEntityArg<?, T, S> entityArgValueOf(Class<? extends AbstractEntityArg<?, T, S>> entityArgClass, String s) Invoke either a staticvalueOfmethod or a suitable constructor to instantiate the argument.getArgsByPropertyName(AbstractEntityArrayArg<T, S> entitiesArg) Given aAbstractEntityArrayArg, construct a mapping of properties it refers to values those properties are allowed to take in a filter.getEntities(AbstractEntityArg<?, T, S> entityArg) Retrieve the entities represented by this argument.getEntities(AbstractEntityArrayArg<T, S> entitiesArg) Retrieve each entity represented by the array argument, raising aNotFoundExceptionif any of them is missing.getEntity(AbstractEntityArg<?, T, S> entityArg) Retrieve the entity represented by this argument.Collection<org.springframework.security.access.ConfigAttribute> List<org.springframework.context.MessageSourceResolvable> Class<?> <A> FiltersgetFilters(AbstractEntityArg<A, T, S> entityArg) Translate the provided entity argument into aFilters.getFilters(AbstractEntityArrayArg<T, S> entitiesArg) Translate the provided entity argument into aFilters.getFilters(FilterArg<T> filterArg) Obtain aFiltersfrom a filter argument.Obtain aSortfrom a sort argument.booleanboolean
-
Field Details
-
service
-
-
Constructor Details
-
AbstractEntityArgService
-
-
Method Details
-
getElementClass
- Specified by:
getElementClassin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterableProperties
- Specified by:
getFilterablePropertiesin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterablePropertyType
- Specified by:
getFilterablePropertyTypein interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterablePropertyDescription
- Specified by:
getFilterablePropertyDescriptionin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterablePropertyAllowedValues
- Specified by:
getFilterablePropertyAllowedValuesin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterablePropertyResolvableAllowedValuesLabels
public List<org.springframework.context.MessageSourceResolvable> getFilterablePropertyResolvableAllowedValuesLabels(String p) - Specified by:
getFilterablePropertyResolvableAllowedValuesLabelsin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
isFilterablePropertyUsingSubquery
- Specified by:
isFilterablePropertyUsingSubqueryin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getFilterablePropertyConfigAttributes
public Collection<org.springframework.security.access.ConfigAttribute> getFilterablePropertyConfigAttributes(String p) - Specified by:
getFilterablePropertyConfigAttributesin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
isFilterablePropertyDeprecated
- Specified by:
isFilterablePropertyDeprecatedin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - See Also:
-
getEntity
@Nonnull public T getEntity(AbstractEntityArg<?, T, throws javax.ws.rs.NotFoundException, javax.ws.rs.BadRequestExceptionS> entityArg) Description copied from interface:EntityArgServiceRetrieve the entity represented by this argument.- Specified by:
getEntityin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.NotFoundException- if the entity does not existjavax.ws.rs.BadRequestException- if the argument is malformed
-
getEntities
public List<T> getEntities(AbstractEntityArg<?, T, throws javax.ws.rs.NotFoundException, javax.ws.rs.BadRequestExceptionS> entityArg) Description copied from interface:EntityArgServiceRetrieve the entities represented by this argument.Note that this will never return an empty array.
This is intended for cases where an argument could match more than one entity.
- Specified by:
getEntitiesin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.NotFoundException- if no entity matching the argument existjavax.ws.rs.BadRequestException- if the argument is malformed
-
getEntities
public List<T> getEntities(AbstractEntityArrayArg<T, S> entitiesArg) throws javax.ws.rs.NotFoundException, javax.ws.rs.BadRequestExceptionDescription copied from interface:EntityArgServiceRetrieve each entity represented by the array argument, raising aNotFoundExceptionif any of them is missing.- Specified by:
getEntitiesin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.NotFoundException- if any entity is missingjavax.ws.rs.BadRequestException- if the argument is malformed
-
getFilters
public <A> Filters getFilters(AbstractEntityArg<A, T, throws javax.ws.rs.BadRequestExceptionS> entityArg) Description copied from interface:EntityArgServiceTranslate the provided entity argument into aFilters.This will generate clause in the form of
property = value.- Specified by:
getFiltersin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.BadRequestException- if the argument is malformed
-
getFilters
public Filters getFilters(AbstractEntityArrayArg<T, S> entitiesArg) throws javax.ws.rs.BadRequestExceptionDescription copied from interface:EntityArgServiceTranslate the provided entity argument into aFilters.This will generate clause in the form of
property in (values...).- Specified by:
getFiltersin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.BadRequestException- if the argument is malformed
-
getArgsByPropertyName
Given aAbstractEntityArrayArg, construct a mapping of properties it refers to values those properties are allowed to take in a filter. -
getFilters
Description copied from interface:EntityArgServiceObtain aFiltersfrom a filter argument.- Specified by:
getFiltersin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.BadRequestException- if the argument is malformed
-
getSort
Description copied from interface:EntityArgServiceObtain aSortfrom a sort argument.- Specified by:
getSortin interfaceEntityArgService<T extends Identifiable,S extends FilteringService<T>> - Throws:
javax.ws.rs.BadRequestException- if the argument is malformed
-
checkEntity
protected T checkEntity(AbstractEntityArg<?, T, throws javax.ws.rs.NotFoundExceptionS> entityArg, @Nullable T entity) Checks whether the given object is null, and throws an appropriate exception if necessary.- Parameters:
entity- the object that should be checked for being null.- Returns:
- the same object as given.
- Throws:
javax.ws.rs.NotFoundException- if the given entity is null.
-
entityArgValueOf
protected AbstractEntityArg<?,T, entityArgValueOfS> (Class<? extends AbstractEntityArg<?, T, throws javax.ws.rs.BadRequestExceptionS>> entityArgClass, String s) Invoke either a staticvalueOfmethod or a suitable constructor to instantiate the argument.- Throws:
javax.ws.rs.BadRequestException
-