diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java index c0eabcd..581add2 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java @@ -5,6 +5,8 @@ package org.gcube.portlets.user.td.gwtservice.client.rpc; import java.util.ArrayList; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; @@ -721,8 +723,7 @@ public interface TDGWTService extends RemoteService { * @return * @throws TDGWTServiceException */ - public AddColumnMonitor getAddColumnMonitor() - throws TDGWTServiceException; + public AddColumnMonitor getAddColumnMonitor() throws TDGWTServiceException; /** * Start add column @@ -734,8 +735,6 @@ public interface TDGWTService extends RemoteService { public void startAddColumn(AddColumnSession addColumnSession) throws TDGWTServiceException; - - /** * Get Operation Monitor during the Delete Column operation * @@ -907,22 +906,40 @@ public interface TDGWTService extends RemoteService { */ OpHistory getLastOperationInfo(TRId trId) throws TDGWTServiceException; - // Extract Codelist + // Helper Extract Codelist /** * Get Operation Monitor during the Extract Codelist operation * * @return * @throws TDGWTServiceException */ - public ExtractCodelistMonitor getExtractCodelistMonitor() throws TDGWTServiceException; + public ExtractCodelistMonitor getExtractCodelistMonitor() + throws TDGWTServiceException; /** * Start Extract Codelist and invokes the client library - * + * * @param extractCodelistSession * @throws TDGWTServiceException */ - public void startExtractCodelist(ExtractCodelistSession extractCodelistSession) + public void startExtractCodelist( + ExtractCodelistSession extractCodelistSession) + throws TDGWTServiceException; + + // Helper Codelist Mapping Import + public CodelistMappingMonitor getCodelistMappingMonitor() + throws TDGWTServiceException; + + public void setCodelistMappingSession( + CodelistMappingSession codelistMappingSession) + throws TDGWTServiceException; + + public void getFileFromWorkspace( + CodelistMappingSession codelistMappingSession) + throws TDGWTServiceException; + + public void startCodelistMappingImport( + CodelistMappingSession codelistMappingSession) throws TDGWTServiceException; } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java index 3600c1a..40a10da 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java @@ -5,6 +5,8 @@ package org.gcube.portlets.user.td.gwtservice.client.rpc; import java.util.ArrayList; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; @@ -161,9 +163,10 @@ public interface TDGWTServiceAsync { void startSDMXImport(SDMXImportSession sdmxImportSession,AsyncCallback callback); - //Import CSV + //File Upload Monitor void getFileUploadMonitor(AsyncCallback callback); + //Import CSV void getCSVImportMonitor(AsyncCallback callback); void setCSVSession(CSVImportSession csvImportSession, AsyncCallback callback); @@ -185,7 +188,6 @@ public interface TDGWTServiceAsync { //Export SDMX void getSDMXExportMonitor(AsyncCallback callback); - void startSDMXExport(SDMXExportSession exportSession, AsyncCallback callback); @@ -238,8 +240,15 @@ public interface TDGWTServiceAsync { void getLastOperationInfo(AsyncCallback callback); void getLastOperationInfo(TRId trId, AsyncCallback callback); - //Extract Codelist + //Helper Extract Codelist void getExtractCodelistMonitor(AsyncCallback callback); void startExtractCodelist(ExtractCodelistSession extractCodelistSession, AsyncCallback callback); + + //Helper Codelist Mapping Import + void getCodelistMappingMonitor(AsyncCallback callback); + void setCodelistMappingSession(CodelistMappingSession codelistMappingSession, AsyncCallback callback); + void getFileFromWorkspace(CodelistMappingSession codelistMappingSession, AsyncCallback callback); + void startCodelistMappingImport(CodelistMappingSession codelistMappingSession, AsyncCallback callback); + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java index 9903303..64610cf 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java @@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession; +import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public class CSVImportFileServlet extends HttpServlet { } logger.info("CSVImportFileServlet import session id: "+session.getId()); - FileUploadSession fileUploadSession=SessionUtil.getFileUploadSession(session); + CSVFileUploadSession fileUploadSession=SessionUtil.getCSVFileUploadSession(session); if (fileUploadSession == null) { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java new file mode 100644 index 0000000..f0f4b97 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java @@ -0,0 +1,168 @@ +/** + * + */ +package org.gcube.portlets.user.td.gwtservice.server; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession; +import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener; +import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor; +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; +import org.slf4j.LoggerFactory; + +import com.allen_sauer.gwt.log.client.Log; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class CodelistMappingUploadServlet extends HttpServlet { + + protected static Logger logger = LoggerFactory.getLogger(CodelistMappingUploadServlet.class); + + + /** + * + */ + private static final long serialVersionUID = -4197748678713054285L; + + @SuppressWarnings("rawtypes") + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + logger.trace("Post"); + + HttpSession session = request.getSession(); + + if(session==null){ + logger.error("Error getting the upload session, no session valid found: "+session); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error getting the user session, no session found"+session); + return ; + } + logger.info("Codelist Mapping session id: "+session.getId()); + + CodelistMappingFileUploadSession codelistMappingFileUploadSession=new CodelistMappingFileUploadSession(); + CodelistMappingMonitor codelistMappingMonitor=new CodelistMappingMonitor(); + FileUploadMonitor fileUploadMonitor=new FileUploadMonitor(); + + codelistMappingFileUploadSession.setId(session.getId()); + codelistMappingFileUploadSession.setFileUploadState(FileUploadState.STARTED); + codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); + codelistMappingFileUploadSession.setFileUploadMonitor(fileUploadMonitor); + + + try { + SessionUtil.setCodelistMappingFileUploadSession(session,codelistMappingFileUploadSession); + } catch (TDGWTSessionExpiredException e) { + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + throw new ServletException(e.getLocalizedMessage()); + } + + + FileItemFactory factory = new DiskFileItemFactory(); + ServletFileUpload upload = new ServletFileUpload(factory); + + + FileUploadListener uploadListener = new FileUploadListener(fileUploadMonitor); + upload.setProgressListener(uploadListener); + + FileItem uploadItem = null; + Log.info("Start upload file "); + try { + List items = upload.parseRequest(request); + Iterator it = items.iterator(); + while (it.hasNext()) { + FileItem item = (FileItem) it.next(); + if (!item.isFormField() && "uploadFormElement".equals(item.getFieldName())) { + uploadItem = item; + } + } + } catch (FileUploadException e) { + codelistMappingFileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the HTTP request", FileUtil.exceptionDetailMessage(e)); + codelistMappingFileUploadSession.setFileUploadState(FileUploadState.FAILED); + try { + SessionUtil.setCodelistMappingFileUploadSession(session, codelistMappingFileUploadSession); + } catch (TDGWTSessionExpiredException e1) { + logger.error(e1.getLocalizedMessage()); + e1.printStackTrace(); + throw new ServletException(e1.getLocalizedMessage()); + } + logger.error("Error processing request in upload servlet", e); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "ERROR-Error during request processing: "+e.getMessage()); + return; + } + + if (uploadItem == null) { + codelistMappingFileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the HTTP request: No file found", "Upload request without file"); + codelistMappingFileUploadSession.setFileUploadState(FileUploadState.FAILED); + try { + SessionUtil.setCodelistMappingFileUploadSession(session, codelistMappingFileUploadSession); + } catch (TDGWTSessionExpiredException e) { + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + throw new ServletException(e.getLocalizedMessage()); + } + logger.error("Error processing request in upload servlet: No file to upload"); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No file to upload"); + return; + } + + String contentType = uploadItem.getContentType(); + + logger.trace("ContentType: "+contentType); + + + try { + FileUtil.setImportFileCodelistMapping(codelistMappingFileUploadSession, uploadItem.getInputStream(), uploadItem.getName(), contentType); + } catch (Exception e) { + codelistMappingFileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the file", FileUtil.exceptionDetailMessage(e)); + codelistMappingFileUploadSession.setFileUploadState(FileUploadState.FAILED); + try { + SessionUtil.setCodelistMappingFileUploadSession(session, codelistMappingFileUploadSession); + } catch (TDGWTSessionExpiredException e1) { + logger.error(e1.getLocalizedMessage()); + e1.printStackTrace(); + throw new ServletException(e1.getLocalizedMessage()); + } + logger.error("Error elaborating the stream", e); + uploadItem.delete(); + response.getWriter().write("ERROR-"+e.getMessage()); + return; + } + + uploadItem.delete(); + + logger.trace("changing state"); + codelistMappingFileUploadSession.getFileUploadMonitor().setState(FileUploadState.COMPLETED); + try { + SessionUtil.setCodelistMappingFileUploadSession(session, codelistMappingFileUploadSession); + } catch (TDGWTSessionExpiredException e) { + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + throw new ServletException(e.getLocalizedMessage()); + } + response.getWriter().write("OK"); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java index 72fbe6e..16aade2 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java @@ -19,7 +19,7 @@ import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; 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.CSVFileUploadSession; 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.TDGWTSessionExpiredException; @@ -61,7 +61,7 @@ public class LocalUploadServlet extends HttpServlet { } logger.info("CSV Import session id: "+session.getId()); - FileUploadSession fileUploadSession=new FileUploadSession(); + CSVFileUploadSession fileUploadSession=new CSVFileUploadSession(); CSVImportMonitor csvImportMonitor=new CSVImportMonitor(); FileUploadMonitor fileUploadMonitor=new FileUploadMonitor(); @@ -72,7 +72,7 @@ public class LocalUploadServlet extends HttpServlet { try { - SessionUtil.setFileUploadSession(session,fileUploadSession); + SessionUtil.setCSVFileUploadSession(session,fileUploadSession); } catch (TDGWTSessionExpiredException e) { logger.error(e.getLocalizedMessage()); e.printStackTrace(); @@ -102,7 +102,7 @@ public class LocalUploadServlet extends HttpServlet { fileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the HTTP request", FileUtil.exceptionDetailMessage(e)); fileUploadSession.setFileUploadState(FileUploadState.FAILED); try { - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); } catch (TDGWTSessionExpiredException e1) { logger.error(e1.getLocalizedMessage()); e1.printStackTrace(); @@ -117,7 +117,7 @@ public class LocalUploadServlet extends HttpServlet { fileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the HTTP request: No file found", "Upload request without file"); fileUploadSession.setFileUploadState(FileUploadState.FAILED); try { - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); } catch (TDGWTSessionExpiredException e) { logger.error(e.getLocalizedMessage()); e.printStackTrace(); @@ -134,12 +134,12 @@ public class LocalUploadServlet extends HttpServlet { try { - FileUtil.setImportFile(fileUploadSession, uploadItem.getInputStream(), uploadItem.getName(), contentType); + FileUtil.setImportFileCSV(fileUploadSession, uploadItem.getInputStream(), uploadItem.getName(), contentType); } catch (Exception e) { fileUploadSession.getFileUploadMonitor().setFailed("An error occured elaborating the file", FileUtil.exceptionDetailMessage(e)); fileUploadSession.setFileUploadState(FileUploadState.FAILED); try { - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); } catch (TDGWTSessionExpiredException e1) { logger.error(e1.getLocalizedMessage()); e1.printStackTrace(); @@ -156,7 +156,7 @@ public class LocalUploadServlet extends HttpServlet { logger.trace("changing state"); fileUploadSession.getFileUploadMonitor().setState(FileUploadState.COMPLETED); try { - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); } catch (TDGWTSessionExpiredException e) { logger.error(e.getLocalizedMessage()); e.printStackTrace(); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java index ad5d9be..db83f93 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java @@ -23,8 +23,8 @@ public class SessionConstants { protected static final String CSV_IMPORT_SESSION = "CSV_IMPORT"; protected static final String CSV_IMPORT_FILE_UPLOAD_SESSION = "CSV_IMPORT_FILE_UPLOAD"; protected static final String CSV_IMPORT_TASK = "CSV_IMPORT_TASK"; - protected static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE"; - + protected static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE"; + protected static final String CSV_EXPORT_SESSION = "CSV_EXPORT_SESSION"; protected static final String CSV_EXPORT_TASK = "CSV_EXPORT_TASK"; protected static final String CSV_EXPORT_END = "CSV_EXPORT_END"; @@ -102,7 +102,11 @@ public class SessionConstants { protected static final String MERGE_COLUMN_MONITOR = "MERGE_COLUMN_MONITOR"; protected static final String MERGE_COLUMN_TASK = "MERGE_COLUMN_TASK"; - + protected static final String CODELIST_MAPPING_SESSION = "CODELIST_MAPPING_SESSION"; + protected static final String CODELIST_MAPPING_FILE_UPLOAD_SESSION = "CODELIST_MAPPING_FILE_UPLOAD_SESSION"; + protected static final String CODELIST_MAPPING_TASK = "CODELIST_MAPPING_TASK"; + protected static final String CODELIST_MAPPING_MONITOR = "CODELIST_MAPPING_MONITOR"; + } 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 43e2b23..348af52 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 @@ -14,9 +14,12 @@ import org.gcube.common.scope.api.ScopeProvider; import org.gcube.data.analysis.tabulardata.service.operation.Task; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; -import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession; +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.codelisthelper.CodelistMappingMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; 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.TDGWTSessionExpiredException; @@ -303,10 +306,10 @@ public class SessionUtil { return exportSession; } - public static void setFileUploadSession(HttpSession httpSession, - FileUploadSession s) throws TDGWTSessionExpiredException { + public static void setCSVFileUploadSession(HttpSession httpSession, + CSVFileUploadSession s) throws TDGWTSessionExpiredException { - FileUploadSession session = (FileUploadSession) httpSession + CSVFileUploadSession session = (CSVFileUploadSession) httpSession .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (session != null) httpSession.removeAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); @@ -315,15 +318,41 @@ public class SessionUtil { ScopeProvider.instance.set(aslSession.getScope().toString()); } - public static FileUploadSession getFileUploadSession(HttpSession httpSession) { - FileUploadSession fileUploadSession = (FileUploadSession) httpSession + public static CSVFileUploadSession getCSVFileUploadSession(HttpSession httpSession) { + CSVFileUploadSession fileUploadSession = (CSVFileUploadSession) httpSession .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (fileUploadSession == null) { logger.error("FileUploadSession was not acquired"); } return fileUploadSession; } + + + //TODO + public static void setCodelistMappingFileUploadSession(HttpSession httpSession, + CodelistMappingFileUploadSession s) throws TDGWTSessionExpiredException { + CodelistMappingFileUploadSession session = (CodelistMappingFileUploadSession) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); + if (session != null) + httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); + httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION, s); + ASLSession aslSession = getAslSession(httpSession); + ScopeProvider.instance.set(aslSession.getScope().toString()); + } + + public static CodelistMappingFileUploadSession getCodelistMappingFileUploadSession(HttpSession httpSession) { + CodelistMappingFileUploadSession fileUploadSession = (CodelistMappingFileUploadSession) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); + if (fileUploadSession == null) { + logger.error("CodelistMappingFileUploadSession was not acquired"); + } + return fileUploadSession; + } + + + + // public static ArrayList retrieveCodelists(HttpSession httpSession) throws Exception { logger.info("SessionUtil retriveCodelists"); @@ -1745,6 +1774,69 @@ public class SessionUtil { httpSession.removeAttribute(SessionConstants.MERGE_COLUMN_TASK); httpSession.setAttribute(SessionConstants.MERGE_COLUMN_TASK, task); } + + + // + public static CodelistMappingSession getCodelistMappingSession(HttpSession httpSession) { + CodelistMappingSession importSession = (CodelistMappingSession) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_SESSION); + if (importSession == null) { + logger.error("CSVImportSession was not acquired"); + } + return importSession; + } + public static void setCodelistMappingSession(HttpSession httpSession, + CodelistMappingSession codelistMappingSession) throws TDGWTSessionExpiredException { + + CodelistMappingSession session = (CodelistMappingSession) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_SESSION); + if (session != null) + httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_SESSION); + httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_SESSION, codelistMappingSession); + ASLSession aslSession = getAslSession(httpSession); + ScopeProvider.instance.set(aslSession.getScope().toString()); + } + + public static CodelistMappingMonitor getCodelistMappingMonitor( + HttpSession httpSession) { + CodelistMappingMonitor codelistMappingMonitor = (CodelistMappingMonitor) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); + if (codelistMappingMonitor != null) { + return codelistMappingMonitor; + } else { + codelistMappingMonitor = new CodelistMappingMonitor(); + httpSession + .setAttribute(SessionConstants.CODELIST_MAPPING_MONITOR, codelistMappingMonitor); + return codelistMappingMonitor; + } + } + + public static void setCodelistMappingMonitor(HttpSession httpSession, + CodelistMappingMonitor codelistMappingMonitor) { + CodelistMappingMonitor cmm = (CodelistMappingMonitor) httpSession + .getAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); + if (cmm != null) { + httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); + } + httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_MONITOR, codelistMappingMonitor); + + } + + public static Task getCodelistMappingTask(HttpSession httpSession) { + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CODELIST_MAPPING_TASK); + if (monitor == null) { + logger.error("CODELIST_MAPPING_TASK was not acquired"); + } + return monitor; + } + + public static void setCodelistMappingTask(HttpSession httpSession, Task task) { + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CODELIST_MAPPING_TASK); + if (monitor != null) + httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_TASK); + httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_TASK, task); + } + } 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 adabbec..efc0e66 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 @@ -97,7 +97,8 @@ import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryDescriptor; import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryInterfaceType; import org.gcube.datapublishing.sdmx.impl.model.GCubeSDMXRegistryDescriptor; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService; -import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession; +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.file.FileUtil; import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage; import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap; @@ -112,6 +113,8 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.OperationsId; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; @@ -137,6 +140,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; +import org.gcube.portlets.user.td.gwtservice.shared.source.SourceType; import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS; import org.gcube.portlets.user.td.gwtservice.shared.task.JobS; import org.gcube.portlets.user.td.gwtservice.shared.task.State; @@ -337,8 +341,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "CURRENT_TABULAR_RESOURCE has TRId null"); } - logger.debug("Current TRId: "+currentTR - .getTrId()); + logger.debug("Current TRId: " + currentTR.getTrId()); ArrayList trMetadatas = getTRMetadata(currentTR .getTrId()); @@ -2492,8 +2495,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - FileUploadSession fileUploadSession = SessionUtil - .getFileUploadSession(session); + CSVFileUploadSession fileUploadSession = SessionUtil + .getCSVFileUploadSession(session); if (fileUploadSession == null) { throw new TDGWTServiceException( "Error retrieving the fileUploadSession: null"); @@ -2531,8 +2534,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements + " headerPresence: " + headerPresence + " delimiter: " + delimiter + " comment: " + comment); - FileUploadSession fileUploadSession = SessionUtil - .getFileUploadSession(session); + CSVFileUploadSession fileUploadSession = SessionUtil + .getCSVFileUploadSession(session); if (fileUploadSession == null) { throw new TDGWTServiceException( "Error retrieving the fileUploadSession: null"); @@ -2548,7 +2551,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements parserConfiguration.update(encoding, delimiter, comment, headerPresence); } - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); try { return CSVFileUtil.getHeader(fileUploadSession.getCsvFile(), fileUploadSession.getParserConfiguration()); @@ -2572,8 +2575,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error retrieving the session: null"); } logger.debug("Session:" + session.getId()); - FileUploadSession fileUploadSession = SessionUtil - .getFileUploadSession(session); + CSVFileUploadSession fileUploadSession = SessionUtil + .getCSVFileUploadSession(session); if (fileUploadSession == null) { throw new TDGWTServiceException( "Error retrieving the fileUploadSession: null"); @@ -2612,8 +2615,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("StartCSVImport: " + csvImportSession.toString()); - FileUploadSession fileUploadSession = SessionUtil - .getFileUploadSession(session); + CSVFileUploadSession fileUploadSession = SessionUtil + .getCSVFileUploadSession(session); if (fileUploadSession == null) { throw new TDGWTServiceException( "Error retrieving the fileUploadSession: null"); @@ -2632,7 +2635,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @return */ protected Map csvImportFileParameter( - String fileUrlOnStorage, FileUploadSession fileUploadSession, + String fileUrlOnStorage, CSVFileUploadSession fileUploadSession, CSVImportSession csvImportSession) { Map parameterInstances = new HashMap(); parameterInstances.put(Constants.PARAMETER_URL, fileUrlOnStorage); @@ -2663,7 +2666,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements */ protected void importCSVFileOnService(HttpSession session, ASLSession aslSession, String user, - FileUploadSession fileUploadSession, + CSVFileUploadSession fileUploadSession, CSVImportSession csvImportSession) throws TDGWTServiceException { logger.debug("File Storage Access"); @@ -2893,7 +2896,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error retrieving the item on workspace" + wi); } - FileUploadSession fileUploadSession = new FileUploadSession(); + CSVFileUploadSession fileUploadSession = new CSVFileUploadSession(); CSVImportMonitor csvImportMonitor = new CSVImportMonitor(); FileUploadMonitor fileUploadMonitor = new FileUploadMonitor(); @@ -2902,15 +2905,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements fileUploadSession.setCsvImportMonitor(csvImportMonitor); fileUploadSession.setFileUploadMonitor(fileUploadMonitor); - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); try { FilesStorage filesStorage = new FilesStorage(); InputStream is = filesStorage.retriveImputStream( aslSession.getUsername(), wi); - FileUtil.setImportFile(fileUploadSession, is, wi.getName(), - "text/csv"); + FileUtil.setImportFileCSV(fileUploadSession, is, wi.getName(), + Constants.FILE_CSV_MIMETYPE); } catch (Throwable e) { fileUploadSession/** * Get informations on tabular resource @@ -2922,7 +2925,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "An error occured elaborating the file", FileUtil.exceptionDetailMessage(e)); fileUploadSession.setFileUploadState(FileUploadState.FAILED); - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); logger.error("Error elaborating the input stream", e); throw new TDGWTServiceException( "Error in importCSV getFileFromWorkspace: " @@ -2932,7 +2935,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.trace("changing state"); fileUploadSession.getFileUploadMonitor().setState( FileUploadState.COMPLETED); - SessionUtil.setFileUploadSession(session, fileUploadSession); + SessionUtil.setCSVFileUploadSession(session, fileUploadSession); } /** @@ -3052,7 +3055,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername())); TabularDataService service = TabularDataServiceFactory.getService(); - //TODO + // TODO TabularResource tr = service .getTabularResource(new TabularResourceId(Long.valueOf(trId .getId()))); @@ -4137,9 +4140,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ColumnDataType.Text); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4165,9 +4168,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ColumnDataType.Text); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4179,9 +4182,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ColumnDataType.Text); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4193,9 +4196,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ColumnDataType.Text); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4205,9 +4208,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getColumnType())); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4231,9 +4234,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getColumnType())); map.put(Constants.PARAMETER_ADD_COLUMN_LABEL, new ImmutableLocalizedText(defNewColumn.getLabel())); - map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map( - ColumnDataType.Text, - defNewColumn.getDefaultValue())); + map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, + TDTypeValueMap.map(ColumnDataType.Text, + defNewColumn.getDefaultValue())); invocation = new OperationExecution( operationDefinition.getOperationId(), map); break; @@ -4396,6 +4399,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return invocation; } + /** + * + * @param service + * @param changeTableTypeSession + * @return + * @throws TDGWTServiceException + */ + protected OperationExecution retrieveOperationExecution( + TabularDataService service, + CodelistMappingSession codelistMappingSession, String importUrl) + throws TDGWTServiceException { + + OperationExecution invocation = null; + + logger.debug(codelistMappingSession.toString()); + OperationDefinition operationDefinition; + Map map = new HashMap(); + + operationDefinition = OperationDefinitionMap.map( + OperationsId.CodelistMappingImport.toString(), service); + map.put(Constants.PARAMETER_URL, importUrl); + + invocation = new OperationExecution( + operationDefinition.getOperationId(), map); + + return invocation; + } + /** * * @param service @@ -5521,15 +5552,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername())); - logger.debug("CloneTabularResourceSession: "+cloneTabularResourceSession); - + logger.debug("CloneTabularResourceSession: " + + cloneTabularResourceSession); + TabularDataService service = TabularDataServiceFactory.getService(); TabularResourceId serviceTR = new TabularResourceId( Long.valueOf(cloneTabularResourceSession.getTrId().getId())); TabularResource cloned = service.cloneTabularResource(serviceTR); - logger.debug("Clone: "+cloned.toString()); + logger.debug("Clone: " + cloned.toString()); Table table = service.getLastTable(cloned.getId()); Table viewTable = null; @@ -7688,8 +7720,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - ExtractCodelistSession extractCodelistSession = SessionUtil - .getExtractCodelistSession(session); + SplitColumnSession splitColumnSession = SessionUtil + .getSplitColumnSession(session); Task task = SessionUtil.getSplitColumnTask(session); SplitColumnMonitor splitColumnMonitor = new SplitColumnMonitor(); @@ -7731,7 +7763,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Task Result:" + task.getResult()); splitColumnMonitor.setProgress(task.getProgress()); trId = new TRId(); - trId.setId(extractCodelistSession.getTrId().getId()); + trId.setId(splitColumnSession.getColumnData().getTrId().getId()); trId = retrieveTabularResourceBasicData(trId); splitColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -7753,8 +7785,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Task Result:" + task.getResult()); splitColumnMonitor.setProgress(task.getProgress()); - trId = retrieveTabularResourceBasicData(extractCodelistSession - .getTrId()); + trId = retrieveTabularResourceBasicData(splitColumnSession + .getColumnData().getTrId()); splitColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -7832,8 +7864,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - ExtractCodelistSession extractCodelistSession = SessionUtil - .getExtractCodelistSession(session); + MergeColumnSession mergeColumnSession = SessionUtil + .getMergeColumnSession(session); Task task = SessionUtil.getMergeColumnTask(session); MergeColumnMonitor mergeColumnMonitor = new MergeColumnMonitor(); @@ -7875,7 +7907,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Task Result:" + task.getResult()); mergeColumnMonitor.setProgress(task.getProgress()); trId = new TRId(); - trId.setId(extractCodelistSession.getTrId().getId()); + trId.setId(mergeColumnSession.getColumnData().getTrId().getId()); trId = retrieveTabularResourceBasicData(trId); mergeColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -7896,8 +7928,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements case STOPPED: logger.debug("Task Result:" + task.getResult()); mergeColumnMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(extractCodelistSession + trId = retrieveTabularResourceBasicData(mergeColumnSession.getColumnData() .getTrId()); mergeColumnMonitor.setTrId(trId); @@ -7928,4 +7959,312 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } + @Override + public void setCodelistMappingSession( + CodelistMappingSession codelistMappingSession) + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + SessionUtil.setCodelistMappingSession(session, + codelistMappingSession); + return; + + } catch (TDGWTSessionExpiredException e) { + throw e; + } catch (Throwable e) { + logger.error( + "Error setting CodelistMappingSession parameter: " + + e.getLocalizedMessage(), e); + throw new TDGWTServiceException( + "Error setting CodelistMappingSession parameter: " + + e.getLocalizedMessage()); + } + + } + + @Override + public void getFileFromWorkspace( + CodelistMappingSession codelistMappingSession) + throws TDGWTServiceException { + HttpSession session = this.getThreadLocalRequest().getSession(); + ASLSession aslSession = SessionUtil.getAslSession(session); + Workspace w = null; + WorkspaceItem wi = null; + + try { + HomeManagerFactory factory = HomeLibrary.getHomeManagerFactory(); + + HomeManager manager = factory.getHomeManager(); + + Home home = manager.getHome(aslSession.getUsername()); + + w = home.getWorkspace(); + wi = w.getItem(codelistMappingSession.getItemId()); + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException( + "Error in import Codelist Mapping getFileFromWorkspace accessing the workspace: " + + e.getLocalizedMessage(), e); + } + + if (wi == null) { + logger.error("Error retrieving the item on workspace" + + codelistMappingSession.getItemId()); + throw new TDGWTServiceException( + "Error retrieving the item on workspace" + + codelistMappingSession.getItemId()); + } + + try { + logger.debug("WorkspaceItem [id:" + wi.getId() + " name:" + + wi.getName() + " remotePath:" + wi.getRemotePath() + "]"); + } catch (InternalErrorException e1) { + e1.printStackTrace(); + throw new TDGWTServiceException( + "Error retrieving the item on workspace" + wi); + } + + CodelistMappingFileUploadSession fileUploadSession = new CodelistMappingFileUploadSession(); + CodelistMappingMonitor codelistMappingMonitor = new CodelistMappingMonitor(); + FileUploadMonitor fileUploadMonitor = new FileUploadMonitor(); + + fileUploadSession.setId(session.getId()); + fileUploadSession.setFileUploadState(FileUploadState.STARTED); + fileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); + fileUploadSession.setFileUploadMonitor(fileUploadMonitor); + + SessionUtil.setCodelistMappingFileUploadSession(session, + fileUploadSession); + + try { + FilesStorage filesStorage = new FilesStorage(); + InputStream is = filesStorage.retriveImputStream( + aslSession.getUsername(), wi); + + FileUtil.setImportFileCodelistMapping(fileUploadSession, is, + wi.getName(), Constants.FILE_XML_MIMETYPE); + } catch (Throwable e) { + fileUploadSession/** + * Get informations on tabular resource + * + * @return + * @throws TDGWTServiceException + */ + .getFileUploadMonitor().setFailed( + "An error occured elaborating the file", + FileUtil.exceptionDetailMessage(e)); + fileUploadSession.setFileUploadState(FileUploadState.FAILED); + SessionUtil.setCodelistMappingFileUploadSession(session, + fileUploadSession); + logger.error("Error elaborating the input stream", e); + throw new TDGWTServiceException( + "Error in import Codelist Mapping getFileFromWorkspace: " + + e.getLocalizedMessage(), e); + } + + logger.trace("changing state"); + fileUploadSession.getFileUploadMonitor().setState( + FileUploadState.COMPLETED); + SessionUtil.setCodelistMappingFileUploadSession(session, + fileUploadSession); + + } + + @Override + public void startCodelistMappingImport( + CodelistMappingSession codelistMappingSession) + throws TDGWTServiceException { + try { + + HttpSession session = this.getThreadLocalRequest().getSession(); + if (session == null) { + throw new TDGWTServiceException( + "Error retrieving the session: null"); + } + logger.debug("Session:" + session.getId()); + + ASLSession aslSession = SessionUtil.getAslSession(session); + if (aslSession == null) { + throw new TDGWTServiceException( + "Error retrieving the asl session: null"); + } + String user = aslSession.getUsername(); + logger.debug("Session User:" + user); + + logger.debug("StartCodelistMappingImport: " + + codelistMappingSession.toString()); + + CodelistMappingFileUploadSession codelistMappingFileUploadSession = SessionUtil + .getCodelistMappingFileUploadSession(session); + if (codelistMappingFileUploadSession == null) { + throw new TDGWTServiceException( + "Error retrieving the codelistMappingFileUploadSession: null"); + } + + importCodelistMappingFileOnService(session, aslSession, user, + codelistMappingFileUploadSession, codelistMappingSession); + } catch (TDGWTSessionExpiredException e) { + throw e; + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException("Error in Codelist Mapping import: " + + e.getLocalizedMessage()); + } + } + + @Override + public CodelistMappingMonitor getCodelistMappingMonitor() + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + CodelistMappingSession codelistMappingSession = SessionUtil + .getCodelistMappingSession(session); + + Task task = SessionUtil.getMergeColumnTask(session); + CodelistMappingMonitor codelistMappingMonitor = new CodelistMappingMonitor(); + + if (task == null) { + logger.debug("Task null"); + throw new TDGWTServiceException( + "Error in CodelistMappingMonitor task null"); + } else { + TaskStatus status = task.getStatus(); + if (status == null) { + logger.debug("Services TaskStatus : null"); + throw new TDGWTServiceException( + "Error in CodelistMappingMonitor Status null"); + } else { + logger.debug("Services TaskStatus: " + task.getStatus()); + + codelistMappingMonitor.setStatus(TaskStateMap.map(task + .getStatus())); + + TRId trId; + TabResource tabResource; + switch (codelistMappingMonitor.getStatus()) { + case FAILED: + if (task.getResult() != null) { + logger.debug("Task exception:" + + task.getErrorCause()); + task.getErrorCause().printStackTrace(); + codelistMappingMonitor.setError(new Throwable(task + .getErrorCause())); + } else { + logger.debug("Task exception: Error In CodelistMappingMonitor"); + codelistMappingMonitor.setError(new Throwable( + "Error task resume")); + } + codelistMappingMonitor.setProgress(task.getProgress()); + break; + case SUCCEDED: + logger.debug("Task Result:" + task.getResult()); + codelistMappingMonitor.setProgress(task.getProgress()); + trId = new TRId(); + trId.setId(codelistMappingSession.getTrId().getId()); + trId = retrieveTabularResourceBasicData(trId); + codelistMappingMonitor.setTrId(trId); + tabResource = SessionUtil.getTabResource(session); + tabResource.setTrId(trId); + SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTRId(session, trId); + break; + case IN_PROGRESS: + codelistMappingMonitor.setProgress(task.getProgress()); + break; + case VALIDATING_RULES: + codelistMappingMonitor.setProgress(task.getProgress()); + break; + case GENERATING_VIEW: + break; + case ABORTED: + break; + case STOPPED: + logger.debug("Task Result:" + task.getResult()); + codelistMappingMonitor.setProgress(task.getProgress()); + trId = retrieveTabularResourceBasicData(codelistMappingSession + .getTrId()); + + codelistMappingMonitor.setTrId(trId); + tabResource = SessionUtil.getTabResource(session); + tabResource.setTrId(trId); + SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTRId(session, trId); + break; + case INITIALIZING: + break; + default: + break; + } + } + SessionUtil.setCodelistMappingTask(session, task); + } + + logger.debug("CodelistMappingMonitor(): " + codelistMappingMonitor); + return codelistMappingMonitor; + } catch (TDGWTSessionExpiredException e) { + throw e; + } catch (Throwable e) { + logger.debug("Error in CodelistMappingMonitor: " + + e.getLocalizedMessage()); + e.printStackTrace(); + throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); + + } + } + + /** + * + * @param user + * @param codelistMappingFileUploadSession + * @param codelistMappingSession + * @throws TDGWTServiceException + */ + protected void importCodelistMappingFileOnService(HttpSession session, + ASLSession aslSession, String user, + CodelistMappingFileUploadSession codelistMappingFileUploadSession, + CodelistMappingSession codelistMappingSession) throws Throwable { + + String importUrl = null; + + if (codelistMappingSession.getSource().getId() + .compareTo(SourceType.URL.toString()) == 0) { + importUrl = codelistMappingSession.getUrl(); + } else { + logger.debug("File Storage Access"); + FilesStorage filesStorage = new FilesStorage(); + String fileUrlOnStorage = filesStorage + .storageCodelistMappingTempFile(user, + codelistMappingFileUploadSession + .getCodelistMappingFile()); + logger.debug("File Url On Storage:" + fileUrlOnStorage); + codelistMappingFileUploadSession.getCodelistMappingFile().delete(); + + if (fileUrlOnStorage == null || fileUrlOnStorage.isEmpty()) { + throw new TDGWTServiceException( + "Tabular Data Service error loading file on storage"); + } + importUrl = fileUrlOnStorage; + } + + AuthorizationProvider.instance.set(new AuthorizationToken(aslSession + .getUsername())); + TabularDataService service = TabularDataServiceFactory.getService(); + + OperationExecution invocation = retrieveOperationExecution(service, + codelistMappingSession, importUrl); + if (invocation == null) { + throw new TDGWTServiceException( + "Error in invocation: Operation not supported"); + } + Long id = Long.valueOf(codelistMappingSession.getTrId().getId()); + + TabularResourceId serviceTR = new TabularResourceId(id); + logger.debug("OperationInvocation: \n" + invocation.toString()); + Task trTask = service.execute(invocation, serviceTR); + logger.debug("Codelist Mapping Import on service: TaskId " + + trTask.getId()); + SessionUtil.setCodelistMappingTask(session, trTask); + return; + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUploadSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java similarity index 97% rename from src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUploadSession.java rename to src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java index 2db0863..0e3587f 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUploadSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java @@ -14,7 +14,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; * g.panichi@isti.cnr.it * */ -public class FileUploadSession implements Serializable { +public class CSVFileUploadSession implements Serializable { private static final long serialVersionUID = -7906477664944910362L; diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java new file mode 100644 index 0000000..c739a5d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java @@ -0,0 +1,90 @@ +package org.gcube.portlets.user.td.gwtservice.server.file; + +import java.io.File; +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class CodelistMappingFileUploadSession implements Serializable { + + private static final long serialVersionUID = -5683392670926072167L; + + protected String id; + + protected FileUploadState fileUploadState; + + protected File codelistMappingFile; + protected String codelistMappingName; + + protected FileUploadMonitor fileUploadMonitor; + + protected CodelistMappingMonitor codelistMappingMonitor; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FileUploadState getFileUploadState() { + return fileUploadState; + } + + public void setFileUploadState(FileUploadState fileUploadState) { + this.fileUploadState = fileUploadState; + } + + public FileUploadMonitor getFileUploadMonitor() { + return fileUploadMonitor; + } + + public void setFileUploadMonitor(FileUploadMonitor fileUploadMonitor) { + this.fileUploadMonitor = fileUploadMonitor; + } + + public File getCodelistMappingFile() { + return codelistMappingFile; + } + + public void setCodelistMappingFile(File codelistMappingFile) { + this.codelistMappingFile = codelistMappingFile; + } + + public String getCodelistMappingName() { + return codelistMappingName; + } + + public void setCodelistMappingName(String codelistMappingName) { + this.codelistMappingName = codelistMappingName; + } + + public CodelistMappingMonitor getCodelistMappingMonitor() { + return codelistMappingMonitor; + } + + public void setCodelistMappingMonitor( + CodelistMappingMonitor codelistMappingMonitor) { + this.codelistMappingMonitor = codelistMappingMonitor; + } + + @Override + public String toString() { + return "CodelistMappingFileUploadSession [id=" + id + + ", fileUploadState=" + fileUploadState + + ", codelistMappingFile=" + codelistMappingFile + + ", codelistMappingName=" + codelistMappingName + + ", fileUploadMonitor=" + fileUploadMonitor + + ", codelistMappingMonitor=" + codelistMappingMonitor + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUtil.java index 17f768a..280671d 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/FileUtil.java @@ -17,45 +17,47 @@ import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - public class FileUtil { - protected static final Logger logger = LoggerFactory.getLogger(FileUtil.class); + protected static final Logger logger = LoggerFactory + .getLogger(FileUtil.class); - public static final String[] ZIP_MIMETYPES = new String[]{ - "application/x-compress", - "application/x-compressed", - "application/x-gzip", - "application/x-winzip", - "application/x-zip", - "application/zip", - "multipart/x-zip"}; + public static final String[] ZIP_MIMETYPES = new String[] { + "application/x-compress", "application/x-compressed", + "application/x-gzip", "application/x-winzip", "application/x-zip", + "application/zip", "multipart/x-zip" }; /** * Check if the content type is a zip type. - * @param contentType the content type to check. + * + * @param contentType + * the content type to check. * @return true if is a zip file, false otherwise. */ - public static boolean isZipContentType(String contentType) - { - for (String zip_mimetype:ZIP_MIMETYPES) if (zip_mimetype.equals(contentType)) return true; + public static boolean isZipContentType(String contentType) { + for (String zip_mimetype : ZIP_MIMETYPES) + if (zip_mimetype.equals(contentType)) + return true; return false; } - /** * Unzip the specified stream - * @param is the zip stream. - * @param os the output stream. + * + * @param is + * the zip stream. + * @param os + * the output stream. * @throws Exception */ - public static String unZip(InputStream is, OutputStream os) throws Exception - { + public static String unZip(InputStream is, OutputStream os) + throws Exception { try { ZipInputStream zis = new ZipInputStream(is); ZipEntry entry; - while ((entry = zis.getNextEntry())!=null && !entry.isDirectory()); + while ((entry = zis.getNextEntry()) != null && !entry.isDirectory()) + ; if (entry == null || entry.isDirectory()) { zis.close(); @@ -68,16 +70,13 @@ public class FileUtil { os.close(); return entry.getName(); - - } catch(IOException e) - { - throw new Exception("Unzip error: "+e.getMessage(), e); + } catch (IOException e) { + throw new Exception("Unzip error: " + e.getMessage(), e); } } - public static String exceptionDetailMessage(Throwable t) - { + public static String exceptionDetailMessage(Throwable t) { StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); t.printStackTrace(writer); @@ -88,28 +87,47 @@ public class FileUtil { return message.toString(); } - public static void setImportFile(FileUploadSession fileUploadSession, InputStream is, String name, String mimeType) throws Exception - { - File csvTmp = File.createTempFile("import", ".csv"); - - csvTmp.deleteOnExit(); - - logger.trace("mimeType: "+mimeType); - if (isZipContentType(mimeType)){ - //we need to unzip - logger.trace("is a zip file"); - name = unZip(is, new FileOutputStream(csvTmp)); - } else { - logger.trace("is a text file"); - IOUtils.copy(is, new FileOutputStream(csvTmp)); - } + public static void setImportFileCSV(CSVFileUploadSession fileUploadSession, + InputStream is, String name, String mimeType) throws Exception { - logger.trace("upload completed"); + File csvTmp = setImportFile(is, "import", ".csv", name, mimeType); fileUploadSession.setCsvName(name); fileUploadSession.setCsvFile(csvTmp); + + } + + public static void setImportFileCodelistMapping(CodelistMappingFileUploadSession fileUploadSession, + InputStream is, String name, String mimeType) throws Exception { - + File xmlTmp = setImportFile(is, "importCodMap", ".xml", name, mimeType); + + fileUploadSession.setCodelistMappingName(name); + fileUploadSession.setCodelistMappingFile(xmlTmp); + + } + + + public static File setImportFile(InputStream is, String tempName, + String extention, String name, String mimeType) throws Exception { + File fileTmp = File.createTempFile(tempName, extention); + + fileTmp.deleteOnExit(); + + logger.trace("mimeType: " + mimeType); + if (isZipContentType(mimeType)) { + // we need to unzip + logger.trace("is a zip file"); + name = unZip(is, new FileOutputStream(fileTmp)); + } else { + logger.trace("is a text file"); + IOUtils.copy(is, new FileOutputStream(fileTmp)); + } + + logger.trace("upload completed"); + + return fileTmp; + } } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/storage/FilesStorage.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/storage/FilesStorage.java index 9e4d02f..17e6514 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/storage/FilesStorage.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/storage/FilesStorage.java @@ -51,6 +51,26 @@ public class FilesStorage { return url; } + + public String storageCodelistMappingTempFile(String user, File file) { + String url = null; + try { + IClient client = new StorageClient(user, AccessType.PUBLIC, + MemoryType.VOLATILE).getClient(); + String remotePath = "/CodelistMappingImport/" + file.getName(); + logger.debug("remotePath: " + remotePath); + client.put(true).LFile(file.getAbsolutePath()).RFile(remotePath); + url = client.getUrl().RFile(remotePath); + } catch (Throwable e) { + logger.error("Error no codelist mapping file loaded on storage" + + e.getLocalizedMessage()); + e.printStackTrace(); + } + + return url; + } + + /** * user diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java index 2a03c08..63ff858 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java @@ -14,7 +14,10 @@ public class Constants { public final static String VERSION = "2.1.0"; public final static String DEFAULT_USER = "test.user"; public final static String DEFAULT_SCOPE = "/gcube/devsec"; - + + public final static String FILE_XML_MIMETYPE="application/xml"; + public final static String FILE_CSV_MIMETYPE="text/csv"; + public static final String PARAMETER_ENCODING = "encoding"; public static final String PARAMETER_HASHEADER = "hasHeader"; public static final String PARAMETER_FIELDMASK = "fieldMask"; diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/OperationsId.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/OperationsId.java index 08be2ff..5a9344d 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/OperationsId.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/OperationsId.java @@ -114,7 +114,8 @@ public enum OperationsId { ValidateTable("5011"), ValidateDataSet("5012"), ValidateGeneric("5013"), - ExtractCodelist("11001"); + ExtractCodelist("11001"), + CodelistMappingImport("12001"); /** * @param text diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingMonitor.java new file mode 100644 index 0000000..51cae2a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingMonitor.java @@ -0,0 +1,17 @@ +package org.gcube.portlets.user.td.gwtservice.shared.codelisthelper; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.OperationMonitor; + +/** + * + * @author "Giancarlo Panichi" + * + */ +public class CodelistMappingMonitor extends OperationMonitor implements Serializable { + + + private static final long serialVersionUID = -9004720851025676043L; + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingSession.java new file mode 100644 index 0000000..0aaa325 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/codelisthelper/CodelistMappingSession.java @@ -0,0 +1,70 @@ +package org.gcube.portlets.user.td.gwtservice.shared.codelisthelper; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.source.Source; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +public class CodelistMappingSession implements Serializable { + + private static final long serialVersionUID = 2381185326076784908L; + + protected TRId trId; + protected Source source; + protected String url; + protected String localFileName; + protected String itemId; + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + public String getLocalFileName() { + return localFileName; + } + + public void setLocalFileName(String localFileName) { + this.localFileName = localFileName; + } + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public Source getSource() { + return source; + } + + public void setSource(Source source) { + this.source = source; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + @Override + public String toString() { + return "CodelistMappingSession [trId=" + trId + ", source=" + source + + ", url=" + url + ", localFileName=" + localFileName + + ", itemId=" + itemId + "]"; + } + + + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/resource/ResourceTD.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/resource/ResourceTD.java new file mode 100644 index 0000000..cd88bbf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/resource/ResourceTD.java @@ -0,0 +1,38 @@ +package org.gcube.portlets.user.td.gwtservice.shared.resource; + +import java.io.Serializable; + +/** + * + * @author "Giancarlo Panichi" + * + */ +public class ResourceTD implements Serializable { + + private static final long serialVersionUID = -6324769323093791963L; + protected String name; + protected String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "ResourceTD [name=" + name + ", description=" + description + + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/FileSource.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/FileSource.java index 2e882d1..c2c75ee 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/FileSource.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/FileSource.java @@ -14,7 +14,7 @@ public class FileSource implements Source { * {@inheritDoc} */ public String getId() { - return "File"; + return SourceType.FILE.toString(); } /** diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SDMXRegistrySource.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SDMXRegistrySource.java index 1551508..7fef1ab 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SDMXRegistrySource.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SDMXRegistrySource.java @@ -18,7 +18,7 @@ public class SDMXRegistrySource implements Source { * {@inheritDoc} */ public String getId() { - return "SDMXRegistry"; + return SourceType.SDMXRegistry.toString(); } /** diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SourceType.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SourceType.java new file mode 100644 index 0000000..171e802 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/SourceType.java @@ -0,0 +1,23 @@ +package org.gcube.portlets.user.td.gwtservice.shared.source; + +public enum SourceType { + FILE("File"), + URL("Url"), + WORKSPACE("Workspace"), + SDMXRegistry("SDMXRegistry"); + + /** + * @param text + */ + private SourceType(final String id) { + this.id = id; + } + + private final String id; + + @Override + public String toString() { + return id; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/UrlSource.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/UrlSource.java index 020e078..3c5302e 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/UrlSource.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/UrlSource.java @@ -14,7 +14,7 @@ public class UrlSource implements Source { * {@inheritDoc} */ public String getId() { - return "Url"; + return SourceType.URL.toString(); } /** diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/WorkspaceSource.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/WorkspaceSource.java index 0b7cebf..5f810da 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/WorkspaceSource.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/source/WorkspaceSource.java @@ -15,7 +15,7 @@ public class WorkspaceSource implements Source { * {@inheritDoc} */ public String getId() { - return "Workspace"; + return SourceType.WORKSPACE.toString(); } /** diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index eaf4272..163cef8 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -21,6 +21,11 @@ org.gcube.portlets.user.td.gwtservice.server.LocalUploadServlet + + CodelistMappingUploadServlet + org.gcube.portlets.user.td.gwtservice.server.CodelistMappingUploadServlet + + jUnitHostImpl com.google.gwt.junit.server.JUnitHostImpl @@ -44,6 +49,11 @@ /tdgwtservice/LocalUploadServlet + + CodelistMappingUploadServlet + /tdgwtservice/CodelistMappingUploadServlet + + jUnitHostImpl TDServiceManagerWidgets/junithost/*