private void checkStatus(int expectedStatus, String message) throws ConstraintViolationException { if (status != expectedStatus) { throw new ConstraintViolationException(message); } }
public Property setProperty(String name, Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException { throw new ConstraintViolationException("jcr:versionStorage is protected"); }
public Property setProperty(String name, InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException { throw new ConstraintViolationException("jcr:versionStorage is protected"); }
public void update(String srcWorkspaceName) throws NoSuchWorkspaceException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException { throw new ConstraintViolationException("jcr:versionStorage is protected"); }
/** * Always throws a {@link javax.jcr.nodetype.ConstraintViolationException} since this node * is protected. * * @throws javax.jcr.nodetype.ConstraintViolationException */ @Override public void update(String srcWorkspaceName) throws ConstraintViolationException { String msg = "update operation not allowed: " + this; log.debug(msg); throw new ConstraintViolationException(msg); }
/** * Always throws a {@link javax.jcr.nodetype.ConstraintViolationException} since this node * is protected. * * @throws javax.jcr.nodetype.ConstraintViolationException */ @Override public void update(String srcWorkspaceName) throws ConstraintViolationException { String msg = "update operation not allowed: " + this; log.debug(msg); throw new ConstraintViolationException(msg); }
/** * Always throws a {@link javax.jcr.nodetype.ConstraintViolationException} since this node * is protected. * * @throws javax.jcr.nodetype.ConstraintViolationException */ @Override public void update(String srcWorkspaceName) throws ConstraintViolationException { String msg = "update operation not allowed: " + this; log.debug(msg); throw new ConstraintViolationException(msg); }
/** * {@inheritDoc} */ public void setDefaultPrimaryTypeName(String defaultPrimaryType) throws ConstraintViolationException { try { this.defaultPrimaryTypeName = defaultPrimaryType == null ? null : resolver.getQName(defaultPrimaryType); } catch (RepositoryException e) { throw new ConstraintViolationException(e); } }
/** * {@inheritDoc} */ public void setName(String name) throws ConstraintViolationException { try { this.name = resolver.getQName(name); } catch (RepositoryException e) { throw new ConstraintViolationException(e); } }
@Override public void onPasswordChange(@Nonnull User user, String newPassword, @Nonnull Root root, @Nonnull NamePathMapper namePathMapper) throws RepositoryException { if (newPassword == null) { throw new ConstraintViolationException("Expected a new password that is not null."); } String pwHash = getPasswordHash(root, user); if (PasswordUtil.isSame(pwHash, newPassword)) { throw new ConstraintViolationException("New password is identical to the old password."); } }
private static void checkDefinition(NodeInfo nInfo, Name expName, Name expNodeTypeName) throws ConstraintViolationException { if (expName != null && !expName.equals(nInfo.getName())) { // illegal name throw new ConstraintViolationException("Unexpected Node name "+ nInfo.getName() +". Node name should be " + expName + "."); } if (expNodeTypeName != null && !expNodeTypeName.equals(nInfo.getNodeTypeName())) { // illegal name throw new ConstraintViolationException("Unexpected node type " + nInfo.getNodeTypeName() + ". Node type should be " + expNodeTypeName + "."); } }
private static void checkIdMixins(NodeInfo nInfo) throws ConstraintViolationException { // neither explicit id NOR mixin types may be present. Name[] mixins = nInfo.getMixinNames(); NodeId id = nInfo.getId(); if (id != null || mixins != null) { throw new ConstraintViolationException("The node represented by NodeInfo " + nInfo + " may neither be referenceable nor have mixin types."); } }
private static void checkIdMixins(NodeInfo nInfo) throws ConstraintViolationException { // neither explicit id NOR mixin types may be present. Name[] mixins = nInfo.getMixinNames(); NodeId id = nInfo.getId(); if (id != null || mixins != null) { throw new ConstraintViolationException("The node represented by NodeInfo " + nInfo + " may neither be referenceable nor have mixin types."); } }
public void throwFailure() throws ConstraintViolationException, ItemExistsException { String msg = JcrI18n.unableToAddChildUnderParent.text(childName, childPrimaryType, parentPath, parentPrimaryType, parentMixinTypes, workspaceName, repositoryName, reasons); if (constraintViolation) throw new ConstraintViolationException(msg); throw new ItemExistsException(msg); } }
public void checkProtectedNode(String path) throws RepositoryException { NodeDelegate node = getNode(path); if (node == null) { throw new PathNotFoundException( "Node " + path + " does not exist."); } else if (node.isProtected()) { throw new ConstraintViolationException( "Node " + path + " is protected."); } }
private void checkProtectedProperty(@NotNull Tree parent, @NotNull PropertyState property) throws RepositoryException { ReadOnlyNodeTypeManager nodeTypeManager = authorizable.getUserManager().getNodeTypeManager(); PropertyDefinition def = nodeTypeManager.getDefinition(parent, property, false); if (def.isProtected()) { throw new ConstraintViolationException( "Attempt to set an protected property " + property.getName()); } }
public void checkProtectedNode(String path) throws RepositoryException { NodeDelegate node = getNode(path); if (node == null) { throw new PathNotFoundException( "Node " + path + " does not exist."); } else if (node.isProtected()) { throw new ConstraintViolationException( "Node " + path + " is protected."); } }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }
private void internalSetPrimaryType(final String nodeTypeName) throws RepositoryException { // TODO: figure out the right place for this check NodeType nt = getNodeTypeManager().getNodeType(nodeTypeName); // throws on not found if (nt.isAbstract() || nt.isMixin()) { throw new ConstraintViolationException(getNodePath()); } // TODO: END PropertyState state = PropertyStates.createProperty( JCR_PRIMARYTYPE, getOakName(nodeTypeName), NAME); dlg.setProperty(state, true, true); dlg.setOrderableChildren(nt.hasOrderableChildNodes()); }