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
This commit is contained in:
Costantino Perciante 2018-02-23 14:23:33 +00:00
parent 13efc7d3a8
commit 232be5c370
4 changed files with 16 additions and 16 deletions

View File

@ -17,7 +17,7 @@ import javax.servlet.http.HttpSession;
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory; import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes; 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.ResourceBean;
import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
@ -101,7 +101,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
List<OrganizationBean> orgsName = new ArrayList<OrganizationBean>(); List<OrganizationBean> orgsName = new ArrayList<OrganizationBean>();
HttpSession httpSession = getThreadLocalRequest().getSession(); 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){ if(httpSession.getAttribute(keyPerScope) != null){
orgsName = (List<OrganizationBean>)httpSession.getAttribute(keyPerScope); orgsName = (List<OrganizationBean>)httpSession.getAttribute(keyPerScope);
@ -151,7 +151,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
HttpSession httpSession = getThreadLocalRequest().getSession(); HttpSession httpSession = getThreadLocalRequest().getSession();
String scope = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); String scope = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
logger.info("Request for CKAN licenses for scope " + scope); 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<LicenseBean> licensesBean = null; List<LicenseBean> licensesBean = null;
if(httpSession.getAttribute(keyPerScope) != null){ if(httpSession.getAttribute(keyPerScope) != null){
@ -264,7 +264,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
private List<String> discoverTagsVocabulary(String context){ private List<String> discoverTagsVocabulary(String context){
logger.debug("Looking for vocabulary of tags in this context " + 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<String> vocabulary = (List<String>) getThreadLocalRequest().getSession().getAttribute(keyPerVocabulary); List<String> vocabulary = (List<String>) getThreadLocalRequest().getSession().getAttribute(keyPerVocabulary);
if(vocabulary == null){ if(vocabulary == null){
@ -483,7 +483,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
return true; // it's an error somehow return true; // it's an error somehow
try{ try{
String scopeFromOrgName = getScopeFromOrgName(orgName); 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"); logger.debug("Evaluating if dataset with id " + title + " in context " + scopeFromOrgName + " already exists");
return getCatalogue(scopeFromOrgName).existProductWithNameOrId(idFromTitle); return getCatalogue(scopeFromOrgName).existProductWithNameOrId(idFromTitle);
}catch(Exception e){ }catch(Exception e){
@ -539,7 +539,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
String scope = orgName != null ? getScopeFromOrgName(orgName) : GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); String scope = orgName != null ? getScopeFromOrgName(orgName) : GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
// check if they are in session // 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){ if(httpSession.getAttribute(keyPerScopeGroups) != null){
toReturn = (List<OrganizationBean>)httpSession.getAttribute(keyPerScopeGroups); toReturn = (List<OrganizationBean>)httpSession.getAttribute(keyPerScopeGroups);
@ -585,9 +585,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest()); String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
// get key per scope // get key per scope
String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl); String keyPerScopeRole = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl); String keyPerScopeOrganizations = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl);
String keyPerScopeGroups = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, 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 // 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 // the role editor), false that he is just a member so he cannot publish

View File

@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletRequest;
import org.gcube.common.portal.mailing.EmailNotification; import org.gcube.common.portal.mailing.EmailNotification;
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; 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.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.UserManager;
@ -118,7 +118,7 @@ public class AssociationToGroupAndNotifyThread extends Thread {
List<String> adminsEmails = new ArrayList<String>(); List<String> adminsEmails = new ArrayList<String>();
for(int i = 0; i < admins.size(); i++){ 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); admins.set(i, convertedName);
} }

View File

@ -11,7 +11,7 @@ import javax.servlet.http.HttpSession;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes; 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.DataCalogueMetadataFormatReader;
import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile; import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile;
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField; import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField;
@ -125,7 +125,7 @@ public class MetadataDiscovery {
logger.debug("Discovering into scope " + scopeInWhichDiscover); logger.debug("Discovering into scope " + scopeInWhichDiscover);
// scope in which we need to discover // 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(); HttpSession httpSession = request.getSession();

View File

@ -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.FolderItem;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl;
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem; 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.datacatalogue.ckanutillibrary.shared.ResourceBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
@ -233,10 +233,10 @@ public class WorkspaceUtils {
if(originalItem.isFolder()){ if(originalItem.isFolder()){
copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area
copiedFolder.setDescription(bean.getDescription()); copiedFolder.setDescription(bean.getDescription());
((WorkspaceFolder)copiedFolder).rename(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime); ((WorkspaceFolder)copiedFolder).rename(CatalogueUtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime);
} }
else{ else{
copiedFolder = userCatalogue.createFolder(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription()); copiedFolder = userCatalogue.createFolder(CatalogueUtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription());
} }
// retrieve the children // retrieve the children