use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class AccessControlManagerImpl method setMixin.
private void setMixin(NodeState parent, Name mixinName) throws RepositoryException {
if (!isNodeType(parent, mixinName)) {
Operation sm = SetMixin.create(parent, new Name[] { mixinName });
itemStateMgr.execute(sm);
} else {
log.debug(mixinName.toString() + " is already present on the given node state " + parent.getName().toString());
}
}
use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class AccessControlManagerImpl method addNode.
private NodeState addNode(SetTree treeOperation, NodeState parent, Name nodeName, String uuid, Name nodeTypeName) throws RepositoryException {
Operation sp = treeOperation.addChildNode(parent, nodeName, nodeTypeName, uuid);
itemStateMgr.execute(sp);
return (NodeState) ((AddNode) sp).getAddedStates().get(0);
}
use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class ChangeLog method persisted.
//-----------------------------------------------< Inform the ChangeLog >---
/**
* Call this method when this change log has been successfully persisted.
* This implementation will call {@link Operation#persisted()} on the
* individual operations followed by setting all remaining modified
* states to EXISTING.
*/
public void persisted() throws RepositoryException {
List<NodeState> changedMixins = new ArrayList<NodeState>();
List<NodeState> changedPrimaryTypes = new ArrayList<NodeState>();
Operation[] ops = operations.toArray(new Operation[operations.size()]);
for (int i = 0; i < ops.length; i++) {
ops[i].persisted();
if (ops[i] instanceof SetMixin) {
changedMixins.add(((SetMixin) ops[i]).getNodeState());
} else if (ops[i] instanceof SetPrimaryType) {
changedPrimaryTypes.add(((SetPrimaryType) ops[i]).getNodeState());
}
}
// operation persistence.
for (ItemState state : affectedStates) {
HierarchyEntry he = state.getHierarchyEntry();
switch(state.getStatus()) {
case Status.EXISTING_MODIFIED:
state.setStatus(Status.EXISTING);
if (state.isNode()) {
if (changedPrimaryTypes.contains(state)) {
// primary type changed for a node -> force reloading upon next
// access in order to be aware of modified definition etc...
he.invalidate(true);
} else if (changedMixins.contains(state)) {
// mixin changed for a node -> force reloading upon next
// access in order to be aware of modified uniqueID.
he.invalidate(false);
}
}
break;
case Status.EXISTING_REMOVED:
he.remove();
break;
case Status.NEW:
// illegal. should not get here.
log.error("ChangeLog still contains NEW state: " + state.getName());
state.setStatus(Status.EXISTING);
break;
case Status.MODIFIED:
case Status._UNDEFINED_:
case Status.STALE_DESTROYED:
case Status.STALE_MODIFIED:
// illegal.
log.error("ChangeLog contains state (" + state.getName() + ") with illegal status " + Status.getName(state.getStatus()));
break;
case Status.EXISTING:
if (state.isNode() && changedMixins.contains(state)) {
// mixin changed for a node -> force reloading upon next
// access in order to be aware of modified uniqueID.
he.invalidate(false);
}
// otherwise: ignore. operations already have been completed
break;
case Status.INVALIDATED:
case Status.REMOVED:
he.invalidate(false);
break;
}
}
}
use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class VersionManagerImpl method restore.
public void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting) throws RepositoryException {
Operation op = Restore.create(nodeState, relativePath, versionState, removeExisting);
workspaceManager.execute(op);
}
use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class VersionManagerImpl method checkout.
public void checkout(NodeState nodeState) throws RepositoryException {
Operation co = Checkout.create(nodeState, this);
workspaceManager.execute(co);
}
Aggregations