Examples of ChangeLog


Examples of org.apache.jackrabbit.core.state.ChangeLog

     *
     * @param sourceNode source node state
     * @throws ItemStateException if the copy operation fails
     */
    private void copy(NodeState sourceNode) throws ItemStateException {
        ChangeLog changes = new ChangeLog();

        // Copy the node state
        NodeState targetNode = target.createNew(sourceNode.getNodeId());
        targetNode.setParentId(sourceNode.getParentId());
        targetNode.setDefinitionId(sourceNode.getDefinitionId());
        targetNode.setNodeTypeName(sourceNode.getNodeTypeName());
        targetNode.setMixinTypeNames(sourceNode.getMixinTypeNames());
        targetNode.setPropertyNames(sourceNode.getPropertyNames());
        targetNode.setChildNodeEntries(sourceNode.getChildNodeEntries());
        if (target.exists(targetNode.getNodeId())) {
            changes.modified(targetNode);
        } else {
            changes.added(targetNode);
        }

        // Copy all associated property states
        for (Name name : sourceNode.getPropertyNames()) {
            PropertyId id = new PropertyId(sourceNode.getNodeId(), name);
            PropertyState sourceState = source.load(id);
            PropertyState targetState = target.createNew(id);
            targetState.setDefinitionId(sourceState.getDefinitionId());
            targetState.setType(sourceState.getType());
            targetState.setMultiValued(sourceState.isMultiValued());
            // TODO: Copy binaries?
            targetState.setValues(sourceState.getValues());
            if (target.exists(targetState.getPropertyId())) {
                changes.modified(targetState);
            } else {
                changes.added(targetState);
            }
        }

        // Copy all node references
        NodeReferencesId refsId = new NodeReferencesId(sourceNode.getNodeId());
        if (source.exists(refsId)) {
            changes.modified(source.load(refsId));
        } else if (target.exists(refsId)) {
            NodeReferences references = target.load(refsId);
            references.clearAllReferences();
            changes.modified(references);
        }

        // Persist the copied states
        target.store(changes);
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

    /**
     * {@inheritDoc}
     */
    public boolean setNodeReferences(ChangeLog references) {
        ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
        if (changeLog != null) {
            Iterator iterator = references.modifiedRefs();
            while (iterator.hasNext()) {
                changeLog.modified((NodeReferences) iterator.next());
            }
            return true;
        } else {
            return false;
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

     * other items.
     */
    public ItemState getItemState(ItemId id)
            throws NoSuchItemStateException, ItemStateException {

        ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
        if (changeLog != null) {
            return changeLog.get(id);
        }
        throw new NoSuchItemStateException("State not in change log: " + id);
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

    /**
     * {@inheritDoc}
     */
    public boolean hasItemState(ItemId id) {
        ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
        if (changeLog != null) {
            return changeLog.has(id);
        }
        return false;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

     * {@inheritDoc}
     */
    public NodeReferences getNodeReferences(NodeReferencesId id)
            throws NoSuchItemStateException, ItemStateException {

        ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
        if (changeLog != null) {
            return changeLog.get(id);
        }
        return null;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

    /**
     * {@inheritDoc}
     */
    public boolean hasNodeReferences(NodeReferencesId id) {
        ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
        if (changeLog != null) {
            return changeLog.get(id) != null;
        }
        return false;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

     */
    ChangeLogRecord(int identifier, Record record, String workspace) {
        super(record, workspace);

        this.identifier = identifier;
        this.changes = new ChangeLog();
        this.events = new ArrayList();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

                log.warn(msg);
                return;
            }

            List events = update.getEvents();
            ChangeLog changes = update.getChanges();
            boolean succeeded = false;

            try {
                ChangeLogRecord clr = new ChangeLogRecord(changes, events,
                        record, workspace, update.getTimestamp(),
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

                log.warn(msg);
                return;
            }

            List<EventState> events = update.getEvents();
            ChangeLog changes = update.getChanges();
            boolean succeeded = false;

            try {
                ChangeLogRecord clr = new ChangeLogRecord(changes, events,
                        record, workspace, update.getTimestamp(),
View Full Code Here

Examples of org.apache.jackrabbit.core.state.ChangeLog

        NodeState n2 = createNodeState();
        NodeState n3 = createNodeState();
        PropertyState p1 = createPropertyState(n1.getNodeId(), "{}a");
        PropertyState p2 = createPropertyState(n2.getNodeId(), "{}b");

        ChangeLog changes = new ChangeLog();
        changes.added(n1);
        changes.added(p1);
        changes.deleted(p2);
        changes.modified(n2);
        changes.deleted(n3);

        List events = new ArrayList();
        events.add(createEventState(n1, Event.NODE_ADDED, "{}n1"));
        events.add(createEventState(p1, n1, Event.PROPERTY_ADDED));
        events.add(createEventState(p2, n2, Event.PROPERTY_REMOVED));
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.