fixed getContent as null
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@169688 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a5e1851f8e
commit
4ae1b0f025
|
@ -325,7 +325,7 @@ public class StorageHubClientService {
|
|||
}
|
||||
|
||||
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
|
||||
return shcClient.open(folderId).asFolder().findByName(name).getItems();
|
||||
return shcClient.open(folderId).asFolder().findByName(name).withContent().getItems();
|
||||
}else
|
||||
throw new Exception("The input folder id is not a folder");
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFolder;
|
|||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceSharedFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceVREFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItemType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -43,6 +45,8 @@ import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItemType;
|
|||
*/
|
||||
public class HLMapper {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(HLMapper.class);
|
||||
|
||||
public static Function<org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry, AccountingEntry> toAccountingEntry = new Function<org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry, AccountingEntry>() {
|
||||
|
||||
public AccountingEntry apply(org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry accountingEntry) {
|
||||
|
@ -188,10 +192,14 @@ public class HLMapper {
|
|||
AbstractFileItem itemAb = (AbstractFileItem) item;
|
||||
Content aC = itemAb.getContent();
|
||||
FileItem theFileItem = (FileItem) theItem;
|
||||
theFileItem.setMimeType(aC.getMimeType());
|
||||
theFileItem.setSize(aC.getSize());
|
||||
theFileItem.setFileItemType(fileItemType);
|
||||
|
||||
if(aC!=null){
|
||||
logger.warn("The content is null for item: "+itemAb.getId());
|
||||
theFileItem.setMimeType(aC.getMimeType());
|
||||
theFileItem.setSize(aC.getSize());
|
||||
}
|
||||
|
||||
//TODO ADD VERSION NAME
|
||||
|
||||
}
|
||||
|
@ -229,68 +237,4 @@ public class HLMapper {
|
|||
return (T) theItem;
|
||||
}
|
||||
|
||||
/*public static Function<Item, ? extends WorkspaceItem> toWorkspaceItem = new Function<Item, WorkspaceItem>() {
|
||||
|
||||
public WorkspaceItem apply(Item item) {
|
||||
|
||||
Accounting accounting = item.getAccounting();
|
||||
List<AccountingEntry> accountingEntries = null;
|
||||
if(accounting!=null && accounting.getEntries().size()>0){
|
||||
accountingEntries = new ArrayList<AccountingEntry>(accounting.getEntries().size());
|
||||
for (AccountEntry ae : accounting.getEntries()) {
|
||||
//TODO
|
||||
accountingEntries.add(toAccountingEntry.apply(ae));
|
||||
}
|
||||
}
|
||||
|
||||
WorkspaceItemImpl theItem = null;
|
||||
WorkspaceItemType type = null;
|
||||
boolean isFolder = false;
|
||||
|
||||
//IS THE ITEM A FOLDER TYPE?
|
||||
if (item instanceof FolderItem){
|
||||
isFolder = true;
|
||||
FolderItem folderItem = (FolderItem) item; //??
|
||||
theItem = new WorkspaceFolderImpl();
|
||||
type = org.gcube.portal.storagehubwrapper.shared.tohl.WorkspaceItemType.FOLDER_ITEM;
|
||||
if (item instanceof SharedFolder || item instanceof VreFolder) {
|
||||
SharedFolder sharedfolder = (SharedFolder) item; //??
|
||||
theItem = new WorkspaceSharedFolderImpl();
|
||||
type = org.gcube.portal.storagehubwrapper.shared.tohl.WorkspaceItemType.SHARED_FOLDER;
|
||||
if (sharedfolder.isVreFolder()){
|
||||
VreFolder vreFolder = (VreFolder) item;
|
||||
theItem = new WorkspaceVREFolderImpl();
|
||||
type = org.gcube.portal.storagehubwrapper.shared.tohl.WorkspaceItemType.VRE_FOLDER;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(theItem.isTrashed())
|
||||
type = org.gcube.portal.storagehubwrapper.shared.tohl.WorkspaceItemType.TRASH_ITEM;
|
||||
|
||||
theItem.setId(item.getId());
|
||||
theItem.setName(item.getName());
|
||||
theItem.setPath(item.getPath());
|
||||
theItem.setParentId(item.getParentId());
|
||||
theItem.setTrashed(item.isTrashed());
|
||||
theItem.setShared(item.isShared());
|
||||
theItem.setLocked(item.isLocked());
|
||||
theItem.setTitle(item.getTitle());
|
||||
theItem.setDescription(item.getDescription());
|
||||
theItem.setLastModifiedBy(item.getLastModifiedBy());
|
||||
theItem.setLastModificationTime(item.getLastModificationTime());
|
||||
theItem.setCreationTime(item.getCreationTime());
|
||||
theItem.setOwner(item.getOwner());
|
||||
theItem.setHidden(item.isHidden());
|
||||
theItem.setAccounting(accountingEntries);
|
||||
theItem.setType(type);
|
||||
theItem.setFolder(isFolder);
|
||||
theItem.setRoot(false);
|
||||
|
||||
return theItem;
|
||||
}
|
||||
};*/
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue