public List<Map.Entry<String, Integer>> getCommunities(Context context) throws SQLException { List<Map.Entry<String, Integer>> cl = new java.util.ArrayList<>(); List<Community> top_communities = communityService.findAllTop(context); for (Community c : top_communities) { cl.add( new java.util.AbstractMap.SimpleEntry<>(c.getName(), itemService.countItems(context, c)) ); } return cl; } }
private int getCommunityCount() { try { List<Community> communityList = communityService.findAll(_context); return communityList.size(); } catch (SQLException e) { log.error(e.getMessage(), e); } return 0; }
@Override public List<Community> getCommunities(Context context, Item item) throws SQLException { List<Community> result = new ArrayList<>(); List<Collection> collections = item.getCollections(); for (Collection collection : collections) { result.addAll(communityService.getAllParents(context, collection)); } return result; }
community = communityService.create(parent, context); } else { community = communityService.create(null, context); communityService.setMetadata(context, community, "short_description", " "); NodeList nl = XPathAPI.selectNodeList(tn, entry.getKey()); if (nl.getLength() == 1) { communityService.setMetadata(context, community, entry.getValue(), getStringValue(nl.item(0))); communityService.update(context, community); nameElement.setText(communityService.getMetadata(community, "name")); element.addContent(nameElement); if (communityService.getMetadata(community, "short_description") != null) { Element descriptionElement = new Element("description"); descriptionElement.setText(communityService.getMetadata(community, "short_description")); element.addContent(descriptionElement); if (communityService.getMetadata(community, "introductory_text") != null) { Element introElement = new Element("intro"); introElement.setText(communityService.getMetadata(community, "introductory_text")); element.addContent(introElement); if (communityService.getMetadata(community, "copyright_text") != null) { Element copyrightElement = new Element("copyright"); copyrightElement.setText(communityService.getMetadata(community, "copyright_text")); element.addContent(copyrightElement);
.createSubcommunity(context, dspaceParentCommunity); communityService.setMetadata(context, dspaceCommunity, "name", community.getName()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.COPYRIGHT_TEXT, community.getCopyrightText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); communityService.update(context, dspaceCommunity); communityService.update(context, dspaceParentCommunity);
org.dspace.content.Community dspaceCommunity = communityService.create(null, context); writeStats(dspaceCommunity, UsageEvent.Action.CREATE, user_ip, user_agent, xforwardedfor, headers, request, context); communityService.setMetadata(context, dspaceCommunity, "name", community.getName()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.COPYRIGHT_TEXT, community.getCopyrightText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); communityService.update(context, dspaceCommunity);
List<MockMetadataValue> metadata = new ArrayList<>(); String description = communityService.getMetadata(community, "introductory_text"); String description_abstract = communityService.getMetadata(community, "short_description"); 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");
org.dspace.content.Community subcommunity = communityService.findByIdOrLegacyId(context, subcommunityId); communityService.removeSubcommunity(context, parentCommunity, subcommunity); communityService.update(context, parentCommunity); communityService.update(context, subcommunity);
String title = communityService.getName(com); if (StringUtils.isNotBlank(title)) { scol.setTitle(title); .getMetadataByMetadataString(com, "short_description"); if (abstracts != null && !abstracts.isEmpty()) { String firstValue = abstracts.get(0).getValue();
this.setCopyrightText(communityService.getMetadata(community, org.dspace.content.Community.COPYRIGHT_TEXT)); this.setIntroductoryText( communityService.getMetadata(community, org.dspace.content.Community.INTRODUCTORY_TEXT)); this.setShortDescription( communityService.getMetadata(community, org.dspace.content.Community.SHORT_DESCRIPTION)); this.setSidebarText(communityService.getMetadata(community, org.dspace.content.Community.SIDEBAR_TEXT)); this.setCountItems(itemService.countItems(context, community)); .getParentObject(context, community); if (parentCommunity != null) { setParentCommunity(new Community(parentCommunity, servletContext, null, context));
dso = communityService.create(null, context, handle); } else { dso = communityService.createSubcommunity(context, ((Community) parent), handle);
List<Community> communityParentList = communityService.getAllParents(context, community); DSpaceObject[] parents = communityParentList.toArray(new DSpaceObject[communityParentList.size()]); for (Collection col : communityService.getAllCollections(context, community)) { if (!RDFUtil.isPublicBoolean(context, col)) { continue;
ResourcePolicy rp = communitiesPolicies.get(i); Community community = ContentServiceFactory.getInstance().getCommunityService() .find(context, rp.getdSpaceObject().getID()); .getAllCollections(context, community));
org.dspace.content.Community community = null; try { community = communityService.findByIdOrLegacyId(context, id);
/** * Find a community by ID * * @param c context * @param communityID community ID * @return Community object * @throws SQLException if database error */ protected Community resolveCommunity(Context c, String communityID) throws SQLException { Community community = null; if (communityID.indexOf('/') != -1) { // has a / must be a handle community = (Community) handleService.resolveToObject(c, communityID); // ensure it's a community if ((community == null) || (community.getType() != Constants.COMMUNITY)) { community = null; } } else { community = communityService.find(c, UUID.fromString(communityID)); } return community; } }
communityService.delete(context, (Community) dso); break; default:
String description = communityService.getMetadata(community, "introductory_text"); String description_abstract = communityService.getMetadata(community, "short_description"); String description_table = communityService.getMetadata(community, "side_bar_text"); String rights = communityService.getMetadata(community, "copyright_text"); String title = communityService.getMetadata(community, "name");
String title = communityService.getName(com); if (StringUtils.isNotBlank(title)) { scol.setTitle(title); .getMetadataByMetadataString(com, "short_description"); if (abstracts != null && !abstracts.isEmpty()) { String firstValue = abstracts.get(0).getValue();
Community comm = communityService.findByIdOrLegacyId(context, dsoId); if (comm == null) { break;