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

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


            readUnlock();
        }

        // we still don't know the path ... it's not a CMIS compliant repository
        if (path == null) {
            throw new CmisRuntimeException("Repository didn't return " + PropertyIds.PATH + "!");
        }

        return path;
    }
View Full Code Here


        ObjectData bindingParent = getBinding().getNavigationService().getFolderParent(getRepositoryId(), objectId,
                getPropertyQueryName(PropertyIds.OBJECT_ID), null);

        if (bindingParent.getProperties() == null) {
            // should not happen...
            throw new CmisRuntimeException("Repository sent invalid data!");
        }

        // get id property
        PropertyData<?> idProperty = bindingParent.getProperties().getProperties().get(PropertyIds.OBJECT_ID);
        if (!(idProperty instanceof PropertyId)) {
            // the repository sent an object without a valid object id...
            throw new CmisRuntimeException("Repository sent invalid data! No object id!");
        }

        // fetch the object and make sure it is a folder
        CmisObject parentFolder = getSession().getObject((String) idProperty.getFirstValue(), context);
        if (!(parentFolder instanceof Folder)) {
            // the repository sent an object that is not a folder...
            throw new CmisRuntimeException("Repository sent invalid data! Object is not a folder!");
        }

        return Collections.singletonList((Folder) parentFolder);
    }
View Full Code Here

        List<Folder> parents = new ArrayList<Folder>();

        for (ObjectParentData p : bindingParents) {
            if ((p == null) || (p.getObject() == null) || (p.getObject().getProperties() == null)) {
                // should not happen...
                throw new CmisRuntimeException("Repository sent invalid data!");
            }

            // get id property
            PropertyData<?> idProperty = p.getObject().getProperties().getProperties().get(PropertyIds.OBJECT_ID);
            if (!(idProperty instanceof PropertyId)) {
                // the repository sent an object without a valid object id...
                throw new CmisRuntimeException("Repository sent invalid data! No object id!");
            }

            // fetch the object and make sure it is a folder
            CmisObject parentFolder = getSession().getObject((String) idProperty.getFirstValue(), context);
            if (!(parentFolder instanceof Folder)) {
                // the repository sent an object that is not a folder...
                throw new CmisRuntimeException("Repository sent invalid data! Object is not a folder!");
            }

            parents.add((Folder) parentFolder);
        }
View Full Code Here

        List<String> paths = new ArrayList<String>();

        for (ObjectParentData p : bindingParents) {
            if ((p == null) || (p.getObject() == null) || (p.getObject().getProperties() == null)) {
                // should not happen...
                throw new CmisRuntimeException("Repository sent invalid data!");
            }

            // get path property
            PropertyData<?> pathProperty = p.getObject().getProperties().getProperties().get(PropertyIds.PATH);
            if (!(pathProperty instanceof PropertyString)) {
                // the repository sent a folder without a valid path...
                throw new CmisRuntimeException("Repository sent invalid data! No path property!");
            }

            if (p.getRelativePathSegment() == null) {
                // the repository didn't send a relative path segment
                throw new CmisRuntimeException("Repository sent invalid data! No relative path segement!");
            }

            String folderPath = ((String) pathProperty.getFirstValue());
            paths.add(folderPath + (folderPath.endsWith("/") ? "" : "/") + p.getRelativePathSegment());
        }
View Full Code Here

            return null;
        }

        CmisObject movedObject = getSession().getObject(objectIdHolder.getValue(), context);
        if (!(movedObject instanceof FileableCmisObject)) {
            throw new CmisRuntimeException("Moved object is invalid!");
        }

        return (FileableCmisObject) movedObject;
    }
View Full Code Here

            return null;
        }
        // get the new object
        CmisObject object = getSession().getObject(newId, context);
        if (!(object instanceof Document)) {
            throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
        }

        return (Document) object;
    }
View Full Code Here

        } finally {
            readUnlock();
        }

        if (versionSeriesId == null) {
            throw new CmisRuntimeException("Version series id is unknown!");
        }

        ObjectData objectData = getBinding().getVersioningService().getObjectOfLatestVersion(getRepositoryId(),
                objectId, versionSeriesId, major, context.getFilterString(), context.isIncludeAllowableActions(),
                context.getIncludeRelationships(), context.getRenditionFilterString(), context.isIncludePolicies(),
                context.isIncludeAcls(), null);

        ObjectFactory objectFactory = getSession().getObjectFactory();

        CmisObject result = objectFactory.convertObject(objectData, context);
        if (!(result instanceof Document)) {
            throw new CmisRuntimeException("Latest version is not a document!");
        }

        return (Document) result;
    }
View Full Code Here

            break;
        }

        // check new object id
        if (newId == null) {
            throw new CmisRuntimeException("Creation failed!");
        }

        // return the new object id
        return newId;
    }
View Full Code Here

     * @return the collected object info
     */
    protected ObjectInfo getObjectInfoIntern(String repositoryId, ObjectData object) {
        // if the object has no properties, stop here
        if (object.getProperties() == null || object.getProperties().getProperties() == null) {
            throw new CmisRuntimeException("No properties!");
        }

        ObjectInfoImpl info = new ObjectInfoImpl();

        // get the repository info
View Full Code Here

                    .setAllowedTargetTypes(((CmisTypeRelationshipDefinitionType) typeDefinition)
                            .getAllowedTargetTypes());
        } else if (typeDefinition instanceof CmisTypePolicyDefinitionType) {
            result = new PolicyTypeDefinitionImpl();
        } else {
            throw new CmisRuntimeException("Type '" + typeDefinition.getId() + "' does not match a base type!");
        }

        result.setBaseTypeId(convert(BaseTypeId.class, typeDefinition.getBaseId()));
        result.setDescription(typeDefinition.getDescription());
        result.setDisplayName(typeDefinition.getDisplayName());
View Full Code Here

TOP

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

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.