/** * Retrieves a resource and its associated concepts to be rendered with a template * registered for CONCEPTS.GenericResourcePage. * * @param uri specifies the uri of a resource * * @return GraphNode */ @GET public GraphNode GenericResourcePage(@QueryParam("uri") UriRef uri, @Context UriInfo uriInfo) { GraphNode node = new GraphNode(new BNode(), new UnionMGraph(new SimpleMGraph(), cgProvider.getContentGraph(), remoteConceptsDescriptionManager.getRemoteConceptsDescriptionMGraph())); node.addProperty(RDF.type, PLATFORM.HeadedPage); node.addProperty(RDF.type, CONCEPTS.GenericResourcePage); if (uri != null) { node.addProperty(CONCEPTS.resource, uri); } else { throw new WebApplicationException(Response.status(Status.BAD_REQUEST) .entity("No resource uri defined.").build()); } return node; } }
private GraphNode getScriptList( @QueryParam(value = "resource") NonLiteral resource) { AccessController.checkPermission(new ScriptManagerAppPermission()); if(resource == null) { resource = new BNode(); } BNode resultResource = new BNode(); MGraph contentGraph = cgProvider.getContentGraph(); MGraph additionGraph = new SimpleMGraph(); UnionMGraph resultGraph = new UnionMGraph(additionGraph, contentGraph); RdfList list = RdfList.createEmptyList(resultResource, additionGraph); resultGraph.add(new TripleImpl(resource, SCRIPTMANAGER.scriptList, resultResource)); resultGraph.add(new TripleImpl(resultResource, RDF.type, SCRIPTMANAGER.ScriptList)); Iterator<Triple> it = contentGraph.filter(null, RDF.type, SCRIPT.Script); while (it.hasNext()) { list.add(it.next().getSubject()); } return new GraphNode(resultResource, new UnionMGraph(resultGraph, contentGraph)); }
SCRIPTMANAGER.ExecutionUriList)); return new GraphNode(resultResource, new UnionMGraph(resultGraph, cgProvider.getContentGraph()));
@GET @Path("list-roles") public GraphNode listRoles(@Context UriInfo uriInfo) { AccessController.checkPermission(new UserManagerAccessPermission()); TrailingSlash.enforceNotPresent(uriInfo); MGraph resultGraph = new SimpleMGraph(); NonLiteral roleOverviewPage = new BNode(); resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type, USERMANAGER.RoleOverviewPage)); resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type, PLATFORM.HeadedPage)); GraphNode result = new GraphNode(roleOverviewPage, new UnionMGraph(resultGraph, systemGraph, cgProvider.getContentGraph())); addAvailableRoles(result); addBaseRoles(result); return result; }
customField)); return new GraphNode(node, new UnionMGraph(resultGraph, contentGraph));
/** * Returns a GraphNode containing a list of {@link ConceptProvider}s stored * in the content graph to be managed. The order in the list represents * the priority of the providers. * This resource is accessible through a GET request on the URI sub-path * "edit-concept-provider-list". * */ @GET @Path("edit-concept-provider-list") public GraphNode getProviderList(@Context UriInfo uriInfo) { AccessController.checkPermission( new ConceptProviderManagerAppPermission()); TrailingSlash.enforceNotPresent(uriInfo); MGraph contentGraph = cgProvider.getContentGraph(); MGraph resultGraph = new SimpleMGraph(); NonLiteral cplNode = getConceptProviderListNode(contentGraph); GraphNode resultNode = new GraphNode(cplNode, resultGraph); resultNode.addProperty(RDF.type, CONCEPTS.ManageConceptProvidersPage); resultNode.addProperty(RDF.type, PLATFORM.HeadedPage); return new GraphNode(resultNode.getNode(), new UnionMGraph(resultGraph, contentGraph)); }
@GET @Path("add-user") public GraphNode addUser(@Context UriInfo uriInfo) { AccessController.checkPermission(new UserManagerAccessPermission()); TrailingSlash.enforceNotPresent(uriInfo); MGraph resultGraph = new SimpleMGraph(); NonLiteral addUserPage = new BNode(); resultGraph.add(new TripleImpl(addUserPage, RDF.type, USERMANAGER.AddUserPage)); resultGraph.add(new TripleImpl(addUserPage, RDF.type, PLATFORM.HeadedPage)); LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph(); Lock readLock = contentGraph.getLock().readLock(); readLock.lock(); try { Iterator<Triple> formFields = contentGraph.filter(null, RDF.type, USERMANAGER.UserFormField); while (formFields.hasNext()) { resultGraph.add(new TripleImpl(addUserPage, CUSTOMPROPERTY.customfield, formFields.next().getSubject())); } } finally { readLock.unlock(); } GraphNode result = new GraphNode(addUserPage, new UnionMGraph( resultGraph, systemGraph, contentGraph)); addAvailableRoles(result); return result; }
return new GraphNode(resource, new UnionMGraph(resultGraph, cgProvider.getContentGraph(), scriptLanguageList.getGraph()));
new UnionMGraph(resultGraph, systemGraph, contentGraph)); addAvailableRoles(result); return result;
UnionMGraph unionGraph = new UnionMGraph(resultGraph, systemGraph);
@Override public GraphNode addUserContext(GraphNode node) { final AccessControlContext context = AccessController.getContext(); GraphNode agent = AccessController.doPrivileged(new PrivilegedAction<GraphNode>() { @Override public GraphNode run() { final String userName = UserUtil.getUserName(context); if (userName == null) { return null; } return userManager.getUserGraphNode(userName); } }); if (agent != null) { if (agent.getNode() instanceof UriRef) { WebIdInfo webIdInfo = webIdGraphsService.getWebIdInfo((UriRef)agent.getNode()); MGraph userGraph = webIdInfo.localPublicUserData(); agent = new GraphNode(agent.getNode(), new UnionMGraph(agent.getGraph(), userGraph)); } node.addProperty(PLATFORM.user, agent.getNode()); MGraph userContext = new SimpleMGraph(agent.getNodeContext()); removeTripleWithProperty(userContext, PERMISSION.password); removeTripleWithProperty(userContext, PERMISSION.passwordSha1); node.getGraph().addAll(userContext); } return node; }
temporary.add(new TripleImpl(agent, PERMISSION.password, new PlainLiteralImpl(newPassword))); MGraph result = new UnionMGraph(temporary, systemGraph); GraphNode mailGraph = new GraphNode(new BNode(), result); mailGraph.addProperty(RDF.type, USERMANAGER.PasswordResetMail);
private GraphNode addLanguages(GraphNode node, NonLiteral platformInstance, List<LanguageDescription> languages, boolean copyToNode) { TripleCollection graph = node.getGraph(); BNode listNode = new BNode(); RdfList list = new RdfList(listNode, graph); LockableMGraph configGraph = getConfigGraph(); Lock readLock = configGraph.getLock().readLock(); for (LanguageDescription languageDescription : languages) { NonLiteral languageUri = (NonLiteral) languageDescription.getResource().getNode(); list.add(languageUri); if (copyToNode) { readLock.lock(); try { graph.addAll(new GraphNode(languageUri, configGraph).getNodeContext()); } finally { readLock.unlock(); } } } node.addProperty(PLATFORM.instance, platformInstance); graph.add(new TripleImpl(platformInstance, RDF.type, PLATFORM.Instance)); graph.add(new TripleImpl(platformInstance, PLATFORM.languages, listNode)); graph.add(new TripleImpl(listNode, RDF.type, LANGUAGE.LanguageList)); if (!copyToNode) { node = new GraphNode(node.getNode(), new UnionMGraph(graph, configGraph)); } return node; }
@GET @Path("manage-custom-properties") public GraphNode manageCustomProperties( @QueryParam(value = "role") String role, @Context UriInfo uriInfo) { TrailingSlash.enforceNotPresent(uriInfo); AccessController.checkPermission(new UserManagerAccessPermission()); MGraph contentGraph = cgProvider.getContentGraph(); MGraph resultGraph = new SimpleMGraph(); NonLiteral propertyManagementPage = new BNode(); resultGraph.add(new TripleImpl(propertyManagementPage, USERMANAGER.role, new PlainLiteralImpl(role))); resultGraph.add(new TripleImpl(propertyManagementPage, RDF.type, USERMANAGER.CustomFieldPage)); resultGraph.add(new TripleImpl(propertyManagementPage, RDF.type, PLATFORM.HeadedPage)); ArrayList<NonLiteral> customfields = customPropertyManager .getCustomfieldsOfCollection(customPropertyManager .getCustomPropertyCollection(PERMISSION.Role, role)); for (NonLiteral customfield : customfields) { resultGraph.add(new TripleImpl(customfield, USERMANAGER.role, new PlainLiteralImpl(role))); resultGraph.add(new TripleImpl(propertyManagementPage, CUSTOMPROPERTY.customfield, customfield)); } return new GraphNode(propertyManagementPage, new UnionMGraph( resultGraph, contentGraph)); }
/** * Execution Uri overview page. * * @return A Graphnode containing a ExecutionUriOverviewPage. */ @GET @Path("execution-uri-overview") public GraphNode getExecutionUriOverview() { AccessController.checkPermission(new ScriptManagerAppPermission()); MGraph contentGraph = cgProvider.getContentGraph(); BNode resultResource = new BNode(); MGraph resultGraph = new SimpleMGraph(); resultGraph.add(new TripleImpl(resultResource, RDF.type, PLATFORM.HeadedPage)); resultGraph.add(new TripleImpl(resultResource, RDF.type, SCRIPTMANAGER.ExecutionUriOverviewPage)); GraphNode scriptList = getScriptList(resultResource); UnionMGraph unionGraph = new UnionMGraph(resultGraph, scriptList.getGraph(), contentGraph); return new GraphNode(resultResource, unionGraph); }
unionGraph = new UnionMGraph(resultGraph, scriptList.getGraph(), scriptNode.getGraph(), contentGraph); } else { unionGraph = new UnionMGraph(resultGraph, scriptList.getGraph(), contentGraph);
resultGraph.add(new TripleImpl(rolePermissionPage, USERMANAGER.role, role)); return new GraphNode(rolePermissionPage, new UnionMGraph( resultGraph, systemGraph));
Iterator<NonLiteral> permissions = userManager .getPermissionsOfUser(user); return new GraphNode(userPermissionPage, new UnionMGraph( resultGraph, systemGraph));
/** * The page that contains the install form. * * @return a Graphnode containing a ScriptManagerInstallPage. */ @GET @Path("script-install") public GraphNode install() { AccessController.checkPermission(new ScriptManagerAppPermission()); MGraph contentGraph = cgProvider.getContentGraph(); BNode resultResource = new BNode(); MGraph resultGraph = new SimpleMGraph(); resultGraph.add(new TripleImpl(resultResource, RDF.type, SCRIPTMANAGER.ScriptManagerInstallPage)); resultGraph.add(new TripleImpl(resultResource, RDF.type, PLATFORM.HeadedPage)); GraphNode languageList = getScriptLanguageList(resultResource); GraphNode scriptList = getScriptList(resultResource); UnionMGraph unionGraph = new UnionMGraph(resultGraph, scriptList.getGraph(), languageList.getGraph(), contentGraph); return new GraphNode(resultResource, unionGraph); }