Examples of FailedToDeleteDataImpl


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

    /**
     * See CMIS 1.0 section 2.2.4.15 deleteTree
     */
    public FailedToDeleteDataImpl deleteTree() {
        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        String id = getId();
        try {
            Node node = getNode();
            if (hasCheckOuts(node)) {
                result.setIds(Collections.<String>singletonList(id));               
            }
            else {
                Session session = node.getSession();
                node.remove();
                session.save();
                result.setIds(Collections.<String>emptyList());
            }
        }
        catch (RepositoryException e) {
            result.setIds(Collections.singletonList(id));
        }

        return result;
    }
View Full Code Here

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

    /**
     * See CMIS 1.0 section 2.2.4.15 deleteTree
     */
    public FailedToDeleteDataImpl deleteTree() {
        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

        String id = getId();
        try {
            Session session = getNode().getSession();
            getNode().remove();
            session.save();
            result.setIds(Collections.<String>emptyList());
        }
        catch (RepositoryException e) {
            result.setIds(Collections.singletonList(id));
        }

        return result;
    }
View Full Code Here

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

        boolean cof = (continueOnFailure == null ? false : continueOnFailure.booleanValue());

        // get the file or folder
        File file = getFile(folderId);

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
        result.setIds(new ArrayList<String>());

        // if it is a folder, remove it recursively
        if (file.isDirectory()) {
            deleteFolder(file, cof, result);
        } else {
            getPropertiesFile(file).delete();
            if (!file.delete()) {
                result.getIds().add(getId(file));
            }
        }

        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

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

            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 RuntimeException("Cannot delete object with id  " + folderId + ". Object does not exist.");

        if (!(so instanceof Folder))
            throw new RuntimeException("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

            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);

        result.setIds(failedToDeleteIds);
        LOG.debug("stop deleteTree()");
        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 cof = (continueOnFailure == null ? false : continueOnFailure.booleanValue());

        // get the file or folder
        File file = getFile(folderId);

        FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
        result.setIds(new ArrayList<String>());

        // if it is a folder, remove it recursively
        if (file.isDirectory()) {
            deleteFolder(file, cof, result);
        } else {
            getPropertiesFile(file).delete();
            if (!file.delete()) {
                result.getIds().add(getId(file));
            }
        }

        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.