public class CitationDocumentServiceImpl extends Object implements CitationDocumentService, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamService |
bitstreamService |
protected Boolean |
citationAsFirstPage
Should the citation page be the first page of the document, or the last page?
default = true.
|
protected List<String> |
citationEnabledCollectionsList
List of all enabled collections, inherited/determined for those under communities.
|
protected Boolean |
citationEnabledGlobally
Boolean to determine is citation-functionality is enabled globally for entire site.
|
protected CommunityService |
communityService |
protected ConfigurationService |
configurationService |
protected String[] |
fields |
protected String |
footer |
protected HandleService |
handleService |
protected String[] |
header1 |
protected String[] |
header2 |
protected ItemService |
itemService |
protected Set<String> |
PDF_MIMES
A set of MIME types that refer to a PDF
|
protected Set<String> |
RASTER_MIMES
A set of MIME types that refer to a JPEG, PNG, or GIF
|
protected Set<String> |
SVG_MIMES
A set of MIME types that refer to a SVG
|
protected File |
tempDir |
protected Set<String> |
VALID_TYPES
A set of MIME types that can have a citation page added to them.
|
| Modifier | Constructor and Description |
|---|---|
protected |
CitationDocumentServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCoverPageToDocument(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDDocument sourceDocument,
org.apache.pdfbox.pdmodel.PDPage coverPage) |
void |
afterPropertiesSet() |
boolean |
canGenerateCitationVersion(Context context,
Bitstream bitstream) |
int |
drawStringWordWrap(org.apache.pdfbox.pdmodel.PDPage page,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
String text,
int startX,
int startY,
org.apache.pdfbox.pdmodel.font.PDFont pdfFont,
float fontSize) |
void |
drawTable(org.apache.pdfbox.pdmodel.PDPage page,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
float y,
float margin,
String[][] content,
org.apache.pdfbox.pdmodel.font.PDFont font,
int fontSize,
boolean cellBorders) |
protected void |
generateCoverPage(Context context,
org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPage coverPage,
Item item) |
String |
getAllMetadataSeparated(Item item,
String metadataKey)
Get metadata separated by value separator (semicolon)
|
String |
getOwningCollection(Item item)
Get name of owning collection
|
String |
getOwningCommunity(Context context,
Item item)
Get name of owning community
|
Boolean |
isCitationEnabledForBitstream(Bitstream bitstream,
Context context)
Repository policy can specify to have a custom citation cover/tail page to the document, which embeds metadata.
|
protected boolean |
isCitationEnabledGlobally() |
protected boolean |
isCitationEnabledThroughCollection(Context context,
Bitstream bitstream) |
protected Boolean |
isCitationFirstPage() |
File |
makeCitedDocument(Context context,
Bitstream bitstream)
Creates a
cited document from the given bitstream of the given item.
|
protected final Set<String> VALID_TYPES
protected final Set<String> RASTER_MIMES
protected List<String> citationEnabledCollectionsList
protected File tempDir
protected String[] header1
protected String[] header2
protected String[] fields
protected String footer
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected CommunityService communityService
@Autowired(required=true) protected ItemService itemService
@Autowired(required=true) protected ConfigurationService configurationService
@Autowired(required=true) protected HandleService handleService
protected Boolean citationEnabledGlobally
protected Boolean citationAsFirstPage
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected boolean isCitationEnabledGlobally()
protected boolean isCitationEnabledThroughCollection(Context context, Bitstream bitstream) throws SQLException
SQLExceptionpublic Boolean isCitationEnabledForBitstream(Bitstream bitstream, Context context) throws SQLException
CitationDocumentServiceisCitationEnabledForBitstream in interface CitationDocumentServicebitstream - DSpace bitstreamcontext - DSpace contextSQLException - if errorprotected Boolean isCitationFirstPage()
public boolean canGenerateCitationVersion(Context context, Bitstream bitstream) throws SQLException
canGenerateCitationVersion in interface CitationDocumentServicecontext - DSpace Contextbitstream - DSpace BitstreamSQLException - if errorpublic File makeCitedDocument(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException
CitationDocumentServiceThe Process for adding a cover page is as follows:
makeCitedDocument in interface CitationDocumentServicecontext - DSpace contextbitstream - The source bitstream being cited. This must be a PDF.IOException - if IO errorSQLException - if database errorAuthorizeException - if authorization errorprotected void generateCoverPage(Context context, org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.PDPage coverPage, Item item) throws IOException
IOExceptionprotected void addCoverPageToDocument(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDDocument sourceDocument,
org.apache.pdfbox.pdmodel.PDPage coverPage)
public int drawStringWordWrap(org.apache.pdfbox.pdmodel.PDPage page,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
String text,
int startX,
int startY,
org.apache.pdfbox.pdmodel.font.PDFont pdfFont,
float fontSize)
throws IOException
drawStringWordWrap in interface CitationDocumentServicepage - pagecontentStream - content streamtext - text to drawstartX - x-coordinate of wordstartY - y-coordinate of wordpdfFont - fontfontSize - size of fontIOException - if IO errorpublic String getOwningCommunity(Context context, Item item)
CitationDocumentServicegetOwningCommunity in interface CitationDocumentServicecontext - DSpace contextitem - DSpace Itempublic String getOwningCollection(Item item)
CitationDocumentServicegetOwningCollection in interface CitationDocumentServiceitem - DSpace Itempublic String getAllMetadataSeparated(Item item, String metadataKey)
CitationDocumentServicegetAllMetadataSeparated in interface CitationDocumentServiceitem - DSpace ItemmetadataKey - metadata stringDSpaceObjectService.getMetadataByMetadataString(org.dspace.content.DSpaceObject, java.lang.String)public void drawTable(org.apache.pdfbox.pdmodel.PDPage page,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
float y,
float margin,
String[][] content,
org.apache.pdfbox.pdmodel.font.PDFont font,
int fontSize,
boolean cellBorders)
throws IOException
drawTable in interface CitationDocumentServicepage - pagecontentStream - content streamy - the y-coordinate of the first rowmargin - the padding on left and right of tablecontent - a 2d array containing the table datafont - PDFontfontSize - size of font (int)cellBorders - whether to include cellBordersIOException - if errorCopyright © 2016 DuraSpace. All rights reserved.