@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)); }
private static void reportCollections(List<Collection> collections) { System.out.println("===================================="); System.out.println("This user is permitted to submit to the following collections."); for (Collection collection : collections) { System.out.println(" - " + collection.getHandle() + " -- " + collection.getName()); } System.out.println("Total: " + collections.size()); } }
private List<Object> findOwningCommunities(Context context, int collId) throws SQLException { Collection coll = Collection.find(context, collId); List<Object> owningComms = new ArrayList<Object>(); for (int i = 0; i < coll.getCommunities().length; i++) { Community community = coll.getCommunities()[i]; findComms(community, owningComms); } return owningComms; }
String name = collection.getMetadata("name"); if (name == null || name.length() == 0) String feedURL = contextPath+"/feed/"+format.trim()+"/"+collection.getHandle(); pageMeta.addMetadata("feed", feedFormat).addContent(feedURL);
@Override public int hashCode() { return Objects.hash(path, collection.getID()); } }
Collection myCollection = Collection.find(context, myID); ItemIterator i = myCollection.getItems(); try Integer cKey = Integer.valueOf(owningCollection.getID()); myCollections.remove(Integer.valueOf(myCollection.getID())); request .setAttribute("all_collections", Collection .findAll(context)); myCollection.removeItem(myItem); try myCollection.addItem(myItem); try ItemIterator itr = myCollection.getItems(); try Collection targetCollection = Collection.find(context, t); ItemIterator i = myCollection.getItems(); try .getMetadata("name")); request.setAttribute("items", items);
/** * Build a Lucene document for a DSpace Collection. * * @param collection Collection to be indexed * @throws SQLException sql exception * @throws IOException IO exception */ private void buildDocument(Collection collection) throws SQLException, IOException { List<String> locations = getCollectionLocations(collection); // Create Lucene Document SolrInputDocument doc = buildDocument(Constants.COLLECTION, collection.getID(), collection.getHandle(), locations); // and populate it String name = collection.getMetadata("name"); if (name != null) { doc.addField("name", name); } //Do any additional indexing, depends on the plugins List<SolrServiceIndexPlugin> solrServiceIndexPlugins = new DSpace().getServiceManager().getServicesByType(SolrServiceIndexPlugin.class); for (SolrServiceIndexPlugin solrServiceIndexPlugin : solrServiceIndexPlugins) { solrServiceIndexPlugin.additionalIndex(collection, doc); } writeDocument(doc); }
@Override public DSpaceObject getParentObject(Context context, Collection collection) throws SQLException { List<Community> communities = collection.getCommunities(); if (CollectionUtils.isNotEmpty(communities)) { return communities.get(0); } else { return null; } }
Collection[] possibleList = Collection.findAll(context); for (Collection possible : possibleList) String name = possible.getMetadata("name"); if (name.length() > 50) subscriptions.addOption(possible.getID(), name); subscriptions.addInstance().setOptionSelected(collection.getID());
scope.addOption(collection.getHandle(), collection.getMetadata("name")); scope.addOption(collection.getHandle(), collection.getMetadata("name")); scope.setOptionSelected(collection.getHandle()); Community[] communities = collection.getCommunities()[0] .getAllParents(); for (Community community : communities) {
Collection[] allCols = Collection.findAll(context); StringBuffer spec = null; for (int i = 0; i < allCols.length; i++) spec.append(allCols[i].getHandle().replace('/', '_')); spec.append("</setSpec>"); String collName = allCols[i].getMetadata("name"); if(collName != null) "null_set_name_for_set_id_" + allCols[i].getHandle()));
validityKey.append(collection.getHandle()); validityKey.append(collection.getMetadata("introductory_text")); validityKey.append(collection.getMetadata("short_description")); validityKey.append(collection.getMetadata("side_bar_text")); validityKey.append(collection.getMetadata("provenance_description")); validityKey.append(collection.getMetadata("copyright_text")); validityKey.append(collection.getMetadata("license")); validityKey.append(collection.getMetadata("name")); this.add(collection.getLogo());
Collection[] collections = Collection.findAll(c); Collection[] collections = Collection.findAll(c); Group[] groups = Group.findAll(c, Group.NAME); Collection collection = Collection.find(c, UIUtil.getIntParameter( request, "collection_id")); + collection.getID()); request.setAttribute("policy", policy); request.setAttribute("groups", groups); request.setAttribute("epeople", epeople); request.setAttribute("id_name", "collection_id"); request.setAttribute("id", "" + collection.getID()); request.setAttribute("newpolicy", "true"); Collection collection = Collection.find(c, UIUtil.getIntParameter( request, "collection_id")); Collection collection = Collection.find(c, UIUtil.getIntParameter( request, "collection_id")); + collection.getID()); request.setAttribute("policy", policy); request.setAttribute("groups", groups); request.setAttribute("epeople", epeople); request.setAttribute("id_name", "collection_id"); request.setAttribute("id", "" + collection.getID()); JSPManager.showJSP(request, response,
collections = Collection.findAuthorized(context, ((Community) dso), Constants.ADD); collections = Collection.findAuthorized(context, null, Constants.ADD); for (Collection collection : collections) String name = collection.getMetadata("name"); if (name.length() > 50) select.addOption(collection.getHandle(),name);
if (dso.getType() == Constants.COLLECTION) { Collection col = (Collection) dso; defaultTitle = col.getName(); feed.setDescription(collectionService.getMetadata(col, "short_description")); logo = col.getLogo(); String cols = ConfigurationManager.getProperty("webui.feed.podcast.collections"); if (cols != null && cols.length() > 1 && cols.contains(col.getHandle())) { podcastFeed = true;
protected void buildSearchControls(Division div) throws WingException, SQLException { Request request = ObjectModelHelper.getRequest(objectModel); Table controlsTable = div.addTable("search-controls", 1, 3); Row controlsRow = controlsTable.addRow(Row.ROLE_DATA); // Create a control for the number of records to display Cell rppCell = controlsRow.addCell(); rppCell.addContent("pagesize"); Select rppSelect = rppCell.addSelect("rpp"); for (int i : RESULTS_PER_PAGE_PROGRESSION) { rppSelect.addOption((i == getParameterRpp()), i, Integer.toString(i)); } Cell filterCell = controlsRow.addCell(); // Create a drop down of the different sort columns available int selectedCollectionId = Util.getIntParameter(request, "filter_collection"); filterCell.addContent("Collection filter:"); Select sortSelect = filterCell.addSelect("filter_collection"); sortSelect.addOption(-1 == selectedCollectionId,-1, "None"); Collection[] collections = Collection.findAll(context); for (Collection collection : collections) { sortSelect.addOption(collection.getID() == selectedCollectionId, collection.getID(), collection.getName()); } controlsRow.addCell().addButton("submit_search_controls").setValue(T_go); }