Package org.dspace.content
Class MetadataSchemaServiceImpl
java.lang.Object
org.dspace.content.MetadataSchemaServiceImpl
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected AuthorizeServiceprotected MetadataFieldServiceprotected MetadataSchemaDAO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new metadata schema in the database, using the name and namespace.voiddelete(Context context, MetadataSchema metadataSchema) Delete the metadata schema.Get the schema corresponding with this numeric ID.Get the schema corresponding with this short name.Return all metadata schemas.findByNamespace(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 Details
-
metadataFieldService
-
authorizeService
-
metadataSchemaDAO
-
-
Constructor Details
-
MetadataSchemaServiceImpl
protected MetadataSchemaServiceImpl()
-
-
Method Details
-
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
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
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
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
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
-