throws SQLException, AuthorizeException, IOException { log.info(LogManager.getHeader(context, "delete_community", "community_id=" + community.getID())); context.addEvent(new Event(Event.DELETE, Constants.COMMUNITY, community.getID(), community.getHandle(), getIdentifiers(context, community))); Iterator<Collection> collections = community.getCollections().iterator(); community.removeCollection(collection); removeCollection(context, community, collection); Iterator<Community> subCommunities = community.getSubcommunities().iterator(); community.removeSubCommunity(subComm); delete(context, subComm); community.removeParentCommunity(parent); parent.removeSubCommunity(community); Group g = community.getAdministrators();
continue; HierarchyCommunity mycomm = new HierarchyCommunity(comm.getID().toString(), comm.getName(), comm.getHandle()); parentComms.add(mycomm); List<Collection> colls = comm.getCollections(); if (colls.size() > 0) { List<HierarchyCollection> myColls = new ArrayList<HierarchyCollection>(); processCommunity(context, mycomm, comm.getSubcommunities());
Community[] communities = Community.findAllTop(context); Integer comID = Integer.valueOf(communities[com].getID()); Collection[] colls = communities[com].getCollections(); colMap.put(comID, colls); Community[] comms = communities[com].getSubcommunities(); commMap.put(comID, comms);
private void findComms(Community comm, List<Object> parentComms) throws SQLException { if (comm == null) { return; } if (!parentComms.contains(comm.getID())) { parentComms.add(comm.getID()); } List<Community> parentCommunities = comm.getParentCommunities(); Community parent = parentCommunities.size() == 0 ? null : parentCommunities.get(0); findComms(parent, parentComms); }
private void findComms(Community comm, List<Object> parentComms) throws SQLException { if (comm == null) { return; } if (!parentComms.contains(comm.getID())) { parentComms.add(comm.getID()); } findComms(comm.getParentCommunity(), parentComms); }
@Override public List<Collection> getAllCollections(Context context, Community community) throws SQLException { List<Collection> collectionList = new ArrayList<Collection>(); List<Community> subCommunities = community.getSubcommunities(); for (Community subCommunity : subCommunities) { addCollectionList(subCommunity, collectionList); } List<Collection> collections = community.getCollections(); for (Collection collection : collections) { collectionList.add(collection); } return collectionList; }
for (Community community : Community.findAllTop(context)) { scope.addOption(community.getHandle(), community.getMetadata("name")); scope.addOption(community.getHandle(), community.getMetadata("name")); scope.setOptionSelected(community.getHandle()); for (Collection collection : community.getCollections()) { scope.addOption(collection.getHandle(), collection.getMetadata("name")); .getAllParents(); for (Community community : communities) { scope.addOption(community.getHandle(), community.getMetadata("name"));
if (!handleButton(request, response, community.getHandle())) "community_id=" + community.getID())); Collection[] collections = community.getCollections(); Community[] subcommunities = community.getSubcommunities(); if (community.canEditBoolean())
@Override public void addSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException { // Check authorisation authorizeService.authorizeAction(context, parentCommunity, Constants.ADD); log.info(LogManager.getHeader(context, "add_subcommunity", "parent_comm_id=" + parentCommunity.getID() + ",child_comm_id=" + childCommunity .getID())); if (!parentCommunity.getSubcommunities().contains(childCommunity)) { parentCommunity.addSubCommunity(childCommunity); childCommunity.addParentCommunity(parentCommunity); } context.addEvent(new Event(Event.ADD, Constants.COMMUNITY, parentCommunity.getID(), Constants.COMMUNITY, childCommunity.getID(), parentCommunity.getHandle(), getIdentifiers(context, parentCommunity))); }
@Override public void applyFiltersCommunity(Context context, Community community) throws Exception { //only apply filters if community not in skip-list if (!inSkipList(community.getHandle())) { List<Community> subcommunities = community.getSubcommunities(); for (Community subcommunity : subcommunities) { applyFiltersCommunity(context, subcommunity); } List<Collection> collections = community.getCollections(); for (Collection collection : collections) { applyFiltersCollection(context, collection); } } }
/** * Construct the service document URL for the given object, which will * be supplied in the sword:service element of other service document * entries. * * @param community target community * @return service document URL for the given object * @throws DSpaceSWORDException can be thrown by the internals of the DSpace SWORD implementation */ public String constructSubServiceUrl(Community community) throws DSpaceSWORDException { String base = this.getBaseServiceDocumentUrl(); String handle = community.getHandle(); return base + "/" + handle; }
Community[] subCommunities = community.getSubcommunities(); Collection[] collections = community.getCollections(); String name = community.getMetadata("name"); if (name == null || name.length() == 0) "community-browse"); browse.setHead(T_head_browse); String url = contextPath + "/handle/" + community.getHandle();
List<org.dspace.content.Collection> collections = community.getCollections(); List<org.dspace.rest.common.Collection> restCollections = new ArrayList<>(); List<org.dspace.content.Community> communities = community.getSubcommunities(); subcommunities = new ArrayList<Community>(); for (org.dspace.content.Community subCommunity : communities) { } else { log.info( "Omitted restricted subCommunity: " + subCommunity.getID() + " _ " + subCommunity.getName()); if (community.getLogo() != null) { logo = new Bitstream(community.getLogo(), servletContext, null, context);
String removedHandle = community.getHandle(); UUID removedId = community.getID(); Iterator<Community> subcommunities = community.getSubcommunities().iterator(); while (subcommunities.hasNext()) { Community subCommunity = subcommunities.next(); community.removeSubCommunity(subCommunity); delete(context, subCommunity);
@Override public void addCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException { // Check authorisation authorizeService.authorizeAction(context, community, Constants.ADD); log.info(LogManager.getHeader(context, "add_collection", "community_id=" + community.getID() + ",collection_id=" + collection.getID())); if (!community.getCollections().contains(collection)) { community.addCollection(collection); collection.addCommunity(community); } context.addEvent( new Event(Event.ADD, Constants.COMMUNITY, community.getID(), Constants.COLLECTION, collection.getID(), community.getHandle(), getIdentifiers(context, community))); }
String name = community.getMetadata("name"); if (name == null || name.length() == 0) String feedURL = contextPath+"/feed/"+format.trim()+"/"+community.getHandle(); pageMeta.addMetadata("feed", feedFormat).addContent(feedURL);
/** * Build a Lucene document for a DSpace Community. * * @param community Community to be indexed * @throws SQLException * @throws IOException */ private void buildDocument(Community community) throws SQLException, IOException { // Create Document SolrInputDocument doc = buildDocument(Constants.COMMUNITY, community.getID(), community.getHandle(), null); // and populate it String name = community.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(community, doc); } writeDocument(doc); }
Community com = Community.find(context, containerID); main.setHead(T_main_head_community.parameterize(com.getMetadata("name"),com.getHandle(),com.getID())); policies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, com);
Community newCommunity = communityDAO.create(context, new Community()); parent.addSubCommunity(newCommunity); newCommunity.addParentCommunity(parent); context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(), getIdentifiers(context, newCommunity))); Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(), getIdentifiers(context, newCommunity))); "community_id=" + newCommunity.getID()) + ",handle=" + newCommunity.getHandle());
Community[] allComs = Community.findAll(context); for (int i = 0; i < allComs.length; i++) spec.append(allComs[i].getHandle().replace('/', '_')); spec.append("</setSpec>"); String commName = allComs[i].getMetadata("name"); if(commName != null) "null_set_name_for_set_id_" + allComs[i].getHandle()));