Package org.jboss.dna.graph.property

Examples of org.jboss.dna.graph.property.PropertyFactory


    }

    @Test
    public void shouldCreateLockRequestWhenLockingNode() throws RepositoryException {
        DnaLock lock = workspaceLockManager.createLock("testOwner", UUID.randomUUID(), validUuid, false, false);
        PropertyFactory propFactory = context.getPropertyFactory();
        String lockOwner = "testOwner";
        boolean isDeep = false;

        Property lockOwnerProp = propFactory.create(JcrLexicon.LOCK_OWNER, lockOwner);
        Property lockIsDeepProp = propFactory.create(JcrLexicon.LOCK_IS_DEEP, isDeep);

        JcrSession session = mock(JcrSession.class);
        stub(session.getExecutionContext()).toReturn(context);
        workspaceLockManager.lockNodeInRepository(session, validUuid, lockOwnerProp, lockIsDeepProp, lock, isDeep);
View Full Code Here


        // Make sure that the parent of the type nodes exists in the graph.
        try {
            graph.getNodeAt(parentOfTypeNodes);
        } catch (PathNotFoundException pnfe) {
            PropertyFactory propertyFactory = context.getPropertyFactory();
            graph.create(parentOfTypeNodes,
                         propertyFactory.create(JcrLexicon.PRIMARY_TYPE,
                                                DnaLexicon.NODE_TYPES.getString(context.getNamespaceRegistry()))).and();
        }

        Graph.Batch batch = graph.batch();
View Full Code Here

        String lockOwner = session.getUserID();
        DnaLock lock = createLock(lockOwner, lockUuid, nodeUuid, isDeep, isSessionScoped);

        Graph.Batch batch = repository.createSystemGraph(sessionContext).batch();

        PropertyFactory propFactory = sessionContext.getPropertyFactory();
        PathFactory pathFactory = sessionContext.getValueFactories().getPathFactory();
        Property lockOwnerProp = propFactory.create(JcrLexicon.LOCK_OWNER, lockOwner);
        Property lockIsDeepProp = propFactory.create(JcrLexicon.LOCK_IS_DEEP, isDeep);

        DateTimeFactory dateFactory = sessionContext.getValueFactories().getDateFactory();
        DateTime expirationDate = dateFactory.create();
        expirationDate = expirationDate.plusMillis(JcrEngine.LOCK_EXTENSION_INTERVAL_IN_MILLIS);

        batch.create(pathFactory.create(locksPath, pathFactory.createSegment(lockUuid.toString())),
                     propFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.LOCK),
                     propFactory.create(DnaLexicon.WORKSPACE, workspaceName),
                     propFactory.create(DnaLexicon.LOCKED_UUID, nodeUuid.toString()),
                     propFactory.create(DnaLexicon.IS_SESSION_SCOPED, isSessionScoped),
                     propFactory.create(DnaLexicon.LOCKING_SESSION, session.sessionId()),
                     propFactory.create(DnaLexicon.EXPIRATION_DATE, expirationDate),
                     // This gets set after the lock succeeds and the lock token gets added to the session
                     propFactory.create(DnaLexicon.IS_HELD_BY_SESSION, false),
                     lockOwnerProp,
                     lockIsDeepProp).ifAbsent().and();
        batch.execute();

        SessionCache cache = session.cache();
View Full Code Here

                           String lockToken,
                           boolean value ) {
        assert lockToken != null;

        ExecutionContext context = session.getExecutionContext();
        PropertyFactory propFactory = context.getPropertyFactory();
        PathFactory pathFactory = context.getValueFactories().getPathFactory();

        repository.createSystemGraph(context)
                  .set(propFactory.create(DnaLexicon.IS_HELD_BY_SESSION, value))
                  .on(pathFactory.create(locksPath, pathFactory.createSegment(lockToken)));
    }
View Full Code Here

        // Create the node for the node type ...
        if (name == null) throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidNodeTypeName.text());
        Path path = pathFactory.create(parentPath, name);

        PropertyFactory factory = nodeType.getExecutionContext().getPropertyFactory();
        destination.create(path,
                           factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.NODE_TYPE),
                           factory.create(JcrLexicon.SUPERTYPES, (Object[])supertypes),
                           factory.create(JcrLexicon.IS_ABSTRACT, isAbstract),
                           factory.create(JcrLexicon.HAS_ORDERABLE_CHILD_NODES, hasOrderableChildNodes),
                           factory.create(JcrLexicon.IS_MIXIN, isMixin),
                           factory.create(JcrLexicon.IS_QUERYABLE, isQueryable),
                           factory.create(JcrLexicon.NODE_TYPE_NAME, name),
                           factory.create(JcrLexicon.PRIMARY_ITEM_NAME, primaryItemName));

        for (PropertyDefinition propDefn : nodeType.getPropertyDefinitionTemplates()) {
            createPropertyDefinition((JcrPropertyDefinitionTemplate)propDefn, path);
        }
View Full Code Here

        // Create the node for the node type ...
        if (name == null) name = JcrNodeType.RESIDUAL_NAME;
        Path path = pathFactory.create(parentPath, JcrLexicon.PROPERTY_DEFINITION);

        PropertyFactory factory = propDefn.getExecutionContext().getPropertyFactory();
        destination.create(path,
                           factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.PROPERTY_DEFINITION),
                           factory.create(JcrLexicon.REQUIRED_TYPE, requiredType),
                           factory.create(JcrLexicon.DEFAULT_VALUES, (Object[])defaultValues),
                           factory.create(JcrLexicon.MULTIPLE, multiple),
                           factory.create(JcrLexicon.MANDATORY, mandatory),
                           factory.create(JcrLexicon.NAME, name),
                           factory.create(JcrLexicon.AUTO_CREATED, autoCreated),
                           factory.create(JcrLexicon.PROTECTED, isProtected),
                           factory.create(JcrLexicon.ON_PARENT_VERSION, onParentVersion),
                           // factory.create(DnaLexicon.QUERY_OPERATORS, queryOperators),
                           // factory.create(JcrLexicon.IS_FULL_TEXT_SEARCHABLE, isFullTextSearchable),
                           // factory.create(JcrLexicon.IS_QUERY_ORDERABLE, isQueryOrderable),
                           factory.create(JcrLexicon.VALUE_CONSTRAINTS, (Object[])valueConstraints));

        return path;
    }
View Full Code Here

        // Create the node for the node type ...
        if (name == null) name = JcrNodeType.RESIDUAL_NAME;
        Path path = pathFactory.create(parentPath, JcrLexicon.CHILD_NODE_DEFINITION);

        PropertyFactory factory = childDefn.getExecutionContext().getPropertyFactory();
        destination.create(path,
                           factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.CHILD_NODE_DEFINITION),
                           factory.create(JcrLexicon.REQUIRED_PRIMARY_TYPES, (Object[])requiredPrimaryTypes),
                           factory.create(JcrLexicon.DEFAULT_PRIMARY_TYPE, defaultPrimaryType),
                           factory.create(JcrLexicon.MANDATORY, mandatory),
                           factory.create(JcrLexicon.NAME, name),
                           factory.create(JcrLexicon.AUTO_CREATED, autoCreated),
                           factory.create(JcrLexicon.PROTECTED, isProtected),
                           factory.create(JcrLexicon.ON_PARENT_VERSION, onParentVersion),
                           factory.create(JcrLexicon.SAME_NAME_SIBLINGS, sameNameSiblings));

        return path;
    }
View Full Code Here

            conflictBehavior = NodeConflictBehavior.APPEND;
            return this;
        }

        public Create<T> and( UUID uuid ) {
            PropertyFactory factory = getContext().getPropertyFactory();
            properties.put(DnaLexicon.UUID, factory.create(DnaLexicon.UUID, uuid));
            return this;
        }
View Full Code Here

        }

        public Create<T> and( String name,
                              Object... values ) {
            ExecutionContext context = getContext();
            PropertyFactory factory = context.getPropertyFactory();
            NameFactory nameFactory = context.getValueFactories().getNameFactory();
            Name propertyName = nameFactory.create(name);
            properties.put(propertyName, factory.create(propertyName, values));
            return this;
        }
View Full Code Here

            return this;
        }

        public Create<T> and( Name name,
                              Object... values ) {
            PropertyFactory factory = getContext().getPropertyFactory();
            properties.put(name, factory.create(name, values));
            return this;
        }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.property.PropertyFactory

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.