}
session.getActionHandler().preRemoveMixin(this, name);
PropertyData propData =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0),
ItemType.PROPERTY);
// create new property data with new values
TransientPropertyData prop =
new TransientPropertyData(propData.getQPath(), propData.getIdentifier(), propData.getPersistedVersion(),
propData.getType(), propData.getParentIdentifier(), propData.isMultiValued(), values);
NodeTypeDataManager ntmanager = session.getWorkspace().getNodeTypesHolder();
// remove mix:versionable stuff
if (ntmanager.isNodeType(Constants.MIX_VERSIONABLE, removedName))
{
removeVersionable();
}
// remove mix:lockable stuff
if (ntmanager.isNodeType(Constants.MIX_LOCKABLE, removedName))
{
removeLockable();
}
// Set mixin property and locally
updateMixin(newMixin);
// Remove mixin nt definition node/properties from this node
QPath ancestorToSave = nodeData().getQPath();
for (PropertyDefinitionData pd : ntmanager.getAllPropertyDefinitions(removedName))
{
ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY);
if (p != null && !p.isNode())
// remove it
dataManager.delete(p, ancestorToSave);
}
for (NodeDefinitionData nd : ntmanager.getAllChildNodeDefinitions(removedName))
{
ItemData n = dataManager.getItemData(nodeData(), new QPathEntry(nd.getName(), 1), ItemType.NODE);
if (n != null && n.isNode())
{
// remove node with subtree
ItemDataRemoveVisitor remover = new ItemDataRemoveVisitor(dataManager, ancestorToSave);
n.accept(remover);