Package org.lab41.dendrite.metagraph.models

Examples of org.lab41.dendrite.metagraph.models.ProjectMetadata$Impl


    @PreAuthorize("hasPermission(#jobId, 'job', 'admin')")
    @RequestMapping(value = "/jobs/{jobId}", method = RequestMethod.GET)
    @ResponseBody
    public GetJobResponse getJob(@PathVariable String jobId) throws NotFound {

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            return new GetJobResponse(jobMetadata);
        } finally {
            tx.commit();
        }
    }
View Full Code Here


    @PreAuthorize("hasPermission(#projectId, 'project', 'admin')")
    @RequestMapping(value = "/projects/{projectId}/jobs", method = RequestMethod.GET)
    @ResponseBody
    public GetJobsResponse getJobs(@PathVariable String projectId) throws NotFound {

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            ProjectMetadata project = tx.getProject(projectId);
            if (project == null) {
                throw new NotFound(ProjectMetadata.class, projectId);
            }

            List<GetJobResponse> jobs = new ArrayList<>();
            for (JobMetadata jobMetadata : project.getJobs()) {
                jobs.add(new GetJobResponse(jobMetadata));
            }

            return new GetJobsResponse(jobs);
        } finally {
            tx.commit();
        }
    }
View Full Code Here

    @PreAuthorize("hasPermission(#jobId, 'job', 'admin')")
    @RequestMapping(value = "/jobs/{jobId}", method = RequestMethod.DELETE)
    @ResponseBody
    public DeleteJobResponse deleteJob(@PathVariable String jobId) throws NotFound {
        MetaGraphTx tx = metaGraphService.newTransaction();
        DeleteJobResponse deleteJobResponse;

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            tx.deleteJob(jobMetadata);

            deleteJobResponse = new DeleteJobResponse();
        } catch (Throwable t) {
            tx.rollback();
            throw t;
        }

        // Commit must come after all graph access.
        tx.commit();

        return deleteJobResponse;
    }
View Full Code Here

    @Override
    public RexsterApplicationGraph getApplicationGraph(String graphId) {

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

        MetaGraphTx tx = metaGraphService.newTransaction();

        try {
            UserMetadata userMetadata = tx.getOrCreateUser(authentication);

            // Make sure we have permission to access this graph.
            GraphMetadata graphMetadata = userMetadata.getGraph(new GraphMetadata.Id(graphId));
            if (graphMetadata == null) {
                return null;
            }

            DendriteGraph graph = metaGraphService.getDendriteGraph(graphId);
            if (graph == null) {
                return null;
            }

            List<String> allowableNamespaces = new ArrayList<>();
            allowableNamespaces.add("tp:gremlin");

            List<HierarchicalConfiguration> extensionConfigurations = new ArrayList<>();

            return new RexsterApplicationGraph(
                    graphId,
                    graph,
                    allowableNamespaces,
                    extensionConfigurations);

        } finally {
            tx.commit();
        }
    }
View Full Code Here

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

        Set<String> graphNames = new TreeSet<>();

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            UserMetadata userMetadata = tx.getOrCreateUser(authentication);

            for (GraphMetadata graphMetadata: userMetadata.getGraphs()) {
                graphNames.add(graphMetadata.getId().toString());
            }
        } finally {
            tx.commit();
        }
        return graphNames;
    }
View Full Code Here

            response.put("status", "error");
            response.put("msg", result.toString());
            return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
        }

        MetaGraphTx metaGraphTx = metaGraphService.buildTransaction().readOnly().start();
        GraphMetadata graphMetadata;
        Git git;

        try {
            graphMetadata = metaGraphTx.getGraph(graphId);
            git = historyService.projectGitRepository(graphMetadata.getProject());
            metaGraphTx.commit();
        } catch (Throwable t) {
            metaGraphTx.rollback();
            throw t;
        }

        DendriteGraph graph = metaGraphService.getDendriteGraph(graphId);
        if (graph == null) {
View Full Code Here

            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        if (!algorithm.equals("approximate_diameter") &&
           !algorithm.equals("connected_component") &&
           !algorithm.equals("connected_component_stats") &&
           !algorithm.equals("directed_triangle_count") &&
View Full Code Here

            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        // We can't pass the values directly because they'll live in a separate thread.
        edgeDegreesService.titanCountDegrees(graph, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
View Full Code Here

            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        // We can't pass the values directly because they'll live in a separate thread.
        edgeDegreesService.faunusCountDegrees(graph, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
View Full Code Here

            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        if (!algorithm.equals("centrality")) {
            response.put("status", "error");
            response.put("msg", algorithm + " not implemented");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.metagraph.models.ProjectMetadata$Impl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.