public class CreativeCommonsServiceImpl extends Object implements CreativeCommonsService, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected BitstreamFormatService |
bitstreamFormatService |
protected BitstreamService |
bitstreamService |
protected static String |
BSN_LICENSE_RDF |
protected static String |
BSN_LICENSE_TEXT
Deprecated.
to make uniform JSPUI and XMLUI approach the bitstream with the license in the textual format it
is no longer stored (see https://jira.duraspace.org/browse/DS-2604)
|
protected static String |
BSN_LICENSE_URL
Deprecated.
use the metadata retrieved at
CreativeCommonsService.getCCField(String) (see https://jira
.duraspace.org/browse/DS-2604) |
protected BundleService |
bundleService |
protected static String |
CC_BS_SOURCE
The Bundle Name
|
protected ConfigurationService |
configurationService |
protected ItemService |
itemService |
protected Templates |
templates |
CC_BUNDLE_NAME| Modifier | Constructor and Description |
|---|---|
protected |
CreativeCommonsServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
String |
fetchLicenseRDF(org.jdom.Document license)
Apply same transformation on the document to retrieve only the most
relevant part of the document passed as parameter.
|
protected Bitstream |
getBitstream(Item item,
String bitstream_name)
This helper method retrieves the bytes of a bitstream for an item under
the CC bundle, with the given bitstream name
|
protected byte[] |
getBytesFromBitstream(Context context,
Item item,
String bitstream_name) |
protected Bundle |
getCcBundle(Context context,
Item item) |
LicenseMetadataValue |
getCCField(String fieldId)
Returns a metadata field handle for given field Id
|
String |
getLicenseRDF(Context context,
Item item) |
Bitstream |
getLicenseRdfBitstream(Item item)
Get Creative Commons license RDF, returning Bitstream object.
|
Bitstream |
getLicenseTextBitstream(Item item)
Deprecated.
|
String |
getLicenseURL(Context context,
Item item) |
protected String |
getStringFromBitstream(Context context,
Item item,
String bitstream_name)
This helper method wraps a String around a byte array returned from the
bitstream method further down
Note: This helper method assumes that the CC
bitstreams are short and easily expressed as byte arrays in RAM
|
boolean |
hasLicense(Context context,
Item item) |
boolean |
isEnabled()
Simple accessor for enabling of CC
|
void |
removeLicense(Context context,
Item item) |
void |
removeLicense(Context context,
LicenseMetadataValue uriField,
LicenseMetadataValue nameField,
Item item)
Remove license information, delete also the bitstream
|
protected void |
setBitstreamFromBytes(Context context,
Item item,
Bundle bundle,
String bitstream_name,
BitstreamFormat format,
byte[] bytes)
This helper method takes some bytes and stores them as a bitstream for an
item, under the CC bundle, with the given bitstream name
Note: This helper method assumes that the CC
bitstreams are short and easily expressed as byte arrays in RAM
|
void |
setLicense(Context context,
Item item,
InputStream licenseStm,
String mimeType)
Used by DSpaceMetsIngester
|
void |
setLicenseRDF(Context context,
Item item,
String licenseRdf)
setLicenseRDF
CC Web Service method for setting the RDF bitstream
|
protected static final String CC_BS_SOURCE
@Deprecated protected static final String BSN_LICENSE_URL
CreativeCommonsService.getCCField(String) (see https://jira
.duraspace.org/browse/DS-2604)@Deprecated protected static final String BSN_LICENSE_TEXT
protected static final String BSN_LICENSE_RDF
protected Templates templates
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected BitstreamFormatService bitstreamFormatService
@Autowired(required=true) protected BundleService bundleService
@Autowired(required=true) protected ItemService itemService
protected ConfigurationService configurationService
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic boolean isEnabled()
CreativeCommonsServiceisEnabled in interface CreativeCommonsServiceprotected Bundle getCcBundle(Context context, Item item) throws SQLException, AuthorizeException, IOException
public void setLicenseRDF(Context context, Item item, String licenseRdf) throws SQLException, IOException, AuthorizeException
CreativeCommonsServicesetLicenseRDF in interface CreativeCommonsServicecontext - The relevant DSpace Context.item - The item to set license on.licenseRdf - license RDF stringSQLException - An exception that provides information on a database access error or other errors.IOException - A general class of exceptions produced by failed or interrupted I/O operations.AuthorizeException - Exception indicating the current user of the context does not have permission
to perform a particular action.public void setLicense(Context context, Item item, InputStream licenseStm, String mimeType) throws SQLException, IOException, AuthorizeException
CreativeCommonsServicesetLicense in interface CreativeCommonsServicecontext - 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)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 wjbpublic void removeLicense(Context context, Item item) throws SQLException, IOException, AuthorizeException
removeLicense in interface CreativeCommonsServiceSQLExceptionIOExceptionAuthorizeExceptionpublic boolean hasLicense(Context context, Item item) throws SQLException, IOException
hasLicense in interface CreativeCommonsServiceSQLExceptionIOExceptionpublic String getLicenseRDF(Context context, Item item) throws SQLException, IOException, AuthorizeException
getLicenseRDF in interface CreativeCommonsServiceSQLExceptionIOExceptionAuthorizeExceptionpublic Bitstream getLicenseRdfBitstream(Item item) throws SQLException, IOException, AuthorizeException
CreativeCommonsServicegetLicenseRdfBitstream in interface CreativeCommonsServiceitem - bitstream's parent itemSQLException - An exception that provides information on a database access error or other errors.IOException - A general class of exceptions produced by failed or interrupted I/O operations.AuthorizeException - Exception indicating the current user of the context does not have permission
to perform a particular action.@Deprecated public Bitstream getLicenseTextBitstream(Item item) throws SQLException, IOException, AuthorizeException
CreativeCommonsServicegetLicenseTextBitstream in interface CreativeCommonsServiceitem - bitstream's parent itemSQLException - An exception that provides information on a database access error or other errors.IOException - A general class of exceptions produced by failed or interrupted I/O operations.AuthorizeException - Exception indicating the current user of the context does not have permission
to perform a particular action.public String getLicenseURL(Context context, Item item) throws SQLException, IOException, AuthorizeException
getLicenseURL in interface CreativeCommonsServiceSQLExceptionIOExceptionAuthorizeExceptionpublic String fetchLicenseRDF(org.jdom.Document license)
CreativeCommonsServicefetchLicenseRDF in interface CreativeCommonsServicelicense - - an element that could be contains as part of your content
the license rdfprotected void setBitstreamFromBytes(Context context, Item item, Bundle bundle, String bitstream_name, BitstreamFormat format, byte[] bytes) throws SQLException, IOException, AuthorizeException
context - The relevant DSpace Context.item - parent itembundle - parent bundlebitstream_name - bitstream name to setformat - bitstream formatbytes - bitstream dataIOException - 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.protected String getStringFromBitstream(Context context, Item item, String bitstream_name) throws SQLException, IOException, AuthorizeException
context - The relevant DSpace Context.item - parent itembitstream_name - bitstream name to setIOException - 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.protected Bitstream getBitstream(Item item, String bitstream_name) throws SQLException, IOException, AuthorizeException
item - parent itembitstream_name - bitstream name to setIOException - 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.protected byte[] getBytesFromBitstream(Context context, Item item, String bitstream_name) throws SQLException, IOException, AuthorizeException
public LicenseMetadataValue getCCField(String fieldId)
getCCField in interface CreativeCommonsServicefieldId - name of the property.public void removeLicense(Context context, LicenseMetadataValue uriField, LicenseMetadataValue nameField, Item item) throws AuthorizeException, IOException, SQLException
CreativeCommonsServiceremoveLicense in interface CreativeCommonsServicecontext - - DSpace ContexturiField - - the metadata field for license urinameField - - the metadata field for license nameitem - - the itemAuthorizeException - 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.Copyright © 2019 DuraSpace. All rights reserved.