Package org.jboss.dna.graph.property

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


     */
    private List<JcrNodeType> supertypesFor( Node nodeType,
                                             List<JcrNodeType> pendingTypes ) throws RepositoryException {
        assert nodeType != null;

        Property supertypesProperty = nodeType.getProperty(JcrLexicon.SUPERTYPES);

        // If no supertypes are provided, assume nt:base as a supertype
        if (supertypesProperty == null || supertypesProperty.size() == 0) {
            Property isMixinProperty = nodeType.getProperty(JcrLexicon.IS_MIXIN);
            boolean isMixin = isMixinProperty != null && Boolean.valueOf(isMixinProperty.getFirstValue().toString());
            JcrNodeType supertype = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
            // We register nt:base at startup now instead of just injecting it
            if (supertype == null || isMixin) {
                return Collections.emptyList();
            }
View Full Code Here


        this.workspaceName = workspaceName;
        this.locksPath = locksPath;

        this.workspaceLocksByNodeUuid = new ConcurrentHashMap<UUID, DnaLock>();

        Property locksPrimaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.LOCKS);
        repository.createSystemGraph(context).create(locksPath, locksPrimaryType).ifAbsent().and();
    }
View Full Code Here

        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);
View Full Code Here

            ValueFactory<Boolean> booleanFactory = context.getValueFactories().getBooleanFactory();

            assert lockNode.getLocation().getPath() != null;

            String lockUuidAsString = lockNode.getLocation().getPath().getLastSegment().getName().getLocalName();
            Property lockOwnerProperty = lockNode.getProperty(JcrLexicon.LOCK_OWNER);
            Property nodeUuidProperty = lockNode.getProperty(DnaLexicon.LOCKED_UUID);
            Property lockIsDeepProperty = lockNode.getProperty(JcrLexicon.LOCK_IS_DEEP);
            Property isSessionScopedProperty = lockNode.getProperty(DnaLexicon.IS_SESSION_SCOPED);

            assert lockUuidAsString != null;
            assert lockOwnerProperty != null;
            assert nodeUuidProperty != null;
            assert lockIsDeepProperty != null;
            assert isSessionScopedProperty != null;

            this.lockOwner = stringFactory.create(lockOwnerProperty.getFirstValue());
            this.lockUuid = UUID.fromString(lockUuidAsString);
            this.nodeUuid = uuidFactory.create(nodeUuidProperty.getFirstValue());
            this.deep = booleanFactory.create(lockIsDeepProperty.getFirstValue());
            this.sessionScoped = booleanFactory.create(isSessionScopedProperty.getFirstValue());
        }
View Full Code Here

     * {@inheritDoc}
     *
     * @see javax.jcr.Property#getLengths()
     */
    public long[] getLengths() throws RepositoryException {
        Property dnaProperty = propertyInfo().getProperty();
        long[] lengths = new long[dnaProperty.size()];
        Iterator<?> iter = dnaProperty.iterator();
        for (int ndx = 0; iter.hasNext(); ndx++) {
            lengths[ndx] = createValue(iter.next()).getLength();
        }
        return lengths;
    }
View Full Code Here

     * </p>
     *
     * @see javax.jcr.Property#getValues()
     */
    public Value[] getValues() throws RepositoryException {
        Property dnaProperty = propertyInfo().getProperty();
        Value[] values = new JcrValue[dnaProperty.size()];
        Iterator<?> iter = dnaProperty.iterator();
        for (int ndx = 0; iter.hasNext(); ndx++) {
            values[ndx] = createValue(iter.next());
        }
        return values;
    }
View Full Code Here

                throw new ValidationException(msg);
            }
            if (primaryType.isNodeType(JcrMixLexicon.REFERENCEABLE)) referenceable = true;

            // The process the mixin types ...
            Property mixinTypesProperty = graphProperties.get(JcrLexicon.MIXIN_TYPES);
            List<Name> mixinTypeNames = null;
            if (mixinTypesProperty != null && !mixinTypesProperty.isEmpty()) {
                for (Object mixinTypeValue : mixinTypesProperty) {
                    Name mixinTypeName = nameFactory.create(mixinTypeValue);
                    if (mixinTypeNames == null) mixinTypeNames = new LinkedList<Name>();
                    mixinTypeNames.add(mixinTypeName);
                    JcrNodeType mixinType = nodeTypes().getNodeType(mixinTypeName);
                    if (mixinType == null) continue;
                    if (!referenceable && mixinType.isNodeType(JcrMixLexicon.REFERENCEABLE)) referenceable = true;
                }
            }

            // Create the set of multi-valued property names ...
            Set<Name> multiValuedPropertyNames = EMPTY_NAMES;
            Set<Name> newSingleMultiPropertyNames = null;
            Property multiValuedPropNamesProp = graphProperties.get(DnaIntLexicon.MULTI_VALUED_PROPERTIES);
            if (multiValuedPropNamesProp != null && !multiValuedPropNamesProp.isEmpty()) {
                multiValuedPropertyNames = getSingleMultiPropertyNames(multiValuedPropNamesProp, location);
            }

            // Create the JCR Node payload object ...
            JcrNodePayload nodePayload = new JcrNodePayload(SessionCache.this, node, primaryTypeName, mixinTypeNames,
View Full Code Here

                // A cast is required ...
                org.jboss.dna.graph.property.PropertyType dnaPropertyType = PropertyTypeUtil.dnaPropertyTypeFor(propertyType);
                ValueFactory<?> factory = factories().getValueFactory(dnaPropertyType);
                objValue = factory.create(objValue);
            }
            Property dnaProp = propertyFactory.create(name, objValue);

            try {
                // Create (or reuse) the JCR Property object ...
                AbstractJcrProperty jcrProp = null;
                if (existing != null) {
                    jcrProp = existing.getPayload().getJcrProperty();
                } else {
                    AbstractJcrNode jcrNode = payload.getJcrNode();
                    if (definition.isMultiple()) {
                        jcrProp = new JcrMultiValueProperty(SessionCache.this, jcrNode, dnaProp.getName());
                    } else {
                        jcrProp = new JcrSingleValueProperty(SessionCache.this, jcrNode, dnaProp.getName());
                    }
                }
                assert jcrProp != null;
                JcrPropertyPayload propPayload = new JcrPropertyPayload(definition.getId(), propertyType, jcrProp);
                node.setProperty(dnaProp, definition.isMultiple(), propPayload);
View Full Code Here

                ValueFactory<?> factory = factories().getValueFactory(dnaPropertyType);
                for (int i = 0; i != numValues; ++i) {
                    objValues[i] = factory.create(((JcrValue)newValues[i]).value());
                }
            }
            Property dnaProp = propertyFactory.create(name, objValues);

            try {
                // Create (or reuse) the JCR Property object ...
                AbstractJcrProperty jcrProp = null;
                if (existing != null) {
                    jcrProp = existing.getPayload().getJcrProperty();
                } else {
                    AbstractJcrNode jcrNode = payload.getJcrNode();
                    if (definition.isMultiple()) {
                        jcrProp = new JcrMultiValueProperty(SessionCache.this, jcrNode, dnaProp.getName());
                    } else {
                        jcrProp = new JcrSingleValueProperty(SessionCache.this, jcrNode, dnaProp.getName());
                    }
                }
                assert jcrProp != null;
                JcrPropertyPayload propPayload = new JcrPropertyPayload(definition.getId(), propertyType, jcrProp);
                node.setProperty(dnaProp, definition.isMultiple(), propPayload);
View Full Code Here

                // ---------------------------------------------------------
                // Now create the child node representation in the cache ...
                // ---------------------------------------------------------

                // Create the initial properties ...
                Property primaryTypeProp = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, primaryTypeName);
                Property nodeDefinitionProp = propertyFactory.create(DnaIntLexicon.NODE_DEFINITON, definition.getId().getString());

                // Now add the "jcr:uuid" property if and only if referenceable ...
                Node<JcrNodePayload, JcrPropertyPayload> result = null;
                boolean isReferenceable = primaryType.isNodeType(JcrMixLexicon.REFERENCEABLE);
                Property uuidProperty = null;
                if (desiredUuid != null || isReferenceable) {
                    if (desiredUuid == null) {
                        desiredUuid = UUID.randomUUID();
                    }
                    uuidProperty = propertyFactory.create(JcrLexicon.UUID, desiredUuid);
View Full Code Here

TOP

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

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.