Calling search with excludeTrashed = true

Added a check with instance of TrahItem
This commit is contained in:
francesco 2020-03-13 12:56:58 +01:00
parent 4779c04a24
commit 2e0b2afa53
3 changed files with 7 additions and 7 deletions

View File

@ -570,14 +570,14 @@ public class StorageHubClientService {
/**
* Search by text.
* Search for text.
*
* @param name the name
* @param text the text
* @param folderId the folder id
* @return the list<? extends item>
* @throws Exception the exception
*/
public List<? extends Item> searchByText(String name, String folderId) throws Exception {
public List<? extends Item> searchForText(String text, String folderId) throws Exception {
Item item;
try {
@ -588,8 +588,8 @@ public class StorageHubClientService {
}
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
//return shcClient.open(folderId).asFolder().findByName(name).withContent().getItems();
return shcClient.open(folderId).asFolder().search(name).withContent().getItems();
//this does not return the trashed items
return shcClient.open(folderId).asFolder().search(text,true).withContent().getItems();
}else
throw new Exception("The input folder id is not a folder");
}

View File

@ -667,7 +667,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{
LOGGER.debug("called text");
Validate.notNull(folderId,"The input folderid is null");
try {
List<? extends Item> items = storageHubClientService.searchByText(text, folderId);
List<? extends Item> items = storageHubClientService.searchForText(text, folderId);
List<WorkspaceItem> wsItems = null;
if(items!=null){
wsItems = new ArrayList<WorkspaceItem>(items.size());

View File

@ -296,7 +296,7 @@ public class HLMapper {
}
//CONVERTING TRASH ITEM
if(item.isTrashed()){
if(item.isTrashed() && item instanceof TrashItem){
type = WorkspaceItemType.TRASH_ITEM;
TrashItem trashItem = (TrashItem) item; //??
theItem = new org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem();