T - class typepublic interface DSpaceObjectService<T extends DSpaceObject>
| Modifier and Type | Method and Description |
|---|---|
void |
addMetadata(Context context,
T dso,
MetadataField metadataField,
String language,
List<String> values) |
void |
addMetadata(Context context,
T dso,
MetadataField metadataField,
String lang,
List<String> values,
List<String> authorities,
List<Integer> confidences)
Add metadata fields.
|
void |
addMetadata(Context context,
T dso,
MetadataField metadataField,
String language,
String value) |
void |
addMetadata(Context context,
T dso,
MetadataField metadataField,
String language,
String value,
String authority,
int confidence) |
void |
addMetadata(Context context,
T dso,
String schema,
String element,
String qualifier,
String lang,
List<String> values)
Add metadata fields.
|
void |
addMetadata(Context context,
T dso,
String schema,
String element,
String qualifier,
String lang,
List<String> values,
List<String> authorities,
List<Integer> confidences)
Add metadata fields.
|
void |
addMetadata(Context context,
T dso,
String schema,
String element,
String qualifier,
String lang,
String value)
Add a single metadata field.
|
void |
addMetadata(Context context,
T dso,
String schema,
String element,
String qualifier,
String lang,
String value,
String authority,
int confidence)
Add a single metadata field.
|
void |
clearMetadata(Context context,
T dso,
String schema,
String element,
String qualifier,
String lang)
Clear metadata values.
|
void |
delete(Context context,
T dso) |
T |
find(Context context,
UUID id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
DSpaceObject |
getAdminObject(Context context,
T dso,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
ArrayList<String> |
getIdentifiers(Context context,
T dso)
Tries to lookup all Identifiers of this DSpaceObject.
|
String |
getMetadata(T dSpaceObject,
String value)
Get the value of a metadata field
|
List<MetadataValue> |
getMetadata(T dSpaceObject,
String mdString,
String authority) |
List<MetadataValue> |
getMetadata(T dSpaceObject,
String schema,
String element,
String qualifier,
String lang)
Get metadata for the DSpace Object in a chosen schema.
|
List<MetadataValue> |
getMetadata(T dSpaceObject,
String schema,
String element,
String qualifier,
String lang,
String authority) |
List<MetadataValue> |
getMetadataByMetadataString(T dSpaceObject,
String mdString)
Retrieve metadata field values from a given metadata string
of the form
<schema prefix>.<element>[.<qualifier>|.*] |
String |
getMetadataFirstValue(T dso,
String schema,
String element,
String qualifier,
String language) |
String |
getName(T dso)
Get a proper name for the object.
|
DSpaceObject |
getParentObject(Context context,
T dso)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
String |
getTypeText(T dso)
Provide the text name of the type of this DSpaceObject.
|
void |
removeMetadataValues(Context context,
T dso,
List<MetadataValue> values) |
void |
setMetadataSingleValue(Context context,
T dso,
String schema,
String element,
String qualifier,
String language,
String value)
Set first metadata field value
|
void |
update(Context context,
T dso) |
void |
updateLastModified(Context context,
T dso) |
T find(Context context, UUID id) throws SQLException
context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.String getName(T dso)
null.
Name should be suitable for display in a user interface.dso - DSpaceObjectnull if it doesn't have
oneArrayList<String> getIdentifiers(Context context, T dso)
context - DSpace contextdso - DSpaceObjectDSpaceObject getParentObject(Context context, T dso) throws SQLException
context - DSpace contextdso - DSpaceObjectSQLException - if database errorDSpaceObject getAdminObject(Context context, T dso, int action) throws SQLException
Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
context - DSpace contextdso - DSpaceObjectaction - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrownSQLException - if database errorIllegalArgumentException - if the ADMIN action is supplied as parameter of the method
callString getTypeText(T dso)
dso - DSpaceObjectList<MetadataValue> getMetadata(T dSpaceObject, String schema, String element, String qualifier, String lang)
MetadataSchema for more information about schemas.
Passing in a null value for qualifier
or lang only matches metadata fields where that
qualifier or languages is actually null.
Passing in DSpaceObject.ANY
retrieves all metadata fields with any value for the qualifier or
language, including null
Examples:
Return values of the unqualified "title" field, in any language. Qualified title fields (e.g. "title.uniform") are NOT returned:
dspaceobject.getMetadataByMetadataString("dc", "title", null, DSpaceObject.ANY );
Return all US English values of the "title" element, with any qualifier (including unqualified):
dspaceobject.getMetadataByMetadataString("dc, "title", DSpaceObject.ANY, "en_US" );
The ordering of values of a particular element/qualifier/language combination is significant. When retrieving with wildcards, values of a particular element/qualifier/language combinations will be adjacent, but the overall ordering of the combinations is indeterminate.
dSpaceObject - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the element name. DSpaceObject.ANY matches any
element. null doesn't really make sense as all
metadata must have an element.qualifier - the qualifier. null means unqualified, and
DSpaceObject.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are returned, and
DSpaceObject.ANY means values with any country code or
no country code are returned.List<MetadataValue> getMetadataByMetadataString(T dSpaceObject, String mdString)
<schema prefix>.<element>[.<qualifier>|.*]dSpaceObject - DSpaceObjectmdString - The metadata string of the form
<schema prefix>.<element>[.<qualifier>|.*]String getMetadata(T dSpaceObject, String value)
dSpaceObject - DSpaceObjectvalue - the name of the metadata field to getIllegalArgumentException - if the requested metadata field doesn't existList<MetadataValue> getMetadata(T dSpaceObject, String mdString, String authority)
List<MetadataValue> getMetadata(T dSpaceObject, String schema, String element, String qualifier, String lang, String authority)
void addMetadata(Context context, T dso, String schema, String element, String qualifier, String lang, List<String> values) throws SQLException
clearDC to remove values. The ordering of values
passed in is maintained.
If metadata authority control is available, try to get authority values. The authority confidence depends on whether authority is required or not.
context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifier name, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).values - the values to add.SQLException - if database errorvoid addMetadata(Context context, T dso, String schema, String element, String qualifier, String lang, List<String> values, List<String> authorities, List<Integer> confidences) throws SQLException
clearDC to remove values. The ordering of values
passed in is maintained.context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifier name, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).values - the values to add.authorities - the external authority key for this value (or null)confidences - the authority confidence (default 0)SQLException - if database errorvoid addMetadata(Context context, T dso, MetadataField metadataField, String lang, List<String> values, List<String> authorities, List<Integer> confidences) throws SQLException
clearDC to remove values. The ordering of values
passed in is maintained.context - DSpace contextdso - DSpaceObjectmetadataField - the metadata field to which the value is to be setlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).values - the values to add.authorities - the external authority key for this value (or null)confidences - the authority confidence (default 0)SQLException - if database errorvoid addMetadata(Context context, T dso, MetadataField metadataField, String language, String value, String authority, int confidence) throws SQLException
SQLExceptionvoid addMetadata(Context context, T dso, MetadataField metadataField, String language, String value) throws SQLException
SQLExceptionvoid addMetadata(Context context, T dso, MetadataField metadataField, String language, List<String> values) throws SQLException
SQLExceptionvoid addMetadata(Context context, T dso, String schema, String element, String qualifier, String lang, String value) throws SQLException
clearDC to remove values.context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifier, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).value - the value to add.SQLException - if database errorvoid addMetadata(Context context, T dso, String schema, String element, String qualifier, String lang, String value, String authority, int confidence) throws SQLException
clearDC to remove values.context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifier, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).value - the value to add.authority - the external authority key for this value (or null)confidence - the authority confidence (default 0)SQLException - if database errorvoid clearMetadata(Context context, T dso, String schema, String element, String qualifier, String lang) throws SQLException
getDC above,
passing in null only matches fields where the qualifier or
language is actually null.Item.ANY will
match any element, qualifier or language, including null.
Thus, dspaceobject.clearDC(Item.ANY, Item.ANY, Item.ANY) will
remove all Dublin Core metadata associated with an DSpaceObject.context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the Dublin Core element to remove, or Item.ANYqualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are removed, and Item.ANY
means values with any country code or no country code are
removed.SQLException - if database errorvoid removeMetadataValues(Context context, T dso, List<MetadataValue> values) throws SQLException
SQLExceptionString getMetadataFirstValue(T dso, String schema, String element, String qualifier, String language)
void setMetadataSingleValue(Context context, T dso, String schema, String element, String qualifier, String language, String value) throws SQLException
context - DSpace contextdso - DSpaceObjectschema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the Dublin Core element to remove, or Item.ANYqualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)language - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are removed, and Item.ANY
means values with any country code or no country code are
removed.value - metadata valueSQLException - if database errorvoid updateLastModified(Context context, T dso) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionvoid update(Context context, T dso) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionvoid delete(Context context, T dso) throws SQLException, AuthorizeException, IOException
int getSupportsTypeConstant()
Copyright © 2016 DuraSpace. All rights reserved.