Package org.dspace.license.service
Interface CreativeCommonsService
-
- All Known Implementing Classes:
CreativeCommonsServiceImpl
public interface CreativeCommonsServiceService interface class for the Creative commons licensing. The implementation of this class is responsible for all business logic calls for the Creative commons licensing and is autowired by spring- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description static StringCC_BUNDLE_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddLicense(Context context, Item item, String licenseUri, String licenseName, org.jdom2.Document doc)Add a new license to the itemStringfetchLicenseRDF(org.jdom2.Document license)Apply same transformation on the document to retrieve only the most relevant part of the document passed as parameter.List<CCLicense>findAllCCLicenses()Find all CC Licenses using the default language found in the configurationList<CCLicense>findAllCCLicenses(String language)Find all CC Licenses for the provided languageCCLicensefindOne(String id)Find the CC License corresponding to the provided ID using the default language found in the configurationCCLicensefindOne(String id, String language)Find the CC License corresponding to the provided ID and provided languageStringgetCCField(String fieldId)Get a few license-specific properties.StringgetLicenseName(Item item)Returns the stored license name of the itemBitstreamgetLicenseRdfBitstream(Item item)Get Creative Commons license RDF, returning Bitstream object.BitstreamgetLicenseTextBitstream(Item item)Deprecated.the bitstream with the license in the textual format it is no longer stored (see https://jira.duraspace.org/browse/DS-2604)StringgetLicenseURI(Item item)Returns the stored license uri of the itemStringgetLicenseURL(Context context, Item item)voidremoveLicense(Context context, Item item)Remove license information, delete also the bitstreamvoidremoveLicenseFile(Context context, Item item)Removes the license file from the itemMap<String,String>retrieveFullAnswerMap(String licenseId, String language, Map<String,String> answerMap)Retrieve the full answer map for a provided language, containing empty values when an answer for a field was not provided in the answerMap.Map<String,String>retrieveFullAnswerMap(String licenseId, Map<String,String> answerMap)Retrieve the full answer map containing empty values when an answer for a field was not provided in the answerMap, using the default language found in the configurationStringretrieveLicenseUri(String licenseId, String language, Map<String,String> answerMap)Retrieve the CC License URI for the provided license ID and language based on the provided answersStringretrieveLicenseUri(String licenseId, Map<String,String> answerMap)Retrieve the CC License URI for the provided license ID, based on the provided answers, using the default language found in the configurationvoidsetLicense(Context context, Item item, InputStream licenseStm, String mimeType)Used by DSpaceMetsIngestervoidsetLicenseRDF(Context context, Item item, String licenseRdf)setLicenseRDF CC Web Service method for setting the RDF bitstreambooleanupdateLicense(Context context, String licenseUri, Item item)Update the license of the item with a new one based on the provided license URIbooleanverifyLicenseInformation(String licenseId, String language, Map<String,String> fullAnswerMap)Verify whether the answer map contains a valid response to all field questions and no answers that don't have a corresponding question in the license, using the provided language to check the licensebooleanverifyLicenseInformation(String licenseId, Map<String,String> fullAnswerMap)Verify whether the answer map contains a valid response to all field questions and no answers that don't have a corresponding question in the license, using the default language found in the config to check the license
-
-
-
Field Detail
-
CC_BUNDLE_NAME
static final String CC_BUNDLE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setLicenseRDF
void setLicenseRDF(Context context, Item item, String licenseRdf) throws SQLException, IOException, AuthorizeException
setLicenseRDF CC Web Service method for setting the RDF bitstream- Parameters:
context- The relevant DSpace Context.item- The item to set license on.licenseRdf- license RDF string- 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.
-
setLicense
void setLicense(Context context, Item item, InputStream licenseStm, String mimeType) throws SQLException, IOException, AuthorizeException
Used by DSpaceMetsIngester- Parameters:
context- The relevant DSpace Context.item- The item to set license on.licenseStm- InputStream with the license text.mimeType- License text file MIME type ("text/xml", "text/rdf" or generic)- Throws:
SQLException- if database error An exception that provides information on a database access error or other errors.IOException- if IO error A general class of exceptions produced by failed or interrupted I/O operations.AuthorizeException- if authorization error Exception indicating the current user of the context does not have permission to perform a particular action. * // PATCHED 12/01 FROM JIRA re: mimetypes for CCLicense and License RDF wjb
-
removeLicenseFile
void removeLicenseFile(Context context, Item item) throws SQLException, IOException, AuthorizeException
Removes the license file from the item- Parameters:
context- - The relevant DSpace Contextitem- - The item from which the license file needs to be removed- Throws:
SQLExceptionIOExceptionAuthorizeException
-
getLicenseURL
String getLicenseURL(Context context, Item item) throws SQLException, IOException, AuthorizeException
-
getLicenseURI
String getLicenseURI(Item item)
Returns the stored license uri of the item- Parameters:
item- - The item for which to retrieve the stored license uri- Returns:
- the stored license uri of the item
-
getLicenseName
String getLicenseName(Item item)
Returns the stored license name of the item- Parameters:
item- - The item for which to retrieve the stored license name- Returns:
- the stored license name of the item
-
getLicenseRdfBitstream
Bitstream getLicenseRdfBitstream(Item item) throws SQLException, IOException, AuthorizeException
Get Creative Commons license RDF, returning Bitstream object.- Parameters:
item- bitstream's parent item- Returns:
- bitstream or null.
- 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.
-
getLicenseTextBitstream
@Deprecated Bitstream getLicenseTextBitstream(Item item) throws SQLException, IOException, AuthorizeException
Deprecated.the bitstream with the license in the textual format it is no longer stored (see https://jira.duraspace.org/browse/DS-2604)Get Creative Commons license Text, returning Bitstream object.- Parameters:
item- bitstream's parent item- Returns:
- bitstream or null.
- 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.
-
getCCField
String getCCField(String fieldId)
Get a few license-specific properties. We expect these to be cached at least per server run.- Parameters:
fieldId- name of the property.- Returns:
- its value.
-
fetchLicenseRDF
String fetchLicenseRDF(org.jdom2.Document license)
Apply same transformation on the document to retrieve only the most relevant part of the document passed as parameter. If no transformation is needed then take in consideration to empty the CreativeCommons.xml- Parameters:
license- - an element that could be contains as part of your content the license rdf- Returns:
- the document license in textual format after the transformation
-
removeLicense
void removeLicense(Context context, Item item) throws AuthorizeException, IOException, SQLException
Remove license information, delete also the bitstream- Parameters:
context- - DSpace Contextitem- - the item- Throws:
AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.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.
-
findAllCCLicenses
List<CCLicense> findAllCCLicenses()
Find all CC Licenses using the default language found in the configuration- Returns:
- A list of available CC Licenses
-
findAllCCLicenses
List<CCLicense> findAllCCLicenses(String language)
Find all CC Licenses for the provided language- Parameters:
language- - the language for which to find the CC Licenses- Returns:
- A list of available CC Licenses for the provided language
-
findOne
CCLicense findOne(String id)
Find the CC License corresponding to the provided ID using the default language found in the configuration- Parameters:
id- - the ID of the license to be found- Returns:
- the corresponding license if found or null when not found
-
findOne
CCLicense findOne(String id, String language)
Find the CC License corresponding to the provided ID and provided language- Parameters:
id- - the ID of the license to be foundlanguage- - the language for which to find the CC License- Returns:
- the corresponding license if found or null when not found
-
retrieveLicenseUri
String retrieveLicenseUri(String licenseId, Map<String,String> answerMap)
Retrieve the CC License URI for the provided license ID, based on the provided answers, using the default language found in the configuration- Parameters:
licenseId- - the ID of the licenseanswerMap- - the answers to the different field questions- Returns:
- the corresponding license URI
-
retrieveLicenseUri
String retrieveLicenseUri(String licenseId, String language, Map<String,String> answerMap)
Retrieve the CC License URI for the provided license ID and language based on the provided answers- Parameters:
licenseId- - the ID of the licenselanguage- - the language for which to find the CC License URIanswerMap- - the answers to the different field questions- Returns:
- the corresponding license URI
-
retrieveFullAnswerMap
Map<String,String> retrieveFullAnswerMap(String licenseId, Map<String,String> answerMap)
Retrieve the full answer map containing empty values when an answer for a field was not provided in the answerMap, using the default language found in the configuration- Parameters:
licenseId- - the ID of the licenseanswerMap- - the answers to the different field questions- Returns:
- the answerMap supplemented with all other license fields with a blank answer
-
retrieveFullAnswerMap
Map<String,String> retrieveFullAnswerMap(String licenseId, String language, Map<String,String> answerMap)
Retrieve the full answer map for a provided language, containing empty values when an answer for a field was not provided in the answerMap.- Parameters:
licenseId- - the ID of the licenselanguage- - the language for which to retrieve the full answerMapanswerMap- - the answers to the different field questions- Returns:
- the answerMap supplemented with all other license fields with a blank answer for the provided language
-
verifyLicenseInformation
boolean verifyLicenseInformation(String licenseId, Map<String,String> fullAnswerMap)
Verify whether the answer map contains a valid response to all field questions and no answers that don't have a corresponding question in the license, using the default language found in the config to check the license- Parameters:
licenseId- - the ID of the licensefullAnswerMap- - the answers to the different field questions- Returns:
- whether the information is valid
-
verifyLicenseInformation
boolean verifyLicenseInformation(String licenseId, String language, Map<String,String> fullAnswerMap)
Verify whether the answer map contains a valid response to all field questions and no answers that don't have a corresponding question in the license, using the provided language to check the license- Parameters:
licenseId- - the ID of the licenselanguage- - the language for which to retrieve the full answerMapfullAnswerMap- - the answers to the different field questions- Returns:
- whether the information is valid
-
updateLicense
boolean updateLicense(Context context, String licenseUri, Item item) throws AuthorizeException, SQLException
Update the license of the item with a new one based on the provided license URI- Parameters:
context- - The relevant DSpace contextlicenseUri- - The license URI to be used in the updateitem- - The item for which to update the license- Returns:
- true when the update was successful, false when not
- Throws:
AuthorizeExceptionSQLException
-
addLicense
void addLicense(Context context, Item item, String licenseUri, String licenseName, org.jdom2.Document doc) throws SQLException, IOException, AuthorizeException
Add a new license to the item- Parameters:
context- - The relevant Dspace contextitem- - The item to which the license will be addedlicenseUri- - The license URI to addlicenseName- - The license name to adddoc- - The license to document to add- Throws:
SQLExceptionIOExceptionAuthorizeException
-
-