result.append("?sequence=").append(String.valueOf(bitstream.getSequenceID())); return result.toString();
String itemMsg = "item - " + itemHandle + ": "; String bsMsg = "bitstream - " + bitstream.getName() + ": SequenceId - " + bitstream.getSequenceID() + ": infected"; report(itemMsg + bsMsg); results.add(bsMsg);
path.append(item.getHandle()); path.append("/"); path.append(bitstream.getSequenceID()); } else { path.append("/retrieve/");
/** * Find the bitstream identified by a sequence number on this item. * * @param item A DSpace item * @param sequence The sequence of the bitstream * @return The bitstream or null if none found. */ private Bitstream findBitstreamBySequence(Item item, int sequence) throws SQLException { if (item == null) { return null; } Bundle[] bundles = item.getBundles(); for (Bundle bundle : bundles) { Bitstream[] bitstreams = bundle.getBitstreams(); for (Bitstream bitstream : bitstreams) { if (bitstream.getSequenceID() == sequence) { return bitstream; } } } return null; }
/** * Find the bitstream identified by a sequence number on this item. * * @param item A DSpace item * @param sequence The sequence of the bitstream * @return The bitstream or null if none found. */ private Bitstream findBitstreamBySequence(Item item, int sequence) throws SQLException { if (item == null) { return null; } Bundle[] bundles = item.getBundles(); for (Bundle bundle : bundles) { Bitstream[] bitstreams = bundle.getBitstreams(); for (Bitstream bitstream : bitstreams) { if (bitstream.getSequenceID() == sequence) { return bitstream; } } } return null; }
String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" + UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING); thumbFrag.append("<a target=\"_blank\" href=\"" + link + "\" />");
private void buildFullTextList(Item parentItem) { // now get full text of any bitstreams in the TEXT bundle // trundle through the bundles List<Bundle> myBundles = parentItem.getBundles(); for (Bundle myBundle : emptyIfNull(myBundles)) { if (StringUtils.equals(FULLTEXT_BUNDLE, myBundle.getName())) { // a-ha! grab the text out of the bitstreams List<Bitstream> bitstreams = myBundle.getBitstreams(); for (Bitstream fulltextBitstream : emptyIfNull(bitstreams)) { fullTextStreams.add(new FullTextBitstream(sourceInfo, fulltextBitstream)); log.debug("Added BitStream: " + fulltextBitstream.getStoreNumber() + " " + fulltextBitstream.getSequenceID() + " " + fulltextBitstream.getName()); } } } }
String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" + UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING); thumbFrag.append("<a target=\"_blank\" href=\"" + link + "\" />");
+ handle + "/" + String.valueOf(bitstream.getSequenceID()) + "/" + URLEncoder.encode(bitstream.getName(), "UTF-8");
bitstream.getSequenceID() + "/" + bitstream.getName(); } else { bsLink = bsLink + "/retrieve/" + bitstream.getID();
+ bitstream.getSequenceID() + "/" + Util.encodeBitstreamName(bitstream.getName(), Constants.DEFAULT_ENCODING); } catch (UnsupportedEncodingException ex) {
bitstream.getSequenceID() + "/" + bitstream.getName(); } else { bsLink = bsLink + "/retrieve/" + bitstream.getID() + "/" +
+ bitstream.getSequenceID() + "/";
@Override public void delete(Context context, Bitstream bitstream) throws SQLException, AuthorizeException { // changed to a check on delete // Check authorisation authorizeService.authorizeAction(context, bitstream, Constants.DELETE); log.info(LogManager.getHeader(context, "delete_bitstream", "bitstream_id=" + bitstream.getID())); context.addEvent(new Event(Event.DELETE, Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()), getIdentifiers(context, bitstream))); // Remove bitstream itself bitstream.setDeleted(true); update(context, bitstream); //Remove our bitstream from all our bundles final List<Bundle> bundles = bitstream.getBundles(); for (Bundle bundle : bundles) { bundle.removeBitstream(bitstream); } //Remove all bundles from the bitstream object, clearing the connection in 2 ways bundles.clear(); // Remove policies only after the bitstream has been updated (otherwise the current user has not WRITE rights) authorizeService.removeAllPolicies(context, bitstream); }
retrieveLink = path + "/bitstreams/" + bitstream.getID() + "/retrieve"; mimeType = bitstreamService.getFormat(context, bitstream).getMIMEType(); sequenceId = bitstream.getSequenceID(); CheckSum checkSum = new CheckSum(); checkSum.setCheckSumAlgorith(bitstream.getChecksumAlgorithm());
Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()), getIdentifiers(context, bundle)));
Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()), getIdentifiers(context, bundle)));
bsLink = bsLink + "/bitstream/" + handle + "/" + bitstream.getSequenceID() + "/" + bitstream.getName();
if (bitstream.getSequenceID() > sequence) { sequence = bitstream.getSequenceID(); if (stream.getSequenceID() < 0) { stream.setSequenceID(sequence); sequence++;
/** * Add the bitstream metadata to the item * * @param item The item * @param bitstream The bitstream * @param type The type of bitstream * @throws SQLException An exception that provides information on a database access error or other errors. */ protected void addMetadata(Item item, Bitstream bitstream, String type) throws SQLException { String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##"; value += bitstream.getName() + "##"; value += bitstream.getSizeBytes() + "##"; value += item.getHandle() + "##"; value += bitstream.getSequenceID() + "##"; value += bitstream.getChecksum() + "##"; if (bitstream.getDescription() != null) { value += bitstream.getDescription(); } itemService.addMetadata(Curator.curationContext(), item, "dc", "format", type, "en", value); } }