Package org.apache.jackrabbit.jcr2spi.operation

Examples of org.apache.jackrabbit.jcr2spi.operation.Operation


                } else {
                    // can only be multi-valued (n == 0 || n > 1)
                    propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName, conflicting.getType(), true);
                }

                Operation ap = AddProperty.create(parent, newName, conflicting.getType(), propDef, conflicting.getValues());
                stateMgr.execute(ap);
                Operation rm = Remove.create(conflicting);
                stateMgr.execute(rm);
            }
        }

        // do create new nodeState
        QNodeDefinition def = session.getItemDefinitionProvider().getQNodeDefinition(parentNtNames, nodeInfo.getName(), nodeInfo.getNodeTypeName());
        if (def.isProtected()) {
            log.debug("Skipping protected nodeState (" + nodeInfo.getName() + ")");
            return null;
        } else {
            Name ntName = nodeInfo.getNodeTypeName();
            if (ntName == null) {
                // use default node type
                ntName = def.getDefaultPrimaryType();
            }
            Operation an = AddNode.create(parent, nodeInfo.getName(), ntName, nodeInfo.getUUID());
            stateMgr.execute(an);
            // retrieve id of state that has been created during execution of AddNode
            NodeState childState = (NodeState) ((AddNode) an).getAddedStates().get(0);

            // and set mixin types
            Name[] mixinNames = nodeInfo.getMixinNames();
            if (mixinNames != null && mixinNames.length > 0) {
                Operation sm = SetMixin.create(childState, nodeInfo.getMixinNames());
                stateMgr.execute(sm);
            }
            return childState;
        }
    }
View Full Code Here


        }

        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();
        } else {
            // modify value of existing property
            Operation sp = SetPropertyValue.create(propState, values, targetType);
            stateMgr.execute(sp);
        }

        // store reference for later resolution
        if (propState.getType() == PropertyType.REFERENCE) {
View Full Code Here

        Path beforePath = null;
        if (destChildRelPath != null) {
            beforePath = getReorderPath(destChildRelPath);
        }

        Operation op = ReorderNodes.create(getNodeState(), srcPath, beforePath);
        session.getSessionItemStateManager().execute(op);
    }
View Full Code Here

        if (nt.isMixin() || nt.isAbstract()) {
            throw new ConstraintViolationException("Cannot change the primary type: '" + nodeTypeName + "' is a mixin type or abstract.");
        }

        // perform the operation
        Operation op = SetPrimaryType.create(getNodeState(), ntName);
        session.getSessionItemStateManager().execute(op);
    }
View Full Code Here

                throw new ConstraintViolationException("Cannot add '" + mixinName + "' mixin type.");
            }

            mixinValue.add(mixinQName);
            // perform the operation
            Operation op = SetMixin.create(getNodeState(), mixinValue.toArray(new Name[mixinValue.size()]));
            session.getSessionItemStateManager().execute(op);
        }
    }
View Full Code Here

            }
        }

        // delegate to operation
        Name[] mixins = mixinValue.toArray(new Name[mixinValue.size()]);
        Operation op = SetMixin.create(getNodeState(), mixins);
        session.getSessionItemStateManager().execute(op);
    }
View Full Code Here

        } catch (ItemNotFoundException e) {
            // no corresponding node exists -> method has not effect
            return;
        }

        Operation op = Update.create(getNodeState(), srcWorkspaceName);
        ((WorkspaceImpl)session.getWorkspace()).getUpdatableItemStateManager().execute(op);
    }
View Full Code Here

            // use default node type
            nodeTypeName = definition.getDefaultPrimaryType();
        }
        // validation check are performed by item state manager
        // NOTE: uuid is generated while creating new state.
        Operation an = AddNode.create(getNodeState(), nodeName, nodeTypeName, null);
        session.getSessionItemStateManager().execute(an);

        // finally retrieve the new node
        List<ItemState> addedStates = ((AddNode) an).getAddedStates();
        ItemState nState = addedStates.get(0);
View Full Code Here

     * @throws RepositoryException
     */
    private Property createProperty(Name qName, int type, QPropertyDefinition def,
                                    QValue[] qvs)
        throws ConstraintViolationException, RepositoryException {
        Operation op = AddProperty.create(getNodeState(), qName, type, def, qvs);
        session.getSessionItemStateManager().execute(op);
        return getProperty(qName);
    }
View Full Code Here

        // build paths from the given JCR paths.
        Path srcPath = getQPath(srcAbsPath);
        Path destPath = getQPath(destAbsPath);

        // all validation is performed by Move Operation and state-manager
        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getPathResolver(), true);
        itemStateManager.execute(op);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.operation.Operation

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.