From 232be5c3708ed12b1895bc5567c6ea199435eaf9 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 23 Feb 2018 14:23:33 +0000 Subject: [PATCH] minor fix git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@164563 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/CKANPublisherServicesImpl.java | 18 +++++++++--------- .../AssociationToGroupAndNotifyThread.java | 4 ++-- .../server/utils/MetadataDiscovery.java | 4 ++-- .../server/utils/WorkspaceUtils.java | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java index 9814a84..d855442 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java @@ -17,7 +17,7 @@ import javax.servlet.http.HttpSession; import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory; import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods; +import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods; import org.gcube.datacatalogue.ckanutillibrary.shared.ResourceBean; import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService; @@ -101,7 +101,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C List orgsName = new ArrayList(); HttpSession httpSession = getThreadLocalRequest().getSession(); - String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scope); + String keyPerScope = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scope); if(httpSession.getAttribute(keyPerScope) != null){ orgsName = (List)httpSession.getAttribute(keyPerScope); @@ -151,7 +151,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C HttpSession httpSession = getThreadLocalRequest().getSession(); String scope = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); logger.info("Request for CKAN licenses for scope " + scope); - String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_LICENSES_KEY, scope); + String keyPerScope = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_LICENSES_KEY, scope); List licensesBean = null; if(httpSession.getAttribute(keyPerScope) != null){ @@ -264,7 +264,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C private List discoverTagsVocabulary(String context){ logger.debug("Looking for vocabulary of tags in this context " + context); - String keyPerVocabulary = UtilMethods.concatenateSessionKeyScope(TAGS_VOCABULARY_KEY, context); + String keyPerVocabulary = CatalogueUtilMethods.concatenateSessionKeyScope(TAGS_VOCABULARY_KEY, context); List vocabulary = (List) getThreadLocalRequest().getSession().getAttribute(keyPerVocabulary); if(vocabulary == null){ @@ -483,7 +483,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C return true; // it's an error somehow try{ String scopeFromOrgName = getScopeFromOrgName(orgName); - String idFromTitle = UtilMethods.fromProductTitleToName(title); + String idFromTitle = CatalogueUtilMethods.fromProductTitleToName(title); logger.debug("Evaluating if dataset with id " + title + " in context " + scopeFromOrgName + " already exists"); return getCatalogue(scopeFromOrgName).existProductWithNameOrId(idFromTitle); }catch(Exception e){ @@ -539,7 +539,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C String scope = orgName != null ? getScopeFromOrgName(orgName) : GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); // check if they are in session - String keyPerScopeGroups = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scope); + String keyPerScopeGroups = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scope); if(httpSession.getAttribute(keyPerScopeGroups) != null){ toReturn = (List)httpSession.getAttribute(keyPerScopeGroups); @@ -585,9 +585,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); // get key per scope - String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl); - String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl); - String keyPerScopeGroups = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scopePerCurrentUrl); + String keyPerScopeRole = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl); + String keyPerScopeOrganizations = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl); + String keyPerScopeGroups = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scopePerCurrentUrl); // check if this information was already into session(true means the user has at least in one org // the role editor), false that he is just a member so he cannot publish diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/threads/AssociationToGroupAndNotifyThread.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/threads/AssociationToGroupAndNotifyThread.java index 9e110f8..3266249 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/threads/AssociationToGroupAndNotifyThread.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/threads/AssociationToGroupAndNotifyThread.java @@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletRequest; import org.gcube.common.portal.mailing.EmailNotification; import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods; +import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods; import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.vomanagement.usermanagement.UserManager; @@ -118,7 +118,7 @@ public class AssociationToGroupAndNotifyThread extends Thread { List adminsEmails = new ArrayList(); for(int i = 0; i < admins.size(); i++){ - String convertedName = UtilMethods.fromCKanUsernameToUsername(admins.get(i)); + String convertedName = CatalogueUtilMethods.fromCKanUsernameToUsername(admins.get(i)); admins.set(i, convertedName); } diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/MetadataDiscovery.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/MetadataDiscovery.java index a163f40..13ea3ab 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/MetadataDiscovery.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/MetadataDiscovery.java @@ -11,7 +11,7 @@ import javax.servlet.http.HttpSession; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods; +import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods; import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader; import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile; import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField; @@ -125,7 +125,7 @@ public class MetadataDiscovery { logger.debug("Discovering into scope " + scopeInWhichDiscover); // scope in which we need to discover - String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_PROFILES_KEY, scopeInWhichDiscover); + String keyPerScope = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_PROFILES_KEY, scopeInWhichDiscover); HttpSession httpSession = request.getSession(); diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java index 75188e8..283ce3e 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java @@ -18,7 +18,7 @@ import org.gcube.common.homelibrary.home.workspace.catalogue.WorkspaceCatalogue; import org.gcube.common.homelibrary.home.workspace.folder.FolderItem; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl; import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods; +import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods; import org.gcube.datacatalogue.ckanutillibrary.shared.ResourceBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; @@ -233,10 +233,10 @@ public class WorkspaceUtils { if(originalItem.isFolder()){ copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area copiedFolder.setDescription(bean.getDescription()); - ((WorkspaceFolder)copiedFolder).rename(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime); + ((WorkspaceFolder)copiedFolder).rename(CatalogueUtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime); } else{ - copiedFolder = userCatalogue.createFolder(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription()); + copiedFolder = userCatalogue.createFolder(CatalogueUtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription()); } // retrieve the children