@Override public String generateIdentifier(Context context, int type, UUID id, String handle, List<String> identifiers) throws SQLException { if (type == Constants.SITE) { return handleService.getCanonicalForm(siteService.findSite(context).getHandle()); } if (type == Constants.COMMUNITY || type == Constants.COLLECTION || type == Constants.ITEM) { if (StringUtils.isEmpty(handle)) { throw new IllegalArgumentException("Handle is null"); } log.debug("Generated identifier " + handleService.getCanonicalForm(handle) + " for " + Constants.typeText[type] + " " + id.toString() + "."); return handleService.getCanonicalForm(handle); } return null; }
public void consumeSite(Context ctx, Event event) throws SQLException { if (event.getEventType() == Event.ADD || event.getEventType() == Event.REMOVE || event.getEventType() == Event.MODIFY || event.getEventType() == Event.MODIFY_METADATA) { Site site = siteService.findSite(ctx); DSOIdentifier id = new DSOIdentifier(Constants.SITE, site.getID(), site.getHandle(), Arrays.asList(site.getHandle())); if (!this.toConvert.contains(id)) { this.toConvert.add(id); } return; } log.warn("Got an unexpected Event for the SITE. Event type is " + event.getEventTypeAsString() + ", ignoring."); }
@Override public String generateIdentifier(Context context, int type, UUID id, String handle, List<String> identifiers) throws SQLException { String urlPrefix = DSpaceServicesFactory.getInstance().getConfigurationService() .getProperty(RDFUtil.CONTEXT_PATH_KEY) + "/resource/"; if (type == Constants.SITE) { return urlPrefix + siteService.findSite(context).getHandle(); } if (type == Constants.COMMUNITY || type == Constants.COLLECTION || type == Constants.ITEM) { if (StringUtils.isEmpty(handle)) { throw new IllegalArgumentException("Handle is null"); } return urlPrefix + handle; } return null; }
/** * Generate a list of metadata elements for the given DSpace * site. * * @param site The site to derive metadata from * @return list of metadata */ protected List<MockMetadataValue> site2Metadata(Site site) { List<MockMetadataValue> metadata = new ArrayList<>(); String identifier_uri = handleService.getCanonicalPrefix() + site.getHandle(); String title = site.getName(); String url = site.getURL(); if (identifier_uri != null) { metadata.add(createDCValue("identifier.uri", null, identifier_uri)); } //FIXME: adding two URIs for now (site handle and URL), in case site isn't using handles if (url != null) { metadata.add(createDCValue("identifier.uri", null, url)); } if (title != null) { metadata.add(createDCValue("title", null, title)); } return metadata; }
repo.setId(site.getID().toString()); repo.setName(site.getName()); repo.setHandle(site.getHandle()); List<Community> dspaceCommunities = communityService.findAllTop(context); processCommunity(context, repo, dspaceCommunities);
curator.curate(c, ContentServiceFactory.getInstance().getSiteService().findSite(c).getHandle()); } else { curator.curate(c, idName);
String ownerHdl = null; if (CollectionUtils.isEmpty(parentCommunities)) { ownerHdl = siteService.findSite(context).getHandle(); } else { ownerHdl = parentCommunities.get(0).getHandle(); dc.add(makeDC("identifier", "uri", "hdl:" + site.getHandle())); dc.add(makeDC("identifier", "uri", site.getURL()));
Site site = (Site) dso; String identifier_uri = "hdl:" + site.getHandle(); String title = site.getName(); String url = site.getURL();
Name name = new Name(); name.getContent() .add(new PCData(siteService.findSite(context).getHandle())); agent.getContent().add(name); metsHdr.getContent().add(agent);
List<Community> parents = ((Community) dso).getParentCommunities(); if (CollectionUtils.isEmpty(parents)) { parentHandle = siteService.findSite(context).getHandle(); } else { parentHandle = parents.get(0).getHandle();