Class LicenseMetadataValue


  • public class LicenseMetadataValue
    extends Object
    Helper class for using CC-related Metadata fields
    Author:
    kevinvandevelde at atmire.com
    • 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 read
        key - - 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 update
        value - - 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 update
        value - - the value to add in this field
        Throws:
        SQLException - An exception that provides information on a database access error or other errors.