Examples of LazyTransactionData


Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

    /**
     * {@inheritDoc}
     */
    @Override
    public Void beforeCommit(TransactionData data) throws Exception {
        ImprovedTransactionData improvedTransactionData = new LazyTransactionData(data);

        long delta = 0;

        //handle new friendships
        for (Relationship newFriendship : improvedTransactionData.getAllCreatedRelationships()) {
            if (newFriendship.isType(FRIEND_OF)) {
                delta += (long) newFriendship.getProperty(STRENGTH, 0L);
            }
        }

        //handle changed friendships
        for (Change<Relationship> changedFriendship : improvedTransactionData.getAllChangedRelationships()) {
            if (changedFriendship.getPrevious().isType(FRIEND_OF)) {
                delta -= (long) changedFriendship.getPrevious().getProperty(STRENGTH, 0L);
                delta += (long) changedFriendship.getCurrent().getProperty(STRENGTH, 0L);
            }
        }

        //handle deleted friendships
        for (Relationship deletedFriendship : improvedTransactionData.getAllDeletedRelationships()) {
            if (deletedFriendship.isType(FRIEND_OF)) {
                delta -= (long) deletedFriendship.getProperty(STRENGTH, 0L);
            }
        }

View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

    private void justForDocs() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        database.registerTransactionEventHandler(new TransactionEventHandler<Object>() {
            @Override
            public Object beforeCommit(TransactionData data) throws Exception {
                ImprovedTransactionData improvedTransactionData = new LazyTransactionData(data);

                //have fun here with improvedTransactionData!

                return null;
            }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

                            }
                        })
                        .with(IncludeNoRelationships.getInstance());

                ImprovedTransactionData improvedTransactionData
                        = new FilteredTransactionData(new LazyTransactionData(data), inclusionPolicies);

                //have fun here with improvedTransactionData!

                return null;
            }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

            this.beforeCommitCallback = beforeCommitCallback;
        }

        @Override
        public Object beforeCommit(TransactionData data) throws Exception {
            beforeCommitCallback.doBeforeCommit(new LazyTransactionData(data));
            return null;
        }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

    /**
     * {@inheritDoc}
     */
    @Override
    public Void beforeCommit(TransactionData data) throws Exception {
        logChanges(new LazyTransactionData(data));

        return null;
    }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

        createTestDatabase();

        database.registerTransactionEventHandler(new TransactionEventHandler.Adapter<Void>() {
            @Override
            public Void beforeCommit(TransactionData data) throws Exception {
                ImprovedTransactionData improvedTransactionData = new FilteredTransactionData(new LazyTransactionData(data), InclusionPolicies.none());
                assertFalse(improvedTransactionData.mutationsOccurred());
                assertTrue(improvedTransactionData.hasBeenChanged(database.getNodeById(1)));
                assertTrue(improvedTransactionData.changedProperties(database.getNodeById(1)).isEmpty());
                return null;
            }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

    /**
     * {@inheritDoc}
     */
    @Override
    public Map<String, Object> beforeCommit(TransactionData data) throws Exception {
        LazyTransactionData transactionData = new LazyTransactionData(data);

        if (!isStarted(transactionData)) {
            return null;
        }

View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

            this.beforeCommitCallback = beforeCommitCallback;
        }

        @Override
        public Object beforeCommit(TransactionData data) throws Exception {
            LazyTransactionData lazyTransactionData = new LazyTransactionData(data);

            beforeCommitCallback.doBeforeCommit(new FilteredTransactionData(lazyTransactionData, new InclusionPolicies(
                    new NodeInclusionPolicy() {
                        @Override
                        public boolean include(Node node) {
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

        private Set<String> capturedData = new HashSet<>();

        @Override
        public Void beforeCommit(TransactionData data) throws Exception {
            ImprovedTransactionData improvedTransactionData = new LazyTransactionData(data);
            capturedData.addAll(improvedTransactionData.mutationsToStrings());
            return null;
        }
View Full Code Here

Examples of com.graphaware.tx.event.improved.api.LazyTransactionData

            this.beforeCommitCallback = beforeCommitCallback;
        }

        @Override
        public Object beforeCommit(TransactionData data) throws Exception {
            beforeCommitCallback.beforeCommit(new LazyTransactionData(data));
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.