Examples of QPropertyDefinition


Examples of org.apache.jackrabbit.spi.QPropertyDefinition

                 * (e.g. those defined by mix:referenceable, mix:versionable,
                 * mix:lockable, et.al.)
                 *
                 * todo FIXME delegate to 'node type instance handler'
                 */
                QPropertyDefinition def = ent.getApplicablePropertyDef(
                        srcChildState.getName(), srcChildState.getType(),
                        srcChildState.isMultiValued());
                if (NameConstants.MIX_LOCKABLE.equals(def.getDeclaringNodeType())) {
                    // skip properties defined by mix:lockable
                    continue;
                }

                PropertyState newChildState =
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

                case Operation.STATUS_PERSISTED:
                    // for autocreated/protected props, mark to be reloaded
                    // upon next access.
                    PropertyState addedState = (PropertyState) ((PropertyEntryImpl) pe).internalGetItemState();
                    addedState.setStatus(Status.EXISTING);
                    QPropertyDefinition pd = addedState.getDefinition();
                    if (pd.isAutoCreated() || pd.isProtected()) {
                        pe.invalidate(true);
                    } // else: assume added property is up to date.
                    break;
                case Operation.STATUS_UNDO:
                    pe.revert();
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

        // node state.
        // see also: JCR-2408
        if (state.getStatus() == ItemState.STATUS_EXISTING_REMOVED
                && state.getName().equals(NameConstants.JCR_UUID)) {
            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
            QPropertyDefinition def = ntReg.getEffectiveNodeType(
                    NameConstants.MIX_REFERENCEABLE).getApplicablePropertyDef(
                    state.getName(), state.getType());
            return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
        }
        try {
            // retrieve parent in 2 steps in order to avoid the check for
            // read permissions on the parent which isn't required in order
            // to read the property's definition. see also JCR-2418.
            ItemData parentData = getItemData(state.getParentId(), null, false);
            NodeImpl parent = (NodeImpl) createItemInstance(parentData);
            return parent.getApplicablePropertyDefinition(
                    state.getName(), state.getType(), state.isMultiValued(), true);
        } catch (ItemNotFoundException e) {
            // parent probably removed, get it from attic
        }
        try {
            NodeState parent = (NodeState) sism.getAttic().getItemState(
                    state.getParentId()).getOverlayedState();
            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
            EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                    parent.getNodeTypeName(), parent.getMixinTypeNames());
            QPropertyDefinition def;
            try {
                def = ent.getApplicablePropertyDef(
                    state.getName(), state.getType(), state.isMultiValued());
            } catch (ConstraintViolationException e) {
                ent = ntReg.getEffectiveNodeType(NameConstants.NT_UNSTRUCTURED);
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

     * could be found.
     * @throws RepositoryException if another error occurs.
     */
    private Property createProperty(Name qName, Value value, int type)
            throws ConstraintViolationException, RepositoryException {
        QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, false);
        int targetType = def.getRequiredType();
        if (targetType == PropertyType.UNDEFINED) {
            targetType = type;
        }
        QValue qvs;
        if (targetType == PropertyType.UNDEFINED) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

     * @throws ConstraintViolationException
     * @throws RepositoryException
     */
    private Property createProperty(Name qName, Value[] values, int type)
        throws ConstraintViolationException, RepositoryException {
        QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, true);
        int targetType = def.getRequiredType();
        // make sure, the final type is not set to undefined
        if (targetType == PropertyType.UNDEFINED) {
            if (type == PropertyType.UNDEFINED) {
                // try to retrieve type from the values array
                if (values.length > 0) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

                Name newName = session.getNameFactory().create(nodeInfo.getName().getNamespaceURI(), nodeInfo.getName().getLocalName() + "_");
                if (parent.hasPropertyName(newName)) {
                    newName = session.getNameFactory().create(newName.getNamespaceURI(), newName.getLocalName() + "_");
                }
                // since name changes, need to find new applicable definition
                QPropertyDefinition propDef;
                if (conflicting.getValues().length == 1) {
                    // could be single- or multi-valued (n == 1)
                    try {
                        // try single-valued
                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName, conflicting.getType(), false);
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

        Name propName = pi.getName();
        TextValue[] tva = pi.getValues();
        int infoType = pi.getType();

        PropertyState propState = null;
        QPropertyDefinition def = null;

        NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
        PropertyEntry pEntry = parentEntry.getPropertyEntry(propName);
        if (pEntry != null) {
            // a property with that name already exists...
            try {
                PropertyState existing = pEntry.getPropertyState();
                def = existing.getDefinition();
                if (def.isProtected()) {
                    // skip protected property
                    log.debug("skipping protected property " + LogUtil.safeGetJCRPath(existing, session.getPathResolver()));
                    return;
                }
                if (def.isAutoCreated()
                    && (existing.getType() == infoType || infoType == PropertyType.UNDEFINED)
                    && def.isMultiple() == existing.isMultiValued()) {
                    // this property has already been auto-created, no need to create it
                    propState = existing;
                } else {
                    throw new ItemExistsException(LogUtil.safeGetJCRPath(existing, session.getPathResolver()));
                }
            } catch (ItemNotFoundException e) {
                // property apperently doesn't exist any more
                // -> ignore
            }
        }

        Name[] parentNtNames = parentState.getAllNodeTypeNames();
        if (def == null) {
            // there's no property with that name, find applicable definition
            if (tva.length == 1) {
                // could be single- or multi-valued (n == 1)
                def = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, propName, infoType);
            } else {
                // can only be multi-valued (n == 0 || n > 1)
                def = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, propName, infoType, true);
            }
            if (def.isProtected()) {
                // skip protected property
                log.debug("skipping protected property " + propName);
                return;
            }
        }

        // retrieve the target property type needed for creation of QValue(s)
        // including an eventual conversion. the targetType is then needed for
        // setting/updating the type of the property-state.
        int targetType = def.getRequiredType();
        if (targetType == PropertyType.UNDEFINED) {
            if (infoType == PropertyType.UNDEFINED) {
                targetType = PropertyType.STRING;
            } else {
                targetType = infoType;
            }
        }

        QValue[] values = getPropertyValues(pi, targetType, def.isMultiple(), resolver);
        if (propState == null) {
            // create new property
            Operation ap = AddProperty.create(parentState, propName, targetType, def, values);
            stateMgr.execute(ap);
            propState = parentEntry.getPropertyEntry(propName).getPropertyState();
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

     * could be found.
     * @throws RepositoryException if another error occurs.
     */
    private Property createProperty(Name qName, Value value, int type)
            throws ConstraintViolationException, RepositoryException {
        QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, false);
        int targetType = def.getRequiredType();
        if (targetType == PropertyType.UNDEFINED) {
            targetType = type;
        }
        QValue qvs;
        if (targetType == PropertyType.UNDEFINED) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

     * @throws ConstraintViolationException
     * @throws RepositoryException
     */
    private Property createProperty(Name qName, Value[] values, int type)
        throws ConstraintViolationException, RepositoryException {
        QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, true);
        int targetType = def.getRequiredType();
        // make sure, the final type is not set to undefined
        if (targetType == PropertyType.UNDEFINED) {
            if (type == PropertyType.UNDEFINED) {
                // try to retrieve type from the values array
                if (values.length > 0) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.QPropertyDefinition

        // node state.
        // see also: JCR-2408
        if (state.getStatus() == ItemState.STATUS_EXISTING_REMOVED
                && state.getName().equals(NameConstants.JCR_UUID)) {
            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
            QPropertyDefinition def = ntReg.getEffectiveNodeType(
                    NameConstants.MIX_REFERENCEABLE).getApplicablePropertyDef(
                    state.getName(), state.getType());
            return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
        }
        try {
            // retrieve parent in 2 steps in order to avoid the check for
            // read permissions on the parent which isn't required in order
            // to read the property's definition. see also JCR-2418.
            ItemData parentData = getItemData(state.getParentId(), null, false);
            NodeImpl parent = (NodeImpl) createItemInstance(parentData);
            return parent.getApplicablePropertyDefinition(
                    state.getName(), state.getType(), state.isMultiValued(), true);
        } catch (ItemNotFoundException e) {
            // parent probably removed, get it from attic
        }
        try {
            NodeState parent = (NodeState) sism.getAttic().getItemState(
                    state.getParentId()).getOverlayedState();
            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
            EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                    parent.getNodeTypeName(), parent.getMixinTypeNames());
            QPropertyDefinition def;
            try {
                def = ent.getApplicablePropertyDef(
                    state.getName(), state.getType(), state.isMultiValued());
            } catch (ConstraintViolationException e) {
                ent = ntReg.getEffectiveNodeType(NameConstants.NT_UNSTRUCTURED);
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.