Package org.apache.jackrabbit.jcr2spi.hierarchy

Examples of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry


        if (getNodeState().getStatus() == Status.EXISTING) {
            // jcr:mixinTypes must correspond to the mixins present on the nodestate.
            mixinValue = getNodeState().getMixinTypeNames();
        } else {
            try {
                PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES);
                if (pe != null) {
                    // prop entry exists (and ev. has been transiently mod.)
                    // -> retrieve mixin types from prop
                    mixinValue = StateUtility.getMixinNames(pe.getPropertyState());
                } else {
                    // prop entry has not been loaded yet -> not modified
                    mixinValue = getNodeState().getMixinTypeNames();
                }
            } catch (RepositoryException e) {
View Full Code Here


     */
    // TODO: protected due to usage within VersionImpl, VersionHistoryImpl (check for alternatives)
    protected Property getProperty(Name qName) throws PathNotFoundException, RepositoryException {
        checkStatus();
        try {
            PropertyEntry pEntry = getNodeEntry().getPropertyEntry(qName, true);
            if (pEntry == null) {
                throw new PathNotFoundException(LogUtil.saveGetJCRName(qName, session.getNameResolver()));
            }
            return (Property) getItemManager().getItem(pEntry);
        } catch (AccessDeniedException e) {
View Full Code Here

     * <code>null</code> if no property exists at <code>relPath</code>
     * @throws RepositoryException if <code>relPath</code> is not a valid
     * relative path
     */
    private PropertyEntry resolveRelativePropertyPath(String relPath) throws RepositoryException {
        PropertyEntry targetEntry = null;
        try {
            Path rp = session.getPathResolver().getQPath(relPath);
            if (rp.getLength() == 1 && rp.getNameElement().denotesName()) {
                // a single path element must always denote a name. '.' and '..'
                // will never point to a property. If the NodeEntry does not
View Full Code Here

         // removed as with JSR 283 having same-named node and property can be
         // allowed. thus delegate the correspoding validation to the underlying
         // SPI implementation.

        // check for name collisions with an existing property
        PropertyEntry pe = parentEntry.getPropertyEntry(propertyName);
        if (pe != null) {
            try {
                pe.getPropertyState();
                throw new ItemExistsException("Property '" + pe.getName() + "' already exists.");
            } catch (ItemNotFoundException e) {
                // apparently conflicting entry does not exist any more
                // ignore and return
            }
        }
View Full Code Here

        } else {
            // TODO: check if correct (and only used for creating new)
            Name primaryType = getNodeTypeName();
            allNtNames = new Name[] { primaryType }; // default
            try {
                PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES, true);
                if (pe != null) {
                    PropertyState mixins = pe.getPropertyState();
                    QValue[] values = mixins.getValues();
                    allNtNames = new Name[values.length + 1];
                    for (int i = 0; i < values.length; i++) {
                        allNtNames[i] = values[i].getName();
                    }
View Full Code Here

     *
     * @see NodeEntry#getPropertyEntry(Name, boolean)
     * @see PropertyEntry#getPropertyState()
     */
    public PropertyState getPropertyState(Name propertyName) throws ItemNotFoundException, RepositoryException {
        PropertyEntry pe = getNodeEntry().getPropertyEntry(propertyName, true);
        if (pe != null) {
            return pe.getPropertyState();
        } else {
            throw new ItemNotFoundException("Child Property with name " + propertyName + " does not exist.");
        }
    }
View Full Code Here

        NodeState nState = operation.getNodeState();
        NodeEntry nEntry = nState.getNodeEntry();

        // assert the existence of the property entry and set the array of
        // mixinNames to be set on the corresponding property state
        PropertyEntry mixinEntry = nEntry.getPropertyEntry(NameConstants.JCR_MIXINTYPES);
        if (mixinNames.length > 0) {
            // update/create corresponding property state
            if (mixinEntry != null) {
                // execute value of existing property
                PropertyState pState = mixinEntry.getPropertyState();
                setPropertyStateValue(pState, getQValues(mixinNames, qValueFactory), PropertyType.NAME, operation.getOptions());
            } else {
                // create new jcr:mixinTypes property
                ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
                QPropertyDefinition pd = defProvider.getQPropertyDefinition(nState.getAllNodeTypeNames(), NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true);
                QValue[] mixinValue = getQValues(mixinNames, qValueFactory);
                addPropertyState(nState, pd.getName(), pd.getRequiredType(), mixinValue, pd, operation.getOptions());
            }
            nState.markModified();
            transientStateMgr.addOperation(operation);
        } else if (mixinEntry != null) {
            // remove the jcr:mixinTypes property state if already present
            PropertyState pState = mixinEntry.getPropertyState();
            removeItemState(pState, operation.getOptions());

            nState.markModified();
            transientStateMgr.addOperation(operation);
        } // else: empty Name array and no mixin-prop-entry (should not occur)
View Full Code Here

        // retrieve effective to assert validity of arguments
        entProvider.getEffectiveNodeType(all.toArray(new Name[all.size()]));

        // modify the value of the jcr:primaryType property entry without
        // changing the node state itself
        PropertyEntry pEntry = nEntry.getPropertyEntry(NameConstants.JCR_PRIMARYTYPE);
        PropertyState pState = pEntry.getPropertyState();
        setPropertyStateValue(pState, getQValues(new Name[] {primaryName}, qValueFactory), PropertyType.NAME, operation.getOptions());

        // mark the affected node state modified and remember the operation
        nState.markModified();
        transientStateMgr.addOperation(operation);
View Full Code Here

    /**
     * @see ItemManager#getProperty(Path)
     */
    public synchronized Property getProperty(Path path) throws PathNotFoundException, RepositoryException {
        PropertyEntry propertyEntry = hierMgr.getPropertyEntry(path);
        try {
            return (Property) getItem(propertyEntry);
        } catch (ItemNotFoundException infe) {
            throw new PathNotFoundException(LogUtil.safeGetJCRPath(path, session.getPathResolver()));
        }
View Full Code Here

        session.checkIsAlive();

        Iterator<PropertyEntry> iter = parentEntry.getPropertyEntries();
        while (iter.hasNext()) {
            try {
                PropertyEntry entry = iter.next();
                // check read access by accessing the propState (also implicit validation).
                entry.getPropertyState();
                return true;
            } catch (ItemNotFoundException e) {
                // should not occur. ignore
                log.debug("Failed to access node state.", e);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry

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.