From 25830d5b399d229070436641ce9a357c766b0680 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 10 Nov 2014 17:59:04 +0000 Subject: [PATCH] Added Chart git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@101556 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/gwtservice/server/SessionUtil.java | 22 +- .../gwtservice/server/TDGWTServiceImpl.java | 427 ++++++------------ .../gwtservice/shared/chart/ChartSession.java | 81 ++++ .../shared/chart/ChartTopRatingSession.java | 14 +- .../BackgroundOperationMonitorCreator.java | 11 +- .../monitor/OperationMonitorCreator.java | 11 +- 6 files changed, 260 insertions(+), 306 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartSession.java diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java index b850c2c..f8eb640 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java @@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; @@ -82,17 +83,17 @@ public class SessionUtil { ASLSession session; if (username == null) { logger.warn("no user found in session, using test one"); - throw new TDGWTSessionExpiredException("Session Expired!"); + /* throw new TDGWTSessionExpiredException("Session Expired!"); */ // Remove comment for Test - /* - * username = Constants.DEFAULT_USER; String scope = - * Constants.DEFAULT_SCOPE; - * - * httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, - * username); session = SessionManager.getInstance().getASLSession( - * httpSession.getId(), username); session.setScope(scope); - */ + + username = Constants.DEFAULT_USER; + String scope = Constants.DEFAULT_SCOPE; + + httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username); + session = SessionManager.getInstance().getASLSession( + httpSession.getId(), username); + session.setScope(scope); } else { session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); @@ -1564,7 +1565,8 @@ public class SessionUtil { ChartTopRatingSession chart = (ChartTopRatingSession) httpSession .getAttribute(SessionConstants.CHART_TOPRATING_SESSION); if (chart != null) { - httpSession.removeAttribute(SessionConstants.CHART_TOPRATING_SESSION); + httpSession + .removeAttribute(SessionConstants.CHART_TOPRATING_SESSION); } httpSession.setAttribute(SessionConstants.CHART_TOPRATING_SESSION, chartTopRatingSession); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index 4966a74..d708611 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -276,18 +276,21 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; */ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTService { - + private static final String NO_VALID_TABULAR_RESOURCE_ID_PRESENT = "No valid tabular resource id present"; + private static final String TABULAR_RESOURCE_IS_FINAL = "Tabular Resource Is Final"; + private static final String TABULAR_RESOURCE_IS_LOCKED = "Tabular Resource Is Locked"; + private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!"; + private static final long serialVersionUID = -5707400086333186368L; - protected static Logger logger = LoggerFactory + private static Logger logger = LoggerFactory .getLogger(TDGWTServiceImpl.class); - protected static SimpleDateFormat sdf = new SimpleDateFormat( + private static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); - protected static SimpleDateFormat sdfDate = new SimpleDateFormat( - "yyyy-MM-dd"); + private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); - protected static SimpleDateFormat sdfPerformance = new SimpleDateFormat( + private static SimpleDateFormat sdfPerformance = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS"); /** @@ -333,8 +336,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("restoreUISession(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error in UI Session Restore: " @@ -403,8 +405,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error retrieving TR id: " @@ -432,8 +433,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error retrieving TR id: " @@ -480,8 +480,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error retrieving TR id: " @@ -510,8 +509,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error retrieving TR id: " @@ -563,62 +561,51 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Table not contains DataseViewTableMetadata"); } - TRId trIdNew=tabResource.getTrId(); + TRId trIdNew = tabResource.getTrId(); if (viewTable == null) { logger.debug("ViewTable is null"); - String tableId=String.valueOf(table.getId().getValue()); - - if (tabResource - .getTrId() - .getTableId() - .compareTo(tableId) == 0) { - trIdNew.setTableId( - tableId); - trIdNew.setTableType( - table.getTableType().getName()); + String tableId = String.valueOf(table.getId().getValue()); + + if (tabResource.getTrId().getTableId().compareTo(tableId) == 0) { + trIdNew.setTableId(tableId); + trIdNew.setTableType(table.getTableType().getName()); trIdNew.setViewTable(false); tabResource.setTrId(trIdNew); } else { - trIdNew.setTableId( - tableId); - trIdNew.setTableType( - table.getTableType().getName()); + trIdNew.setTableId(tableId); + trIdNew.setTableType(table.getTableType().getName()); trIdNew.setViewTable(false); tabResource.setTrId(trIdNew); - SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); - + SessionUtil.addToCurrentTabularResourcesOpen(session, + tabResource); + } } else { - String tableId=String.valueOf(viewTable.getId().getValue()); - if (tabResource - .getTrId() - .getTableId() - .compareTo(tableId) == 0) { - trIdNew.setTableId( - tableId); - trIdNew.setTableType( - viewTable.getTableType().getName()); - trIdNew.setReferenceTargetTableId( - String.valueOf(table.getId().getValue())); + String tableId = String.valueOf(viewTable.getId() + .getValue()); + if (tabResource.getTrId().getTableId().compareTo(tableId) == 0) { + trIdNew.setTableId(tableId); + trIdNew.setTableType(viewTable.getTableType().getName()); + trIdNew.setReferenceTargetTableId(String.valueOf(table + .getId().getValue())); trIdNew.setViewTable(true); tabResource.setTrId(trIdNew); } else { - trIdNew.setTableId( - tableId); - trIdNew.setTableType( - viewTable.getTableType().getName()); - trIdNew.setReferenceTargetTableId( - String.valueOf(table.getId().getValue())); + trIdNew.setTableId(tableId); + trIdNew.setTableType(viewTable.getTableType().getName()); + trIdNew.setReferenceTargetTableId(String.valueOf(table + .getId().getValue())); trIdNew.setViewTable(true); tabResource.setTrId(trIdNew); - SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); + SessionUtil.addToCurrentTabularResourcesOpen(session, + tabResource); } } // SessionUtil.setTabResource(session, tabResource); SessionUtil.setTRId(session, tabResource.getTrId()); - logger.debug("New Active: "+tabResource.getTrId()); + logger.debug("New Active: " + tabResource.getTrId()); } else { logger.error("Set Active Tabular Resource failed, no valid id!: " + activeTRId); @@ -631,8 +618,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error retrieving TR id: " @@ -656,8 +642,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error setting TabResource parameter: " @@ -722,8 +707,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error setting TabResource parameter: " @@ -783,8 +767,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error setting TabResource parameter: " @@ -956,8 +939,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving Columns: " + e.getLocalizedMessage(), e); @@ -1075,8 +1057,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving Columns: " + e.getLocalizedMessage(), e); @@ -1206,8 +1187,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving Columns: " + e.getLocalizedMessage(), e); @@ -1368,8 +1348,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving Columns: " + e.getLocalizedMessage(), e); @@ -1488,8 +1467,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error retrieving Column: " + e.getLocalizedMessage(), e); @@ -1607,8 +1585,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error retrieving Column: " + e.getLocalizedMessage(), e); @@ -1721,8 +1698,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving Validation Columns: " @@ -1910,8 +1886,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error in getLastTable(): " + e.getLocalizedMessage(), e); @@ -2087,8 +2062,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error in getTable(): " + e.getLocalizedMessage(), e); throw new TDGWTServiceException("Error in getTable(): " @@ -2434,8 +2408,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); logger.error("Error retrieving Codelist in setCodelistsPagingLoader(): " @@ -2518,8 +2491,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); logger.error("Error retrieving Codelist in getCodelistsPagingLoader(): " @@ -2809,8 +2781,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); logger.error("Error retrieving TabularResources: " @@ -2867,8 +2838,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); logger.error("Error retrieving TabularResources: " @@ -2921,8 +2891,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error deleting the tabular resource: " @@ -2970,8 +2939,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error creating new TabularResource: " @@ -3092,8 +3060,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in SDMX Import: " @@ -3162,8 +3129,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in Client Library Request: " @@ -3373,8 +3339,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in CSVImport: " @@ -3645,8 +3610,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error checking if it is a valid tabular resource: " + e.getLocalizedMessage(), e); @@ -3684,8 +3648,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error checking if it is a finalized tabular resource: " @@ -3724,8 +3687,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error("Error checking if it is a locked tabular resource: " + e.getLocalizedMessage(), e); @@ -3815,8 +3777,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error in getTRMetadata(): " + e.getLocalizedMessage(), e); @@ -3924,8 +3885,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error in getTRMetadata(): " + e.getLocalizedMessage(), e); @@ -3982,8 +3942,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error in getTableValidationMetadata(): " @@ -4189,12 +4148,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements protected void checkTRId(TRId trId) throws TDGWTServiceException { if (trId == null) { logger.error("TRId is null"); - new TDGWTServiceException("No valid tabular resource id present"); + new TDGWTServiceException(NO_VALID_TABULAR_RESOURCE_ID_PRESENT); } if (trId.getId() == null || trId.getId().isEmpty()) { logger.error("TRId not valid: " + trId); - new TDGWTServiceException("No valid tabular resource id present"); + new TDGWTServiceException(NO_VALID_TABULAR_RESOURCE_ID_PRESENT); } } @@ -4209,8 +4168,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { if (tabularResource.isLocked()) { - logger.error("Tabular Resource Is Locked"); - throw new TDGWTIsLockedException("Tabular Resource Is Locked"); + logger.error(TABULAR_RESOURCE_IS_LOCKED); + throw new TDGWTIsLockedException(TABULAR_RESOURCE_IS_LOCKED); } } catch (TDGWTServiceException e) { throw e; @@ -4233,8 +4192,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { try { if (tabularResource.isFinalized()) { - logger.error("Tabular Resource Is Final"); - throw new TDGWTIsFinalException("Tabular Resource Is Final"); + logger.error(TABULAR_RESOURCE_IS_FINAL); + throw new TDGWTIsFinalException(TABULAR_RESOURCE_IS_FINAL); } } catch (TDGWTServiceException e) { @@ -4348,8 +4307,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in CSVExport: " @@ -4423,8 +4381,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in CSV Export: " @@ -4497,8 +4454,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in JSON Export: " @@ -4564,8 +4520,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in ChangeColumnType: " @@ -4625,8 +4580,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in AddColumn: " @@ -4689,8 +4643,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in DeleteColumn: " @@ -4763,8 +4716,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in filter column: " @@ -4850,8 +4802,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -4913,8 +4864,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Changing The Column Label: " @@ -4978,8 +4928,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Changing Table Type: " @@ -5094,8 +5043,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error in getColumnsForDimension() retrieving Columns: " @@ -5157,8 +5105,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Deleting Rows: " @@ -5246,8 +5193,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Cloning: " @@ -5308,8 +5254,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -5344,8 +5289,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return contacts; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in retrieveShareInfo: " @@ -5354,45 +5298,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * - * {@inheritDoc} - */ - /* - * @Override public ShareInfo getShareInfo(TRId trId) throws - * TDGWTServiceException { try { HttpSession session = - * this.getThreadLocalRequest().getSession(); ASLSession aslSession = - * SessionUtil.getAslSession(session); - * - * TabResource tabResource = getTabResourceInformation(trId); - * - * AuthorizationProvider.instance.set(new AuthorizationToken( - * aslSession.getUsername(), aslSession.getScope())); TabularDataService - * service = TabularDataServiceFactory.getService(); - * - * TabularResourceId serviceTR = new TabularResourceId( - * Long.valueOf(tabResource.getTrId().getId())); - * - * TabularResource tr = service.getTabularResource(serviceTR); - * ArrayList contacts = new ArrayList(); List - * sharedWithUsers = tr.getSharedWithUsers(); - * logger.debug("Shared with Users: " + sharedWithUsers); if - * (sharedWithUsers != null) { for (String user : sharedWithUsers) { - * Contacts cont = new Contacts(user, user, false); contacts.add(cont); } } - * - * List sharedWithGroups = tr.getSharedWithGroup(); - * logger.debug("Shared with Groups: " + sharedWithUsers); if - * (sharedWithGroups != null) { for (String group : sharedWithGroups) { - * Contacts cont = new Contacts(group, group, true); contacts.add(cont); } } - * - * ShareInfo shareInfo = new ShareInfo(tabResource, contacts); return - * shareInfo; } catch (TDGWTServiceException e) { throw e; } catch - * (SecurityException e) { e.printStackTrace(); throw new - * TDGWTServiceException( "Security exception, you haven't rights!"); } - * catch (Throwable e) { e.printStackTrace(); throw new - * TDGWTServiceException("Error in getShareInfo: " + - * e.getLocalizedMessage()); } } - */ + /** * @@ -5432,8 +5338,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error on service"); @@ -5478,8 +5383,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error on service"); @@ -5507,8 +5411,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error in checkTabularResourceNotFinal: " + e.getLocalizedMessage()); @@ -5631,8 +5534,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error in setTabResourceInformation: " + e.getLocalizedMessage()); @@ -5672,8 +5574,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error in GetOccurencesForBatchReplace: " + e.getLocalizedMessage()); @@ -5737,8 +5638,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error in GetTemplates: " + e.getLocalizedMessage()); e.printStackTrace(); @@ -5777,8 +5677,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return contacts; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in retrieveShareInfo: " @@ -5831,8 +5730,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error StartTemplateApply: " + e.getLocalizedMessage()); e.printStackTrace(); @@ -5873,8 +5771,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error StartTemplateDelete: No such Template"); } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("Error StartTemplateDelete: " + e.getLocalizedMessage()); @@ -5939,8 +5836,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -6011,8 +5907,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -6104,8 +5999,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6162,8 +6056,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6226,8 +6119,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("getHistory(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6284,8 +6176,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("getHistory(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6390,8 +6281,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("discard(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6453,8 +6343,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.debug("rollBack(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6546,8 +6435,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error in getValidationsTasksMetadata(): " @@ -6607,8 +6495,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in operation: " @@ -6717,8 +6604,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in resubmit task: " @@ -6866,8 +6752,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in resume task: " @@ -6931,8 +6816,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in extract codelist: " @@ -6997,8 +6881,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in split column: " @@ -7064,8 +6947,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in split column: " @@ -7219,8 +7101,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -7356,8 +7237,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in start group by: " @@ -7416,8 +7296,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in start Time Aggregation: " @@ -7480,8 +7359,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in start normalization: " @@ -7547,8 +7425,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in start denormalization: " @@ -7608,8 +7485,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in union: " @@ -7617,18 +7493,19 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - - + /** * * {@inheritDoc} */ @Override - public String startReplaceByExternal(ReplaceByExternalSession replaceByExternalSession) + public String startReplaceByExternal( + ReplaceByExternalSession replaceByExternalSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - SessionUtil.setReplaceByExternalSession(session, replaceByExternalSession); + SessionUtil.setReplaceByExternalSession(session, + replaceByExternalSession); ASLSession aslSession = SessionUtil.getAslSession(session); AuthorizationProvider.instance.set(new AuthorizationToken( @@ -7646,8 +7523,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements checkTabularResourceLocked(tabularResource); checkTabularResourceIsFinal(tabularResource); - OpExecution4ReplaceByExternal opEx = new OpExecution4ReplaceByExternal(service, - replaceByExternalSession); + OpExecution4ReplaceByExternal opEx = new OpExecution4ReplaceByExternal( + service, replaceByExternalSession); OpExecutionDirector director = new OpExecutionDirector(); director.setOperationExecutionBuilder(opEx); director.constructOperationExecution(); @@ -7662,7 +7539,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Start Task on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, - UIOperationsId.ReplaceByExternal, replaceByExternalSession.getTrId()); + UIOperationsId.ReplaceByExternal, + replaceByExternalSession.getTrId()); SessionUtil.setStartedTask(session, taskWrapper); return trTask.getId().getValue(); @@ -7670,8 +7548,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in replace by external: " @@ -7679,7 +7556,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - /** * @@ -7734,8 +7610,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in statistical operation: " @@ -7803,8 +7678,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in get Licences: " @@ -7905,8 +7779,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving resources: " + e.getLocalizedMessage(), e); @@ -7950,8 +7823,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error retrieving resources by type: " @@ -8017,8 +7889,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { logger.error( "Error deleting the resource: " + e.getLocalizedMessage(), @@ -8074,8 +7945,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error creating the map: " @@ -8122,8 +7992,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -8132,30 +8001,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - @Override - public String startChartTopRating(ChartTopRatingSession chartTopRatingSession) + public String startChartTopRating( + ChartTopRatingSession chartTopRatingSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - SessionUtil.setChartTopRatingSession(session, chartTopRatingSession); + SessionUtil + .setChartTopRatingSession(session, chartTopRatingSession); ASLSession aslSession = SessionUtil.getAslSession(session); AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTRId(chartTopRatingSession.getTrId()); + checkTRId(chartTopRatingSession.getColumn().getTrId()); TabularResourceId tabularResourceId = new TabularResourceId( - Long.valueOf(chartTopRatingSession.getTrId().getId())); + Long.valueOf(chartTopRatingSession.getColumn().getTrId() + .getId())); TabularResource tabularResource = service .getTabularResource(tabularResourceId); checkTabularResourceLocked(tabularResource); - OpExecution4ChartTopRating opEx = new OpExecution4ChartTopRating(service, - chartTopRatingSession); + OpExecution4ChartTopRating opEx = new OpExecution4ChartTopRating( + service, chartTopRatingSession); OpExecutionDirector director = new OpExecutionDirector(); director.setOperationExecutionBuilder(opEx); director.constructOperationExecution(); @@ -8171,7 +8042,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Start Task on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, - UIOperationsId.ChartTopRating, chartTopRatingSession.getTrId()); + UIOperationsId.ChartTopRating, chartTopRatingSession + .getColumn().getTrId()); SessionUtil.setStartedTask(session, taskWrapper); return trTask.getId().getValue(); @@ -8179,8 +8051,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw e; } catch (SecurityException e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error creating top rating chart: " @@ -8188,5 +8059,5 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartSession.java new file mode 100644 index 0000000..7a88880 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartSession.java @@ -0,0 +1,81 @@ +package org.gcube.portlets.user.td.gwtservice.shared.chart; + +import java.io.Serializable; +import java.util.ArrayList; + +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.google.web.bindery.event.shared.EventBus; + +/** + * Chart Session + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class ChartSession implements Serializable { + + private static final long serialVersionUID = -51554111438593905L; + private TRId trId; + private UserInfo userInfo; + private EventBus eventBus; + private ArrayList columns; + + public ChartSession() { + super(); + + } + + public ChartSession(TRId trId, UserInfo userInfo, EventBus eventBus, + ArrayList columns) { + super(); + this.trId = trId; + this.userInfo = userInfo; + this.eventBus = eventBus; + this.columns = columns; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + public UserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + } + + public EventBus getEventBus() { + return eventBus; + } + + public void setEventBus(EventBus eventBus) { + this.eventBus = eventBus; + } + + public ArrayList getColumns() { + return columns; + } + + public void setColumns(ArrayList columns) { + this.columns = columns; + } + + @Override + public String toString() { + return "ChartSession [trId=" + trId + ", userInfo=" + userInfo + + ", eventBus=" + eventBus + ", columns=" + columns + "]"; + } + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartTopRatingSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartTopRatingSession.java index 6267299..bd50b8e 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartTopRatingSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/chart/ChartTopRatingSession.java @@ -26,7 +26,7 @@ public class ChartTopRatingSession implements Serializable { public ChartTopRatingSession() { super(); } - + /** * * @param trId @@ -43,47 +43,38 @@ public class ChartTopRatingSession implements Serializable { this.valueOperation = valueOperation; } - public TRId getTrId() { return trId; } - public void setTrId(TRId trId) { this.trId = trId; } - public ColumnData getColumn() { return column; } - public void setColumn(ColumnData column) { this.column = column; } - public Integer getSampleSize() { return sampleSize; } - public void setSampleSize(Integer sampleSize) { this.sampleSize = sampleSize; } - public String getValueOperation() { return valueOperation; } - public void setValueOperation(String valueOperation) { this.valueOperation = valueOperation; } - @Override public String toString() { return "ChartTopRatingSession [trId=" + trId + ", column=" + column @@ -95,4 +86,7 @@ public class ChartTopRatingSession implements Serializable { + + + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java index c2d2582..d169ec5 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java @@ -45,13 +45,16 @@ import org.slf4j.LoggerFactory; * */ public class BackgroundOperationMonitorCreator { - protected static Logger logger = LoggerFactory + private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!"; + + private static Logger logger = LoggerFactory .getLogger(BackgroundOperationMonitorCreator.class); - protected static SimpleDateFormat sdf = new SimpleDateFormat( + private static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); - protected static SimpleDateFormat sdfDate = new SimpleDateFormat( + @SuppressWarnings("unused") + private static SimpleDateFormat sdfDate = new SimpleDateFormat( "yyyy-MM-dd"); protected HttpSession session; @@ -345,7 +348,7 @@ public class BackgroundOperationMonitorCreator { } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in Client Library Request: " diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java index b6e8437..9afda48 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java @@ -46,13 +46,16 @@ import org.slf4j.LoggerFactory; * */ public class OperationMonitorCreator { - protected static Logger logger = LoggerFactory + private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!"; + + private static Logger logger = LoggerFactory .getLogger(OperationMonitorCreator.class); - protected static SimpleDateFormat sdf = new SimpleDateFormat( + private static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); - protected static SimpleDateFormat sdfDate = new SimpleDateFormat( + @SuppressWarnings("unused") + private static SimpleDateFormat sdfDate = new SimpleDateFormat( "yyyy-MM-dd"); protected HttpSession session; @@ -399,7 +402,7 @@ public class OperationMonitorCreator { } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException( - "Security exception, you haven't rights!"); + SECURITY_EXCEPTION_RIGHTS); } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Retrieving Basic Data: "