Examples of CmisNameConstraintViolationException


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

                millisToCalendar(System.currentTimeMillis()), context.getUsername(), properties);

        // check the name
        String name = getStringProperty(properties, PropertyIds.NAME);
        if (!isValidName(name)) {
            throw new CmisNameConstraintViolationException("Name is not valid!");
        }

        // get parent File
        File parent = getFile(folderId);
        if (!parent.isDirectory()) {
            throw new CmisObjectNotFoundException("Parent is not a folder!");
        }

        // check the file
        File newFile = new File(parent, name);
        if (newFile.exists()) {
            throw new CmisNameConstraintViolationException("Document already exists!");
        }

        // create the file
        try {
            newFile.createNewFile();
View Full Code Here

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

        if (properties != null) {
            // find new name
            String newName = getStringProperty(properties, PropertyIds.NAME);
            if (newName != null) {
                if (!isValidName(newName)) {
                    throw new CmisNameConstraintViolationException("Name is not valid!");
                }
                name = newName;
            }

            // get the property definitions
            TypeDefinition type = types.getType(typeId);
            if (type == null) {
                throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
            }

            // replace with new values
            for (PropertyData<?> prop : properties.getProperties().values()) {
                PropertyDefinition<?> propType = type.getPropertyDefinitions().get(prop.getId());

                // do we know that property?
                if (propType == null) {
                    throw new CmisConstraintException("Property '" + prop.getId() + "' is unknown!");
                }

                // can it be set?
                if ((propType.getUpdatability() != Updatability.READWRITE)) {
                    throw new CmisConstraintException("Property '" + prop.getId() + "' cannot be updated!");
                }

                // empty properties are invalid
                if (isEmptyProperty(prop)) {
                    throw new CmisConstraintException("Property '" + prop.getId() + "' must not be empty!");
                }

                newProperties.addProperty(prop);
            }
        }

        addPropertyId(newProperties, typeId, null, PropertyIds.OBJECT_TYPE_ID, typeId);
        addPropertyString(newProperties, typeId, null, PropertyIds.CREATED_BY, context.getUsername());
        addPropertyDateTime(newProperties, typeId, null, PropertyIds.CREATION_DATE,
                millisToCalendar(System.currentTimeMillis()));
        addPropertyString(newProperties, typeId, null, PropertyIds.LAST_MODIFIED_BY, context.getUsername());

        // check the file
        File newFile = new File(parent, name);
        if (newFile.exists()) {
            throw new CmisNameConstraintViolationException("Document already exists.");
        }

        // create the file
        try {
            newFile.createNewFile();
View Full Code Here

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

                millisToCalendar(System.currentTimeMillis()), context.getUsername(), properties);

        // check the name
        String name = getStringProperty(properties, PropertyIds.NAME);
        if (!isValidName(name)) {
            throw new CmisNameConstraintViolationException("Name is not valid.");
        }

        // get parent File
        File parent = getFile(folderId);
        if (!parent.isDirectory()) {
View Full Code Here

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

        // get and check the new name
        String newName = getStringProperty(properties, PropertyIds.NAME);
        boolean isRename = (newName != null) && (!file.getName().equals(newName));
        if (isRename && !isValidName(newName)) {
            throw new CmisNameConstraintViolationException("Name is not valid!");
        }

        // get old properties
        PropertiesImpl oldProperties = new PropertiesImpl();
        readCustomProperties(file, oldProperties, null, new ObjectInfoImpl());
View Full Code Here

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

            fObjStore.lock();
            boolean hasChild;
            String name = folder.getName();
            hasChild = hasChild(name);
            if (hasChild) {
                throw new CmisNameConstraintViolationException("Cannot create folder " + name + ". Name already exists in parent folder");
            }
            folder.setParent(this);
        } finally {
            fObjStore.unlock();
        }
View Full Code Here

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

            }

            boolean hasChild;
            hasChild = hasChild(name);
            if (hasChild) {
                throw new CmisNameConstraintViolationException(
                        "Cannot create object: " + name + ". Name already exists in parent folder");
            }

            if (so instanceof SingleFiling) {
                ((SingleFiling) so).setParent(this);
View Full Code Here

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

            for (Folder folder : fParents) {
              if (folder == null) {
                throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
            }
              if (folder.hasChild(newName)) {
                throw new CmisNameConstraintViolationException("Cannot rename object to " + newName
                          + ". This path already exists in parent " + folder.getPath() + ".");
            }
            }
            setName(newName);
        } finally {
View Full Code Here

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

            } else if (CmisVersioningException.EXCEPTION_NAME.equals(exception)) {
                return new CmisVersioningException(message, errorContent, t);
            } else if (CmisUpdateConflictException.EXCEPTION_NAME.equals(exception)) {
                return new CmisUpdateConflictException(message, errorContent, t);
            } else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equals(exception)) {
                return new CmisNameConstraintViolationException(message, errorContent, t);
            }
            return new CmisConstraintException(message, errorContent, t);
        default:
            if (CmisStorageException.EXCEPTION_NAME.equals(exception)) {
                return new CmisStorageException(message, errorContent, t);
View Full Code Here

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

            } else if (CmisVersioningException.EXCEPTION_NAME.equals(exception)) {
                return new CmisVersioningException(message, errorContent, t);
            } else if (CmisUpdateConflictException.EXCEPTION_NAME.equals(exception)) {
                return new CmisUpdateConflictException(message, errorContent, t);
            } else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equals(exception)) {
                return new CmisNameConstraintViolationException(message, errorContent, t);
            }
            return new CmisConstraintException(message, errorContent, t);
        default:
            if (CmisStorageException.EXCEPTION_NAME.equals(exception)) {
                return new CmisStorageException(message, errorContent, t);
View Full Code Here

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

                } else if (CmisFilterNotValidException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisFilterNotValidException(message, errorContent, t);
                } else if (CmisInvalidArgumentException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisInvalidArgumentException(message, errorContent, t);
                } else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisNameConstraintViolationException(message, errorContent, t);
                } else if (CmisNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisNotSupportedException(message, errorContent, t);
                } else if (CmisObjectNotFoundException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisObjectNotFoundException(message, errorContent, t);
                } else if (CmisPermissionDeniedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.