Package org.openengsb.core.ekb.api

Examples of org.openengsb.core.ekb.api.EKBCommit


    @Test
    public void ekbCommit_shouldCreateIndexInherently() throws Exception {
        EOModel insert = new EOModel();
        insert.setEdbId("insert/1");

        EKBCommit ekbCommit = getTestEKBCommit();
        ekbCommit.addInsert(insert);

        ekb.commit(ekbCommit);

        Index<?> index = indexEngine.getIndex(insert.getClass());
View Full Code Here


        model1.setShared("A");
        model2.setShared("B");
        model3.setShared("C");

        EKBCommit insertCommit =
            getTestEKBCommit().addInsert(model1).addInsert(model2).addInsert(model3);
        ekb.commit(insertCommit);

        model2.setShared("B_EDITED");

        EKBCommit updateCommit = getTestEKBCommit().addUpdate(model2).addDelete(model3);
        ekb.commit(updateCommit);

        // assert
        Index<?> index = indexEngine.getIndex(model1.getClass());
View Full Code Here

    @Override
    public void checkinProjects(List<Project> projects) {
        preparePersistenceAccess();

        EKBCommit commit = getEKBCommit();
        for (Project project : projects) {
            List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\"");

            if (result.size() == 0) {
                commit.addInsert(project);
            } else {
                commit.addUpdate(project);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

    }

    @Override
    public void deleteProjects(List<Project> projects) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (Project project : projects) {
            List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\"");

            if (result.size() == 0) {
                LOGGER.warn("Project {1} does not exist.", project.getName());
            } else {
                commit.addDelete(project);
            }
            deleteAllAssignmentsForProject(project);
        }
        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        addUsersInPersistence(Sets.newHashSet(user));
    }

    private void addUsersInPersistence(Collection<User> users) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (User user : users) {
            List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");

            if (result.size() == 0) {
                LOGGER.debug("Create User " + user.getUsername());
                commit.addInsert(user);
            } else if (result.size() == 1) {
                LOGGER.debug("Update User " + user.getUsername());
                commit.addUpdate(user);
            } else {
                LOGGER.debug("Error: Duplicate users in EngSB");
                commit.addUpdate(user);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        deleteUsersFromPersistence(Sets.newHashSet(user));
    }

    private void deleteUsersFromPersistence(Collection<User> users) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (User user : users) {
            List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");

            if (result.size() == 0) {
                LOGGER.warn("User {1} does not exist.", user.getUsername());
            } else {
                commit.addDelete(user);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        addRolesInPersistence(Sets.newHashSet(role));
    }

    private void addRolesInPersistence(Collection<Role> roles) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (Role role : roles) {
            List<Role> result = queryService.queryByString(Role.class, "name:\"" + role.getName() + "\"");

            if (result.size() == 0) {
                commit.addInsert(role);
            } else {
                commit.addUpdate(role);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        deleteRolesFromPersistence(Sets.newHashSet(role));
    }

    private void deleteRolesFromPersistence(Collection<Role> roles) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (Role role : roles) {
            List<Role> result = queryService.queryByString(Role.class, "name:\"" + role.getName() + "\"");

            if (result.size() == 0) {
                LOGGER.warn("User {1} does not exist.", role.getName());
            } else {
                commit.addDelete(role);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        addAssignmentsInPersistence(Sets.newHashSet(assignment));
    }

    private void addAssignmentsInPersistence(Collection<Assignment> assignments) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (Assignment assignment : assignments) {
            List<Assignment> result =
                queryService.queryByString(Assignment.class, "uuid:\"" + assignment.getUuid() + "\"");

            if (result.size() == 0) {
                LOGGER.debug("New Assignment: " + assignment.getUser() + ":" + assignment.getProject());
                commit.addInsert(assignment);
            } else {
                LOGGER.debug("Update Assignment: " + assignment.getUser() + ":" + assignment.getProject());
                commit.addUpdate(assignment);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

        deleteAssignmentsFromPersistence(Sets.newHashSet(assignment));
    }

    private void deleteAssignmentsFromPersistence(Collection<Assignment> assignments) {
        preparePersistenceAccess();
        EKBCommit commit = getEKBCommit();

        for (Assignment assignment : assignments) {
            List<Role> result = queryService.queryByString(Role.class, "uuid:\"" + assignment.getUuid() + "\"");

            if (result.size() == 0) {
                LOGGER.warn("User {1} does not exist.", assignment.getUuid());
            } else {
                commit.addDelete(assignment);
            }
        }

        persistService.commit(commit);
        revokePersistenceAccess();
View Full Code Here

TOP

Related Classes of org.openengsb.core.ekb.api.EKBCommit

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.