Java Code Examples for org.apache.chemistry.opencmis.commons.enums.UnfileObject

The following examples show how to use org.apache.chemistry.opencmis.commons.enums.UnfileObject. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
        UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Folder Id", folderId);
    allVersions = getDefaultTrue(allVersions);
    unfileObjects = getDefault(unfileObjects);
    continueOnFailure = getDefaultFalse(continueOnFailure);

    try {
        return getWrappedService().deleteTree(repositoryId, folderId, allVersions, unfileObjects,
                continueOnFailure, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example 2
Source Project: wildfly-camel   Source File: CmisIntegrationTest.java    License: Apache License 2.0 6 votes vote down vote up
private void deleteAllContent() {
    Session session = createSession();
    Folder rootFolder = session.getRootFolder();
    ItemIterable<CmisObject> children = rootFolder.getChildren();
    for (CmisObject cmisObject : children) {
        if ("cmis:folder".equals(cmisObject.getPropertyValue(PropertyIds.OBJECT_TYPE_ID))) {
            List<String> notDeltedIdList = ((Folder)cmisObject)
                    .deleteTree(true, UnfileObject.DELETE, true);
            if (notDeltedIdList != null && notDeltedIdList.size() > 0) {
                throw new RuntimeException("Cannot empty repo");
            }
        } else {
            cmisObject.delete(true);
        }
    }
    session.getBinding().close();
}
 
Example 3
/**
 * Clean up test folder before executing test
 * 
 * @param target
 * @param delFolderName
 */
private static void cleanup(Folder target, String delFolderName) {
	try {
		CmisObject object = session.getObjectByPath(target.getPath() + delFolderName);
		Folder delFolder = (Folder) object;
		delFolder.deleteTree(true, UnfileObject.DELETE, true);
	} catch (CmisObjectNotFoundException e) {
		System.err.println("No need to clean up.");
	}
}
 
Example 4
@Override
public FailedToDeleteData deleteTree(
        String repositoryId, String folderId, Boolean allVersions,
        UnfileObject unfileObjects, final Boolean continueOnFailure, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    if (!allVersions)
    {
        throw new CmisInvalidArgumentException("Only allVersions=true supported!");
    }

    if (unfileObjects == UnfileObject.UNFILE)
    {
        throw new CmisInvalidArgumentException("Unfiling not supported!");
    }

    final NodeRef folderNodeRef = getOrCreateFolderInfo(folderId, "Folder").getNodeRef();
    final FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

    try
    {
        connector.deleteNode(folderNodeRef, true);
    }
    catch (Exception e)
    {
        List<String> ids = new ArrayList<String>();
        ids.add(folderId);
        result.setIds(ids);
    }

    return result;
}
 
Example 5
/**
 * Returns {@code UnfileObjects.DELETE} if {@code value} is {@code null}.
 */
protected UnfileObject getDefault(UnfileObject value) {
    if (value == null) {
        return UnfileObject.DELETE;
    }

    return value;
}
 
Example 6
public List<String> removeTree(String objectId, boolean allVersions, UnfileObject unfile, boolean continueOnFailure)
{
    CmisObject o = getObject(objectId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;
        List<String> res = f.deleteTree(allVersions, unfile, continueOnFailure);
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a folder");
    }
}
 
Example 7
Source Project: iaf   Source File: IbisObjectService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId,
		Boolean allVersions, UnfileObject unfileObjects,
		Boolean continueOnFailure, ExtensionsData extension) {
	// TODO Auto-generated method stub
	return objectService.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
}
 
Example 8
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
		UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
	validateSession();
	return getRepository().deleteTree(getCallContext(), folderId, continueOnFailure);
}
 
Example 9
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
        UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
    return service.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
}
 
Example 10
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions, UnfileObject unfileObjects,
                                     Boolean continueOnFailure, ExtensionsData extension) {
	log.debug("deleteTree({}, {}, {})", new Object[]{repositoryId, folderId, allVersions});
	return getRepository().deleteTree(getCallContext(), folderId, continueOnFailure);
}
 
Example 11
Source Project: iaf   Source File: FilterCmisService.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
		UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
	return getObjectService().deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure,
			extension);
}