protected boolean isCitationEnabledThroughCollection(Context context, Bitstream bitstream) throws SQLException { //Reject quickly if no-enabled collections if (citationEnabledCollectionsList.size() == 0) { return false; } DSpaceObject owningDSO = bitstreamService.getParentObject(context, bitstream); if (owningDSO instanceof Item) { Item item = (Item) owningDSO; List<Collection> collections = item.getCollections(); for (Collection collection : collections) { if (citationEnabledCollectionsList.contains(collection.getHandle())) { return true; } } } // If previous logic didn't return true, then we're false return false; }
if (authorizeService .authorizeActionBoolean(context, dspaceBitstreams.get(i), org.dspace.core.Constants.READ)) { if (bitstreamService.getParentObject(context, dspaceBitstreams
@Override public Pair<InputStream, Long> makeCitedDocument(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException { PDDocument document = new PDDocument(); PDDocument sourceDocument = new PDDocument(); try { Item item = (Item) bitstreamService.getParentObject(context, bitstream); sourceDocument = sourceDocument.load(bitstreamService.retrieve(context, bitstream)); PDPage coverPage = new PDPage(citationPageFormat); generateCoverPage(context, document, coverPage, item); addCoverPageToDocument(document, sourceDocument, coverPage); //We already have the full PDF in memory, so keep it there try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { document.save(out); byte[] data = out.toByteArray(); return Pair.of((InputStream) new ByteArrayInputStream(data), new Long(data.length)); } } finally { sourceDocument.close(); document.close(); } }
DSpaceObject parent = bitstreamService.getParentObject(context, bitstream);
bitstream = bitstreamService.findByIdOrLegacyId(context, id); if ((bitstream == null) || (bitstreamService.getParentObject(context, bitstream) == null)) { context.abort(); log.warn("Bitstream(id=" + id + ") was not found!");
} else { DSpaceObject parentObject = bitstreamService.getParentObject(context, bitstream); if (parentObject instanceof Collection) { bundleName = "LOGO-COLLECTION";
if (bitstreamService.getParentObject(context, bitstream).getType() == Constants.ITEM) { bundleName = bitstream.getBundles().get(0).getName(); parentObject = new DSpaceObject(bitstreamService.getParentObject(context, bitstream), servletContext); } else { this.addExpand("parent");
DSpaceObject parent = bitstreamService.getParentObject(c, b); if (!(parent instanceof Collection) && !(parent instanceof Community)) { ignoreCustomPolicies = !isAnyItemInstalled(c, b.getBundles());