/** * Return a group id for a bitstream. */ protected String getGroupFileID(Bitstream bitstream) { return "group_file_" + bitstream.getID(); }
/** * Return a unique id for the given bitstream */ protected String getFileID(Bitstream bitstream) { return "file_" + bitstream.getID(); }
/** * Return a group id for the given bitstream */ protected String getGroupFileID(Bitstream bitstream) { return "group_file_" + bitstream.getID(); }
/** * Return a unique id for a bitstream. */ protected String getFileID(Bitstream bitstream) { return "file_" + bitstream.getID(); }
private void checkLastBitstream(Bitstream bitstream) throws SQLException { if (bitstream != null) { if (lastBitstream == null) { lastBitstream = bitstream; } else if (!lastBitstream.getID().equals(bitstream.getID())) { numUncache++; context.uncacheEntity(lastBitstream); lastBitstream = bitstream; } } }
@Override public int hashCode() { int hash = 5; hash += 73 * hash + getType(); hash += 73 * hash + getID().hashCode(); return hash; }
/** * Return <code>true</code> if <code>other</code> is the same Bitstream * as this object, <code>false</code> otherwise * * @param other object to compare to * @return <code>true</code> if object passed in represents the same * collection as this object */ @Override public boolean equals(Object other) { if (other == null) { return false; } Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(other); if (this.getClass() != objClass) { return false; } final Bitstream otherBitstream = (Bitstream) other; if (!this.getID().equals(otherBitstream.getID())) { return false; } return true; }
protected String urlOfBitstream(HttpServletRequest request, Bitstream logo) { String name = logo.getName(); return resolveURL(request, null) + (uiType.equalsIgnoreCase(UITYPE_XMLUI) ? "/bitstream/id/" : "/retrieve/") + logo.getID() + "/" + (name == null ? "" : name); }
public String getActionableBitstreamUrl(Bitstream bitstream) throws DSpaceSwordException { return this.getSwordBaseUrl() + "/edit-media/bitstream/" + bitstream.getID() + "/" + bitstream.getName(); }
@Override public List<Bitstream> findDuplicateInternalIdentifier(Context context, Bitstream bitstream) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Bitstream.class); Root<Bitstream> bitstreamRoot = criteriaQuery.from(Bitstream.class); criteriaQuery.select(bitstreamRoot); criteriaQuery.where(criteriaBuilder.and( criteriaBuilder.equal(bitstreamRoot.get(Bitstream_.internalId), bitstream.getInternalId()), criteriaBuilder.notEqual(bitstreamRoot.get(Bitstream_.id), bitstream.getID()) ) ); return list(context, criteriaQuery, false, Bitstream.class, -1, -1); }
@Override public void updateLastModified(Context context, Bitstream bitstream) { //Also fire a modified event since the bitstream HAS been modified context.addEvent( new Event(Event.MODIFY, Constants.BITSTREAM, bitstream.getID(), null, getIdentifiers(context, bitstream))); }
buf.append("------------------------------------------------ \n"); buf.append(msg("bitstream-id")).append(" = ").append( mostRecentChecksum.getBitstream().getID()).append("\n"); buf.append(msg("process-start-date")).append(" = ").append( applyDateFormatLong(mostRecentChecksum.getProcessStartDate()))
/** * Find out whether bitstream is readable by the public. * * @param bitstream the target bitstream * @return whether bitstream is readable by the Anonymous group */ protected boolean isPublic(Bitstream bitstream) { if (bitstream == null) { return false; } boolean result = false; Context context = null; try { context = new Context(); result = AuthorizeServiceFactory.getInstance().getAuthorizeService() .authorizeActionBoolean(context, bitstream, Constants.READ, true); } catch (SQLException e) { log.error( "Cannot determine whether bitstream is public, assuming it isn't. bitstream_id=" + bitstream.getID(), e); } return result; }
@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); }
UUID bitstreamId = bitstream.getID();
@Override public void update(Context context, Bitstream bitstream) throws SQLException, AuthorizeException { // Check authorisation authorizeService.authorizeAction(context, bitstream, Constants.WRITE); log.info(LogManager.getHeader(context, "update_bitstream", "bitstream_id=" + bitstream.getID())); super.update(context, bitstream); if (bitstream.isModified()) { context.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM, bitstream.getID(), null, getIdentifiers(context, bitstream))); bitstream.setModified(); } if (bitstream.isMetadataModified()) { context.addEvent( new Event(Event.MODIFY_METADATA, Constants.BITSTREAM, bitstream.getID(), bitstream.getDetails(), getIdentifiers(context, bitstream))); bitstream.clearModified(); bitstream.clearDetails(); } bitstreamDAO.save(context, bitstream); }
+ newLogo.getID()));
private UUID mapType(int type, int val) throws SQLException { if (type == Constants.COMMUNITY) { Community comm = communityService.findByLegacyId(context, val); return comm == null ? null : comm.getID(); } if (type == Constants.COLLECTION) { org.dspace.content.Collection coll = collectionService.findByLegacyId(context, val); return coll == null ? null : coll.getID(); } if (type == Constants.ITEM) { Item item = itemService.findByLegacyId(context, val); checkLastItem(item); return item == null ? null : item.getID(); } if (type == Constants.BITSTREAM) { Bitstream bit = bitstreamService.findByLegacyId(context, val); UUID uuid = bit == null ? null : bit.getID(); // A bitstream is unlikely to be processed more than once, to clear immediately checkLastBitstream(bit); return uuid; } return null; }
+ newLogo.getID()));