Class LicenseUtils


  • public class LicenseUtils
    extends Object
    Utility class to manage generation and storing of the license text that the submitter has to grant/granted for archiving the item
    Author:
    bollini
    • Method Detail

      • getLicenseText

        public static String getLicenseText​(Locale locale,
                                            Collection collection,
                                            Item item,
                                            EPerson eperson,
                                            Map<String,​Object> additionalInfo)
        Return the text of the license that the user has granted/must grant before for submit the item. The license text is build using the template defined for the collection if any or the wide site configuration. In the license text the following substitutions can be used.
        {0} the eperson firstname
        {1} the eperson lastname
        {2} the eperson email
        {3} the current date
        {4} the collection object that will be formatted using the appropriate LicenseArgumentFormatter plugin (if defined)
        {5} the item object that will be formatted using the appropriate LicenseArgumentFormatter plugin (if defined)
        {6} the eperson object that will be formatted using the appropriate LicenseArgumentFormatter plugin (if defined)
        {x} any addition argument supplied wrapped in the LicenseArgumentFormatter based on his type (map key)
        Parameters:
        locale - Formatter locale
        collection - collection to get license from
        item - the item object of the license
        eperson - EPerson to get firstname, lastname and email from
        additionalInfo - additional template arguments beyond 0-6
        Returns:
        the license text obtained substituting the provided argument in the license template
      • getLicenseText

        public static String getLicenseText​(Locale locale,
                                            Collection collection,
                                            Item item,
                                            EPerson eperson)
        Utility method if no additional arguments are to be supplied to the license template. (equivalent to calling the full getLicenseText supplying null for the additionalInfo argument)
        Parameters:
        locale - Formatter locale
        collection - collection to get license from
        item - the item object of the license
        eperson - EPerson to get firstname, lastname and email from
        Returns:
        the license text, with no custom substitutions.