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();
int options = ItemStateValidator.CHECK_LOCK | ItemStateValidator.CHECK_VERSIONING;
setPropertyStateValue(pState, getQValues(mixinNames, qValueFactory), PropertyType.NAME, options);
} 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);
int options = ItemStateValidator.CHECK_LOCK | ItemStateValidator.CHECK_VERSIONING;
addPropertyState(nState, pd.getName(), pd.getRequiredType(), mixinValue, pd, options);
}
nState.markModified();
transientStateMgr.addOperation(operation);
} else if (mixinEntry != null) {
// remove the jcr:mixinTypes property state if already present
PropertyState pState = mixinEntry.getPropertyState();
int options = ItemStateValidator.CHECK_LOCK | ItemStateValidator.CHECK_VERSIONING;
removeItemState(pState, options);
nState.markModified();
transientStateMgr.addOperation(operation);