org.apache.chemistry.opencmis.commons.data.FailedToDeleteData Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.data.FailedToDeleteData. 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: LDRepository.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * CMIS deleteTree
 * 
 * @param context call context
 * @param folderId identifier of the folder
 * @param continueOnFailure if the execution must continue even in presence
 *        of an issue
 * 
 * @return informations about the failure
 */
public FailedToDeleteData deleteTree(CallContext context, String folderId, Boolean continueOnFailure) {
	debug("deleteTree " + folderId);
	validatePermission(folderId, context, Permission.DELETE);

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

	// get the document or folder
	PersistentObject object = getObject(folderId);
	if (object == null)
		throw new CmisObjectNotFoundException(String.format("Object %s not found!", folderId));

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

	try {
		if (object instanceof Folder) {
			Folder folder = (Folder) object;
			deleteFolder(folder, cof, result);
		} else {
			Document doc = (Document) object;
			DocumentHistory transaction = new DocumentHistory();
			transaction.setUser(getSessionUser());
			transaction.setEvent(FolderEvent.DELETED.toString());
			transaction.setSessionId(sid);

			if (!documentDao.delete(doc.getId(), transaction))
				throw new Exception("Unable to delete document");
		}
	} catch (Throwable t) {
		log.error(t.getMessage(), t);
		throw new CmisStorageException("Deletion failed!");
	}
	return result;
}
 
Example #3
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 #4
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 #5
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 #6
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 #7
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);
}