public void save(final int operationType) throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException { if (!isSystem() && getLocale() != null) { for (JCRNodeWrapper node : newNodes.values()) { for (String s : node.getNodeTypes()) { ExtendedPropertyDefinition[] propDefs = NodeTypeRegistry.getInstance().getNodeType(s).getPropertyDefinitions(); for (ExtendedPropertyDefinition propDef : propDefs) { if (propDef.isMandatory() && propDef.getRequiredType() != PropertyType.WEAKREFERENCE && propDef.getRequiredType() != PropertyType.REFERENCE && !propDef.isProtected() && !node.hasProperty(propDef.getName())) { throw new ConstraintViolationException("Mandatory field : " + propDef.getName()); } } } } } newNodes.clear(); JCRObservationManager.doWorkspaceWriteCall( this, operationType, new JCRCallback<Object>() { public Object doInJCR(JCRSessionWrapper thisSession) throws RepositoryException { for (Session session : sessions.values()) { session.save(); } return null; } }); }