Package org.dspace.content
Class LicenseUtils
- java.lang.Object
-
- org.dspace.content.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetLicenseText(Locale locale, Collection collection, Item item, EPerson eperson)Utility method if no additional arguments are to be supplied to the license template.static StringgetLicenseText(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.static voidgrantLicense(Context context, Item item, String licenseText, String acceptanceDate)Store a copy of the license a user granted in the item.
-
-
-
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 localecollection- collection to get license fromitem- the item object of the licenseeperson- EPerson to get firstname, lastname and email fromadditionalInfo- 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 supplyingnullfor the additionalInfo argument)- Parameters:
locale- Formatter localecollection- collection to get license fromitem- the item object of the licenseeperson- EPerson to get firstname, lastname and email from- Returns:
- the license text, with no custom substitutions.
-
grantLicense
public static void grantLicense(Context context, Item item, String licenseText, String acceptanceDate) throws SQLException, IOException, AuthorizeException
Store a copy of the license a user granted in the item.- Parameters:
context- the dspace contextitem- the item object of the licenselicenseText- the license the user grantedacceptanceDate- TODO- Throws:
SQLException- if database errorIOException- if IO errorAuthorizeException- if authorization error
-
-