Package org.dspace.app.rest.converter
Class MetadataConverter
java.lang.Object
org.dspace.app.rest.converter.MetadataConverter
- All Implemented Interfaces:
DSpaceConverter<MetadataValueList,MetadataRest<MetadataValueRest>>
@Component
public class MetadataConverter
extends Object
implements DSpaceConverter<MetadataValueList,MetadataRest<MetadataValueRest>>
Converter to translate between lists of domain
MetadataValues and MetadataRest representations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends DSpaceObject>
voidaddMetadata(Context context, T dso, MetadataRest metadataRest) Add to a DSpace object's domain metadata values from a rest representation.convert(MetadataValueList metadataValues, Projection projection) Convert a DSpace model object into its equivalent REST resource, applying a given projection.For what DSpace API model class does this converter convert?<T extends DSpaceObject>
voidmergeMetadata(Context context, T dso, MetadataRest<MetadataValueRest> metadataRest) Merge into a DSpace object's domain metadata values from a rest representation.<T extends DSpaceObject>
voidsetMetadata(Context context, T dso, MetadataRest metadataRest) Sets a DSpace object's domain metadata values from a rest representation.
-
Constructor Details
-
MetadataConverter
public MetadataConverter()
-
-
Method Details
-
convert
public MetadataRest<MetadataValueRest> convert(MetadataValueList metadataValues, Projection projection) Description copied from interface:DSpaceConverterConvert a DSpace model object into its equivalent REST resource, applying a given projection.- Specified by:
convertin interfaceDSpaceConverter<MetadataValueList,MetadataRest<MetadataValueRest>> - Parameters:
metadataValues- a DSpace API model object.- Returns:
- a resource representing the model object.
-
getModelClass
Description copied from interface:DSpaceConverterFor what DSpace API model class does this converter convert?- Specified by:
getModelClassin interfaceDSpaceConverter<MetadataValueList,MetadataRest<MetadataValueRest>> - Returns:
- Class of model objects represented.
-
setMetadata
public <T extends DSpaceObject> void setMetadata(Context context, T dso, MetadataRest metadataRest) throws SQLException, AuthorizeException Sets a DSpace object's domain metadata values from a rest representation. Any existing metadata value is deleted or overwritten.- Parameters:
context- the context to use.dso- the DSpace object.metadataRest- the rest representation of the new metadata.- Throws:
SQLException- if a database error occurs.AuthorizeException- if an authorization error occurs.
-
addMetadata
public <T extends DSpaceObject> void addMetadata(Context context, T dso, MetadataRest metadataRest) throws SQLException, AuthorizeException Add to a DSpace object's domain metadata values from a rest representation. Any existing metadata value is preserved.- Parameters:
context- the context to use.dso- the DSpace object.metadataRest- the rest representation of the new metadata.- Throws:
SQLException- if a database error occurs.AuthorizeException- if an authorization error occurs.
-
mergeMetadata
public <T extends DSpaceObject> void mergeMetadata(Context context, T dso, MetadataRest<MetadataValueRest> metadataRest) throws SQLException, AuthorizeException Merge into a DSpace object's domain metadata values from a rest representation. Any existing metadata value is preserved or overwritten with the new ones- Parameters:
context- the context to use.dso- the DSpace object.metadataRest- the rest representation of the new metadata.- Throws:
SQLException- if a database error occurs.AuthorizeException- if an authorization error occurs.
-