Added TDGWTSessionExpiredException

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@95716 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-15 12:55:30 +00:00
parent 71cd544fdf
commit 3e764a8388
5 changed files with 275 additions and 60 deletions

View File

@ -22,7 +22,7 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener;
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
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.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
import org.slf4j.Logger;
@ -70,12 +70,13 @@ public class LocalUploadServlet extends HttpServlet {
fileUploadSession.setCsvImportMonitor(csvImportMonitor);
fileUploadSession.setFileUploadMonitor(fileUploadMonitor);
try {
SessionUtil.setFileUploadSession(session,fileUploadSession);
} catch (TDGWTServiceException e1) {
logger.error(e1.getLocalizedMessage());
e1.printStackTrace();
throw new ServletException(e1.getLocalizedMessage());
} catch (TDGWTSessionExpiredException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new ServletException(e.getLocalizedMessage());
}
@ -102,7 +103,7 @@ public class LocalUploadServlet extends HttpServlet {
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setFileUploadSession(session, fileUploadSession);
} catch (TDGWTServiceException e1) {
} catch (TDGWTSessionExpiredException e1) {
logger.error(e1.getLocalizedMessage());
e1.printStackTrace();
throw new ServletException(e1.getLocalizedMessage());
@ -117,7 +118,7 @@ public class LocalUploadServlet extends HttpServlet {
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setFileUploadSession(session, fileUploadSession);
} catch (TDGWTServiceException e) {
} catch (TDGWTSessionExpiredException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new ServletException(e.getLocalizedMessage());
@ -139,7 +140,7 @@ public class LocalUploadServlet extends HttpServlet {
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setFileUploadSession(session, fileUploadSession);
} catch (TDGWTServiceException e1) {
} catch (TDGWTSessionExpiredException e1) {
logger.error(e1.getLocalizedMessage());
e1.printStackTrace();
throw new ServletException(e1.getLocalizedMessage());
@ -156,7 +157,7 @@ public class LocalUploadServlet extends HttpServlet {
fileUploadSession.getFileUploadMonitor().setState(FileUploadState.COMPLETED);
try {
SessionUtil.setFileUploadSession(session, fileUploadSession);
} catch (TDGWTServiceException e) {
} catch (TDGWTSessionExpiredException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new ServletException(e.getLocalizedMessage());

View File

@ -18,7 +18,7 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
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.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSessionMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
@ -137,13 +137,13 @@ public class SessionUtil {
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
public static ASLSession getAslSession(HttpSession httpSession) throws TDGWTServiceException {
public static ASLSession getAslSession(HttpSession httpSession) throws TDGWTSessionExpiredException {
String username = (String) httpSession
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
ASLSession session;
if (username == null) {
logger.warn("no user found in session, using test one");
throw new TDGWTServiceException("Session Expired!");
throw new TDGWTSessionExpiredException("Session Expired!");
/*
username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE;
@ -166,7 +166,7 @@ public class SessionUtil {
}
public static void setTDOpenSession(HttpSession httpSession, TDOpenSession s) throws TDGWTServiceException {
public static void setTDOpenSession(HttpSession httpSession, TDOpenSession s) throws TDGWTSessionExpiredException {
TDOpenSession session = (TDOpenSession) httpSession
.getAttribute(TDOPEN_SESSION);
@ -187,7 +187,7 @@ public class SessionUtil {
}
public static void setTabularResources(HttpSession httpSession,
List<TabularResource> trs) throws TDGWTServiceException {
List<TabularResource> trs) throws TDGWTSessionExpiredException {
@SuppressWarnings("unchecked")
List<TabularResource> tabularResources = (List<TabularResource>) httpSession
@ -207,7 +207,7 @@ public class SessionUtil {
return id;
}
public static void setTRId(HttpSession httpSession, TRId trId) throws TDGWTServiceException {
public static void setTRId(HttpSession httpSession, TRId trId) throws TDGWTSessionExpiredException {
TRId id = (TRId) httpSession.getAttribute(CURRENT_TR_ID);
if (id != null)
httpSession.removeAttribute(CURRENT_TR_ID);
@ -226,7 +226,7 @@ public class SessionUtil {
}
public static void setTabResource(HttpSession httpSession,
TabResource tabResource) throws TDGWTServiceException {
TabResource tabResource) throws TDGWTSessionExpiredException {
TabResource t = (TabResource) httpSession
.getAttribute(CURRENT_TABULAR_RESOURCE);
if (t != null)
@ -246,7 +246,7 @@ public class SessionUtil {
}
public static void setSDMXImportTabResource(HttpSession httpSession,
TabResource tabResource) throws TDGWTServiceException {
TabResource tabResource) throws TDGWTSessionExpiredException {
TabResource t = (TabResource) httpSession
.getAttribute(SDMX_IMPORT_TABULAR_RESOURCE);
if (t != null)
@ -267,7 +267,7 @@ public class SessionUtil {
}
public static void setCSVImportTabResource(HttpSession httpSession,
TabResource tabResource) throws TDGWTServiceException {
TabResource tabResource) throws TDGWTSessionExpiredException {
TabResource t = (TabResource) httpSession
.getAttribute(CSV_IMPORT_TABULAR_RESOURCE);
if (t != null)
@ -280,7 +280,7 @@ public class SessionUtil {
// //
public static void setSDMXImportSession(HttpSession httpSession,
SDMXImportSession s) throws TDGWTServiceException {
SDMXImportSession s) throws TDGWTSessionExpiredException {
SDMXImportSession session = (SDMXImportSession) httpSession
.getAttribute(SDMX_IMPORT_SESSION);
@ -301,7 +301,7 @@ public class SessionUtil {
}
public static void setCSVImportSession(HttpSession httpSession,
CSVImportSession s) throws TDGWTServiceException {
CSVImportSession s) throws TDGWTSessionExpiredException {
CSVImportSession session = (CSVImportSession) httpSession
.getAttribute(CSV_IMPORT_SESSION);
@ -322,7 +322,7 @@ public class SessionUtil {
}
public static void setCSVExportSession(HttpSession httpSession,
CSVExportSession s) throws TDGWTServiceException {
CSVExportSession s) throws TDGWTSessionExpiredException {
CSVExportSession session = (CSVExportSession) httpSession
.getAttribute(CSV_EXPORT_SESSION);
@ -343,7 +343,7 @@ public class SessionUtil {
}
public static void setSDMXExportSession(HttpSession httpSession,
SDMXExportSession s) throws TDGWTServiceException {
SDMXExportSession s) throws TDGWTSessionExpiredException {
SDMXExportSession session = (SDMXExportSession) httpSession
.getAttribute(SDMX_EXPORT_SESSION);
@ -364,7 +364,7 @@ public class SessionUtil {
}
public static void setFileUploadSession(HttpSession httpSession,
FileUploadSession s) throws TDGWTServiceException {
FileUploadSession s) throws TDGWTSessionExpiredException {
FileUploadSession session = (FileUploadSession) httpSession
.getAttribute(CSV_IMPORT_FILE_UPLOAD_SESSION);
@ -412,7 +412,7 @@ public class SessionUtil {
}
public static void setSDMXRegistrySource(HttpSession httpSession,
SDMXRegistrySource sdmxRegistrySource) throws TDGWTServiceException {
SDMXRegistrySource sdmxRegistrySource) throws TDGWTSessionExpiredException {
SDMXRegistrySource source = (SDMXRegistrySource) httpSession
.getAttribute(SDMX_REGISTRY_SOURCE);

View File

@ -112,6 +112,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVParserConfiguration;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
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.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
@ -237,7 +238,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
SessionUtil.setTabResource(session, tabResource);
SessionUtil.setTRId(session, tabResource.getTrId());
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error setting TabResource parameter: "
@ -274,6 +277,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
logger.debug("getCurrentTRId():" + currentTR.getTrId());
return currentTR.getTrId();
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e);
throw new TDGWTServiceException("Error retrieving TR id: "
@ -316,6 +322,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ currentTR.toString());
return currentTR;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error setting TabResource parameter: "
@ -356,7 +364,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("GetTabResourceInformation() updated information:"
+ currentTR.toString());
return currentTR;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error setting TabResource parameter: "
@ -506,7 +516,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
return columns;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error retrieving Columns: " + e.getLocalizedMessage(), e);
@ -619,7 +631,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
return columns;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error retrieving Columns: " + e.getLocalizedMessage(), e);
@ -735,7 +749,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
return cData;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error retrieving Column: " + e.getLocalizedMessage(),
e);
@ -851,7 +867,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
return cData;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error retrieving Column: " + e.getLocalizedMessage(),
e);
@ -958,6 +976,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Validation Column: " + columns.size());
return columns;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error retrieving Validation Columns: "
@ -1126,6 +1147,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("getLastTable: " + tData);
return tData;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error in getLastTable(): " + e.getLocalizedMessage(),
e);
@ -1292,7 +1316,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("getTable: " + tData);
return tData;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error in getTable(): " + e.getLocalizedMessage(), e);
throw new TDGWTServiceException("Error in getTable(): "
@ -1311,7 +1337,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
SessionUtil.setTDOpenSession(session, s);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error setting TDOpenSession parameter: "
+ e.getLocalizedMessage());
@ -1403,7 +1431,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
t.setDate(sdf.format(tr.getCreationDate().getTime()));
// logger.debug("TabResource: "+t);
return t;
} catch (Throwable e) {
logger.error("Error retrieving tabular resources metadata in retrieveTRMetadataFromService(): "
+ e.getLocalizedMessage());
@ -1529,6 +1558,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Codelists retrived: " + ltr);
SessionUtil.setCodelistsPagingLoaded(session, ltr);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("Error retrieving Codelist in setCodelistsPagingLoader(): "
@ -1606,6 +1638,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Codelists retrieved: " + ltrTemp);
return codelistPagingLoadResult;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("Error retrieving Codelist in getCodelistsPagingLoader(): "
@ -1890,6 +1925,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Tabular Resources retrived: " + ltr);
return ltr;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("Error retrieving TabularResources: "
@ -1941,6 +1979,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Tabular Resources retrived: " + ltr);
return ltr;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("Error retrieving TabularResources: "
@ -1983,6 +2024,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ owner + ")");
}
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error deleting the tabular resource: "
@ -2023,6 +2067,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
tabResource.setTrId(trId);
tabResource.setValid(serviceTR.isValid());
return tabResource;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error creating new TabularResource: "
@ -2041,6 +2088,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
return SessionUtil.retrieveCodelists(session);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error retrieving codelists: "
@ -2056,6 +2106,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
return SessionUtil.retrieveDatasets(session);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error retrieving datasets: "
@ -2071,6 +2124,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
return SessionUtil.retrieveAgencies(session);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error retrieving datasets: "
@ -2152,6 +2208,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setSDMXImportTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error in Client Library Request: "
@ -2210,7 +2269,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Retrieved TRId basic info:" + newTRId.toString());
return newTRId;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error in Client Library Request: "
@ -2317,6 +2378,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
logger.debug("getSDMXImportMonitor(): " + importMonitor);
return importMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -2336,7 +2400,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
SessionUtil.setSDMXRegistrySource(session, sdmxRegistrySource);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error setting SDMXRegistrySource parameter: "
@ -2357,7 +2423,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
SessionUtil.setCSVImportSession(session, importSession);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error setting SDMXImportSession parameter: "
@ -2553,11 +2621,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
ASLSession aslSession, String user,
FileUploadSession fileUploadSession,
CSVImportSession csvImportSession) throws TDGWTServiceException {
logger.debug("File Storage Access");
logger.debug("CSVImportSession skip:"
+ csvImportSession.isSkipInvalidLines());
/*
* if (csvImportSession.isSkipInvalidLines()) { try {
* fileUploadSession.setCsvFile(CSVFileUtil.skipError(
@ -2727,6 +2795,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
logger.info("getImportMonitor(): " + importMonitor);
return importMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -2743,7 +2814,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
*/
public void getFileFromWorkspace(CSVImportSession csvImportSession)
throws TDGWTServiceException {
// TODO Auto-generated method stub
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
Workspace w = null;
@ -2844,7 +2914,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getId())));
return sdf.format(tr.getCreationDate().getTime());
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getTRCreationDate(): " + e.getLocalizedMessage(),
@ -2877,7 +2949,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getId())));
logger.debug("IsTabularResourceValid: " + tr.isValid());
return tr.isValid();
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error("Error checking if it is a valid tabular resource: "
+ e.getLocalizedMessage(), e);
@ -2951,7 +3024,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("GetTRMetadata retrived: " + listTRMetadata.size());
return listTRMetadata;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getTRMetadata(): " + e.getLocalizedMessage(), e);
@ -3003,7 +3078,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("TabValidationsMetadata: " + tabValidationsMetadata);
return tabValidationsMetadata;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getTableValidationMetadata(): "
@ -3128,7 +3205,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
return listTabMetadata;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getTableMetadata(): " + e.getLocalizedMessage(),
@ -3384,6 +3463,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("getExportMonitor(): " + exportMonitor);
return exportMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -3569,6 +3651,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("getExportMonitor(): " + exportMonitor);
return exportMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4097,6 +4182,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setChangeColumnTypeTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error in ChangeColumnType: "
@ -4203,6 +4291,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("ChangeColumnTypeMonitor(): " + changeColumnTypeMonitor);
return changeColumnTypeMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4242,6 +4333,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setDeleteColumnTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error in DeleteColumn: "
@ -4347,6 +4441,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("DeleteColumnMonitor(): " + deleteColumnMonitor);
return deleteColumnMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4388,6 +4485,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setLabelColumnTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error Changing The Column Label: "
@ -4491,6 +4590,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("LabelColumnMonitor(): " + labelColumnMonitor);
return labelColumnMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4533,6 +4634,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setChangeTableTypeTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error Changing Table Type: "
@ -4641,6 +4744,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("ChangeTableTypeMonitor(): " + changeTableTypeMonitor);
return changeTableTypeMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4752,7 +4857,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
return columns;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getColumnsForDimension() retrieving Columns: "
@ -4792,6 +4898,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setDeleteRowsTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error Deleting Rows: "
@ -4896,6 +5004,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("DeleteRowsMonitor(): " + deleteRowsMonitor);
return deleteRowsMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -4963,6 +5073,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
SessionUtil.setTRId(session, trId);
return trId;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error Cloning: "
@ -5001,6 +5113,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setDuplicatesTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -5110,6 +5224,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("DuplicatesMonitor(): " + duplicatesMonitor);
return duplicatesMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -5149,6 +5265,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
ShareInfo shareInfo = new ShareInfo(tabResource, contacts);
return shareInfo;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException("Error in getShareInfo: "
@ -5181,7 +5299,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
String[] usersArray = users.toArray(new String[0]);
logger.debug("Share with Users: " + users);
service.share(serviceTR, usersArray);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (SecurityException e) {
e.printStackTrace();
throw new TDGWTServiceException(e.getLocalizedMessage());
@ -5234,7 +5354,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
tabResource.getRight());
tr.setMetadata(rights);
}
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in setTabResourceInformation: "
+ e.getLocalizedMessage());
@ -5269,6 +5391,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Retrieved Occurences");
return occurences;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in GetOccurencesForBatchReplace: "
+ e.getLocalizedMessage());
@ -5325,6 +5450,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Retrieved TemplateData List");
return templateDataList;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in GetTemplates: " + e.getLocalizedMessage());
e.printStackTrace();
@ -5359,7 +5487,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Task task = service.applyTemplate(templateId, tabularResourceId);
logger.debug("startTemplateApply task start");
SessionUtil.setTemplateApplyTask(session, task);
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error StartTemplateApply: " + e.getLocalizedMessage());
e.printStackTrace();
@ -5467,12 +5597,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("TemplateApplyMonitor(): " + templateApplyMonitor);
return templateApplyMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error in monitor DuplicatesMonitor: "
+ e.getLocalizedMessage());
}
}
@ -5497,7 +5629,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
templateId = new TemplateId(template.getId());
service.remove(templateId);
}
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (NoSuchTemplateException e) {
logger.debug("Error StartTemplateDelete: No such Template");
e.printStackTrace();
@ -5543,6 +5677,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setReplaceColumnTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -5650,6 +5787,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("ReplaceColumnMonitor(): " + replaceColumnMonitor);
return replaceColumnMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in replace column monitor ReplaceColumnMonitor: "
+ e.getLocalizedMessage());
@ -5696,6 +5836,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setReplaceBatchColumnTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
@ -5809,6 +5952,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("ReplaceBatchColumnMonitor(): "
+ replaceBatchColumnMonitor);
return replaceBatchColumnMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in ReplaceBatchColumnMonitor: "
+ e.getLocalizedMessage());
@ -5838,7 +5984,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("locales :" + locales);
return locales;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("getLocales(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -5895,7 +6043,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Last Operation Info :" + op);
return op;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -5947,7 +6097,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
logger.debug("Last Operation Info :" + op);
return op;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -6005,7 +6157,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("History :" + opHistoryList);
return opHistoryList;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("getHistory(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -6057,7 +6211,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("History :" + opHistoryList);
return opHistoryList;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("getHistory(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -6119,6 +6275,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
return rollBackSession;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("discard(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -6158,7 +6316,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: " + trTask.getId());
SessionUtil.setRollBackSessionTask(session, trTask);
return;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("rollBack(): " + e.getLocalizedMessage());
e.printStackTrace();
@ -6261,6 +6420,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.info("RollBackSessionMonitor(): " + rollBackMonitor);
return rollBackMonitor;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.debug("Error in RollBackSessionMonitor: "
+ e.getLocalizedMessage());
@ -6320,7 +6481,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("ValidationsTasksMetadata: "
+ validationsTasksMetadata);
return validationsTasksMetadata;
} catch (TDGWTSessionExpiredException e) {
throw e;
} catch (Throwable e) {
logger.error(
"Error in getValidationsTasksMetadata(): "

View File

@ -0,0 +1,37 @@
package org.gcube.portlets.user.td.gwtservice.shared.exception;
/**
* ASL Session Expired Exception
*
* @author "Giancarlo Panichi"
*
*/
public class TDGWTSessionExpiredException extends TDGWTServiceException {
private static final long serialVersionUID = 4306091799912937920L;
/**
*
*/
public TDGWTSessionExpiredException() {
super();
}
/**
* @param message
*/
public TDGWTSessionExpiredException(String message) {
super(message);
}
/**
*
* @param message
* @param t
*/
public TDGWTSessionExpiredException(String message,Throwable t) {
super(message,t);
}
}

View File

@ -1,8 +1,10 @@
package org.gcube.portlets.user.td.gwtservice.shared.tr.rows;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
/**
@ -16,6 +18,7 @@ public class EditRowSession implements Serializable {
private static final long serialVersionUID = -4503878699159491057L;
protected TRId trId;
protected ArrayList<ColumnData> columns;
protected HashMap<String, String> maps;
protected boolean newRow;
protected String rowId;
@ -24,14 +27,16 @@ public class EditRowSession implements Serializable {
}
public EditRowSession(TRId trId, HashMap<String, String> maps){
public EditRowSession(TRId trId, ArrayList<ColumnData> columns,HashMap<String, String> maps){
this.trId=trId;
this.columns=columns;
this.maps=maps;
this.newRow=true;
}
public EditRowSession(TRId trId, HashMap<String, String> maps, String rowId){
public EditRowSession(TRId trId, ArrayList<ColumnData> columns,HashMap<String, String> maps, String rowId){
this.trId=trId;
this.columns=columns;
this.maps=maps;
this.newRow=false;
this.rowId=rowId;
@ -45,6 +50,14 @@ public class EditRowSession implements Serializable {
this.trId = trId;
}
public ArrayList<ColumnData> getColumns() {
return columns;
}
public void setColumns(ArrayList<ColumnData> columns) {
this.columns = columns;
}
public HashMap<String, String> getMaps() {
return maps;
}
@ -71,10 +84,12 @@ public class EditRowSession implements Serializable {
@Override
public String toString() {
return "EditRowSession [trId=" + trId + ", maps=" + maps + ", newRow="
+ newRow + ", rowId=" + rowId + "]";
return "EditRowSession [trId=" + trId + ", columns=" + columns
+ ", maps=" + maps + ", newRow=" + newRow + ", rowId=" + rowId
+ "]";
}
}