Package org.apache.chemistry.opencmis.commons.exceptions

Examples of org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException


          continue; // ignore system properties for validation
        }

        // Check if all properties are known in the type
        if (!typeContainsProperty(typeDef, propertyId)) {
          throw new CmisConstraintException("Unknown property "
              + propertyId + " in type " + typeDef.getId());
        }

        // check all type specific constraints:
        PropertyDefinition<T> propDef = getPropertyDefinition(typeDef,
            propertyId);
        PropertyValidator<T> validator = createPropertyValidator(propDef);
        validator.validate(propDef, (PropertyData<T>) prop);
      }
        }

        if (checkMandatory && !propDefsRequired.isEmpty()) {
            throw new CmisConstraintException("The following mandatory properties are missing: " + propDefsRequired);
        }
    }
View Full Code Here


        if (null == verState) {
            return;
        }
        if (typeDef.isVersionable() && verState.equals(VersioningState.NONE) || !typeDef.isVersionable()
                && !verState.equals(VersioningState.NONE)) {
            throw new CmisConstraintException("The versioning state flag is imcompatible to the type definition.");
        }

    }
View Full Code Here

         for (String allowedType : allowedTypes) {
             if (allowedType.equals(typeDef.getId()))
                 return;
         }
         throw new CmisConstraintException("The requested type " + typeDef.getId() + " is not allowed " + description);
     }
View Full Code Here

      
    public static void  validateAcl(TypeDefinition typeDef, Acl addACEs, Acl removeACEs)
    {
      if (!typeDef.isControllableAcl() && (addACEs != null || removeACEs != null))
      {
        throw new CmisConstraintException("acl set for type: " + typeDef.getDisplayName() + " that is not controllableACL");
      }
    }
View Full Code Here

        public void validate(PropertyDefinition<T> propDef, PropertyData<T> prop) {

            // check general constraints for all property types
            if (propDef.getCardinality() == Cardinality.SINGLE && prop.getValues().size() > 1) {
                throw new CmisConstraintException("The property with id " + propDef.getId()
                        + " is single valued, but multiple values are passed " + prop.getValues());
            }

            if (propDef.getChoices() != null && propDef.getChoices().size() > 0) {
                validateChoices(propDef, prop);
View Full Code Here

                    }
                }
            }

            if (!isAllowedValue) {
                throw new CmisConstraintException("The property with id " + propDef.getId()
                        + " has a fixed set of values. Value(s) " + prop.getValues() + " are not listed.");
            }
        }
View Full Code Here

            BigInteger minVal = ((PropertyIntegerDefinition) propDef).getMinValue();
            BigInteger maxVal = ((PropertyIntegerDefinition) propDef).getMaxValue();

            // check min and max
            if (minVal != null && propVal != null && propVal.compareTo(minVal) == -1) {
                throw new CmisConstraintException("For property with id " + propDef.getId() + " the value " + propVal
                        + " is less than the minimum value " + minVal);
            }
            if (maxVal != null && propVal != null && propVal.compareTo(maxVal) == 1) {
                throw new CmisConstraintException("For property with id " + propDef.getId() + " the value " + propVal
                        + " is bigger than the maximum value " + maxVal);
            }
        }
View Full Code Here

            BigDecimal minVal = ((PropertyDecimalDefinition) propDef).getMinValue();
            BigDecimal maxVal = ((PropertyDecimalDefinition) propDef).getMaxValue();

            // check min and max
            if (minVal != null && propVal != null && propVal.compareTo(minVal) == -1) {
                throw new CmisConstraintException("For property with id " + propDef.getId() + " the value " + propVal
                        + " is less than the minimum value " + minVal);
            }
            if (maxVal != null && propVal != null && propVal.compareTo(maxVal) == 1) {
                throw new CmisConstraintException("For property with id " + propDef.getId() + " the value " + propVal
                        + " is bigger than the maximum value " + maxVal);
            }
        }
View Full Code Here

            long len = property.getFirstValue() == null ? -1
                    : property.getFirstValue().length();

            // check max length
            if (maxLen >= 0 && len >= 0 && maxLen < len) {
                throw new CmisConstraintException("For property with id " + propDef.getId() + " the length of " + len
                        + "is bigger than the maximum allowed length  " + maxLen);
            }
        }
View Full Code Here

     */
    public JcrPrivateWorkingCopy checkout() {
        Node node = getNode();
        try {
            if (node.isCheckedOut()) {
                throw new CmisConstraintException("Document is already checked out " + getId());
            }

            checkout(node);
            return getPwc();
        }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.