From d7366068c926b579ec527cdbebe3150c8c8d53f7 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Wed, 9 Oct 2019 15:06:07 +0000 Subject: [PATCH] Removed the HL dependencies Added a patch to convert FolderItem to SocialItemFolder git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@181955 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 22 ++++++++-------- .../notification/NotificationMapper.java | 25 ++++++++++++++++--- 2 files changed, 33 insertions(+), 14 deletions(-) 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); }