@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 initializeSiteObject() { // After every migrate, ensure default Site is setup correctly. Context context = null; try { context = new Context(); context.turnOffAuthorisationSystem(); // While it's not really a formal "registry", we need to ensure the // default, required Groups exist in the DSpace database if (siteService.findSite(context) == null) { siteService.createSite(context); } context.restoreAuthSystemState(); // Commit changes and close context context.complete(); } catch (Exception e) { log.error("Error attempting to add/update default DSpace Groups", e); } finally { // Clean up our context, if it still exists & it was never completed if (context != null && context.isValid()) { context.abort(); } } }
@Override public String getName() { return getSiteService().getName(this); }
@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; }
try { if (id.type == Constants.SITE) { m = RDFUtil.convertAndStore(ctx, siteService.findSite(ctx)); return;
/** * Converts and stores all DSpaceObjects that are readable for an anonymous * user. * * @throws SQLException An exception that provides information on a database access error or other errors. */ public void convertAll() throws SQLException { report("Starting conversion of all DSpaceItems, this may take a while..."); this.convert(contentServiceFactory.getSiteService().findSite(context), true); report("Conversion ended."); }
throw new WebApplicationException(Response.Status.NOT_FOUND); writeStats(siteService.findSite(context), UsageEvent.Action.DELETE, user_ip, user_agent, xforwardedfor, headers, request, context);
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."); }
throw new WebApplicationException(Response.Status.NOT_FOUND); writeStats(siteService.findSite(context), UsageEvent.Action.DELETE, user_ip, user_agent, xforwardedfor, headers, request, context);
writeStats(siteService.findSite(context), UsageEvent.Action.VIEW, user_ip, user_agent, xforwardedfor, headers, request, context); result.annotateQuery(query_field, query_op, query_val);
context = createContext(); Site site = siteService.findSite(context); repo.setId(site.getID().toString()); repo.setName(site.getName());
writeStats(siteService.findSite(context), UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, request, context);
curator.curate(c, ContentServiceFactory.getInstance().getSiteService().findSite(c).getHandle()); } else { curator.curate(c, idName);
writeStats(siteService.findSite(context), UsageEvent.Action.CREATE, user_ip, user_agent, xforwardedfor, headers, request, context);
retSchema = new MetadataSchema(dspaceSchema, "", context); writeStats(siteService.findSite(context), UsageEvent.Action.CREATE, user_ip, user_agent, xforwardedfor, headers, request, context);
String ownerHdl = null; if (CollectionUtils.isEmpty(parentCommunities)) { ownerHdl = siteService.findSite(context).getHandle(); } else { ownerHdl = parentCommunities.get(0).getHandle();
new Event(Event.REMOVE, Constants.SITE, siteService.findSite(context).getID(), Constants.COMMUNITY, removedId, removedHandle, removedIdentifiers));
Name name = new Name(); name.getContent() .add(new PCData(siteService.findSite(context).getHandle())); agent.getContent().add(name); metsHdr.getContent().add(agent);
return siteService.findSite(context); default: return null;
List<Community> parents = ((Community) dso).getParentCommunities(); if (CollectionUtils.isEmpty(parents)) { parentHandle = siteService.findSite(context).getHandle(); } else { parentHandle = parents.get(0).getHandle();