Examples of FailedToDeleteDataImpl


Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

    public static FailedToDeleteData convertFailedToDelete(final Map<String, Object> json) {
        if (json == null) {
            return null;
        }

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        List<String> ids = new ArrayList<String>();
        List<Object> jsonIds = getList(json.get(JSON_FAILEDTODELETE_ID));

        if (jsonIds != null) {
            for (Object obj : jsonIds) {
                if (obj != null) {
                    ids.add(obj.toString());
                }
            }
        }

        result.setIds(ids);

        convertExtension(json, result, FAILEDTODELETE_KEYS);

        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

        if (!BigInteger.ZERO.equals(resp.getContentLength())) {
            Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
            return JSONConverter.convertFailedToDelete(json);
        }

        return new FailedToDeleteDataImpl();
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

    public static FailedToDeleteData convertFailedToDelete(final Map<String, Object> json) {
        if (json == null) {
            return null;
        }

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        List<String> ids = new ArrayList<String>();
        List<Object> jsonIds = getList(json.get(JSON_FAILEDTODELETE_ID));

        if (jsonIds != null) {
            for (Object obj : jsonIds) {
                if (obj != null) {
                    ids.add(obj.toString());
                }
            }
        }

        result.setIds(ids);

        convertExtension(json, result, FAILEDTODELETE_KEYS);

        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

    public static FailedToDeleteData convert(DeleteTreeResponse.FailedToDelete failedToDelete) {
        if (failedToDelete == null) {
            return null;
        }

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        result.setIds(failedToDelete.getObjectIds());

        // handle extensions
        convertExtension(failedToDelete, result);

        return result;
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

            Boolean allVersions, UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {

        LOG.debug("start deleteTree()");
        StoredObject so = checkStandardParameters(repositoryId, folderId);
        List<String> failedToDeleteIds = new ArrayList<String>();
        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        if (null == allVersions)
            allVersions = true;
        if (null == unfileObjects)
            unfileObjects = UnfileObject.DELETE;
        if (null == continueOnFailure)
            continueOnFailure = false;

        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);

        if (null == so)
            throw new CmisInvalidArgumentException("Cannot delete object with id  " + folderId + ". Object does not exist.");

        if (!(so instanceof Folder))
            throw new CmisInvalidArgumentException("deleteTree can only be invoked on a folder, but id " + folderId
                    + " does not refer to a folder");

        if (unfileObjects == UnfileObject.UNFILE)
            throw new CmisNotSupportedException("This repository does not support unfile operations.");

        // check if it is the root folder
        if (folderId.equals(objectStore.getRootFolder().getId()))
            throw new CmisNotSupportedException("You can't delete a root folder");

        // recursively delete folder
        deleteRecursive(objectStore, (Folder) so, continueOnFailure, allVersions, failedToDeleteIds);

        result.setIds(failedToDeleteIds);
        LOG.debug("stop deleteTree()");
        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

        // make the call
        HttpUtils.Response resp = HttpUtils.invokeDELETE(url, getSession());

        // check response code
        if ((resp.getResponseCode() == 200) || (resp.getResponseCode() == 202) || (resp.getResponseCode() == 204)) {
            return new FailedToDeleteDataImpl();
        }

        throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

    public static FailedToDeleteData convert(DeleteTreeResponse.FailedToDelete failedToDelete) {
        if (failedToDelete == null) {
            return null;
        }

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        result.setIds(failedToDelete.getObjectIds());

        // handle extensions
        convertExtension(failedToDelete, result);

        return result;
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl

            Boolean allVersions, UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {

        LOG.debug("start deleteTree()");
        StoredObject so = validator.deleteTree(context, repositoryId, folderId, allVersions, unfileObjects, extension);
        List<String> failedToDeleteIds = new ArrayList<String>();
        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        if (null == allVersions) {
            allVersions = true;
        }
        if (null == unfileObjects) {
            unfileObjects = UnfileObject.DELETE;
        }
        if (null == continueOnFailure) {
            continueOnFailure = false;
        }

        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);

        if (null == so) {
            throw new CmisInvalidArgumentException("Cannot delete object with id  " + folderId + ". Object does not exist.");
        }

        if (!(so instanceof Folder)) {
            throw new CmisInvalidArgumentException("deleteTree can only be invoked on a folder, but id " + folderId
                    + " does not refer to a folder");
        }

        if (unfileObjects == UnfileObject.UNFILE) {
            throw new CmisNotSupportedException("This repository does not support unfile operations.");
        }

        // check if it is the root folder
        if (folderId.equals(objectStore.getRootFolder().getId())) {
            throw new CmisNotSupportedException("You can't delete a root folder");
        }

        // recursively delete folder
        deleteRecursive(objectStore, (Folder) so, continueOnFailure, allVersions, failedToDeleteIds, context.getUsername());

        result.setIds(failedToDeleteIds);
        LOG.debug("stop deleteTree()");
        return result;
    }
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.