Package org.dspace.license
Class LicenseMetadataValue
- java.lang.Object
-
- org.dspace.license.LicenseMetadataValue
-
public class LicenseMetadataValue extends Object
Helper class for using CC-related Metadata fields- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringccShibprotected ItemServiceitemService
-
Constructor Summary
Constructors Constructor Description LicenseMetadataValue(String fieldName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItemValue(Context context, Item item, String value)Adds passed value to the set of values for the field in passed item.StringccItemValue(Item item)Returns first value that matches Creative Commons 'shibboleth', or null if no matching values.StringkeyedItemValue(Item item, String key)Returns the value that matches the value mapped to the passed key if any.voidremoveItemValue(Context context, Item item, String value)Removes the passed value from the set of values for the field in passed item.
-
-
-
Field Detail
-
itemService
protected final ItemService itemService
-
ccShib
protected static final String ccShib
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LicenseMetadataValue
public LicenseMetadataValue(String fieldName)
-
-
Method Detail
-
ccItemValue
public String ccItemValue(Item item)
Returns first value that matches Creative Commons 'shibboleth', or null if no matching values. NB: this method will succeed only for metadata fields holding CC URIs- Parameters:
item- - the item to read- Returns:
- value - the first CC-matched value, or null if no such value
-
keyedItemValue
public String keyedItemValue(Item item, String key) throws AuthorizeException, IOException, SQLException
Returns the value that matches the value mapped to the passed key if any. NB: this only delivers a license name (if present in field) given a license URI- Parameters:
item- - the item to readkey- - the key for desired value- Returns:
- value - the value associated with key or null if no such value
- Throws:
IOException- A general class of exceptions produced by failed or interrupted I/O operations.SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
removeItemValue
public void removeItemValue(Context context, Item item, String value) throws AuthorizeException, IOException, SQLException
Removes the passed value from the set of values for the field in passed item.- Parameters:
context- The relevant DSpace Context.item- - the item to updatevalue- - the value to remove- Throws:
IOException- A general class of exceptions produced by failed or interrupted I/O operations.SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
addItemValue
public void addItemValue(Context context, Item item, String value) throws SQLException
Adds passed value to the set of values for the field in passed item.- Parameters:
context- The relevant DSpace Context.item- - the item to updatevalue- - the value to add in this field- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
-