Package org.lab41.dendrite.jobs.titan

Examples of org.lab41.dendrite.jobs.titan.DegreeCentralityJob


            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);
View Full Code Here


            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);
View Full Code Here

            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);
View Full Code Here

            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);
View Full Code Here

        // This needs to be a read/write transaction as we might make a user.
        MetaGraphTx tx = metaGraphService.buildTransaction().start();
        GetJobsResponse getJobsResponse;

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

            List<GetJobResponse> jobs = new ArrayList<>();

            for (ProjectMetadata projectMetadata : userMetadata.getProjects()) {
                for (JobMetadata jobMetadata : projectMetadata.getJobs()) {
                    jobs.add(new GetJobResponse(jobMetadata));
                }
            }
View Full Code Here

        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);
View Full Code Here

        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();
        }
View Full Code Here

    public GetUserResponse getUser(@PathVariable String userId) throws NotFound {

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

        try {
            UserMetadata userMetadata = tx.getUser(userId);

            if (userMetadata == null) {
                throw new NotFound(UserMetadata.class, userId);
            }
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;
        }
View Full Code Here

    }

    @ResponseStatus(HttpStatus.NOT_FOUND)
    @ExceptionHandler(NotFound.class)
    public ErrorResponse handleNotFound(NotFound notFound) {
        return new ErrorResponse(notFound.getLocalizedMessage());
    }
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.jobs.titan.DegreeCentralityJob

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.