Package org.dspace.disseminate
Class CitationDocumentServiceImpl
java.lang.Object
org.dspace.disseminate.CitationDocumentServiceImpl
- All Implemented Interfaces:
CitationDocumentService,InitializingBean
public class CitationDocumentServiceImpl
extends Object
implements CitationDocumentService, InitializingBean
The Citation Document produces a dissemination package (DIP) that is different that the archival package (AIP).
In this case we append the descriptive metadata to the end (configurable) of the document. i.e. last page of PDF.
So instead of getting the original PDF, you get a cPDF (with citation information added).
- Author:
- Peter Dietz (peter@longsight.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorizeServiceprotected BitstreamServiceprotected BooleanShould the citation page be the first page of the document, or the last page?List of all enabled collections, inherited/determined for those under communities.protected BooleanBoolean to determine is citation-functionality is enabled globally for entire site.protected CommunityServiceprotected ConfigurationServiceprotected HandleServiceprotected ItemServiceA set of MIME types that refer to a PDFA set of MIME types that refer to a JPEG, PNG, or GIFA set of MIME types that refer to a SVGprotected FileA set of MIME types that can have a citation page added to them. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleancanGenerateCitationVersion(Context context, Bitstream bitstream) isCitationEnabledForBitstream(Bitstream bitstream, Context context) Repository policy can specify to have a custom citation cover/tail page to the document, which embeds metadata.protected booleanprotected booleanisCitationEnabledThroughCollection(Context context, Bitstream bitstream) protected Booleanorg.apache.commons.lang3.tuple.Pair<byte[],Long> makeCitedDocument(Context context, Bitstream bitstream) Creates a cited document from the given bitstream of the given item.
-
Field Details
-
VALID_TYPES
A set of MIME types that can have a citation page added to them. That is, MIME types in this set can be converted to a PDF which is then prepended with a citation page. -
PDF_MIMES
A set of MIME types that refer to a PDF -
RASTER_MIMES
A set of MIME types that refer to a JPEG, PNG, or GIF -
SVG_MIMES
A set of MIME types that refer to a SVG -
citationEnabledCollectionsList
List of all enabled collections, inherited/determined for those under communities. -
tempDir
-
authorizeService
-
bitstreamService
-
communityService
-
itemService
-
configurationService
-
handleService
-
citationEnabledGlobally
Boolean to determine is citation-functionality is enabled globally for entire site. config/modules/citation-page: enable_globally, default false. true=on, false=off -
citationAsFirstPage
Should the citation page be the first page of the document, or the last page? default = true. true = first page, false = last page citation_as_first_page=true
-
-
Constructor Details
-
CitationDocumentServiceImpl
protected CitationDocumentServiceImpl()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception
-
isCitationEnabledGlobally
protected boolean isCitationEnabledGlobally() -
isCitationEnabledThroughCollection
protected boolean isCitationEnabledThroughCollection(Context context, Bitstream bitstream) throws SQLException - Throws:
SQLException
-
isCitationEnabledForBitstream
public Boolean isCitationEnabledForBitstream(Bitstream bitstream, Context context) throws SQLException Description copied from interface:CitationDocumentServiceRepository policy can specify to have a custom citation cover/tail page to the document, which embeds metadata. We need to determine if we will intercept this bitstream download, and give out a citation dissemination rendition. What will trigger a redirect/intercept? Citation enabled globally (all citable bitstreams will get "watermarked") modules/disseminate-citation: enable_globally OR The container is this object is "allow list" enabled. - community: modules/disseminate-citation: enabled_communities - collection: modules/disseminate-citation: enabled_collections AND This User is not an admin. (Admins need to be able to view the "raw" original instead.) AND This object is citation-able (presently, just PDF) The module must be enabled, before the permission level checks happen.- Specified by:
isCitationEnabledForBitstreamin interfaceCitationDocumentService- Parameters:
bitstream- DSpace bitstreamcontext- DSpace context- Returns:
- true or false
- Throws:
SQLException- if error
-
isCitationFirstPage
-
canGenerateCitationVersion
- Specified by:
canGenerateCitationVersionin interfaceCitationDocumentService- Parameters:
context- DSpace Contextbitstream- DSpace Bitstream- Returns:
- true or false
- Throws:
SQLException- if error
-
makeCitedDocument
public org.apache.commons.lang3.tuple.Pair<byte[],Long> makeCitedDocument(Context context, Bitstream bitstream) throws IOException, SQLException Description copied from interface:CitationDocumentServiceCreates a cited document from the given bitstream of the given item. This requires that bitstream is contained in item.The Process for adding a cover page is as follows:
- Load source file into PdfReader and create a Document to put our cover page into.
- Create cover page and add content to it.
- Concatenate the coverpage and the source document.
- Specified by:
makeCitedDocumentin interfaceCitationDocumentService- Parameters:
context- DSpace contextbitstream- The source bitstream being cited. This must be a PDF.- Returns:
- The temporary File that is the finished, cited document.
- Throws:
IOException- if IO errorSQLException- if database error
-