/** * 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; }
/** * 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 * @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; }
/** * Obtain the deposit URL for the given community. These URLs * should not be considered persistent, but will remain consistent * unless configuration changes are made to DSpace * * @param community the community to query * @return The Deposit URL * @throws DSpaceSWORDException can be thrown by the internals of the DSpace SWORD implementation */ public String getDepositLocation(Community community) throws DSpaceSWORDException { // FIXME: there is no deposit url for communities yet, so this could // be misleading return this.getBaseDepositUrl() + "/" + community.getHandle(); }
/** * 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 * @return * @throws DSpaceSWORDException */ public String constructSubServiceUrl(Community community) throws DSpaceSWORDException { String base = this.getBaseServiceDocumentUrl(); String handle = community.getHandle(); return base + "/" + handle; }
/** * Obtain the deposit URL for the given community. These URLs * should not be considered persistent, but will remain consistent * unless configuration changes are made to DSpace * * @param community * @return The Deposit URL * @throws DSpaceSWORDException */ public String getDepositLocation(Community community) throws DSpaceSWORDException { // FIXME: there is no deposit url for communities yet, so this could // be misleading return this.getBaseDepositUrl() + "/" + community.getHandle(); }
public DSpaceSet(Community c) { super("com_" + c.getHandle().replace('/', '_'), checkName(c.getName())); }
/** * Obtain the deposit URL for the given community. These URLs * should not be considered persistent, but will remain consistent * unless configuration changes are made to DSpace * * @param community target community * @return The Deposit URL * @throws DSpaceSwordException can be thrown by the internals of the DSpace SWORD implementation */ public String getDepositLocation(Community community) throws DSpaceSwordException { if (this.config.allowCommunityDeposit()) { return this.getBaseCollectionUrl() + "/" + community.getHandle(); } return null; }
/** * Produce a list of DSpaceCommunitySet. The list is a segment of the full * list of Community ordered alphabetically by name. * * @param offset start this far down the list of Community. * @param length return up to this many Sets. * @return some Sets representing the Community list segment. */ private List<Set> community(int offset, int length) { List<Set> array = new ArrayList<Set>(); try { List<Community> communityList = communityService.findAll(_context, length, offset); for (Community community : communityList) { array.add(DSpaceSet.newDSpaceCommunitySet( community.getHandle(), community.getName())); } } catch (SQLException e) { log.error(e.getMessage(), e); } return array; }
@Override public String toSetSpec(Community community) throws InvalidSetSpecException { String handle = community.getHandle(); String[] split = handle.split("/"); if (split.length != 2) { throw new InvalidSetSpecException("Invalid handle " + handle); } return format(getSetSpecFormat(Community.class), split[0], split[1]); }
String description_table = communityService.getMetadata(community, "side_bar_text"); String identifier_uri = handleService.getCanonicalPrefix() + community.getHandle(); String rights = communityService.getMetadata(community, "copyright_text"); String title = communityService.getMetadata(community, "name");
@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); } } }
comm.getHandle()); parentComms.add(mycomm); List<Collection> colls = comm.getCollections();
/** * queues curation tasks */ public static FlowResult processQueueCommunity(Context context, int dsoID, Request request) throws AuthorizeException, IOException, SQLException, Exception { String task = request.getParameter("curate_task"); Curator curator = FlowCurationUtils.getCurator(task); String objId = String.valueOf(dsoID); String taskQueueName = ConfigurationManager.getProperty("curate", "ui.queuename"); boolean status = false; Community community = Community.find(context, dsoID); if (community != null) { objId = community.getHandle(); try { curator.queue(context, objId, taskQueueName); status = true; } catch (IOException ioe) { // no-op } } return FlowCurationUtils.getQueueFlowResult(task, status, objId, taskQueueName); }
@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 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))); }
curator.curate(context, community.getHandle());
@Override public void removeSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException, IOException { // Check authorisation authorizeService.authorizeAction(context, parentCommunity, Constants.REMOVE); ArrayList<String> removedIdentifiers = getIdentifiers(context, childCommunity); String removedHandle = childCommunity.getHandle(); UUID removedId = childCommunity.getID(); rawDelete(context, childCommunity); log.info(LogManager.getHeader(context, "remove_subcommunity", "parent_comm_id=" + parentCommunity.getID() + ",child_comm_id=" + childCommunity .getID())); context.addEvent( new Event(Event.REMOVE, Constants.COMMUNITY, parentCommunity.getID(), Constants.COMMUNITY, removedId, removedHandle, removedIdentifiers)); }
/** * Display a single community (and refrence any sub communites or * collections) */ public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { DSpaceObject dso = HandleUtil.obtainHandle(objectModel); if (!(dso instanceof Community)) { return; } // Set up the major variables Community community = (Community) dso; Division home = body.addDivision("community-home", "primary repository community"); Division search = home.addDivision("community-search-browse", "secondary search-browse"); // Search query Division query = search.addInteractiveDivision("community-search", contextPath + "/handle/" + community.getHandle() + "/search", Division.METHOD_POST, "secondary search"); Para para = query.addPara("search-query", null); para.addContent(T_full_text_search); para.addContent(" "); para.addText("query"); para.addContent(" "); para.addButton("submit").setValue(T_go); query.addPara().addXref(contextPath + "/handle/" + community.getHandle() + "/advanced-search", T_advanced_search_link); }
String removedHandle = community.getHandle(); UUID removedId = community.getID();
/** * 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); }