Class AbstractEntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.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 ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>> extends Object implements EntityArgService<T,S>
  • Field Details

    • service

      protected final S extends ubic.gemma.persistence.service.FilteringService<T> service
  • Constructor Details

    • AbstractEntityArgService

      protected AbstractEntityArgService(S service)
  • Method Details

    • getElementClass

      public Class<? extends T> getElementClass()
      Specified by:
      getElementClass in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • BaseReadOnlyService.getElementClass()
    • getFilterableProperties

      public Set<String> getFilterableProperties()
      Specified by:
      getFilterableProperties in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterableProperties()
    • getFilterablePropertyType

      public Class<?> getFilterablePropertyType(String p)
      Specified by:
      getFilterablePropertyType in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterablePropertyType(String)
    • getFilterablePropertyDescription

      public String getFilterablePropertyDescription(String p)
      Specified by:
      getFilterablePropertyDescription in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterablePropertyDescription(String)
    • getFilterablePropertyAllowedValues

      public List<Object> getFilterablePropertyAllowedValues(String p)
      Specified by:
      getFilterablePropertyAllowedValues in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterablePropertyAllowedValues(String)
    • getFilterablePropertyResolvableAllowedValuesLabels

      public List<org.springframework.context.MessageSourceResolvable> getFilterablePropertyResolvableAllowedValuesLabels(String p)
      Specified by:
      getFilterablePropertyResolvableAllowedValuesLabels in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterablePropertyResolvableAllowedValuesLabels(String)
    • isFilterablePropertyUsingSubquery

      public boolean isFilterablePropertyUsingSubquery(String p)
      Specified by:
      isFilterablePropertyUsingSubquery in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.isFilterablePropertyUsingSubquery(String)
    • getFilterablePropertyConfigAttributes

      public Collection<org.springframework.security.access.ConfigAttribute> getFilterablePropertyConfigAttributes(String p)
      Specified by:
      getFilterablePropertyConfigAttributes in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.getFilterablePropertyConfigAttributes(String)
    • isFilterablePropertyDeprecated

      public boolean isFilterablePropertyDeprecated(String p)
      Specified by:
      isFilterablePropertyDeprecated in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      See Also:
      • FilteringService.isFilterablePropertyDeprecated(String)
    • getEntity

      @Nonnull public T getEntity(AbstractEntityArg<?,T,S> entityArg) throws javax.ws.rs.NotFoundException, javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Retrieve the entity represented by this argument.
      Specified by:
      getEntity in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.NotFoundException - if the entity does not exist
      javax.ws.rs.BadRequestException - if the argument is malformed
    • getEntities

      public List<T> getEntities(AbstractEntityArg<?,T,S> entityArg) throws javax.ws.rs.NotFoundException, javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Retrieve 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:
      getEntities in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.NotFoundException - if no entity matching the argument exist
      javax.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.BadRequestException
      Description copied from interface: EntityArgService
      Retrieve each entity represented by the array argument, raising a NotFoundException if any of them is missing.
      Specified by:
      getEntities in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.NotFoundException - if any entity is missing
      javax.ws.rs.BadRequestException - if the argument is malformed
    • getFilters

      public <A> ubic.gemma.persistence.util.Filters getFilters(AbstractEntityArg<A,T,S> entityArg) throws javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Translate the provided entity argument into a Filters.

      This will generate clause in the form of property = value.

      Specified by:
      getFilters in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.BadRequestException - if the argument is malformed
    • getFilters

      public ubic.gemma.persistence.util.Filters getFilters(AbstractEntityArrayArg<T,S> entitiesArg) throws javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Translate the provided entity argument into a Filters.

      This will generate clause in the form of property in (values...).

      Specified by:
      getFilters in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.BadRequestException - if the argument is malformed
    • getArgsByPropertyName

      protected Map<String,List<String>> getArgsByPropertyName(AbstractEntityArrayArg<T,S> entitiesArg)
      Given a AbstractEntityArrayArg, construct a mapping of properties it refers to values those properties are allowed to take in a filter.
    • getFilters

      public ubic.gemma.persistence.util.Filters getFilters(FilterArg<T> filterArg) throws javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Obtain a Filters from a filter argument.
      Specified by:
      getFilters in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.BadRequestException - if the argument is malformed
    • getSort

      public ubic.gemma.persistence.util.Sort getSort(SortArg<T> sortArg) throws javax.ws.rs.BadRequestException
      Description copied from interface: EntityArgService
      Obtain a Sort from a sort argument.
      Specified by:
      getSort in interface EntityArgService<T extends ubic.gemma.model.common.Identifiable,S extends ubic.gemma.persistence.service.FilteringService<T>>
      Throws:
      javax.ws.rs.BadRequestException - if the argument is malformed
    • checkEntity

      protected T checkEntity(AbstractEntityArg<?,T,S> entityArg, @Nullable T entity) throws javax.ws.rs.NotFoundException
      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,S> entityArgValueOf(Class<? extends AbstractEntityArg<?,T,S>> entityArgClass, String s) throws javax.ws.rs.BadRequestException
      Invoke either a static valueOf method or a suitable constructor to instantiate the argument.
      Throws:
      javax.ws.rs.BadRequestException