Updated to new PortalContext

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@141690 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-01-20 18:18:08 +00:00
parent a56c2b4a62
commit 4e708d1686
7 changed files with 73 additions and 97 deletions

View File

@ -4,7 +4,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.ResourceDescriptor; import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.ResourceDescriptor;
import org.gcube.data.analysis.tabulardata.model.resources.InternalURI; import org.gcube.data.analysis.tabulardata.model.resources.InternalURI;
import org.gcube.data.analysis.tabulardata.model.resources.Resource; import org.gcube.data.analysis.tabulardata.model.resources.Resource;
@ -13,6 +12,7 @@ import org.gcube.data.analysis.tabulardata.model.resources.StringResource;
import org.gcube.data.analysis.tabulardata.model.resources.TableResource; import org.gcube.data.analysis.tabulardata.model.resources.TableResource;
import org.gcube.data.analysis.tabulardata.model.resources.Thumbnail; import org.gcube.data.analysis.tabulardata.model.resources.Thumbnail;
import org.gcube.portlets.user.td.gwtservice.server.uriresolver.UriResolverTDClient; import org.gcube.portlets.user.td.gwtservice.server.uriresolver.UriResolverTDClient;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
@ -39,10 +39,10 @@ public class ResourceTDCreator {
protected static SimpleDateFormat sdf = new SimpleDateFormat( protected static SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm"); "yyyy-MM-dd HH:mm");
private ASLSession aslSession; private ServiceCredentials serviceCredentials;
public ResourceTDCreator(ASLSession aslSession) { public ResourceTDCreator(ServiceCredentials serviceCredentials) {
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
} }
/** /**
@ -121,7 +121,7 @@ public class ResourceTDCreator {
thumbnail.getUri().toString(), ApplicationType.SMP_ID, thumbnail.getUri().toString(), ApplicationType.SMP_ID,
"resourcethumbnail.jpg", thumbnail.getMimeType()); "resourcethumbnail.jpg", thumbnail.getMimeType());
String link = uriResolverTDClient.resolve(uriResolverSession, String link = uriResolverTDClient.resolve(uriResolverSession,
aslSession); serviceCredentials);
thumbnailTD = new ThumbnailTD(link, thumbnail.getMimeType()); thumbnailTD = new ThumbnailTD(link, thumbnail.getMimeType());
} }

View File

@ -4,13 +4,13 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.homelibrary.util.WorkspaceUtil; import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.portal.databook.shared.NotificationType; import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareRule; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareRule;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource;
@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
public class TDMNotifications extends Thread { public class TDMNotifications extends Thread {
private static Logger logger = LoggerFactory private static Logger logger = LoggerFactory
.getLogger(TDMNotifications.class); .getLogger(TDMNotifications.class);
private ASLSession aslSession; private ServiceCredentials serviceCredentials;
private NotificationType notificationType; private NotificationType notificationType;
private ShareTabResource shareTabularResource; private ShareTabResource shareTabularResource;
private ShareRule shareRule; private ShareRule shareRule;
@ -41,55 +41,56 @@ public class TDMNotifications extends Thread {
/** /**
* Share Tabular Resource * Share Tabular Resource
* *
* @param aslSession * @param serviceCredentials
* @param shareTabularResource * @param shareTabularResource
*/ */
public TDMNotifications(HttpServletRequest request, ASLSession aslSession, public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials,
ShareTabResource shareTabularResource) { ShareTabResource shareTabularResource) {
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
this.shareTabularResource = shareTabularResource; this.shareTabularResource = shareTabularResource;
this.notificationType = NotificationType.TDM_TAB_RESOURCE_SHARE; this.notificationType = NotificationType.TDM_TAB_RESOURCE_SHARE;
site = new SocialNetworkingSite(request); site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(), user = new SocialNetworkingUser(serviceCredentials.getUserName(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(), serviceCredentials.getEmail(), serviceCredentials.getFullName(),
aslSession.getUserAvatarId()); serviceCredentials.getUserAvatarURL());
scope = aslSession.getScope(); scope = serviceCredentials.getScope();
} }
/** /**
* *
* @param aslSession * @param serviceCredentials
* @param shareRule * @param shareRule
*/ */
public TDMNotifications(HttpServletRequest request, ASLSession aslSession, public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials,
ShareRule shareRule) { ShareRule shareRule) {
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
this.shareRule = shareRule; this.shareRule = shareRule;
this.notificationType = NotificationType.TDM_RULE_SHARE; this.notificationType = NotificationType.TDM_RULE_SHARE;
site = new SocialNetworkingSite(request); site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(), user = new SocialNetworkingUser(serviceCredentials.getUserName(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(), serviceCredentials.getEmail(), serviceCredentials.getFullName(),
aslSession.getUserAvatarId()); serviceCredentials.getUserAvatarURL());
scope = aslSession.getScope(); scope = serviceCredentials.getScope();
} }
/** /**
* *
* @param aslSession * @param serviceCredentials
* @param shareTemplate * @param shareTemplate
*/ */
public TDMNotifications(HttpServletRequest request, ASLSession aslSession, public TDMNotifications(HttpServletRequest request,
ServiceCredentials serviceCredentials,
ShareTemplate shareTemplate) { ShareTemplate shareTemplate) {
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
this.shareTemplate = shareTemplate; this.shareTemplate = shareTemplate;
this.notificationType = NotificationType.TDM_TEMPLATE_SHARE; this.notificationType = NotificationType.TDM_TEMPLATE_SHARE;
site = new SocialNetworkingSite(request); site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(), user = new SocialNetworkingUser(serviceCredentials.getUserName(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(), serviceCredentials.getEmail(), serviceCredentials.getFullName(),
aslSession.getUserAvatarId()); serviceCredentials.getUserAvatarURL());
scope = aslSession.getScope(); scope = serviceCredentials.getScope();
} }
@ -134,7 +135,7 @@ public class TDMNotifications extends Thread {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + notificationType
+ " - " + " - "
+ aslSession.getUsername() + serviceCredentials.getUserName()
+ " share tabular resource id=" + " share tabular resource id="
+ shareTabularResource.getTabResource() + shareTabularResource.getTabResource()
.getTrId().getId() + " with " .getTrId().getId() + " with "
@ -164,7 +165,7 @@ public class TDMNotifications extends Thread {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + notificationType
+ " - " + " - "
+ aslSession.getUsername() + serviceCredentials.getUserName()
+ " share tabular resource id=" + " share tabular resource id="
+ shareTabularResource.getTabResource().getTrId() + shareTabularResource.getTabResource().getTrId()
.getId() + " with " + contact.getLogin() .getId() + " with " + contact.getLogin()
@ -196,7 +197,7 @@ public class TDMNotifications extends Thread {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + notificationType
+ " - " + " - "
+ aslSession.getUsername() + serviceCredentials.getUserName()
+ " share rule id=" + " share rule id="
+ shareRule.getRuleDescriptionData() + shareRule.getRuleDescriptionData()
.getId() + " with " + member .getId() + " with " + member
@ -222,7 +223,7 @@ public class TDMNotifications extends Thread {
} catch (Exception e) { } catch (Exception e) {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + " - " + notificationType + " - "
+ aslSession.getUsername() + " share rule id=" + serviceCredentials.getUserName() + " share rule id="
+ shareRule.getRuleDescriptionData().getId() + shareRule.getRuleDescriptionData().getId()
+ " with " + contact.getLogin() + "): " + " with " + contact.getLogin() + "): "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
@ -253,7 +254,7 @@ public class TDMNotifications extends Thread {
} catch (Exception e) { } catch (Exception e) {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + " - " + notificationType + " - "
+ aslSession.getUsername() + serviceCredentials.getUserName()
+ " share template id=" + " share template id="
+ shareTemplate.getTemplateData().getId() + shareTemplate.getTemplateData().getId()
+ " with " + member + "): " + " with " + member + "): "
@ -279,7 +280,7 @@ public class TDMNotifications extends Thread {
} catch (Exception e) { } catch (Exception e) {
logger.error("Error in the notification(Type: " logger.error("Error in the notification(Type: "
+ notificationType + " - " + notificationType + " - "
+ aslSession.getUsername() + " share template id=" + serviceCredentials.getUserName() + " share template id="
+ shareTemplate.getTemplateData().getId() + shareTemplate.getTemplateData().getId()
+ " with " + contact.getLogin() + "): " + " with " + contact.getLogin() + "): "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.server.uriresolver;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.uriresolver.UriResolverSession; import org.gcube.portlets.user.td.gwtservice.shared.uriresolver.UriResolverSession;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager; import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
@ -27,7 +27,7 @@ public class UriResolverTDClient {
} }
public String resolve(UriResolverSession uriResolverSession, public String resolve(UriResolverSession uriResolverSession,
ASLSession aslSession) throws TDGWTServiceException { ServiceCredentials serviceCredentials) throws TDGWTServiceException {
try { try {
String link = ""; String link = "";
@ -42,7 +42,7 @@ public class UriResolverTDClient {
resolver = new UriResolverManager(uriResolverSession resolver = new UriResolverManager(uriResolverSession
.getApplicationType().toString()); .getApplicationType().toString());
params.put("gis-UUID", uriResolverSession.getUuid()); params.put("gis-UUID", uriResolverSession.getUuid());
params.put("scope", aslSession.getScope()); params.put("scope", serviceCredentials.getScope());
logger.debug("Uri Resolver params: " + params); logger.debug("Uri Resolver params: " + params);
link = resolver.getLink(params, true); // true, link is shorted link = resolver.getLink(params, true); // true, link is shorted
// otherwise none // otherwise none

View File

@ -10,12 +10,18 @@ package org.gcube.portlets.user.td.gwtservice.shared;
* *
*/ */
public class Constants { public class Constants {
public static final boolean DEBUG_MODE = false; public static final boolean DEBUG_MODE = true;
public static final boolean TEST_ENABLE = false; public static final boolean TEST_ENABLE = true;
public static final String DEFAULT_USER = "giancarlo.panichi"; public static final String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devNext"; public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548"; public static final String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548";
//public static final String DEFAULT_SCOPE = "/gcube/devNext";
//public static final String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
public static final String DEFAULT_ROLE = "OrganizationMember"; public static final String DEFAULT_ROLE = "OrganizationMember";
public final static String FILE_XML_MIMETYPE = "application/xml"; public final static String FILE_XML_MIMETYPE = "application/xml";

View File

@ -6,9 +6,6 @@ import java.util.List;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus;
import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata;
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
@ -30,9 +27,9 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.JobClassifierMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS; import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier; import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
@ -64,7 +61,7 @@ public class BackgroundOperationMonitorCreator {
protected HttpSession session; protected HttpSession session;
protected TaskWrapper taskWrapper; protected TaskWrapper taskWrapper;
protected OperationMonitorSession operationMonitorSession; protected OperationMonitorSession operationMonitorSession;
protected ASLSession aslSession; protected ServiceCredentials serviceCredentials;
/** /**
* *
@ -73,10 +70,10 @@ public class BackgroundOperationMonitorCreator {
* @param operationMonitorSession * @param operationMonitorSession
*/ */
public BackgroundOperationMonitorCreator(HttpSession session, public BackgroundOperationMonitorCreator(HttpSession session,
ASLSession aslSession, TaskWrapper taskWrapper, ServiceCredentials serviceCredentials, TaskWrapper taskWrapper,
OperationMonitorSession operationMonitorSession) { OperationMonitorSession operationMonitorSession) {
this.session = session; this.session = session;
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
this.taskWrapper = taskWrapper; this.taskWrapper = taskWrapper;
this.operationMonitorSession = operationMonitorSession; this.operationMonitorSession = operationMonitorSession;
logger.debug("BackgroundOperationMonitorCreator: " + taskWrapper + " " logger.debug("BackgroundOperationMonitorCreator: " + taskWrapper + " "
@ -330,10 +327,6 @@ public class BackgroundOperationMonitorCreator {
protected TRId retrieveTabularResourceBasicData(TRId trId) protected TRId retrieveTabularResourceBasicData(TRId trId)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
ASLSession aslSession = SessionUtil.getAslSession(session);
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
TabularResourceId tabularResourceId = new TabularResourceId( TabularResourceId tabularResourceId = new TabularResourceId(
new Long(trId.getId())); new Long(trId.getId()));
@ -376,8 +369,7 @@ public class BackgroundOperationMonitorCreator {
logger.debug("Retrieved TRId basic info:" + newTRId.toString()); logger.debug("Retrieved TRId basic info:" + newTRId.toString());
return newTRId; return newTRId;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (SecurityException e) { } catch (SecurityException e) {
e.printStackTrace(); e.printStackTrace();
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
@ -401,7 +393,7 @@ public class BackgroundOperationMonitorCreator {
throws TDGWTServiceException { throws TDGWTServiceException {
CSVExportSession exportSession = SessionUtil CSVExportSession exportSession = SessionUtil
.getCSVExportSession(session); .getCSVExportSession(session);
String user = aslSession.getUsername(); String user = serviceCredentials.getUserName();
logger.debug("Save Export In Destination"); logger.debug("Save Export In Destination");
logger.debug("Destination: " + exportSession.getDestination().getId()); logger.debug("Destination: " + exportSession.getDestination().getId());
@ -449,7 +441,7 @@ public class BackgroundOperationMonitorCreator {
throws TDGWTServiceException { throws TDGWTServiceException {
JSONExportSession exportSession = SessionUtil JSONExportSession exportSession = SessionUtil
.getJSONExportSession(session); .getJSONExportSession(session);
String user = aslSession.getUsername(); String user = serviceCredentials.getUserName();
logger.debug("Save Export In Destination"); logger.debug("Save Export In Destination");
logger.debug("Destination: " + exportSession.getDestination().getId()); logger.debug("Destination: " + exportSession.getDestination().getId());
@ -488,8 +480,6 @@ public class BackgroundOperationMonitorCreator {
private String retrieveTabularResourceIdFromTable(TableId tableId) private String retrieveTabularResourceIdFromTable(TableId tableId)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
Table table = service.getTable(tableId); Table table = service.getTable(tableId);
@ -513,8 +503,6 @@ public class BackgroundOperationMonitorCreator {
private void retrieveNameOfTabularResourceOnWhicWasLaunchedTheTask( private void retrieveNameOfTabularResourceOnWhicWasLaunchedTheTask(
OperationMonitor operationMonitor) throws TDGWTServiceException { OperationMonitor operationMonitor) throws TDGWTServiceException {
try { try {
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
if (operationMonitor == null || operationMonitor.getTask() == null) { if (operationMonitor == null || operationMonitor.getTask() == null) {

View File

@ -6,9 +6,6 @@ import java.util.List;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus;
import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata;
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
@ -29,6 +26,7 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.JobClassifierMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
@ -64,7 +62,7 @@ public class OperationMonitorCreator {
private HttpSession session; private HttpSession session;
private TaskWrapper taskWrapper; private TaskWrapper taskWrapper;
private OperationMonitorSession operationMonitorSession; private OperationMonitorSession operationMonitorSession;
private ASLSession aslSession; private ServiceCredentials serviceCredentials;
/** /**
* *
@ -72,11 +70,11 @@ public class OperationMonitorCreator {
* @param startTRId * @param startTRId
* @param operationMonitorSession * @param operationMonitorSession
*/ */
public OperationMonitorCreator(HttpSession session, ASLSession aslSession, public OperationMonitorCreator(HttpSession session, ServiceCredentials serviceCredentials,
TaskWrapper taskWrapper, TaskWrapper taskWrapper,
OperationMonitorSession operationMonitorSession) { OperationMonitorSession operationMonitorSession) {
this.session = session; this.session=session;
this.aslSession = aslSession; this.serviceCredentials = serviceCredentials;
this.taskWrapper = taskWrapper; this.taskWrapper = taskWrapper;
this.operationMonitorSession = operationMonitorSession; this.operationMonitorSession = operationMonitorSession;
@ -374,10 +372,7 @@ public class OperationMonitorCreator {
protected TRId retrieveTabularResourceBasicData(TRId trId) protected TRId retrieveTabularResourceBasicData(TRId trId)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
ASLSession aslSession = SessionUtil.getAslSession(session);
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
TabularResourceId tabularResourceId = new TabularResourceId( TabularResourceId tabularResourceId = new TabularResourceId(
new Long(trId.getId())); new Long(trId.getId()));
@ -456,7 +451,7 @@ public class OperationMonitorCreator {
throws TDGWTServiceException { throws TDGWTServiceException {
CSVExportSession exportSession = SessionUtil CSVExportSession exportSession = SessionUtil
.getCSVExportSession(session); .getCSVExportSession(session);
String user = aslSession.getUsername(); String user = serviceCredentials.getUserName();
logger.debug("Save Export In Destination"); logger.debug("Save Export In Destination");
logger.debug("Destination: " + exportSession.getDestination().getId()); logger.debug("Destination: " + exportSession.getDestination().getId());
@ -504,7 +499,7 @@ public class OperationMonitorCreator {
throws TDGWTServiceException { throws TDGWTServiceException {
JSONExportSession exportSession = SessionUtil JSONExportSession exportSession = SessionUtil
.getJSONExportSession(session); .getJSONExportSession(session);
String user = aslSession.getUsername(); String user = serviceCredentials.getUserName();
logger.debug("Save Export In Destination"); logger.debug("Save Export In Destination");
logger.debug("Destination: " + exportSession.getDestination().getId()); logger.debug("Destination: " + exportSession.getDestination().getId());
@ -543,8 +538,6 @@ public class OperationMonitorCreator {
private String retrieveTabularResourceIdFromTable(TableId tableId) private String retrieveTabularResourceIdFromTable(TableId tableId)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
Table table = service.getTable(tableId); Table table = service.getTable(tableId);

View File

@ -9,14 +9,13 @@ import java.io.Serializable;
* *
*/ */
public class UserInfo implements Serializable { public class UserInfo implements Serializable {
private static final long serialVersionUID = -2826549639677017234L; private static final long serialVersionUID = 7894334667499287578L;
private String username; private String username;
private long groupId; private String groupId;
private String groupName; private String groupName;
private String scope; private String scope;
private String scopeName;
private String userEmailAddress; private String userEmailAddress;
private String userFullName; private String userFullName;
@ -34,15 +33,13 @@ public class UserInfo implements Serializable {
* @param userEmailAddress * @param userEmailAddress
* @param userFullName * @param userFullName
*/ */
public UserInfo(String username, long groupId, String groupName, public UserInfo(String username, String groupId, String groupName,
String scope, String scopeName, String userEmailAddress, String scope, String userEmailAddress, String userFullName) {
String userFullName) {
super(); super();
this.username = username; this.username = username;
this.groupId = groupId; this.groupId = groupId;
this.groupName = groupName; this.groupName = groupName;
this.scope = scope; this.scope = scope;
this.scopeName = scopeName;
this.userEmailAddress = userEmailAddress; this.userEmailAddress = userEmailAddress;
this.userFullName = userFullName; this.userFullName = userFullName;
} }
@ -55,11 +52,11 @@ public class UserInfo implements Serializable {
this.username = username; this.username = username;
} }
public long getGroupId() { public String getGroupId() {
return groupId; return groupId;
} }
public void setGroupId(long groupId) { public void setGroupId(String groupId) {
this.groupId = groupId; this.groupId = groupId;
} }
@ -79,14 +76,6 @@ public class UserInfo implements Serializable {
this.scope = scope; this.scope = scope;
} }
public String getScopeName() {
return scopeName;
}
public void setScopeName(String scopeName) {
this.scopeName = scopeName;
}
public String getUserEmailAddress() { public String getUserEmailAddress() {
return userEmailAddress; return userEmailAddress;
} }
@ -107,8 +96,7 @@ public class UserInfo implements Serializable {
public String toString() { public String toString() {
return "UserInfo [username=" + username + ", groupId=" + groupId return "UserInfo [username=" + username + ", groupId=" + groupId
+ ", groupName=" + groupName + ", scope=" + scope + ", groupName=" + groupName + ", scope=" + scope
+ ", scopeName=" + scopeName + ", userEmailAddress=" + ", userEmailAddress=" + userEmailAddress + ", userFullName="
+ userEmailAddress + ", userFullName=" + userFullName + "]"; + userFullName + "]";
} }
} }