@Override public void update(Context context, Site site) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException(); } super.update(context, site); if (site.isMetadataModified()) { context.addEvent(new Event(Event.MODIFY_METADATA, site.getType(), site.getID(), site.getDetails(), getIdentifiers(context, site))); } if (site.isModified()) { context.addEvent(new Event(Event.MODIFY, site.getType(), site.getID(), site.getDetails(), getIdentifiers(context, site))); } site.clearModified(); site.clearDetails(); siteDAO.save(context, site); }
/** * 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; }
@Override public String getName() { return getSiteService().getName(this); }
<% for (int i = 0; siteList != null && i < siteList.size(); i++){ Site s = (Site) siteList.get(i); int siteid = s.getID().intValue(); site = s.getSitename(); if (site.equals(SiteName)){ %> <option selected="selected" > <%=SiteName%> </option> <% } //end of if-statement else{ %> <option value="<%=siteid%>"><%=site%> </option> <% } //End of else } //End of for }catch(Exception e){ e.getMessage(); } %> </select>
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 { 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; }
new Event(Event.REMOVE, Constants.SITE, siteService.findSite(context).getID(), Constants.COMMUNITY, removedId, removedHandle, removedIdentifiers));
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()));
@Override public Site createSite(Context context) throws SQLException { Site site = findSite(context); if (site == null) { //Only one site can be created at any point in time site = siteDAO.create(context, new Site()); handleService.createHandle(context, site, configurationService.getProperty("handle.prefix") + "/0"); } return site; }
@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; }
context.addEvent(new Event(Event.ADD, Constants.SITE, siteService.findSite(context).getID(), Constants.COMMUNITY, newCommunity.getID(), newCommunity.getHandle(), getIdentifiers(context, newCommunity)));
curator.curate(c, ContentServiceFactory.getInstance().getSiteService().findSite(c).getHandle()); } else { curator.curate(c, idName);
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();