use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class Restore method persisted.
/**
* In case of a workspace-restore or 'removeExisting' the complete tree gets
* invalidated, otherwise the given <code>NodeState</code> that has been
* updated and all its descendants.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
NodeEntry entry;
if (nodeState == null || removeExisting) {
// invalidate the complete tree
// -> start searching root-entry from any version-entry or
// from the given nodestate
entry = (nodeState == null) ? versionStates[0].getNodeEntry() : nodeState.getNodeEntry();
while (entry.getParent() != null) {
entry = entry.getParent();
}
} else {
entry = nodeState.getNodeEntry();
}
entry.invalidate(true);
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class WorkspaceImport method persisted.
/**
* Invalidates the <code>NodeState</code> that has been updated and all
* its descendants.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
NodeEntry entry;
if (uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING || uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) {
// invalidate the complete tree
entry = nodeState.getNodeEntry();
while (entry.getParent() != null) {
entry = entry.getParent();
}
entry.invalidate(true);
} else {
// import only added new items below the import target. therefore
// recursive invalidation is not required. // TODO correct?
nodeState.getNodeEntry().invalidate(false);
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class AddLabel method persisted.
/**
* Invalidates the jcr:versionLabel nodestate present with the given
* version history. If '<code>moveLabel</code>' is true, all descendant states
* (property states) are invalidated as well.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
try {
NodeEntry vhEntry = (NodeEntry) versionHistoryState.getHierarchyEntry();
NodeEntry lnEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
if (lnEntry != null) {
lnEntry.invalidate(moveLabel);
}
} catch (RepositoryException e) {
log.debug(e.getMessage());
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class Merge method persisted.
/**
* Invalidates the target nodestate and all descendants.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
if (isActivityMerge()) {
// TODO be more specific about what needs to be invalidated
// look for the root entry and invalidate the complete tree
HierarchyEntry entry = nodeState.getNodeEntry();
while (entry.getParent() != null) {
entry = entry.getParent();
}
entry.invalidate(true);
} else {
try {
NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
if (vhe != null) {
vhe.invalidate(true);
}
} catch (RepositoryException e) {
log.warn("Error while retrieving VersionHistory entry: {}", e.getMessage());
}
nodeState.getHierarchyEntry().invalidate(true);
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class ItemStateValidator method checkCollision.
/**
*
* @param parentState
* @param propertyName
* @throws ItemExistsException
* @throws RepositoryException
*/
private void checkCollision(NodeState parentState, Name propertyName) throws ItemExistsException, RepositoryException {
NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
// NOTE: check for name collisions with existing child node has been
// removed as with JSR 283 having same-named node and property can be
// allowed. thus delegate the corresponding 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
}
}
}
Aggregations