refs 6548: TDM - Migrate TabMan to new PortalContext

Task-Url: https://support.d4science.org/issues/6548

Updated to new PortalContext

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@141738 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-01-24 14:42:41 +00:00
parent 3b56c696ab
commit 21739bac2c
2 changed files with 43 additions and 33 deletions

View File

@ -80,7 +80,7 @@ public class CodelistMappingUploadServlet extends HttpServlet {
scopeGroupId);
ScopeProvider.instance.set(serviceCredentials.getScope());
} catch (TDGWTServiceException e) {
logger.error(
"Error retrieving credentials:" + e.getLocalizedMessage(),
@ -88,26 +88,25 @@ public class CodelistMappingUploadServlet extends HttpServlet {
throw new ServletException(e.getLocalizedMessage());
}
CodelistMappingFileUploadSession codelistMappingFileUploadSession = new CodelistMappingFileUploadSession();
// CodelistMappingMonitor codelistMappingMonitor=new
// CodelistMappingMonitor();
FileUploadMonitor fileUploadMonitor = new FileUploadMonitor();
String id=UUID.randomUUID().toString();
logger.info("Upload Id: "+id);
String id = UUID.randomUUID().toString();
logger.info("Upload Id: " + id);
codelistMappingFileUploadSession.setId(id);
codelistMappingFileUploadSession
.setFileUploadState(FileUploadState.STARTED);
// codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor);
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fileUploadMonitor);
SessionUtil.setFileUploadMonitor(request, serviceCredentials,
fileUploadMonitor);
try {
SessionUtil.setCodelistMappingFileUploadSession(request, serviceCredentials,
codelistMappingFileUploadSession);
SessionUtil.setCodelistMappingFileUploadSession(request,
serviceCredentials, codelistMappingFileUploadSession);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(),e);
logger.error(e.getLocalizedMessage(), e);
throw new ServletException(e.getLocalizedMessage());
}
@ -131,11 +130,12 @@ public class CodelistMappingUploadServlet extends HttpServlet {
}
}
} catch (FileUploadException e) {
FileUploadMonitor fum=null;
FileUploadMonitor fum = null;
try {
fum = SessionUtil.getFileUploadMonitor(request, serviceCredentials);
fum = SessionUtil.getFileUploadMonitor(request,
serviceCredentials);
} catch (TDGWTServiceException e1) {
logger.error(e1.getLocalizedMessage(),e1);
logger.error(e1.getLocalizedMessage(), e1);
throw new ServletException(e1.getLocalizedMessage());
}
fum.setFailed("An error occured elaborating the HTTP request",
@ -144,10 +144,10 @@ public class CodelistMappingUploadServlet extends HttpServlet {
codelistMappingFileUploadSession
.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setCodelistMappingFileUploadSession(request, serviceCredentials,
codelistMappingFileUploadSession);
SessionUtil.setCodelistMappingFileUploadSession(request,
serviceCredentials, codelistMappingFileUploadSession);
} catch (Exception e1) {
logger.error(e1.getLocalizedMessage(),e1);
logger.error(e1.getLocalizedMessage(), e1);
throw new ServletException(e1.getLocalizedMessage());
}
logger.error("Error processing request in upload servlet", e);
@ -157,11 +157,12 @@ public class CodelistMappingUploadServlet extends HttpServlet {
}
if (uploadItem == null) {
FileUploadMonitor fum=null;
FileUploadMonitor fum = null;
try {
fum = SessionUtil.getFileUploadMonitor(request, serviceCredentials);
fum = SessionUtil.getFileUploadMonitor(request,
serviceCredentials);
} catch (TDGWTServiceException e1) {
logger.error(e1.getLocalizedMessage(),e1);
logger.error(e1.getLocalizedMessage(), e1);
throw new ServletException(e1.getLocalizedMessage());
}
fum.setFailed(
@ -172,10 +173,10 @@ public class CodelistMappingUploadServlet extends HttpServlet {
codelistMappingFileUploadSession
.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setCodelistMappingFileUploadSession(request, serviceCredentials,
codelistMappingFileUploadSession);
SessionUtil.setCodelistMappingFileUploadSession(request,
serviceCredentials, codelistMappingFileUploadSession);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(),e);
logger.error(e.getLocalizedMessage(), e);
throw new ServletException(e.getLocalizedMessage());
}
logger.error("Error processing request in upload servlet: No file to upload");
@ -194,11 +195,12 @@ public class CodelistMappingUploadServlet extends HttpServlet {
uploadItem.getInputStream(), uploadItem.getName(),
contentType);
} catch (Exception e) {
FileUploadMonitor fum=null;
FileUploadMonitor fum = null;
try {
fum = SessionUtil.getFileUploadMonitor(request, serviceCredentials);
fum = SessionUtil.getFileUploadMonitor(request,
serviceCredentials);
} catch (TDGWTServiceException e1) {
logger.error(e1.getLocalizedMessage(),e1);
logger.error(e1.getLocalizedMessage(), e1);
throw new ServletException(e1.getLocalizedMessage());
}
fum.setFailed("An error occured elaborating the file",
@ -208,10 +210,10 @@ public class CodelistMappingUploadServlet extends HttpServlet {
codelistMappingFileUploadSession
.setFileUploadState(FileUploadState.FAILED);
try {
SessionUtil.setCodelistMappingFileUploadSession(request, serviceCredentials,
codelistMappingFileUploadSession);
SessionUtil.setCodelistMappingFileUploadSession(request,
serviceCredentials, codelistMappingFileUploadSession);
} catch (Exception e1) {
logger.error(e1.getLocalizedMessage(),e1);
logger.error(e1.getLocalizedMessage(), e1);
throw new ServletException(e1.getLocalizedMessage());
}
logger.error("Error elaborating the stream", e);
@ -223,21 +225,21 @@ public class CodelistMappingUploadServlet extends HttpServlet {
uploadItem.delete();
logger.trace("changing state");
FileUploadMonitor fum=null;
FileUploadMonitor fum = null;
try {
fum = SessionUtil.getFileUploadMonitor(request, serviceCredentials);
} catch (TDGWTServiceException e) {
logger.error(e.getLocalizedMessage(),e);
logger.error(e.getLocalizedMessage(), e);
throw new ServletException(e.getLocalizedMessage());
}
fum.setState(FileUploadState.COMPLETED);
SessionUtil.setFileUploadMonitor(request, serviceCredentials, fum);
try {
SessionUtil.setCodelistMappingFileUploadSession(request, serviceCredentials,
codelistMappingFileUploadSession);
SessionUtil.setCodelistMappingFileUploadSession(request,
serviceCredentials, codelistMappingFileUploadSession);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(),e);
logger.error(e.getLocalizedMessage(), e);
throw new ServletException(e.getLocalizedMessage());
}
response.getWriter().write("OK");

View File

@ -143,4 +143,12 @@ public class Constants {
public static final String CODELIST_MAPPING_UPLOAD_SERVLET = "CodelistMappingUploadServlet";
public static final String LOCAL_UPLOAD_SERVLET = "LocalUploadServlet";
public static final String CSV_IMPORT_FILE_SERVLET = "CSVImportFileServlet";
public static final String RETRIEVE_CHART_FILE_SERVLET = "RetrieveChartFileServlet";
public static final String RETRIEVE_FILE_AND_DISCOVER_MIME_TYPE_SERVLET = "RetrieveFileAndDiscoverMimeTypeServlet";
public static final String TD_RSTUDIO_SERVLET = "TDRStudioServlet";
public static final String TD_LOGS_SERVLET = "TDLogsServlet";
}