Search in sources :

Example 1 with FailedToDeleteDataImpl

use of org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl in project structr by structr.

the class CMISObjectService method deleteTree.

@Override
public FailedToDeleteData deleteTree(final String repositoryId, final String folderId, final Boolean allVersions, final UnfileObject unfileObjects, final Boolean continueOnFailure, final ExtensionsData extension) {
    if (UnfileObject.UNFILE.equals(unfileObjects)) {
        throw new CmisNotSupportedException("Unfiling not supported");
    }
    final App app = StructrApp.getInstance(securityContext);
    final FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
    result.setIds(new LinkedList<String>());
    try (final Tx tx = app.tx()) {
        final Folder folder = app.get(Folder.class, folderId);
        if (folder != null) {
            recursivelyCheckAndDeleteFiles(app, result, folder, continueOnFailure);
        } else {
            throw new CmisObjectNotFoundException("Folder with ID " + folderId + " does not exist");
        }
        tx.success();
    } catch (final FrameworkException fex) {
        logger.warn("", fex);
    }
    return result;
}
Also used : CmisNotSupportedException(org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException) App(org.structr.core.app.App) StructrApp(org.structr.core.app.StructrApp) Tx(org.structr.core.graph.Tx) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) FrameworkException(org.structr.common.error.FrameworkException) FailedToDeleteDataImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl) Folder(org.structr.web.entity.Folder)

Aggregations

CmisNotSupportedException (org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException)1 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)1 FailedToDeleteDataImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl)1 FrameworkException (org.structr.common.error.FrameworkException)1 App (org.structr.core.app.App)1 StructrApp (org.structr.core.app.StructrApp)1 Tx (org.structr.core.graph.Tx)1 Folder (org.structr.web.entity.Folder)1