// non-protected items because a mixin has been removed from the parent
// node state.
// see also: JCR-2408
if (state.getStatus() == ItemState.STATUS_EXISTING_REMOVED
&& state.getName().equals(NameConstants.JCR_UUID)) {
NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
QPropertyDefinition def = ntReg.getEffectiveNodeType(
NameConstants.MIX_REFERENCEABLE).getApplicablePropertyDef(
state.getName(), state.getType());
return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
}
try {
// retrieve parent in 2 steps in order to avoid the check for
// read permissions on the parent which isn't required in order
// to read the property's definition. see also JCR-2418.
ItemData parentData = getItemData(state.getParentId(), null, false);
NodeImpl parent = (NodeImpl) createItemInstance(parentData);
return parent.getApplicablePropertyDefinition(
state.getName(), state.getType(), state.isMultiValued(), true);
} catch (ItemNotFoundException e) {
// parent probably removed, get it from attic
}
try {
NodeState parent = (NodeState) sism.getAttic().getItemState(
state.getParentId()).getOverlayedState();
NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
EffectiveNodeType ent = ntReg.getEffectiveNodeType(
parent.getNodeTypeName(), parent.getMixinTypeNames());
QPropertyDefinition def;
try {
def = ent.getApplicablePropertyDef(
state.getName(), state.getType(), state.isMultiValued());
} catch (ConstraintViolationException e) {
ent = ntReg.getEffectiveNodeType(NameConstants.NT_UNSTRUCTURED);
def = ent.getApplicablePropertyDef(state.getName(),
state.getType(), state.isMultiValued());
log.warn("Fallback to nt:unstructured due to unknown property " +
"definition for '" + state.getName() + "'");
}