this.setCopyrightText(collectionService.getMetadata(collection, org.dspace.content.Collection.COPYRIGHT_TEXT)); this.setIntroductoryText( collectionService.getMetadata(collection, org.dspace.content.Collection.INTRODUCTORY_TEXT)); this.setShortDescription( collectionService.getMetadata(collection, org.dspace.content.Collection.SHORT_DESCRIPTION)); this.setSidebarText(collectionService.getMetadata(collection, org.dspace.content.Collection.SIDEBAR_TEXT)); org.dspace.content.Community parentCommunity = (org.dspace.content.Community) collectionService .getParentObject(context, collection); this.setParentCommunity(new Community( parentCommunity, servletContext, null, context)); setLicense(collectionService.getLicense(collection)); } else { this.addExpand("license");
private int getCollectionCount() { try { List<Collection> collectionList = collectionService.findAll(_context); return collectionList.size(); } catch (SQLException e) { log.error(e.getMessage(), e); } return 0; }
@Override public List<Collection> getAvailableSubscriptions(Context context, EPerson eperson) throws SQLException { List<Collection> collections; if (eperson != null) { context.setCurrentUser(eperson); } collections = collectionService.findAuthorized(context, null, Constants.ADD); return collections; }
Collection collection = collectionService.create(context, parent); collectionService.setMetadata(context, collection, "short_description", " "); NodeList nl = XPathAPI.selectNodeList(tn, entry.getKey()); if (nl.getLength() == 1) { collectionService.setMetadata(context, collection, entry.getValue(), getStringValue(nl.item(0))); collectionService.update(context, collection); nameElement.setText(collectionService.getMetadata(collection, "name")); element.addContent(nameElement); if (collectionService.getMetadata(collection, "short_description") != null) { Element descriptionElement = new Element("description"); descriptionElement.setText(collectionService.getMetadata(collection, "short_description")); element.addContent(descriptionElement); if (collectionService.getMetadata(collection, "introductory_text") != null) { Element introElement = new Element("intro"); introElement.setText(collectionService.getMetadata(collection, "introductory_text")); element.addContent(introElement); if (collectionService.getMetadata(collection, "copyright_text") != null) { Element copyrightElement = new Element("copyright"); copyrightElement.setText(collectionService.getMetadata(collection, "copyright_text")); element.addContent(copyrightElement); if (collectionService.getMetadata(collection, "side_bar_text") != null) {
writeStats(dspaceCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, request, context); org.dspace.content.Collection dspaceCollection = collectionService.create(context, dspaceCommunity); collectionService.setMetadata(context, dspaceCollection, "license", collection.getLicense()); collectionService.setMetadata(context, dspaceCollection, "name", collection.getName()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.COPYRIGHT_TEXT, collection.getCopyrightText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.INTRODUCTORY_TEXT, collection.getIntroductoryText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SHORT_DESCRIPTION, collection.getShortDescription()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText()); collectionService.update(context, dspaceCollection); communityService.update(context, dspaceCommunity); retCollection = new Collection(dspaceCollection, servletContext, "", context, 100, 0);
String title = collectionService.getMetadata(col, "name"); String collectionPolicy = collectionService.getLicense(col); .getMetadata(col, "short_description");
String title = collectionService.getName(col); String collectionPolicy = collectionService.getLicense(col); .getMetadataByMetadataString(col, "short_description");
.findByIdOrLegacyId(context, collectionId); org.dspace.content.Item item = itemService.findByIdOrLegacyId(context, itemId); collectionService.removeItem(context, dspaceCollection, item); collectionService.update(context, dspaceCollection); itemService.update(context, item);
/** * Get the license that users must grant before submitting to this * collection. * * @return the license for this collection */ public String getLicenseCollection() { return getCollectionService().getMetadata(this, "license"); }
String licenseTemplate = collectionService.getLicense(collection);
private static void checkSelectCollectionForUser(EPerson person) throws SQLException { context.setCurrentUser(person); StopWatch stopWatch = new StopWatch("SelectCollectionStep Optimization (" + person.getEmail() + ")"); System.out.println("User: " + person.getEmail()); stopWatch.start("findAuthorized"); List<Collection> collections = collectionService.findAuthorized(context, null, Constants.ADD); stopWatch.stop(); Long defaultMS = stopWatch.getLastTaskTimeMillis(); stopWatch.start("ListingCollections"); System.out.println("Legacy Find Authorized"); reportCollections(collections); stopWatch.stop(); stopWatch.start("findAuthorizedOptimized"); List<Collection> collectionsOptimized = collectionService.findAuthorizedOptimized(context, Constants.ADD); stopWatch.stop(); Long optimizedMS = stopWatch.getLastTaskTimeMillis(); timeSavedMS += defaultMS - optimizedMS; stopWatch.start("ListingCollectionsWithOptimizedCollections"); System.out.println("Find Authorized Optimized"); reportCollections(collectionsOptimized); stopWatch.stop(); if (collections.size() == collectionsOptimized.size()) { System.out.println("Number of collections matches - Good"); } else { System.out.println("Number of collections doesn't match -- Bad"); brokenPeople.add(person); } System.out.println(stopWatch.prettyPrint()); }
org.dspace.content.Collection collection = collectionService.findByIdOrLegacyId(context, collectionId); collectionService.update(context, collection);
collectionService.addItem(context, to, item); collectionService.removeItem(context, from, item);
context = createContext(); org.dspace.content.Collection collection = collectionService.findByIdOrLegacyId(context, collection_id); if (authorizeService.authorizeActionBoolean(context, collection, org.dspace.core.Constants.READ)) { writeStats(collection, UsageEvent.Action.VIEW, user_ip,
@Override public void removeCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException, IOException { // Check authorisation authorizeService.authorizeAction(context, community, Constants.REMOVE); ArrayList<String> removedIdentifiers = collectionService.getIdentifiers(context, collection); String removedHandle = collection.getHandle(); UUID removedId = collection.getID(); if (collection.getCommunities().size() == 1) { collectionService.delete(context, collection); } else { community.removeCollection(collection); collection.removeCommunity(community); } log.info(LogManager.getHeader(context, "remove_collection", "community_id=" + community.getID() + ",collection_id=" + collection.getID())); // Remove any mappings context.addEvent(new Event(Event.REMOVE, Constants.COMMUNITY, community.getID(), Constants.COLLECTION, removedId, removedHandle, removedIdentifiers)); }
protected void deleteItem(Context c, Item myitem) throws Exception { if (!isTest) { ArrayList<Collection> removeList = new ArrayList<>(); List<Collection> collections = myitem.getCollections(); // Save items to be removed to prevent concurrent modification exception DS-3322 for (Collection collection : collections) { removeList.add(collection); } // Remove item from all the collections it's in for (Collection collection : removeList) { collectionService.removeItem(c, collection, myitem); } } }
.canCommunityAdminManageCollectionWorkflows()) { org.dspace.content.Collection collection = collectionService.findByGroup(context, group); return collection; } else if (AuthorizeConfiguration.canCommunityAdminManageCollectionWorkflows()) { return collectionService.getParentObject(context, collection); return collection; } else if (AuthorizeConfiguration.canCommunityAdminManageCollectionSubmitters()) { return collectionService.getParentObject(context, collection); return collection; } else if (AuthorizeConfiguration.canCommunityAdminManageCollectionAdminGroup()) { return collectionService.getParentObject(context, collection);
protected Collection getDepositTarget(Context context, String depositUrl, SwordConfigurationDSpace config) throws DSpaceSwordException, SwordError { SwordUrlManager urlManager = config.getUrlManager(context, config); // get the target collection Collection collection = urlManager.getCollection(context, depositUrl); if (collection == null) { throw new SwordError(404); } this.verboseDescription .append("Performing deposit using deposit URL: " + depositUrl); this.verboseDescription .append("Location resolves to collection with handle: " + collection.getHandle() + " and name: " + collectionService.getName(collection)); return collection; } }
collectionService.delete(context, collection); break;