Class ItemConverter

All Implemented Interfaces:
DSpaceConverter<Item,ItemRest>, IndexableObjectConverter<Item,ItemRest>

@Component public class ItemConverter extends DSpaceObjectConverter<Item,ItemRest> implements IndexableObjectConverter<Item,ItemRest>
This is the converter from/to the Item in the DSpace API data model and the REST data model
Author:
Andrea Bollini (andrea.bollini at 4science.it)
  • Constructor Details

    • ItemConverter

      public ItemConverter()
  • Method Details

    • convert

      public ItemRest convert(Item obj, Projection projection)
      Description copied from interface: DSpaceConverter
      Convert a DSpace model object into its equivalent REST resource, applying a given projection.
      Specified by:
      convert in interface DSpaceConverter<Item,ItemRest>
      Overrides:
      convert in class DSpaceObjectConverter<Item,ItemRest>
      Parameters:
      obj - a DSpace API model object.
      Returns:
      a resource representing the model object.
    • getPermissionFilteredMetadata

      public MetadataValueList getPermissionFilteredMetadata(Context context, Item obj)
      Retrieves the metadata list filtered according to the hidden metadata configuration When the context is null, it will return the metadatalist as for an anonymous user When the context is not null, it will return the full metadata list if the user is allowed to edit the item or if the user is an admin. Otherwise, it will return the metadata list filtered according to the hidden metadata configuration Overrides the parent method to include virtual metadata
      Overrides:
      getPermissionFilteredMetadata in class DSpaceObjectConverter<Item,ItemRest>
      Parameters:
      context - The context
      obj - The object of which the filtered metadata will be retrieved
      Returns:
      A list of object metadata (including virtual metadata) filtered based on the hidden metadata configuration
    • newInstance

      protected ItemRest newInstance()
      Specified by:
      newInstance in class DSpaceObjectConverter<Item,ItemRest>
    • getModelClass

      public Class<Item> getModelClass()
      Description copied from interface: DSpaceConverter
      For what DSpace API model class does this converter convert?
      Specified by:
      getModelClass in interface DSpaceConverter<Item,ItemRest>
      Returns:
      Class of model objects represented.
    • supportsModel

      public boolean supportsModel(IndexableObject idxo)
      Specified by:
      supportsModel in interface IndexableObjectConverter<Item,ItemRest>
      Parameters:
      idxo - the IndexableObject to check
      Returns:
      true if the actual converter implementation is able to manage the supplied IndexableObject