Package com.graphaware.common.policy

Examples of com.graphaware.common.policy.RelationshipPropertyInclusionPolicy


*/
public class SpelRelationshipPropertyInclusionPolicyTest extends SpelInclusionPolicyTest {

    @Test
    public void shouldIncludeCorrectProps() {
        RelationshipPropertyInclusionPolicy policy1 = new SpelRelationshipPropertyInclusionPolicy("key != 'since'");
        RelationshipPropertyInclusionPolicy policy2 = new SpelRelationshipPropertyInclusionPolicy("relationship.isType('WORKS_FOR')");

        try (Transaction tx = database.beginTx()) {
            assertFalse(policy1.include("since", vojtaWorksFor()));
            assertFalse(policy1.include("since", michalWorksFor()));
            assertTrue(policy1.include("until", michalWorksFor()));
            assertTrue(policy1.include("until", vojtaWorksFor()));

            assertTrue(policy2.include("since", michalWorksFor()));
            assertFalse(policy2.include("since", michalLivesIn()));
            assertTrue(policy2.include("since", vojtaWorksFor()));
            assertFalse(policy2.include("since", vojtaLivesIn()));

            tx.success();
        }
    }
View Full Code Here


                        @Override
                        public boolean include(Relationship relationship) {
                            return !relationship.isType(withName("R3")) && !relationship.getType().name().startsWith(INTERNAL_PREFIX);
                        }
                    }
                    , new RelationshipPropertyInclusionPolicy() {
                @Override
                public boolean include(String key, Relationship propertyContainer) {
                    return !"time".equals(key) && !key.startsWith(INTERNAL_PREFIX);
                }
            }
View Full Code Here

TOP

Related Classes of com.graphaware.common.policy.RelationshipPropertyInclusionPolicy

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.