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

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


        // 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

        case FILTER_NOT_VALID:
            return new CmisFilterNotValidException(msg, code);
        case INVALID_ARGUMENT:
            return new CmisInvalidArgumentException(msg, code);
        case NAME_CONSTRAINT_VIOLATION:
            return new CmisNameConstraintViolationException(msg, code);
        case NOT_SUPPORTED:
            return new CmisNotSupportedException(msg, code);
        case OBJECT_NOT_FOUND:
            return new CmisObjectNotFoundException(msg, code);
        case PERMISSION_DENIED:
View Full Code Here

            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

            }

            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

            fObjStore.lock();
            if (getParent() == null) {
                throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
            }
            if (getParent().hasChild(newName)) {
                throw new CmisNameConstraintViolationException("Cannot rename object to " + newName
                        + ". This path already exists.");
            }

            setName(newName);
        } finally {
View Full Code Here

        }

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

        // get parent Node and create child
        JcrFolder parent = getJcrNode(session, folderId).asFolder();
        JcrNode jcrNode = parent.addNode(name, typeId, properties, contentStream, versioningState);
View Full Code Here

        }

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

        // get parent Node
        JcrFolder parent = getJcrNode(session, folderId).asFolder();
        JcrNode jcrNode = parent.addFolder(name, typeId, properties);
View Full Code Here

            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

                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

TOP

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

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.