Package org.openengsb.core.ekb.api

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


    /**
     * Converts an EDBCommit object into an EKBCommit object.
     */
    private EKBCommit convertEDBCommitToEKBCommit(EDBCommit commit) throws EKBException {
        EKBCommit result = new EKBCommit();
        Map<ModelDescription, Class<?>> cache = new HashMap<>();
        result.setRevisionNumber(commit.getRevisionNumber());
        result.setComment(commit.getComment());
        result.setParentRevisionNumber(commit.getParentRevisionNumber());
        result.setDomainId(commit.getDomainId());
        result.setConnectorId(commit.getConnectorId());
        result.setInstanceId(commit.getInstanceId());
        for (EDBObject insert : commit.getInserts()) {
            result.addInsert(createModelOfEDBObject(insert, cache));
        }
        for (EDBObject update : commit.getUpdates()) {
            result.addUpdate(createModelOfEDBObject(update, cache));
        }
        for (String delete : commit.getDeletions()) {
            EDBObject object = edbService.getObject(delete, commit.getTimestamp());
            result.addDelete(createModelOfEDBObject(object, cache));
        }
        return result;
    }
View Full Code Here


        }

    }

    private static <ModelType> EKBCommit buildCommit(List<ModelType> localModels, List<ModelType> newModels) {
        EKBCommit result = new EKBCommit();
        List<ModelType> inserted = subtract(newModels, localModels);
        result.addInserts(inserted);
        List<ModelType> deleted = subtract(localModels, newModels);
        result.addDeletes(deleted);
        return result;
    }
View Full Code Here

                try {
                    newModels = fileSerializer.readFile(watchfile);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                EKBCommit commit = buildCommit((List) localModels, (List) newModels);
                commit.setConnectorId("filewatcher");
                commit.setInstanceId(instanceId);
                commit.setDomainId(domainType);
                ContextHolder.get().setCurrentContextId("foo");
                authenticationContext.login("admin", new Password("password"));
                persistService.commit(commit);
                authenticationContext.logout();
            }
View Full Code Here

                        e.onEvent(new Event());
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                }
                EKBCommit commit = (EKBCommit) invocation.getArguments()[0];
                for (Object o : commit.getInserts()) {
                    if (!activeModels.containsKey(o.getClass())) {
                        activeModels.put(o.getClass(), new ArrayList<Object>());
                    }
                    activeModels.get(o.getClass()).add(o);
                }
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.