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

The following examples show how to use org.apache.chemistry.opencmis.commons.enums.UnfileObject. 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
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 File: CmisIntegrationTest.java    From wildfly-camel with 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
Source File: SampleClient.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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
Source File: PublicApiClient.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 File: IbisObjectService.java    From iaf with 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
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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
Source File: AbstractCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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
Source File: CmisServiceImpl.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@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 File: FilterCmisService.java    From iaf with 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);
}