DavPropertyName propName = property.getName();
if (JCR_MIXINNODETYPES.equals(propName)) {
Node n = (Node) item;
try {
NodeType[] existingMixin = n.getMixinNodeTypes();
NodeTypeProperty mix = new NodeTypeProperty(property);
Set mixins = mix.getNodeTypeNames();
for (int i = 0; i < existingMixin.length; i++) {
String name = existingMixin[i].getName();
if (mixins.contains(name)){
// do not add existing mixins
mixins.remove(name);
} else {
// remove mixin that are not contained in the new list
n.removeMixin(name);
}
}
// add the remaining mixing types that are not yet set
Iterator it = mixins.iterator();
while (it.hasNext()) {
n.addMixin((String)it.next());
}
} catch (RepositoryException e) {
throw new JcrDavException(e);
}
} else if (JCR_PRIMARYNODETYPE.equals(propName)) {
Node n = (Node) item;
try {
NodeTypeProperty ntProp = new NodeTypeProperty(property);
Set names = ntProp.getNodeTypeNames();
if (names.size() == 1) {
String ntName = names.iterator().next().toString();
n.setPrimaryType(ntName);
} else {
// only a single node type can be primary node type.