Examples of CmisUpdateConflictException


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

            File parent = file.getParentFile();
            File propFile = getPropertiesFile(file);
            newFile = new File(parent, newName);
            if (!file.renameTo(newFile)) {
                // if something went wrong, throw an exception
                throw new CmisUpdateConflictException("Could not rename object!");
            } else {
                // set new id
                objectId.setValue(getId(newFile));

                // if it is a file, rename properties file too
View Full Code Here

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

        // check properties for validity
        TypeValidator.validateProperties(typeDef, properties, false);

        if (changeToken != null && changeToken.getValue() != null
                && Long.valueOf(so.getChangeToken()) > Long.valueOf(changeToken.getValue())) {
            throw new CmisUpdateConflictException(" updateProperties failed: outdated changeToken");
        }

        // update properties
        boolean hasUpdatedName = false;
        boolean hasUpdatedOtherProps = false;
View Full Code Here

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

        } else {
            content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
        }

        if (verDoc.isCheckedOut()) {
            throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
        }

        String user = context.getUsername();
        checkHasUser(user);
View Full Code Here

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

            if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equals(exception)) {
                return new CmisContentAlreadyExistsException(message, errorContent, t);
            } 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:
View Full Code Here

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

        }
    }

    protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
        if (!user.equals(verDoc.getCheckedOutBy())) {
            throw new CmisUpdateConflictException("User " + verDoc.getCheckedOutBy()
                    + " has checked out the document.");
        }
    }
View Full Code Here

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

        }
    }

    protected void testIsCheckedOut(VersionedDocument verDoc) {
        if (!verDoc.isCheckedOut()) {
            throw new CmisUpdateConflictException("Document " + verDoc.getId() + " is not checked out.");
        }
    }
View Full Code Here

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

        // check properties for validity
        TypeValidator.validateProperties(typeDef, properties, false);

        if (changeToken != null && changeToken.getValue() != null
                && Long.valueOf(so.getChangeToken()) > Long.valueOf(changeToken.getValue())) {
            throw new CmisUpdateConflictException(" updateProperties failed: outdated changeToken");
        }

        // update properties
        boolean hasUpdatedName = false;
        boolean hasUpdatedOtherProps = false;

        for (String key : properties.getProperties().keySet()) {
            if (key.equals(PropertyIds.NAME))
            {
                continue; // ignore here
            }

            PropertyData<?> value = properties.getProperties().get(key);
            PropertyDefinition<?> propDef = typeDef.getPropertyDefinitions().get(key);
            if (value.getValues() == null || value.getFirstValue() == null) {
                // delete property
                // check if a required a property
                if (propDef.isRequired()) {
                    throw new CmisConstraintException(
                            "updateProperties failed, following property can't be deleted, because it is required: "
                                    + key);
                }
                oldProperties.remove(key);
                hasUpdatedOtherProps = true;
            } else {
                if (propDef.getUpdatability().equals(Updatability.WHENCHECKEDOUT)) {
                    if (!isCheckedOut)
                        throw new CmisUpdateConflictException(
                                "updateProperties failed, following property can't be updated, because it is not checked-out: "
                                        + key);
                } else if (!propDef.getUpdatability().equals(Updatability.READWRITE)) {
                    throw new CmisConstraintException(
                            "updateProperties failed, following property can't be updated, because it is not writable: "
View Full Code Here

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

            if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equals(exception)) {
                return new CmisContentAlreadyExistsException(message, errorContent, t);
            } 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:
View Full Code Here

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

        } else {
            content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
        }

        if (verDoc.isCheckedOut()) {
            throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
        }

        String user = context.getUsername();
        checkHasUser(user);
View Full Code Here

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

                } else if (CmisStorageException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisStorageException(message, errorContent, t);
                } else if (CmisStreamNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisStreamNotSupportedException(message, errorContent, t);
                } else if (CmisUpdateConflictException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisUpdateConflictException(message, errorContent, t);
                } else if (CmisVersioningException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
                    return new CmisVersioningException(message, errorContent, t);
                }
            }
        }
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.