Package org.dspace.content
Class MetadataSchemaServiceImpl
- java.lang.Object
-
- org.dspace.content.MetadataSchemaServiceImpl
-
- All Implemented Interfaces:
MetadataSchemaService
public class MetadataSchemaServiceImpl extends Object implements MetadataSchemaService
Service implementation for the MetadataSchema object. This class is responsible for all business logic calls for the MetadataSchema object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected MetadataFieldServicemetadataFieldServiceprotected MetadataSchemaDAOmetadataSchemaDAO
-
Constructor Summary
Constructors Modifier Constructor Description protectedMetadataSchemaServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetadataSchemacreate(Context context, String name, String namespace)Creates a new metadata schema in the database, using the name and namespace.voiddelete(Context context, MetadataSchema metadataSchema)Delete the metadata schema.MetadataSchemafind(Context context, int id)Get the schema corresponding with this numeric ID.MetadataSchemafind(Context context, String shortName)Get the schema corresponding with this short name.List<MetadataSchema>findAll(Context context)Return all metadata schemas.MetadataSchemafindByNamespace(Context context, String namespace)Get the schema object corresponding to this namespace URI.protected booleanuniqueNamespace(Context context, int metadataSchemaId, String namespace)Return true if and only if the passed name appears within the allowed number of times in the current schema.protected booleanuniqueShortName(Context context, int metadataSchemaId, String name)Return true if and only if the passed name is unique.voidupdate(Context context, MetadataSchema metadataSchema)Update the metadata schema in the database.
-
-
-
Field Detail
-
metadataFieldService
@Autowired protected MetadataFieldService metadataFieldService
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
metadataSchemaDAO
@Autowired(required=true) protected MetadataSchemaDAO metadataSchemaDAO
-
-
Method Detail
-
create
public MetadataSchema create(Context context, String name, String namespace) throws SQLException, AuthorizeException, NonUniqueMetadataException
Description copied from interface:MetadataSchemaServiceCreates a new metadata schema in the database, using the name and namespace.- Specified by:
createin interfaceMetadataSchemaService- Parameters:
context- DSpace context objectname- namenamespace- namespace- Returns:
- new MetadataSchema
- Throws:
SQLException- if database errorAuthorizeException- if authorization errorNonUniqueMetadataException- if an existing field with an identical element and qualifier is already present
-
findByNamespace
public MetadataSchema findByNamespace(Context context, String namespace) throws SQLException
Description copied from interface:MetadataSchemaServiceGet the schema object corresponding to this namespace URI.- Specified by:
findByNamespacein interfaceMetadataSchemaService- Parameters:
context- DSpace contextnamespace- namespace URI to match- Returns:
- metadata schema object or null if none found.
- Throws:
SQLException- if database error
-
update
public void update(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException, NonUniqueMetadataException
Description copied from interface:MetadataSchemaServiceUpdate the metadata schema in the database.- Specified by:
updatein interfaceMetadataSchemaService- Parameters:
context- DSpace contextmetadataSchema- metadata schema- Throws:
SQLException- if database errorAuthorizeException- if authorization errorNonUniqueMetadataException- if an existing field with an identical element and qualifier is already present
-
delete
public void delete(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException
Description copied from interface:MetadataSchemaServiceDelete the metadata schema.- Specified by:
deletein interfaceMetadataSchemaService- Parameters:
context- DSpace contextmetadataSchema- metadata schema- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findAll
public List<MetadataSchema> findAll(Context context) throws SQLException
Description copied from interface:MetadataSchemaServiceReturn all metadata schemas.- Specified by:
findAllin interfaceMetadataSchemaService- Parameters:
context- DSpace context- Returns:
- array of metadata schemas
- Throws:
SQLException- if database error
-
find
public MetadataSchema find(Context context, int id) throws SQLException
Description copied from interface:MetadataSchemaServiceGet the schema corresponding with this numeric ID. The ID is a database key internal to DSpace.- Specified by:
findin interfaceMetadataSchemaService- Parameters:
context- context, in case we need to read it in from DBid- the schema ID- Returns:
- the metadata schema object
- Throws:
SQLException- if database error
-
find
public MetadataSchema find(Context context, String shortName) throws SQLException
Description copied from interface:MetadataSchemaServiceGet the schema corresponding with this short name.- Specified by:
findin interfaceMetadataSchemaService- Parameters:
context- context, in case we need to read it in from DBshortName- the short name for the schema- Returns:
- the metadata schema object
- Throws:
SQLException- if database error
-
uniqueNamespace
protected boolean uniqueNamespace(Context context, int metadataSchemaId, String namespace) throws SQLException
Return true if and only if the passed name appears within the allowed number of times in the current schema.- Parameters:
context- DSpace contextmetadataSchemaId- metadata schema idnamespace- namespace URI to match- Returns:
- true of false
- Throws:
SQLException- if database error
-
uniqueShortName
protected boolean uniqueShortName(Context context, int metadataSchemaId, String name) throws SQLException
Return true if and only if the passed name is unique.- Parameters:
context- DSpace contextmetadataSchemaId- metadata schema idname- short name of schema- Returns:
- true of false
- Throws:
SQLException- if database error
-
-