Refine search
@Override public List<Bundle> getBundles(Item item, String name) throws SQLException { List<Bundle> matchingBundles = new ArrayList<>(); // now only keep bundles with matching names List<Bundle> bunds = item.getBundles(); for (Bundle bund : bunds) { if (name.equals(bund.getName())) { matchingBundles.add(bund); } } return matchingBundles; }
@Override public void addItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException { // Check authorisation authorizeService.authorizeAction(context, collection, Constants.ADD); log.info(LogManager.getHeader(context, "add_item", "collection_id=" + collection.getID() + ",item_id=" + item.getID())); // Create mapping // We do NOT add the item to the collection template since we would have to load in all our items // Instead we add the collection to an item which works in the same way. if (!item.getCollections().contains(collection)) { item.addCollection(collection); } context.addEvent(new Event(Event.ADD, Constants.COLLECTION, collection.getID(), Constants.ITEM, item.getID(), item.getHandle(), getIdentifiers(context, collection))); }
public boolean testItem(Context context, Item item) { return item.isWithdrawn(); } },
@Override public DSpaceObject getParentObject(Context context, Item item) throws SQLException { Collection ownCollection = item.getOwningCollection(); if (ownCollection != null) { return ownCollection; } else { // is a template item? return item.getTemplateItemOf(); } }
stm = db.prepareStatement("INSERT INTO ITEM (ID, TYPE, TITEL, UITGELEEND) VALUES (?, ?, ?, ?)"); db.setAutoCommit(false); for (int n = 0; n < ItemLijst.getItems().size(); n++) { Item huidigItem = ItemLijst.getItemObvIdx(n); stm.setString(1, huidigItem.getID().toString()); stm.setString(2, huidigItem.getType().toString()); stm.setString(3, huidigItem.getTitel()); stm.setString(4,String.valueOf(huidigItem.isUitgeleend())); stm.addBatch(); } stm.executeBatch(); db.commit();
case Constants.ITEM: Item item = (Item) dso; if (item.isArchived() && !item.isWithdrawn()) { if (requiresIndexing(handle, ((Item) dso).getLastModified()) || force) { unIndexContent(context, handle); log.info("Removed Item: " + handle + " from Index"); log.info("Wrote Collection: " + handle + " to Index"); break; log.info("Wrote Community: " + handle + " to Index"); break;
if (bundles.length == 0) log.error("Found orphaned bitstream: " + bitstream.getID()); throw new DSpaceSWORDException("Orphaned bitstream discovered"); if (items.length == 0) log.error("Found orphaned bundle: " + bundles[0].getID()); throw new DSpaceSWORDException("Orphaned bundle discovered"); Bundle[] lbundles = item.getBundles("LICENSE"); for (int i = 0; i < lbundles.length; i++) rights.setType(ContentType.TEXT); entry.setRights(rights); log.debug("Added rights entry to entity");
log.warn(LogManager.getHeader(context, "integrity_error", UIUtil .getRequestLogInfo(request))); JSPManager.showIntegrityError(request, response); log.info(LogManager.getHeader(context, "remove_submission", "workspace_item_id=" + workspaceItem.getID() + ",item_id=" + workspaceItem.getItem().getID())); workspaceItem.deleteAll(); showMainPage(context, request, response);
if (modSince != -1 && item.getLastModified().getTime() < modSince) log.error("Error selecting based on If-Modified-Since: "+e.toString()); return false;
if (item.getHandle() != null) handle = item.getHandle(); Bundle[] bundles = item.getBundles(swordBundle); if (bundles.length > 0) log.error("caught exception: ", e); throw new DSpaceSWORDException(e);
DCValue[] value = item.getMetadata(metadata); String styleName = "default"; if (value.length > 0) .warn("more then one value for metadata '" + metadata + "'. Using the first one"); log.warn("metadata '" + metadata + "' specify undefined item display style '" + styleName + "'. Using default"); return "default";
@Override public void removeItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException, IOException { // Check authorisation authorizeService.authorizeAction(context, collection, Constants.REMOVE); //Check if we orphaned our poor item if (item.getCollections().size() == 1) { // Orphan; delete it itemService.delete(context, item); } else { //Remove the item from the collection if we have multiple collections item.removeCollection(collection); } context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION, collection.getID(), Constants.ITEM, item.getID(), item.getHandle(), getIdentifiers(context, collection))); }
+ item.getID())); List<Bundle> bunds = item.getBundles(); if (item.isMetadataModified() || item.isModified()) { item.setLastModified(new Date()); if (item.isMetadataModified()) { context.addEvent(new Event(Event.MODIFY_METADATA, item.getType(), item.getID(), item.getDetails(), getIdentifiers(context, item))); context.addEvent(new Event(Event.MODIFY, Constants.ITEM, item.getID(), null, getIdentifiers(context, item))); item.clearModified(); item.clearDetails();
/** * Internal utitity method to get a description of the handle * * @param item The item to get a description of * @return The handle, or in workflow */ protected String getItemHandle(Item item) { String handle = item.getHandle(); return (handle != null) ? handle : " in workflow"; }
public void deleteItem(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
itemInfo.item = i; itemInfo.handle = handle; itemInfo.withdrawn = i.isWithdrawn(); itemInfo.datestamp = i.getLastModified(); itemInfo.itemID = i.getID();
SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(HANDLE_FIELD + ": " + item.getHandle()); if (mltResults != null && mltResults.get(item.getType() + "-" + item.getID()) != null) { SolrDocumentList relatedDocs = (SolrDocumentList) mltResults.get(item.getType() + "-" + item.getID()); for (Object relatedDoc : relatedDocs) { SolrDocument relatedDocument = (SolrDocument) relatedDoc; LogManager.getHeader(context, "Error while retrieving related items", "Handle: " + item.getHandle()), e);