diff --git a/pom.xml b/pom.xml index ca5ad5e..224f042 100644 --- a/pom.xml +++ b/pom.xml @@ -148,17 +148,17 @@ - - org.gcube.common - home-library - provided - - - asm-all - asm - - - + + + + + + + + + + + commons-httpclient diff --git a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationMapper.java b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationMapper.java index 2cf5d89..27b0d39 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationMapper.java +++ b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationMapper.java @@ -6,6 +6,7 @@ package org.gcube.portlets.widgets.workspaceuploader.server.notification; import org.gcube.applicationsupportlayer.social.shared.SocialFileItem; import org.gcube.applicationsupportlayer.social.shared.SocialSharedFolder; +import org.gcube.common.storagehub.model.items.FolderItem; import org.gcube.common.storagehub.model.items.Item; import org.gcube.common.storagehub.model.items.SharedFolder; import org.gcube.common.storagehub.model.items.VreFolder; @@ -15,6 +16,7 @@ import org.slf4j.LoggerFactory; /** + * The Class NotificationMapper. * * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * Jun 26, 2018 @@ -23,6 +25,7 @@ public class NotificationMapper { protected static Logger logger = LoggerFactory.getLogger(NotificationMapper.class); + /** * To social folder. * @@ -33,6 +36,17 @@ public class NotificationMapper { return new SocialSharedFolder(sharedFolder.getId(), sharedFolder.getName(), sharedFolder.getTitle(), sharedFolder.getDisplayName(), sharedFolder.getPath(), sharedFolder.getParentId(), sharedFolder.isVreFolder()); } + + /** + * To social folder. + * + * @param folderItem the folder item + * @return the social shared folder + */ + public static SocialSharedFolder toSocialFolder(FolderItem folderItem){ + + return new SocialSharedFolder(folderItem.getId(), folderItem.getName(), folderItem.getTitle(), folderItem.getName(), folderItem.getPath(), folderItem.getParentId(), false); + } /** * To social item. @@ -48,12 +62,17 @@ public class NotificationMapper { theFolder = storageWrapper.getStorageHubClientService().getItem(item.getParentId()); } catch (Exception e) { - logger.warn("Impossible the item using the parent id: "+item.getParentId()); + logger.warn("Impossible to read the item parent by using the parent id: "+item.getParentId(), e); } SocialSharedFolder parent = null; - if(theFolder!=null && theFolder instanceof SharedFolder || theFolder instanceof VreFolder) - parent = toSocialFolder((SharedFolder) theFolder); + if(theFolder!=null) { + if(theFolder instanceof SharedFolder || theFolder instanceof VreFolder) { + parent = toSocialFolder((SharedFolder) theFolder); + }else if(theFolder instanceof FolderItem){ + parent = toSocialFolder((FolderItem) theFolder); + } + } return new SocialFileItem(item.getId(), item.getName(), item.getTitle(), item.getPath(), parent); }