handled more errors while retreving folder's files

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@132923 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-10-07 10:49:37 +00:00
parent cb6df188bf
commit 75046a3920
1 changed files with 13 additions and 16 deletions

View File

@ -85,7 +85,7 @@ public class WorkspaceUtils {
// return // return
return resources; return resources;
} }
/** /**
* This method receives a folder id within the user's workspace and set the list of resources in the dataset bean to be returned * This method receives a folder id within the user's workspace and set the list of resources in the dataset bean to be returned
* @param folderId * @param folderId
@ -123,29 +123,26 @@ public class WorkspaceUtils {
} }
} }
List<ResourceBeanWrapper> listOfResources = getWorkspaceResourcesInformation(childrenIds, ws, userName); // set them into the bean
bean.setResources(listOfResources); bean.setResources(getWorkspaceResourcesInformation(childrenIds, ws, userName));
} }
/** /**
* Build up the resource beans. * Build up the resource beans.
* @param resourceIds * @param resourceIds
* @param ws * @param ws
* @param username * @param username
* @return * @return a list of resource wrapper beans
*/ */
public static List<ResourceBeanWrapper> getWorkspaceResourcesInformation( public static List<ResourceBeanWrapper> getWorkspaceResourcesInformation(
List<String> resourceIds, Workspace ws, String username) { List<String> resourceIds, Workspace ws, String username){
List<ResourceBeanWrapper> toReturn = null; List<ResourceBeanWrapper> toReturn = new ArrayList<>();
try{ for (String resourceId : resourceIds) {
toReturn = new ArrayList<>();
for (String resourceId : resourceIds) {
try{
logger.debug("RESOURCE ID IS " + resourceId); logger.debug("RESOURCE ID IS " + resourceId);
ResourceBeanWrapper newResource = new ResourceBeanWrapper(); ResourceBeanWrapper newResource = new ResourceBeanWrapper();
@ -157,12 +154,12 @@ public class WorkspaceUtils {
newResource.setToBeAdded(true); // default is true newResource.setToBeAdded(true); // default is true
newResource.setMimeType(((FolderItem)item).getMimeType()); newResource.setMimeType(((FolderItem)item).getMimeType());
toReturn.add(newResource); toReturn.add(newResource);
}catch(Exception e ){
logger.error("Unable to add resource with id " + resourceId + " to the product bean");
} }
}catch(Exception e){
logger.error("Unable to retrieve resources' info", e);
}
}
return toReturn; return toReturn;
} }