*/
public void visit(SetPrimaryType operation) throws ConstraintViolationException, RepositoryException {
// NOTE: nodestate is only modified upon save of the changes!
Name primaryName = operation.getPrimaryTypeName();
NodeState nState = operation.getNodeState();
NodeEntry nEntry = nState.getNodeEntry();
// detect obvious node type conflicts
EffectiveNodeTypeProvider entProvider = mgrProvider.getEffectiveNodeTypeProvider();
// try to build new effective node type (will throw in case of conflicts)
Name[] mixins = nState.getMixinTypeNames();
List<Name> all = new ArrayList<Name>(Arrays.asList(mixins));
all.add(primaryName);
// retrieve effective to assert validity of arguments
entProvider.getEffectiveNodeType(all.toArray(new Name[all.size()]));
// modify the value of the jcr:primaryType property entry without
// changing the node state itself
PropertyEntry pEntry = nEntry.getPropertyEntry(NameConstants.JCR_PRIMARYTYPE);
PropertyState pState = pEntry.getPropertyState();
setPropertyStateValue(pState, getQValues(new Name[] {primaryName}, qValueFactory), PropertyType.NAME, operation.getOptions());
// mark the affected node state modified and remember the operation
nState.markModified();