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

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


    /**
     * Throws an exception if the given path is <code>null</code> or invalid.
     */
    protected void checkPath(String name, String path) {
        if (path == null) {
            throw new CmisInvalidArgumentException(name + " must be set!");
        }

        if (path.length() == 0) {
            throw new CmisInvalidArgumentException(name + " must not be empty!");
        }

        if (path.charAt(0) != '/') {
            throw new CmisInvalidArgumentException(name + " must start with '/'!");
        }
    }
View Full Code Here


    /**
     * Throws an exception if the given properties set is <code>null</code>.
     */
    protected void checkProperties(Properties properties) {
        if (properties == null) {
            throw new CmisInvalidArgumentException("Properties must be set!");
        }
    }
View Full Code Here

    /**
     * Throws an exception if the given property isn't set or of the wrong type.
     */
    protected void checkProperty(Properties properties, String propertyId, Class<?> clazz) {
        if (properties.getProperties() == null) {
            throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
        }

        PropertyData<?> property = properties.getProperties().get(propertyId);
        if (property == null) {
            throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
        }

        Object value = property.getFirstValue();
        if (value == null) {
            throw new CmisInvalidArgumentException("Property " + propertyId + " must have a value!");
        }

        if (!clazz.isAssignableFrom(value.getClass())) {
            throw new CmisInvalidArgumentException("Property " + propertyId + " has the wrong type!");
        }
    }
View Full Code Here

    /**
     * Throws an exception if the given content object is <code>null</code>.
     */
    protected void checkContentStream(ContentStream content) {
        if (content == null) {
            throw new CmisInvalidArgumentException("Content must be set!");
        }
    }
View Full Code Here

     * Throws an exception if the given query statement is <code>null</code> or
     * empty.
     */
    protected void checkQueryStatement(String statement) {
        if (statement == null) {
            throw new CmisInvalidArgumentException("Statement must be set!");
        }

        if (statement.length() == 0) {
            throw new CmisInvalidArgumentException("Statement must not be empty!");
        }
    }
View Full Code Here

        if (maxItems == null) {
            return defaultTypesMaxItems;
        }

        if (maxItems.compareTo(BigInteger.ZERO) == -1) {
            throw new CmisInvalidArgumentException("maxItems must not be negative!");
        }

        return maxItems;
    }
View Full Code Here

        if (depth == null) {
            return defaultTypesDepth;
        }

        if (depth.compareTo(BigInteger.ZERO) == 0) {
            throw new CmisInvalidArgumentException("depth must not be 0!");
        }

        if (depth.compareTo(MINUS_ONE) == -1) {
            throw new CmisInvalidArgumentException("depth must not be <-1!");
        }

        return depth;
    }
View Full Code Here

        if (maxItems == null) {
            return defaultMaxItems;
        }

        if (maxItems.compareTo(BigInteger.ZERO) == -1) {
            throw new CmisInvalidArgumentException("maxItems must not be negative!");
        }

        return maxItems;
    }
View Full Code Here

        if (skipCount == null) {
            return BigInteger.ZERO;
        }

        if (skipCount.compareTo(BigInteger.ZERO) == -1) {
            throw new CmisInvalidArgumentException("skipCount must not be negative!");
        }

        return skipCount;
    }
View Full Code Here

        if (depth == null) {
            return defaultDepth;
        }

        if (depth.compareTo(BigInteger.ZERO) == 0) {
            throw new CmisInvalidArgumentException("depth must not be 0!");
        }

        if (depth.compareTo(MINUS_ONE) == -1) {
            throw new CmisInvalidArgumentException("depth must not be <-1!");
        }

        return depth;
    }
View Full Code Here

TOP

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

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.