From 9789cd01c4ee8d4c495fa8819640cce1726714a6 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Thu, 11 Jan 2018 09:17:18 +0000 Subject: [PATCH] send the full name of the administrator for recording the annotation git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@162075 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/manage/GRSFNotificationService.java | 5 +++-- .../grsf_manage_widget/server/manage/Utils.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java index e62282e..48377f4 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java @@ -324,7 +324,8 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS String context = Utils.getScopeFromClientUrl(getThreadLocalRequest()); DataCatalogue catalogue = getCatalogue(context); - + String administratorFullName = Utils.getCurrentUser(getThreadLocalRequest()).getFullname(); + String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername(); // check if the base url of the service is in session String keyPerContext = UtilMethods.concatenateSessionKeyScope(Constants.GRSF_UPDATER_SERVICE, context); String baseUrl = (String)getThreadLocalRequest().getSession().getAttribute(keyPerContext); @@ -332,7 +333,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS baseUrl = Utils.discoverEndPoint(context); getThreadLocalRequest().getSession().setAttribute(keyPerContext, baseUrl); } - return Utils.updateRecord(baseUrl, bean, catalogue, Utils.getCurrentUser(getThreadLocalRequest()).getUsername()); + return Utils.updateRecord(baseUrl, bean, catalogue, username, administratorFullName); }catch(Exception e){ logger.error("Unable to update the product.." + e.getMessage()); diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/Utils.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/Utils.java index 0554723..7c4a63a 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/Utils.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/Utils.java @@ -258,7 +258,8 @@ public class Utils { * @return true on success, false otherwise */ @SuppressWarnings("unchecked") - public static String updateRecord(String serviceUrl, ManageProductBean bean, DataCatalogue catalogue, String username) throws Exception{ + public static String updateRecord(String serviceUrl, ManageProductBean bean, DataCatalogue catalogue, String username, + String fullName) throws Exception{ if(serviceUrl == null) throw new IllegalArgumentException("GRSF Updater service url cannot be null"); @@ -269,6 +270,7 @@ public class Utils { try(CloseableHttpClient httpClient = HttpClientBuilder.create().build();){ JSONObject obj = new JSONObject(); + obj.put(Constants.ADMINISTRATOR_FULLNAME, fullName); obj.put(Constants.CATALOGUE_ID, bean.getCatalogueIdentifier()); obj.put(Constants.KB_ID, bean.getKnowledgeBaseIdentifier()); obj.put(Constants.NEW_STATUS, bean.getNewStatus().toString().toLowerCase());