use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class TransientItemStateManager method createNewPropertyState.
/**
* Creates a new transient property state for a given <code>parent</code>
* node state.
*
* @param propName the name of the property state to create.
* @param parent the node state where to the new property is added.
* @param definition
* @return the created property state.
* @throws ItemExistsException if <code>parent</code> already has a property
* with the given name.
* @throws ConstraintViolationException
* @throws RepositoryException
*/
PropertyState createNewPropertyState(Name propName, NodeState parent, QPropertyDefinition definition, QValue[] values, int propertyType) throws ItemExistsException, ConstraintViolationException, RepositoryException {
// NOTE: callers must make sure, the property type is not 'undefined'
NodeEntry nodeEntry = (NodeEntry) parent.getHierarchyEntry();
PropertyEntry pe = nodeEntry.addNewPropertyEntry(propName, definition, values, propertyType);
try {
parent.markModified();
} catch (RepositoryException e) {
pe.remove();
throw e;
}
return pe.getPropertyState();
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class WorkspaceItemStateFactory method getAncestor.
/**
* @param entry
* @param degree
* @return the ancestor entry at the specified degree.
*/
private static NodeEntry getAncestor(HierarchyEntry entry, int degree) {
NodeEntry parent = entry.getParent();
degree--;
while (parent != null && degree > 0) {
parent = parent.getParent();
degree--;
}
if (degree != 0) {
log.error("Parent of degree {} does not exist.", degree);
throw new IllegalArgumentException();
}
return parent;
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class RemoveLabel method persisted.
/**
* Invalidates the jcr:versionLabel nodestate present with the given
* version history and all decendant states (property states).
*
* @see Operation#persisted()
*/
public void persisted() throws RepositoryException {
status = STATUS_PERSISTED;
try {
NodeEntry vhEntry = (NodeEntry) versionHistoryState.getHierarchyEntry();
NodeEntry lnEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
if (lnEntry != null) {
lnEntry.invalidate(true);
}
} catch (RepositoryException e) {
log.debug(e.getMessage());
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class ResolveMergeConflict method persisted.
/**
* Invalidates the <code>NodeState</code> that had a merge conflict pending
* and all its child properties.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
// non-recursive invalidation BUT including all properties
Iterator<PropertyEntry> propEntries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
while (propEntries.hasNext()) {
PropertyEntry pe = propEntries.next();
pe.invalidate(false);
}
nodeState.getHierarchyEntry().invalidate(false);
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class ItemImpl method getParent.
/**
* @see Item#getParent()
*/
public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
checkStatus();
// special treatment for root node
if (state.isNode() && ((NodeState) state).isRoot()) {
String msg = "Root node doesn't have a parent.";
log.debug(msg);
throw new ItemNotFoundException(msg);
}
NodeEntry parentEntry = getItemState().getHierarchyEntry().getParent();
return (Node) getItemManager().getItem(parentEntry);
}
Aggregations