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) |
String |
getOwningCollection(Item item) |
String |
getOwningCommunity(Context context,
Item item) |
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 CitationDocumentServiceSQLExceptionprotected Boolean isCitationFirstPage()
public boolean canGenerateCitationVersion(Context context, Bitstream bitstream) throws SQLException
canGenerateCitationVersion in interface CitationDocumentServiceSQLExceptionpublic File makeCitedDocument(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException
CitationDocumentServiceThe Process for adding a cover page is as follows:
makeCitedDocument in interface CitationDocumentServicebitstream - The source bitstream being cited. This must be a PDF.FileNotFoundExceptionSQLExceptionAuthorizeExceptionIOExceptionprotected 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 CitationDocumentServiceIOExceptionpublic String getOwningCommunity(Context context, Item item)
getOwningCommunity in interface CitationDocumentServicepublic String getOwningCollection(Item item)
getOwningCollection in interface CitationDocumentServicepublic String getAllMetadataSeparated(Item item, String metadataKey)
getAllMetadataSeparated in interface CitationDocumentServicepublic 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 CitationDocumentServicey - the y-coordinate of the first rowmargin - the padding on left and right of tablecontent - a 2d array containing the table dataIOExceptionCopyright © 2016 DuraSpace. All Rights Reserved.