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

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


      
        // get required properties
        PropertyData<?> pd = properties.getProperties().get(PropertyIds.SOURCE_ID);
        String sourceId = (String) pd.getFirstValue();
        if (null == sourceId || sourceId.length() == 0)
            throw new CmisInvalidArgumentException("Cannot create a relationship without a sourceId.");
       
        pd = properties.getProperties().get(PropertyIds.TARGET_ID);
        String targetId = (String) pd.getFirstValue();
        if (null == targetId || targetId.length() == 0)
            throw new CmisInvalidArgumentException("Cannot create a relationship without a targetId.");

        RelationshipTypeDefinition typeDef = (RelationshipTypeDefinition) getTypeDefinition(repositoryId, properties);

        // check if the given type is a relationship type
        if (!typeDef.getBaseTypeId().equals(BaseTypeId.CMIS_RELATIONSHIP))
            throw new CmisInvalidArgumentException("Cannot create a relationship, with a non-relationship type: " + typeDef.getId());

       StoredObject[] relationObjects = validator.createRelationship(context, repositoryId, sourceId, targetId, extension);
    
       TypeValidator.validateRequiredSystemProperties(properties);
      
View Full Code Here


        int levels;
        if (depth == null) {
            levels = 2; // one of the recommended defaults (should it be
        } else if (depth.intValue() == 0) {
            throw new CmisInvalidArgumentException("A zero depth is not allowed for getDescendants().");
        } else {
            levels = depth.intValue();
        }

        int level = 0;
View Full Code Here

        Folder folder = null;
        if (so instanceof Folder) {
            folder = (Folder) so;
        } else {
            throw new CmisInvalidArgumentException("Can't get folder parent, id does not refer to a folder: "
                    + folderId);
        }

        ObjectData res = getFolderParentIntern(repositoryId, folder, filter, false,
            IncludeRelationships.NONE, context.getUsername(), context.isObjectInfoRequired() ? objectInfos : null);
        if (res == null) {
            throw new CmisInvalidArgumentException("Cannot get parent of a root folder");
        }

        // To be able to provide all Atom links in the response we need
        // additional information:
        if (context.isObjectInfoRequired()) {
View Full Code Here

        LOG.debug("start getFolderTree()");

        validator.getFolderTree(context, repositoryId, folderId, extension);

        if (depth != null && depth.intValue() == 0) {
            throw new CmisInvalidArgumentException("A zero depth is not allowed for getFolderTree().");
        }

        int levels = depth == null ? 2 : depth.intValue();
        int level = 0;
        String user = context.getUsername();
View Full Code Here

        StoredObject so;
        List<ObjectData> res = new ArrayList<ObjectData>();
        if (null == versionSeriesId)
            versionSeriesId = objectId;
        if (null == versionSeriesId)
            throw new CmisInvalidArgumentException("getAllVersions requires a version series id, but ist was null.");
            so = validator.getAllVersions(context, repositoryId, objectId, versionSeriesId, extension);
   
            if (!(so instanceof VersionedDocument)) {
              so = validator.getObject(context, repositoryId, objectId, extension)
              ObjectData objData = getObject(context, repositoryId, objectId, filter, includeAllowableActions,
View Full Code Here

                    includeRelationships, extension, objectInfos);
        } else if (so instanceof Document) {
            objData = getObject(context, repositoryId, so.getId(), filter, includeAllowableActions,
                    includeRelationships, extension, objectInfos);
        } else {
            throw new CmisInvalidArgumentException("Object is not instance of a document (version series)");
        }

        // provide information for Atom links for version series:
        if (context.isObjectInfoRequired()) {
            ObjectInfoImpl objectInfo = new ObjectInfoImpl();
View Full Code Here

            VersionedDocument verDoc = (VersionedDocument) so;
            latestVersionObject = verDoc.getLatestVersion(major);
        } else if (so instanceof Document) {
            latestVersionObject = so;
        } else {
            throw new CmisInvalidArgumentException("Object is not instance of a document (version series)");
        }

        List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);

        TypeDefinition td = fStoreManager.getTypeById(repositoryId, latestVersionObject.getTypeId()).getTypeDefinition();
View Full Code Here

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

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

            if (id != null && id.length() > 0) {
                return;
            }
        }

        throw new CmisInvalidArgumentException(name + " must be set!");
    }
View Full Code Here

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

        checkId(name, holder.getValue());
    }
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.