Package org.lab41.dendrite.metagraph

Examples of org.lab41.dendrite.metagraph.DendriteGraphTx


    }

    @ResponseStatus(HttpStatus.BAD_REQUEST)
    @ExceptionHandler(BindingException.class)
    public ErrorResponse handleBindingException(BindingException bindingException) {
        return new ErrorResponse(bindingException.getLocalizedMessage());
    }
View Full Code Here


    }

    @ResponseStatus(HttpStatus.NOT_FOUND)
    @ExceptionHandler(CannotDeleteCurrentBranchException.class)
    public ErrorResponse handleCannotDeleteCurrentBranch() {
        return new ErrorResponse("cannot delete current branch");
    }
View Full Code Here

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

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

            getJobsResponse = new GetJobsResponse(jobs);
        } catch (Throwable t) {
View Full Code Here

            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

                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

    @ResponseBody
    public GetJobsResponse getJobs(Principal principal) {

        // 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));
                }
            }

            getJobsResponse = new GetJobsResponse(jobs);
        } catch (Throwable t) {
            tx.rollback();
            throw t;
        }
View Full Code Here

            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

        try {
            List<GetUserResponse> users = new ArrayList<>();

            for (UserMetadata userMetadata : tx.getUsers()) {
                users.add(new GetUserResponse(userMetadata));
            }

            return new GetUsersResponse(users);
        } finally {
            tx.commit();
View Full Code Here

            if (userMetadata == null) {
                throw new NotFound(UserMetadata.class, userId);
            }

            return new GetUserResponse(userMetadata);
        } finally {
            tx.commit();
        }
    }
View Full Code Here

            for (UserMetadata userMetadata : tx.getUsers()) {
                users.add(new GetUserResponse(userMetadata));
            }

            return new GetUsersResponse(users);
        } finally {
            tx.commit();
        }
    }
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.metagraph.DendriteGraphTx

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.