Package org.lab41.dendrite.metagraph.models

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


        super.tearDown();
    }

    @Test(expected = IllegalArgumentException.class)
    public void createProjectShouldThrowWithEmptyName() {
        UserMetadata userMetadata = tx.createUser("test");
        tx.createProject("", userMetadata);
    }
View Full Code Here


        tx.createProject("", userMetadata);
    }

    @Test
    public void createProjectShouldMakeAProject() {
        UserMetadata userMetadata = tx.createUser("test");
        ProjectMetadata projectMetadata = tx.createProject("test", userMetadata);
        Assert.assertNotNull(projectMetadata);
        Assert.assertEquals(projectMetadata.getName(), "test");

        // Make sure the branch is linked to the project.
View Full Code Here

        Assert.assertEquals(graphMetadata.getChildGraphs().iterator().hasNext(), false);
    }

    @Test
    public void createProjectShouldOptionallyNotMakeABranch() {
        UserMetadata userMetadata = tx.createUser("test");
        ProjectMetadata projectMetadata = tx.createProject("test", userMetadata, false);
        Assert.assertNotNull(projectMetadata);
        Assert.assertNull(projectMetadata.getCurrentBranch());
        Assert.assertNull(projectMetadata.getCurrentGraph());
    }
View Full Code Here

    @Before
    public void setUp() {
        super.setUp();

        MetaGraphTx tx = metaGraph.newTransaction();
        UserMetadata userMetadata = tx.createUser("test");
        ProjectMetadata projectMetadata = tx.createProject("test", userMetadata);
        GraphMetadata graphMetadata = projectMetadata.getCurrentGraph();
        tx.commit();

        graph = metaGraph.getGraph(graphMetadata.getId());
View Full Code Here

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

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

            List<GetProjectResponse> projects = new ArrayList<>();
            for (ProjectMetadata projectMetadata : userMetadata.getProjects()) {
                projects.add(new GetProjectResponse(projectMetadata));
            }

            getProjectsResponse = new GetProjectsResponse(projects);
        } catch (Throwable t) {
View Full Code Here

        MetaGraphTx tx = metaGraphService.newTransaction();
        GetProjectResponse getProjectResponse;
        HttpHeaders headers = new HttpHeaders();

        try {
            UserMetadata userMetadata = tx.getOrCreateUser(principal);
            if (userMetadata == null) {
                throw new NotFound(UserMetadata.class, principal.getName());
            }

            ProjectMetadata projectMetadata = tx.createProject(name, userMetadata, createGraph);
View Full Code Here

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

            UserMetadata otherUserMetadata = tx.getUserByName(item.getName());
            if (otherUserMetadata == null) {
                throw new NotFound(UserMetadata.class);
            }

            projectMetadata.addUser(otherUserMetadata);
View Full Code Here

        // This needs to be a read/write transaction as we might make a user.
        MetaGraphTx tx = metaGraphService.buildTransaction().start();
        List<GetGraphResponse> graphs = new ArrayList<>();

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

            for (ProjectMetadata projectMetadata : userMetadata.getProjects()) {
                for (GraphMetadata graphMetadata : projectMetadata.getGraphs()) {
                    graphs.add(new GetGraphResponse(graphMetadata));
                }
            }
        } catch (Throwable t) {
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.metagraph.models.UserMetadata$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.