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
This commit is contained in:
Costantino Perciante 2018-01-11 09:17:18 +00:00
parent 81718ccede
commit 9789cd01c4
2 changed files with 6 additions and 3 deletions

View File

@ -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());

View File

@ -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());