use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class SessionItemStateManager method visit.
/**
* @see OperationVisitor#visit(SetMixin)
*/
public void visit(SetMixin operation) throws ConstraintViolationException, AccessDeniedException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
// NOTE: nodestate is only modified upon save of the changes!
Name[] mixinNames = operation.getMixinNames();
NodeState nState = operation.getNodeState();
NodeEntry nEntry = nState.getNodeEntry();
// assert the existence of the property entry and set the array of
// mixinNames to be set on the corresponding property state
PropertyEntry mixinEntry = nEntry.getPropertyEntry(NameConstants.JCR_MIXINTYPES);
if (mixinNames.length > 0) {
// update/create corresponding property state
if (mixinEntry != null) {
// execute value of existing property
PropertyState pState = mixinEntry.getPropertyState();
setPropertyStateValue(pState, getQValues(mixinNames, qValueFactory), PropertyType.NAME, operation.getOptions());
} else {
// create new jcr:mixinTypes property
ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
QPropertyDefinition pd = defProvider.getQPropertyDefinition(nState.getAllNodeTypeNames(), NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true);
QValue[] mixinValue = getQValues(mixinNames, qValueFactory);
addPropertyState(nState, pd.getName(), pd.getRequiredType(), mixinValue, pd, operation.getOptions());
}
nState.markModified();
transientStateMgr.addOperation(operation);
} else if (mixinEntry != null) {
// remove the jcr:mixinTypes property state if already present
PropertyState pState = mixinEntry.getPropertyState();
removeItemState(pState, operation.getOptions());
nState.markModified();
transientStateMgr.addOperation(operation);
}
// else: empty Name array and no mixin-prop-entry (should not occur)
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class NodeImpl method hasProperty.
/**
* @see Node#hasProperty(String)
*/
public boolean hasProperty(String relPath) throws RepositoryException {
checkStatus();
PropertyEntry childEntry = resolveRelativePropertyPath(relPath);
return (childEntry != null) && getItemManager().itemExists(childEntry);
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class RemoveVersion method persisted.
/**
* Invalidates the <code>NodeState</code> that has been updated and all
* its descendants. Second, the parent state gets invalidated.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
// Invalidate the versionable node as well (version related properties)
if (versionableEntry != null) {
Iterator<PropertyEntry> propEntries = versionableEntry.getPropertyEntries();
while (propEntries.hasNext()) {
PropertyEntry pe = propEntries.next();
pe.invalidate(false);
}
versionableEntry.invalidate(false);
}
// invalidate the versionhistory entry and all its children
// in order to have the v-graph recalculated
parent.getNodeEntry().invalidate(true);
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry 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