Package org.dspace.license
Class CCLookup
- java.lang.Object
-
- org.dspace.license.CCLookup
-
public class CCLookup extends Object
A wrapper around Creative Commons REST web services.- Author:
- Wendy Bossons
-
-
Field Summary
Fields Modifier and Type Field Description protected CreativeCommonsServicecreativeCommonsService
-
Constructor Summary
Constructors Constructor Description CCLookup()Constructs a new instance with the default web services root.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorMessage()org.jdom.DocumentgetLicenseDocument()Collection<CCLicenseField>getLicenseFields(String license, String language)Queries the web service for a set of licenseFields for a particular license class.StringgetLicenseId(String class_label)Returns the id for a particular CCLicense label.StringgetLicenseName()Retrieves the human readable name for the license issued.Collection<CCLicense>getLicenses(String language)Queries the web service for the available licenses.StringgetLicenseUrl()Retrieves the URI for the license issued.StringgetRdf()booleanisSuccess()voidissue(String licenseURI)Passes a set of "answers" to the web service and retrieves a license.voidissue(String licenseId, Map answers, String lang)Passes a set of "answers" to the web service and retrieves a license.
-
-
-
Field Detail
-
creativeCommonsService
protected CreativeCommonsService creativeCommonsService
-
-
Method Detail
-
getLicenseId
public String getLicenseId(String class_label)
Returns the id for a particular CCLicense label. Returns an empty string if no match is found.- Parameters:
class_label- The CCLicense label to find.- Returns:
- Returns a String containing the License class ID if the label is found; if not found, returns an empty string.
- See Also:
CCLicense
-
getLicenses
public Collection<CCLicense> getLicenses(String language)
Queries the web service for the available licenses.
-
getLicenseFields
public Collection<CCLicenseField> getLicenseFields(String license, String language)
Queries the web service for a set of licenseFields for a particular license class.- Parameters:
license- A String specifying the CCLicense identifier to retrieve fields for.language- the locale string- Returns:
- A Collection of LicenseField objects.
- See Also:
CCLicense
-
issue
public void issue(String licenseId, Map answers, String lang) throws IOException
Passes a set of "answers" to the web service and retrieves a license.- Parameters:
licenseId- The identifier of the license class being requested.answers- A Map containing the answers to the license fields; each key is the identifier of a LicenseField, with the value containing the user-supplied answer.lang- The language to request localized elements in.- Throws:
IOException- if IO error- See Also:
CCLicense,Map
-
issue
public void issue(String licenseURI) throws IOException
Passes a set of "answers" to the web service and retrieves a license.- Parameters:
licenseURI- The uri of the license. Note: does not support localization in 1.5 -- not yet- Throws:
IOException- if IO error- See Also:
CCLicense,Map
-
getLicenseUrl
public String getLicenseUrl()
Retrieves the URI for the license issued.- Returns:
- A String containing the URI for the license issued.
-
getLicenseName
public String getLicenseName()
Retrieves the human readable name for the license issued.- Returns:
- A String containing the license name.
-
getLicenseDocument
public org.jdom.Document getLicenseDocument()
-
getRdf
public String getRdf() throws IOException
- Throws:
IOException
-
isSuccess
public boolean isSuccess()
-
getErrorMessage
public String getErrorMessage()
-
-