ref 8580:TDM - TabMan - Support Java 8 compatibility
https://support.d4science.org/issues/8580 Updated compatibility to Java 8 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@148720 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
68073ed35f
commit
37d3343940
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.16.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.17.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.16.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.17.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -33,5 +33,5 @@
|
|||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.16.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.17.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-17-0"
|
||||
date="2017-06-12">
|
||||
<Change>Support Java 8 compatibility [ticket #8580]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-16-0"
|
||||
date="2017-04-01">
|
||||
<Change>Added DataMiner [issue #6548]</Change>
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-gwt-service</artifactId>
|
||||
<version>2.16.0-SNAPSHOT</version>
|
||||
<version>2.17.0-SNAPSHOT</version>
|
||||
|
||||
<name>tabular-data-gwt-service</name>
|
||||
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
|
||||
|
@ -40,6 +40,10 @@
|
|||
<distroDirectory>distro</distroDirectory>
|
||||
<configDirectory>config</configDirectory>
|
||||
|
||||
<!-- JAVA -->
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
|
||||
|
||||
<gwtVersion>2.6.1</gwtVersion>
|
||||
<gwtLogVersion>3.3.2</gwtLogVersion>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -90,8 +90,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Returns a representation of the csv file in JSON
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVImportFileServlet extends HttpServlet {
|
||||
|
|
|
@ -34,8 +34,8 @@ import com.allen_sauer.gwt.log.client.Log;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingUploadServlet extends HttpServlet {
|
||||
|
|
|
@ -34,8 +34,8 @@ import com.allen_sauer.gwt.log.client.Log;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LocalUploadServlet extends HttpServlet {
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Returns a chart file from storage
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RetrieveChartFileServlet extends HttpServlet {
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Returns a file from storage and discover mime type
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RetrieveFileAndDiscoverMimeTypeServlet extends HttpServlet {
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SDMXClient {
|
||||
|
|
|
@ -2,8 +2,8 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionConstants {
|
||||
|
|
|
@ -12,10 +12,10 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
* @param <T>
|
||||
*
|
||||
* @param <T> Type
|
||||
*/
|
||||
public class SessionOp<T> {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,8 +2,8 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TDGWTServiceMessagesConstants {
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TDLogsServlet extends HttpServlet {
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Returns a RSTudio link
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TDRStudioServlet extends HttpServlet {
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TabularDataRowsXServlet extends HttpServlet {
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum EncodingPGSupported {
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVFileUploadSession implements Serializable {
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingFileUploadSession implements Serializable {
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FileUploadListener implements ProgressListener {
|
||||
|
|
|
@ -20,25 +20,23 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FileUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(FileUtil.class);
|
||||
private 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.
|
||||
* @return <code>true</code> if is a zip file, <code>false</code> otherwise.
|
||||
* @return True if is a zip file, false otherwise.
|
||||
*
|
||||
*/
|
||||
public static boolean isZipContentType(String contentType) {
|
||||
for (String zip_mimetype : ZIP_MIMETYPES)
|
||||
|
@ -51,13 +49,14 @@ public class FileUtil {
|
|||
* Unzip the specified stream
|
||||
*
|
||||
* @param is
|
||||
* the zip stream.
|
||||
* the zip stream
|
||||
* @param os
|
||||
* the output stream.
|
||||
* the output stream
|
||||
* @return Entry name
|
||||
* @throws Exception
|
||||
* 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;
|
||||
|
@ -93,29 +92,28 @@ public class FileUtil {
|
|||
return message.toString();
|
||||
}
|
||||
|
||||
public static void setImportFileCSV(CSVFileUploadSession fileUploadSession,
|
||||
InputStream is, String name, String mimeType) throws Exception {
|
||||
|
||||
public static void setImportFileCSV(CSVFileUploadSession fileUploadSession, InputStream is, String name,
|
||||
String mimeType) throws Exception {
|
||||
|
||||
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 {
|
||||
|
||||
|
||||
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 {
|
||||
public static File setImportFile(InputStream is, String tempName, String extention, String name, String mimeType)
|
||||
throws Exception {
|
||||
File fileTmp = File.createTempFile(tempName, extention);
|
||||
|
||||
fileTmp.deleteOnExit();
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for add column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4AddColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for CSV Export
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4CSVExport extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for CSV Import
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4CSVImport extends OpExecutionBuilder {
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change column type
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ChangeColumnType extends OpExecutionBuilder {
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change column position
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ChangeColumnsPosition extends OpExecutionBuilder {
|
||||
|
|
|
@ -17,8 +17,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change table type
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ChangeTableType extends OpExecutionBuilder {
|
||||
|
|
|
@ -17,8 +17,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for Top Rating Chart creation
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ChartTopRating extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for delete column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4Clone extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for codelist mapping
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4CodelistMapping extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation DataMiner
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4DataMinerOperation extends OpExecutionBuilder {
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for delete column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4DeleteColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for delete rows
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4DeleteRows extends OpExecutionBuilder {
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for Denormalization
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4Denormalization extends OpExecutionBuilder {
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for duplicates
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4Duplicates extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for edit and add row
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4EditRow extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for extract codelist
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ExtractCodelist extends
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for delete column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4FilterColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.gcube.data.analysis.tabulardata.expression.dsl.Types.*;
|
|||
/**
|
||||
* Operation Execution for change table type
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4GeometryCreatePoint extends OpExecutionBuilder {
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change table type
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder {
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change table type
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4GeospatialDownscaleCSquare extends OpExecutionBuilder {
|
||||
|
|
|
@ -15,8 +15,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for groupBy
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4GroupBy extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for JSON Export
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4JSONExport extends OpExecutionBuilder {
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for change label column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4LabelColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for Map Creation
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4MapCreation extends OpExecutionBuilder {
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for merge column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4MergeColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for Normalization
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4Normalization extends OpExecutionBuilder {
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for replace batch
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ReplaceBatch extends OpExecutionBuilder {
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for replace by external tabular resource
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ReplaceByExternal extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for replace column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ReplaceColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for replace column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4ReplaceColumnByExpression extends OpExecutionBuilder {
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for sdmx codelist export
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for sdmx codelist import
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4SDMXCodelistImport extends OpExecutionBuilder {
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for sdmx Dataset export
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for sdmx Template export
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4SDMXTemplateExport extends OpExecutionBuilder {
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for split column
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4SplitColumn extends OpExecutionBuilder {
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for union
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4StatisticalOperation extends OpExecutionBuilder {
|
||||
|
|
|
@ -15,8 +15,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for Time Aggregation
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4TimeAggregation extends OpExecutionBuilder {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Operation Execution for union
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecution4Union extends OpExecutionBuilder {
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
|
|||
/**
|
||||
* Abstract class for build Operation Execution
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
abstract class OpExecutionBuilder {
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
|
|||
/**
|
||||
* Operation Execution Director
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecutionDirector {
|
||||
|
|
|
@ -6,8 +6,8 @@ import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.O
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OpExecutionSpec {
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ResourceTDCreator {
|
||||
|
@ -45,12 +45,7 @@ public class ResourceTDCreator {
|
|||
this.serviceCredentials = serviceCredentials;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resources
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
|
||||
public ArrayList<ResourceTDDescriptor> createResourcesDescriptorTD(
|
||||
List<ResourceDescriptor> resources) throws TDGWTServiceException {
|
||||
ArrayList<ResourceTDDescriptor> resourcesTD = new ArrayList<ResourceTDDescriptor>();
|
||||
|
@ -98,11 +93,7 @@ public class ResourceTDCreator {
|
|||
return resourcesTD;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
* @return
|
||||
*/
|
||||
|
||||
protected ResourceTD createResourceTD(Resource resource)
|
||||
throws TDGWTServiceException {
|
||||
ResourceTD resourceTD = null;
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ResourceTypeMap {
|
||||
|
|
|
@ -22,13 +22,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* TDMNotification notification sharing TR, templates or rules
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TDMNotifications extends Thread {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(TDMNotifications.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(TDMNotifications.class);
|
||||
private ServiceCredentials serviceCredentials;
|
||||
private NotificationType notificationType;
|
||||
private ShareTabResource shareTabularResource;
|
||||
|
@ -41,8 +40,12 @@ public class TDMNotifications extends Thread {
|
|||
/**
|
||||
* Share Tabular Resource
|
||||
*
|
||||
* @param request
|
||||
* Request
|
||||
* @param serviceCredentials
|
||||
* Service credentials
|
||||
* @param shareTabularResource
|
||||
* Share tabular resource
|
||||
*/
|
||||
public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials,
|
||||
ShareTabResource shareTabularResource) {
|
||||
|
@ -50,46 +53,49 @@ public class TDMNotifications extends Thread {
|
|||
this.shareTabularResource = shareTabularResource;
|
||||
this.notificationType = NotificationType.TDM_TAB_RESOURCE_SHARE;
|
||||
site = new SocialNetworkingSite(request);
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(),
|
||||
serviceCredentials.getEmail(), serviceCredentials.getFullName(),
|
||||
serviceCredentials.getUserAvatarURL());
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(), serviceCredentials.getEmail(),
|
||||
serviceCredentials.getFullName(), serviceCredentials.getUserAvatarURL());
|
||||
scope = serviceCredentials.getScope();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* Request
|
||||
* @param serviceCredentials
|
||||
* Service credentials
|
||||
* @param shareRule
|
||||
* Share rule
|
||||
*/
|
||||
public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials,
|
||||
ShareRule shareRule) {
|
||||
public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials, ShareRule shareRule) {
|
||||
this.serviceCredentials = serviceCredentials;
|
||||
this.shareRule = shareRule;
|
||||
this.notificationType = NotificationType.TDM_RULE_SHARE;
|
||||
site = new SocialNetworkingSite(request);
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(),
|
||||
serviceCredentials.getEmail(), serviceCredentials.getFullName(),
|
||||
serviceCredentials.getUserAvatarURL());
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(), serviceCredentials.getEmail(),
|
||||
serviceCredentials.getFullName(), serviceCredentials.getUserAvatarURL());
|
||||
scope = serviceCredentials.getScope();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* Request
|
||||
* @param serviceCredentials
|
||||
* Service credentials
|
||||
* @param shareTemplate
|
||||
* Share template
|
||||
*/
|
||||
public TDMNotifications(HttpServletRequest request,
|
||||
ServiceCredentials serviceCredentials,
|
||||
public TDMNotifications(HttpServletRequest request, ServiceCredentials serviceCredentials,
|
||||
ShareTemplate shareTemplate) {
|
||||
this.serviceCredentials = serviceCredentials;
|
||||
this.shareTemplate = shareTemplate;
|
||||
this.notificationType = NotificationType.TDM_TEMPLATE_SHARE;
|
||||
site = new SocialNetworkingSite(request);
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(),
|
||||
serviceCredentials.getEmail(), serviceCredentials.getFullName(),
|
||||
serviceCredentials.getUserAvatarURL());
|
||||
user = new SocialNetworkingUser(serviceCredentials.getUserName(), serviceCredentials.getEmail(),
|
||||
serviceCredentials.getFullName(), serviceCredentials.getUserAvatarURL());
|
||||
scope = serviceCredentials.getScope();
|
||||
|
||||
}
|
||||
|
@ -112,42 +118,29 @@ public class TDMNotifications extends Thread {
|
|||
}
|
||||
|
||||
private void tabularResourceNotify() {
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site,
|
||||
scope, user, Constants.APPLICATION_ID);
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site, scope, user, Constants.APPLICATION_ID);
|
||||
|
||||
for (Contacts contact : shareTabularResource.getContacts()) {
|
||||
if (contact.isGroup()) {
|
||||
try {
|
||||
List<String> members = WorkspaceUtil
|
||||
.getMembersByGroup(contact.getLogin());
|
||||
List<String> members = WorkspaceUtil.getMembersByGroup(contact.getLogin());
|
||||
for (String member : members) {
|
||||
try {
|
||||
nm.notifyTDMTabularResourceSharing(member,
|
||||
shareTabularResource.getTabResource()
|
||||
.getName(), new String(
|
||||
Constants.TABULAR_RESOURCE_ID
|
||||
+ "="
|
||||
+ shareTabularResource
|
||||
.getTabResource()
|
||||
.getTrId().getId()));
|
||||
nm.notifyTDMTabularResourceSharing(member, shareTabularResource.getTabResource().getName(),
|
||||
new String(Constants.TABULAR_RESOURCE_ID + "="
|
||||
+ shareTabularResource.getTabResource().getTrId().getId()));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType
|
||||
+ " - "
|
||||
+ serviceCredentials.getUserName()
|
||||
+ " share tabular resource id="
|
||||
+ shareTabularResource.getTabResource()
|
||||
.getTrId().getId() + " with "
|
||||
+ member + "): " + e.getLocalizedMessage());
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share tabular resource id="
|
||||
+ shareTabularResource.getTabResource().getTrId().getId() + " with " + member
|
||||
+ "): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(No members found for group "
|
||||
+ contact.getLogin()
|
||||
+ "): "
|
||||
logger.error("Error in the notification(No members found for group " + contact.getLogin() + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -155,20 +148,13 @@ public class TDMNotifications extends Thread {
|
|||
} else {
|
||||
try {
|
||||
nm.notifyTDMTabularResourceSharing(contact.getLogin(),
|
||||
shareTabularResource.getTabResource().getName(),
|
||||
new String(Constants.TABULAR_RESOURCE_ID
|
||||
+ "="
|
||||
+ shareTabularResource.getTabResource()
|
||||
.getTrId().getId()));
|
||||
shareTabularResource.getTabResource().getName(), new String(Constants.TABULAR_RESOURCE_ID
|
||||
+ "=" + shareTabularResource.getTabResource().getTrId().getId()));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType
|
||||
+ " - "
|
||||
+ serviceCredentials.getUserName()
|
||||
+ " share tabular resource id="
|
||||
+ shareTabularResource.getTabResource().getTrId()
|
||||
.getId() + " with " + contact.getLogin()
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share tabular resource id="
|
||||
+ shareTabularResource.getTabResource().getTrId().getId() + " with " + contact.getLogin()
|
||||
+ "): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -178,54 +164,42 @@ public class TDMNotifications extends Thread {
|
|||
}
|
||||
|
||||
private void ruleNotify() {
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site,
|
||||
scope, user, Constants.APPLICATION_ID);
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site, scope, user, Constants.APPLICATION_ID);
|
||||
|
||||
for (Contacts contact : shareRule.getContacts()) {
|
||||
if (contact.isGroup()) {
|
||||
|
||||
try {
|
||||
List<String> members = WorkspaceUtil
|
||||
.getMembersByGroup(contact.getLogin());
|
||||
List<String> members = WorkspaceUtil.getMembersByGroup(contact.getLogin());
|
||||
for (String member : members) {
|
||||
try {
|
||||
nm.notifyTDMObjectSharing(member, notificationType,
|
||||
shareRule.getRuleDescriptionData()
|
||||
.getName(), null);
|
||||
shareRule.getRuleDescriptionData().getName(), null);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType
|
||||
+ " - "
|
||||
+ serviceCredentials.getUserName()
|
||||
+ " share rule id="
|
||||
+ shareRule.getRuleDescriptionData()
|
||||
.getId() + " with " + member
|
||||
+ "): " + e.getLocalizedMessage());
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share rule id="
|
||||
+ shareRule.getRuleDescriptionData().getId() + " with " + member + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(No members found for group "
|
||||
+ contact.getLogin()
|
||||
+ "): "
|
||||
logger.error("Error in the notification(No members found for group " + contact.getLogin() + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
nm.notifyTDMObjectSharing(contact.getLogin(),
|
||||
notificationType, shareRule
|
||||
.getRuleDescriptionData().getName(), null);
|
||||
nm.notifyTDMObjectSharing(contact.getLogin(), notificationType,
|
||||
shareRule.getRuleDescriptionData().getName(), null);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType + " - "
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share rule id="
|
||||
+ shareRule.getRuleDescriptionData().getId()
|
||||
+ " with " + contact.getLogin() + "): "
|
||||
+ shareRule.getRuleDescriptionData().getId() + " with " + contact.getLogin() + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -236,53 +210,42 @@ public class TDMNotifications extends Thread {
|
|||
}
|
||||
|
||||
private void templateNotify() {
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site,
|
||||
scope, user, Constants.APPLICATION_ID);
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(site, scope, user, Constants.APPLICATION_ID);
|
||||
|
||||
for (Contacts contact : shareTemplate.getContacts()) {
|
||||
if (contact.isGroup()) {
|
||||
|
||||
try {
|
||||
List<String> members = WorkspaceUtil
|
||||
.getMembersByGroup(contact.getLogin());
|
||||
List<String> members = WorkspaceUtil.getMembersByGroup(contact.getLogin());
|
||||
for (String member : members) {
|
||||
try {
|
||||
nm.notifyTDMObjectSharing(member, notificationType,
|
||||
shareTemplate.getTemplateData().getName(),
|
||||
null);
|
||||
shareTemplate.getTemplateData().getName(), null);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType + " - "
|
||||
+ serviceCredentials.getUserName()
|
||||
+ " share template id="
|
||||
+ shareTemplate.getTemplateData().getId()
|
||||
+ " with " + member + "): "
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share template id="
|
||||
+ shareTemplate.getTemplateData().getId() + " with " + member + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(No members found for group "
|
||||
+ contact.getLogin()
|
||||
+ "): "
|
||||
logger.error("Error in the notification(No members found for group " + contact.getLogin() + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
nm.notifyTDMObjectSharing(contact.getLogin(),
|
||||
notificationType, shareTemplate.getTemplateData()
|
||||
.getName(), null);
|
||||
nm.notifyTDMObjectSharing(contact.getLogin(), notificationType,
|
||||
shareTemplate.getTemplateData().getName(), null);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType + " - "
|
||||
logger.error("Error in the notification(Type: " + notificationType + " - "
|
||||
+ serviceCredentials.getUserName() + " share template id="
|
||||
+ shareTemplate.getTemplateData().getId()
|
||||
+ " with " + contact.getLogin() + "): "
|
||||
+ shareTemplate.getTemplateData().getId() + " with " + contact.getLogin() + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -25,35 +25,33 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class FilesStorage {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(FilesStorage.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(FilesStorage.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param file
|
||||
* @return
|
||||
* File
|
||||
* @return File id
|
||||
*/
|
||||
public String storageCSVTempFile(String user, File file) {
|
||||
try {
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC,
|
||||
MemoryType.VOLATILE).getClient();
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC, MemoryType.VOLATILE).getClient();
|
||||
String remotePath = "/CSVimport/" + file.getName();
|
||||
logger.debug("remotePath: " + remotePath);
|
||||
String id = client.put(true).LFile(file.getAbsolutePath())
|
||||
.RFile(remotePath);
|
||||
String id = client.put(true).LFile(file.getAbsolutePath()).RFile(remotePath);
|
||||
return id;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error no csv file loaded on storage"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error no csv file loaded on storage" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
|
@ -63,21 +61,20 @@ public class FilesStorage {
|
|||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param file
|
||||
* @return
|
||||
* File
|
||||
* @return File id
|
||||
*/
|
||||
public String storageCodelistMappingTempFile(String user, File file) {
|
||||
try {
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC,
|
||||
MemoryType.VOLATILE).getClient();
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC, MemoryType.VOLATILE).getClient();
|
||||
String remotePath = "/CodelistMappingImport/" + file.getName();
|
||||
logger.debug("remotePath: " + remotePath);
|
||||
String id = client.put(true).LFile(file.getAbsolutePath())
|
||||
.RFile(remotePath);
|
||||
String id = client.put(true).LFile(file.getAbsolutePath()).RFile(remotePath);
|
||||
return id;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error no codelist mapping file loaded on storage"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error no codelist mapping file loaded on storage" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
|
@ -87,19 +84,20 @@ public class FilesStorage {
|
|||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param url
|
||||
* @return
|
||||
* Url
|
||||
* @return File id
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public String storageCodelistMappingTempFile(String user, String url)
|
||||
throws TDGWTServiceException {
|
||||
public String storageCodelistMappingTempFile(String user, String url) throws TDGWTServiceException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
URL address = new URL(url);
|
||||
is = address.openStream();
|
||||
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC,
|
||||
MemoryType.VOLATILE).getClient();
|
||||
IClient client = new StorageClient(user, AccessType.PUBLIC, MemoryType.VOLATILE).getClient();
|
||||
String remotePath = "/CodelistMappingImport/" + address.getFile();
|
||||
logger.debug("remotePath: " + remotePath);
|
||||
String id = client.put(true).LFile(is).RFile(remotePath);
|
||||
|
@ -107,15 +105,12 @@ public class FilesStorage {
|
|||
|
||||
return id;
|
||||
} catch (IOException e) {
|
||||
logger.error("Error no codelist mapping file loaded on storage"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error no codelist mapping file loaded on storage" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error no codelist mapping file loaded on storage"
|
||||
+ e.getLocalizedMessage());
|
||||
"Error no codelist mapping file loaded on storage" + e.getLocalizedMessage());
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error no codelist mapping file loaded on storage"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error no codelist mapping file loaded on storage" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
|
@ -127,14 +122,14 @@ public class FilesStorage {
|
|||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param remotePath
|
||||
* File path on storage
|
||||
* @param wi
|
||||
* Workspace item
|
||||
* @param file
|
||||
* Destination file
|
||||
* File
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public void retrieveFile(String user, WorkspaceItem wi, File file)
|
||||
throws TDGWTServiceException {
|
||||
public void retrieveFile(String user, WorkspaceItem wi, File file) throws TDGWTServiceException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
|
||||
|
@ -142,9 +137,8 @@ public class FilesStorage {
|
|||
// SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
|
||||
URL url = new URL(gcubeItem.getPublicLink());
|
||||
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:"
|
||||
+ url.getPath() + " ref:" + url.getRef() + " userinfo:"
|
||||
+ url.getUserInfo() + " ]");
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:" + url.getPath() + " ref:" + url.getRef()
|
||||
+ " userinfo:" + url.getUserInfo() + " ]");
|
||||
URLConnection uc = null;
|
||||
uc = (URLConnection) url.openConnection();
|
||||
is = uc.getInputStream();
|
||||
|
@ -152,9 +146,7 @@ public class FilesStorage {
|
|||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving file from storage", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving file from storage: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving file from storage: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -168,13 +160,9 @@ public class FilesStorage {
|
|||
}
|
||||
bos.close();
|
||||
} catch (Throwable e) {
|
||||
logger.error(
|
||||
"Error trasferring file from storage: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
logger.error("Error trasferring file from storage: " + e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error trasferring file from storage: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error trasferring file from storage: " + e.getLocalizedMessage(), e);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -183,13 +171,14 @@ public class FilesStorage {
|
|||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param remotePath
|
||||
* File path on storage
|
||||
* @return InputStream back to read the file
|
||||
*
|
||||
* @param wi
|
||||
* Workspace item
|
||||
* @return Input stream
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public InputStream retrieveInputStream(String user, WorkspaceItem wi)
|
||||
throws TDGWTServiceException {
|
||||
public InputStream retrieveInputStream(String user, WorkspaceItem wi) throws TDGWTServiceException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
|
||||
|
@ -197,9 +186,8 @@ public class FilesStorage {
|
|||
// SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
|
||||
URL url = new URL(gcubeItem.getPublicLink());
|
||||
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:"
|
||||
+ url.getPath() + " ref:" + url.getRef() + " userinfo:"
|
||||
+ url.getUserInfo() + " ]");
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:" + url.getPath() + " ref:" + url.getRef()
|
||||
+ " userinfo:" + url.getUserInfo() + " ]");
|
||||
URLConnection uc = null;
|
||||
uc = (URLConnection) url.openConnection();
|
||||
is = uc.getInputStream();
|
||||
|
@ -207,9 +195,7 @@ public class FilesStorage {
|
|||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving file from storage", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving file from storage: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving file from storage: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return is;
|
||||
|
@ -218,24 +204,21 @@ public class FilesStorage {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param remotePath
|
||||
* File path on storage
|
||||
* @return InputStream back to read the file
|
||||
* @param uri
|
||||
* Usi
|
||||
* @return Input stream
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public InputStream retrieveInputStream(String uri)
|
||||
throws TDGWTServiceException {
|
||||
public InputStream retrieveInputStream(String uri) throws TDGWTServiceException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
|
||||
// SMPUrl smsHome = new SMPUrl(uri);
|
||||
URL url = new URL(uri);
|
||||
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:"
|
||||
+ url.getPath() + " ref:" + url.getRef() + " userinfo:"
|
||||
+ url.getUserInfo() + " ]");
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:" + url.getPath() + " ref:" + url.getRef()
|
||||
+ " userinfo:" + url.getUserInfo() + " ]");
|
||||
URLConnection uc = null;
|
||||
uc = (URLConnection) url.openConnection();
|
||||
is = uc.getInputStream();
|
||||
|
@ -243,9 +226,7 @@ public class FilesStorage {
|
|||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving file from storage", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving file from storage: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving file from storage: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return is;
|
||||
|
@ -254,25 +235,31 @@ public class FilesStorage {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param uri
|
||||
* Uri
|
||||
* @param user
|
||||
* User
|
||||
* @param remotePath
|
||||
* File path on storage
|
||||
* @return InputStream back to read the file
|
||||
* @param item_name
|
||||
* Item name
|
||||
* @param item_description
|
||||
* Item description
|
||||
* @param item_mimetype
|
||||
* Item mime type
|
||||
* @param item_folder
|
||||
* Destination folder
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public void createItemOnWorkspace(String uri, String user,
|
||||
String item_name, String item_description, String item_mimetype,
|
||||
String item_folder) throws TDGWTServiceException {
|
||||
public void createItemOnWorkspace(String uri, String user, String item_name, String item_description,
|
||||
String item_mimetype, String item_folder) throws TDGWTServiceException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
|
||||
// SMPUrl smsHome = new SMPUrl(uri);
|
||||
URL url = new URL(uri);
|
||||
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:"
|
||||
+ url.getPath() + " ref:" + url.getRef() + " userinfo:"
|
||||
+ url.getUserInfo() + " ]");
|
||||
logger.debug("smsHome: [host:" + url.getHost() + " path:" + url.getPath() + " ref:" + url.getRef()
|
||||
+ " userinfo:" + url.getUserInfo() + " ]");
|
||||
|
||||
URLConnection uc = null;
|
||||
uc = (URLConnection) url.openConnection();
|
||||
|
@ -283,21 +270,16 @@ public class FilesStorage {
|
|||
WorkspaceFolder folder = (WorkspaceFolder) ws.getItem(item_folder);
|
||||
String uniqueName = WorkspaceUtil.getUniqueName(item_name, folder);
|
||||
|
||||
logger.debug("ws.createExternalFile [folder: " + folder
|
||||
+ ", uniqueName: " + uniqueName + ", description: "
|
||||
+ item_description + ", mimetype: " + item_mimetype
|
||||
+ ", InputStream: " + is + "]");
|
||||
WorkspaceUtil.createExternalFile(folder, uniqueName,
|
||||
item_description, item_mimetype, is);
|
||||
logger.debug("ws.createExternalFile [folder: " + folder + ", uniqueName: " + uniqueName + ", description: "
|
||||
+ item_description + ", mimetype: " + item_mimetype + ", InputStream: " + is + "]");
|
||||
WorkspaceUtil.createExternalFile(folder, uniqueName, item_description, item_mimetype, is);
|
||||
|
||||
is.close();
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating item on workspace", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error creating item on workspace: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error creating item on workspace: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -305,16 +287,22 @@ public class FilesStorage {
|
|||
/**
|
||||
*
|
||||
* @param storageId
|
||||
* Storage id
|
||||
* @param user
|
||||
* User
|
||||
* @param item_name
|
||||
* Item name
|
||||
* @param item_description
|
||||
* Item description
|
||||
* @param item_mimetype
|
||||
* Item mime type
|
||||
* @param item_folder
|
||||
* Destination Folder
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public void createItemOnWorkspaceByStorageId(String storageId, String user,
|
||||
String item_name, String item_description, String item_mimetype,
|
||||
String item_folder) throws TDGWTServiceException {
|
||||
public void createItemOnWorkspaceByStorageId(String storageId, String user, String item_name,
|
||||
String item_description, String item_mimetype, String item_folder) throws TDGWTServiceException {
|
||||
|
||||
try {
|
||||
|
||||
|
@ -323,19 +311,14 @@ public class FilesStorage {
|
|||
WorkspaceFolder folder = (WorkspaceFolder) ws.getItem(item_folder);
|
||||
String uniqueName = WorkspaceUtil.getUniqueName(item_name, folder);
|
||||
|
||||
logger.debug("ws.createExternalFile [folder: " + folder
|
||||
+ ", uniqueName: " + uniqueName + ", description: "
|
||||
+ item_description + ", mimetype: " + item_mimetype
|
||||
+ ", StorageId: " + storageId + "]");
|
||||
WorkspaceUtil.createExternalFile(folder, uniqueName,
|
||||
item_description, item_mimetype, storageId);
|
||||
logger.debug("ws.createExternalFile [folder: " + folder + ", uniqueName: " + uniqueName + ", description: "
|
||||
+ item_description + ", mimetype: " + item_mimetype + ", StorageId: " + storageId + "]");
|
||||
WorkspaceUtil.createExternalFile(folder, uniqueName, item_description, item_mimetype, storageId);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating item on workspace", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error creating item on workspace: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error creating item on workspace: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -343,28 +326,29 @@ public class FilesStorage {
|
|||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param scope
|
||||
* Scope
|
||||
* @return Folder id
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public String getVREFolderIdByScope(String user, String scope)
|
||||
throws TDGWTServiceException {
|
||||
public String getVREFolderIdByScope(String user, String scope) throws TDGWTServiceException {
|
||||
|
||||
try {
|
||||
|
||||
Workspace ws = HomeLibrary.getUserWorkspace(user);
|
||||
WorkspaceSharedFolder folder = ws.getVREFolderByScope(scope);
|
||||
if(folder!=null){
|
||||
if (folder != null) {
|
||||
return folder.getId();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving VRE folder by scope!", e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving VRE folder by scope: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving VRE folder by scope: " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataT
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ColumnDataTypeMap {
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ColumnMap {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeC
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public class ColumnTypeCodeMap {
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ExpressionGenerator {
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ExtractCodelistOperationMap {
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public class ExtractReferences {
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class JobClassifierMap {
|
||||
|
|
|
@ -6,8 +6,8 @@ import org.gcube.data.analysis.tabulardata.commons.utils.Licence;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LicenceMap {
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OperationDefinitionMap {
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ValueDataFo
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class PeriodTypeMap {
|
||||
|
|
|
@ -38,19 +38,17 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class QueryService {
|
||||
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(QueryService.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(QueryService.class);
|
||||
|
||||
public static ArrayList<Occurrences> queryOccurences(
|
||||
TabularDataService service,
|
||||
OccurrencesForReplaceBatchColumnSession occurrencesSession,
|
||||
Direction direction) throws TDGWTServiceException {
|
||||
public static ArrayList<Occurrences> queryOccurences(TabularDataService service,
|
||||
OccurrencesForReplaceBatchColumnSession occurrencesSession, Direction direction)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
try {
|
||||
|
||||
|
@ -61,7 +59,7 @@ public class QueryService {
|
|||
|
||||
TableId tableId;
|
||||
if (column.getTrId().isViewTable()) {
|
||||
tableId= new TableId(new Long(column.getTrId().getReferenceTargetTableId()));
|
||||
tableId = new TableId(new Long(column.getTrId().getReferenceTargetTableId()));
|
||||
} else {
|
||||
tableId = new TableId(new Long(column.getTrId().getTableId()));
|
||||
}
|
||||
|
@ -73,31 +71,22 @@ public class QueryService {
|
|||
if (conditionCode == null) {
|
||||
logger.debug("Replace Batch no validations");
|
||||
if (column.isViewColumn()) {
|
||||
//Use View for Occurrence
|
||||
// Use View for Occurrence
|
||||
tableId = new TableId(new Long(column.getTrId().getTableId()));
|
||||
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(column
|
||||
.getColumnViewData()
|
||||
.getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
sourceColumnId), new QueryColumn(columnId,
|
||||
Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId,
|
||||
sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(
|
||||
column.getColumnViewData().getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(new QueryColumn(columnId),
|
||||
new QueryColumn(sourceColumnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
} else {
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
querySelect = new QuerySelect(
|
||||
Arrays.asList(new QueryColumn(columnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
}
|
||||
} else {
|
||||
logger.debug("Replace Batch from validations");
|
||||
|
@ -106,32 +95,23 @@ public class QueryService {
|
|||
break;
|
||||
case AmbiguousValueOnExternalReference:
|
||||
if (column.isViewColumn()) {
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(column
|
||||
.getColumnViewData()
|
||||
.getSourceTableDimensionColumnId());
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(
|
||||
column.getColumnViewData().getSourceTableDimensionColumnId());
|
||||
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
sourceColumnId), new QueryColumn(
|
||||
columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId,
|
||||
sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
querySelect = new QuerySelect(Arrays.asList(new QueryColumn(columnId),
|
||||
new QueryColumn(sourceColumnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
} else {
|
||||
// ColumnLocalId idColumn =
|
||||
// retrieveColumnLocalIdOFIdColumnType(
|
||||
// column.getTrId(), service);
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
querySelect = new QuerySelect(
|
||||
Arrays.asList(new QueryColumn(columnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
}
|
||||
break;
|
||||
case CastValidation:
|
||||
|
@ -163,28 +143,19 @@ public class QueryService {
|
|||
case MissingValueOnExternalReference:
|
||||
default:
|
||||
if (column.isViewColumn()) {
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(column
|
||||
.getColumnViewData()
|
||||
.getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
sourceColumnId), new QueryColumn(
|
||||
columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId,
|
||||
sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(
|
||||
column.getColumnViewData().getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(new QueryColumn(columnId),
|
||||
new QueryColumn(sourceColumnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
} else {
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
querySelect = new QuerySelect(
|
||||
Arrays.asList(new QueryColumn(columnId), new QueryColumn(columnId, Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:" + querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
logger.debug("Occurences queryGroup:" + queryGroup.toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -193,12 +164,10 @@ public class QueryService {
|
|||
QueryOrder queryOrder = null;
|
||||
switch (direction) {
|
||||
case ASC:
|
||||
queryOrder = new QueryOrder(columnId,
|
||||
QueryOrderDirection.ASCENDING);
|
||||
queryOrder = new QueryOrder(columnId, QueryOrderDirection.ASCENDING);
|
||||
break;
|
||||
case DESC:
|
||||
queryOrder = new QueryOrder(columnId,
|
||||
QueryOrderDirection.DESCENDING);
|
||||
queryOrder = new QueryOrder(columnId, QueryOrderDirection.DESCENDING);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -209,12 +178,10 @@ public class QueryService {
|
|||
logger.debug("Occurences queryPage all");
|
||||
|
||||
QueryFilter queryFilter = null;
|
||||
if (occurrencesSession.getShowType().compareTo(
|
||||
ShowOccurrencesType.ONLYERRORS) == 0) {
|
||||
if (occurrencesSession.getShowType().compareTo(ShowOccurrencesType.ONLYERRORS) == 0) {
|
||||
logger.debug("Filter on error");
|
||||
if (occurrencesSession.isHasValidationColumns()) {
|
||||
Expression exp = ExpressionGenerator
|
||||
.genReplaceBatchOccurrencesFilter(occurrencesSession);
|
||||
Expression exp = ExpressionGenerator.genReplaceBatchOccurrencesFilter(occurrencesSession);
|
||||
logger.debug("Expression: " + exp);
|
||||
if (exp != null) {
|
||||
queryFilter = new QueryFilter(exp);
|
||||
|
@ -229,10 +196,8 @@ public class QueryService {
|
|||
logger.debug("No Filter on error");
|
||||
}
|
||||
|
||||
logger.debug("Query on " + tableId.toString() + " queryPage:"
|
||||
+ queryPage + ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect + ", queryGroup:"
|
||||
+ queryGroup + ", queryOrder:" + queryOrder);
|
||||
logger.debug("Query on " + tableId.toString() + " queryPage:" + queryPage + ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect + ", queryGroup:" + queryGroup + ", queryOrder:" + queryOrder);
|
||||
|
||||
if (querySelect != null) {
|
||||
logger.debug("Query Select Columns:" + querySelect.getColumns());
|
||||
|
@ -247,87 +212,58 @@ public class QueryService {
|
|||
if (queryOrder == null) {
|
||||
if (queryFilter == null) {
|
||||
if (queryGroup == null) {
|
||||
logger.debug("1-QueryAsJson-->tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
logger.debug("1-QueryAsJson-->tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", querySelect:" + querySelect);
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, querySelect);
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, querySelect);
|
||||
} else {
|
||||
logger.debug("2-QueryAsJson-->tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", querySelect:" + querySelect
|
||||
+ ", queryGroup:" + queryGroup);
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, querySelect, queryGroup);
|
||||
logger.debug("2-QueryAsJson-->tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", querySelect:" + querySelect + ", queryGroup:" + queryGroup);
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, querySelect, queryGroup);
|
||||
}
|
||||
} else {
|
||||
if (queryGroup == null) {
|
||||
logger.debug("3-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryFilter, querySelect);
|
||||
logger.debug("3-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter + ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter, querySelect);
|
||||
} else {
|
||||
logger.debug("4-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect
|
||||
+ ", queryGroup:" + queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryFilter, querySelect,
|
||||
queryGroup);
|
||||
logger.debug("4-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter + ", querySelect:" + querySelect + ", queryGroup:"
|
||||
+ queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter, querySelect, queryGroup);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (queryFilter == null) {
|
||||
if (queryGroup == null) {
|
||||
logger.debug("5-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryOrder:" + queryOrder
|
||||
+ ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryOrder, querySelect);
|
||||
logger.debug("5-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryOrder:" + queryOrder + ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryOrder, querySelect);
|
||||
} else {
|
||||
logger.debug("6-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryOrder:" + queryOrder
|
||||
+ ", querySelect:" + querySelect
|
||||
+ ", queryGroup:" + queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryOrder, querySelect,
|
||||
queryGroup);
|
||||
logger.debug("6-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryOrder:" + queryOrder + ", querySelect:" + querySelect + ", queryGroup:"
|
||||
+ queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryOrder, querySelect, queryGroup);
|
||||
}
|
||||
} else {
|
||||
if (queryGroup == null) {
|
||||
logger.debug("7-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter
|
||||
+ ", queryOrder:" + queryOrder
|
||||
+ ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryFilter, queryOrder,
|
||||
querySelect);
|
||||
logger.debug("7-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter + ", queryOrder:" + queryOrder + ", querySelect:"
|
||||
+ querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter, queryOrder, querySelect);
|
||||
|
||||
} else {
|
||||
logger.debug("8-QueryAsJson-->[tableId:" + tableId
|
||||
+ ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter
|
||||
+ ", queryOrder:" + queryOrder
|
||||
+ ", querySelect:" + querySelect
|
||||
+ ", queryGroup:" + queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId,
|
||||
queryPage, queryFilter, queryOrder,
|
||||
querySelect, queryGroup);
|
||||
logger.debug("8-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage
|
||||
+ ", queryFilter:" + queryFilter + ", queryOrder:" + queryOrder + ", querySelect:"
|
||||
+ querySelect + ", queryGroup:" + queryGroup + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter, queryOrder, querySelect,
|
||||
queryGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Error by running the query on the server:"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.debug("Error by running the query on the server:" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"An error occurred while running query on service", e);
|
||||
throw new TDGWTServiceException("An error occurred while running query on service", e);
|
||||
}
|
||||
|
||||
logger.debug("Created serviceJson");
|
||||
|
@ -349,14 +285,10 @@ public class QueryService {
|
|||
currentRow = rows.getJSONArray(i);
|
||||
if (conditionCode == null) {
|
||||
if (column.isViewColumn()) {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getString(1),
|
||||
occurence = new Occurrences(currentRow.getString(0), currentRow.getString(1),
|
||||
currentRow.getInt(2));
|
||||
} else {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getInt(1));
|
||||
occurence = new Occurrences(currentRow.getString(0), currentRow.getInt(1));
|
||||
}
|
||||
} else {
|
||||
switch (conditionCode) {
|
||||
|
@ -364,14 +296,10 @@ public class QueryService {
|
|||
break;
|
||||
case AmbiguousValueOnExternalReference:
|
||||
if (column.isViewColumn()) {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getString(1),
|
||||
occurence = new Occurrences(currentRow.getString(0), currentRow.getString(1),
|
||||
currentRow.getInt(2));
|
||||
} else {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0), "1",
|
||||
currentRow.getInt(1));
|
||||
occurence = new Occurrences(currentRow.getString(0), "1", currentRow.getInt(1));
|
||||
}
|
||||
break;
|
||||
case CastValidation:
|
||||
|
@ -404,14 +332,10 @@ public class QueryService {
|
|||
case MissingValueOnExternalReference:
|
||||
default:
|
||||
if (column.isViewColumn()) {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getString(1),
|
||||
occurence = new Occurrences(currentRow.getString(0), currentRow.getString(1),
|
||||
currentRow.getInt(2));
|
||||
} else {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getInt(1));
|
||||
occurence = new Occurrences(currentRow.getString(0), currentRow.getInt(1));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -424,19 +348,16 @@ public class QueryService {
|
|||
|
||||
} catch (JSONException e) {
|
||||
|
||||
logger.error("An error occurred while parsing json document\n"
|
||||
+ "At Row " + i + ",Column " + j + "\nRow Content: "
|
||||
+ currentRow + "\nLenght rows " + totalRows, e);
|
||||
logger.error("An error occurred while parsing json document\n" + "At Row " + i + ",Column " + j
|
||||
+ "\nRow Content: " + currentRow + "\nLenght rows " + totalRows, e);
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"An error occurred, while reading json of service", e);
|
||||
throw new TDGWTServiceException("An error occurred, while reading json of service", e);
|
||||
}
|
||||
logger.debug("Retieved occurences: size " + occurences.size());
|
||||
return occurences;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("QueryService - error on queryOccurences():"
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("QueryService - error on queryOccurences():" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
@ -445,20 +366,22 @@ public class QueryService {
|
|||
|
||||
/**
|
||||
* Retrieve ColumnLocalId value of IdColumnType
|
||||
*
|
||||
*
|
||||
* @param trId
|
||||
* TR id
|
||||
* @param service
|
||||
* @return
|
||||
* Tabular data service
|
||||
* @return Column local id
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public static ColumnLocalId retrieveColumnLocalIdOFIdColumnType(TRId trId,
|
||||
TabularDataService service) throws TDGWTServiceException {
|
||||
public static ColumnLocalId retrieveColumnLocalIdOFIdColumnType(TRId trId, TabularDataService service)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
ColumnLocalId columnLocalId = null;
|
||||
Table table;
|
||||
|
||||
table = service.getTable(new TableId(
|
||||
Long.valueOf(trId.getTableId())));
|
||||
table = service.getTable(new TableId(Long.valueOf(trId.getTableId())));
|
||||
|
||||
List<Column> cols = table.getColumns();
|
||||
for (Column c : cols) {
|
||||
|
@ -470,72 +393,58 @@ public class QueryService {
|
|||
return columnLocalId;
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||
} catch (NoSuchTableException e) {
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||
} catch (Throwable e) {
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("QueryService - retrieveColumnLocalIdOFIdColumn: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String retrieveColumnDimensionValue(String rowId,
|
||||
ColumnData column, TabularDataService service)
|
||||
public static String retrieveColumnDimensionValue(String rowId, ColumnData column, TabularDataService service)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
logger.debug("RetriveColumnDimensionValue: [rowId=" + rowId
|
||||
+ ", column=" + column + "]");
|
||||
logger.debug("RetriveColumnDimensionValue: [rowId=" + rowId + ", column=" + column + "]");
|
||||
|
||||
column.getColumnViewData().getSourceTableDimensionColumnId();
|
||||
|
||||
TableId tableId = new TableId(new Long(column.getTrId()
|
||||
.getTableId()));
|
||||
TableId tableId = new TableId(new Long(column.getTrId().getTableId()));
|
||||
ColumnLocalId columnId = new ColumnLocalId(column.getColumnId());
|
||||
QuerySelect querySelect = null;
|
||||
|
||||
if (!column.isViewColumn()) {
|
||||
logger.error("The column selected is not a view column:"
|
||||
+ column);
|
||||
throw new TDGWTServiceException(
|
||||
"The column selected is not a view column");
|
||||
logger.error("The column selected is not a view column:" + column);
|
||||
throw new TDGWTServiceException("The column selected is not a view column");
|
||||
}
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(column
|
||||
.getColumnViewData().getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(new QueryColumn(
|
||||
columnId), new QueryColumn(sourceColumnId)));
|
||||
ColumnLocalId sourceColumnId = new ColumnLocalId(
|
||||
column.getColumnViewData().getSourceTableDimensionColumnId());
|
||||
querySelect = new QuerySelect(Arrays.asList(new QueryColumn(columnId), new QueryColumn(sourceColumnId)));
|
||||
logger.debug("QuerySelect:" + querySelect.toString());
|
||||
|
||||
QueryPage queryPage = null;// All occurences
|
||||
logger.debug("Occurences queryPage all");
|
||||
|
||||
ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType(
|
||||
column.getTrId(), service);
|
||||
ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType(column.getTrId(), service);
|
||||
|
||||
ColumnReference cr = new ColumnReference(tableId, idColumn);
|
||||
Equals rowIdEqual = new Equals(cr, new TDInteger(
|
||||
Integer.parseInt(rowId)));
|
||||
Equals rowIdEqual = new Equals(cr, new TDInteger(Integer.parseInt(rowId)));
|
||||
|
||||
QueryFilter queryFilter = new QueryFilter(rowIdEqual);
|
||||
|
||||
logger.debug("Query on " + tableId.toString() + " queryPage:"
|
||||
+ queryPage + ", queryFilter:" + queryFilter
|
||||
logger.debug("Query on " + tableId.toString() + " queryPage:" + queryPage + ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect);
|
||||
|
||||
String serviceJson = null;
|
||||
logger.debug("3-QueryAsJson-->[tableId:" + tableId + ", queryPage:"
|
||||
+ queryPage + ", queryFilter:" + queryFilter
|
||||
+ ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter,
|
||||
querySelect);
|
||||
logger.debug("3-QueryAsJson-->[tableId:" + tableId + ", queryPage:" + queryPage + ", queryFilter:"
|
||||
+ queryFilter + ", querySelect:" + querySelect + "]");
|
||||
serviceJson = service.queryAsJson(tableId, queryPage, queryFilter, querySelect);
|
||||
|
||||
logger.debug("Created serviceJson");
|
||||
// logger.debug(serviceJson);
|
||||
|
@ -558,13 +467,11 @@ public class QueryService {
|
|||
}
|
||||
|
||||
if (dimensionValue == null) {
|
||||
logger.error("The column selected has not a dimension with valid value: "
|
||||
+ column + ", dimenensionValue: " + dimensionValue);
|
||||
throw new TDGWTServiceException(
|
||||
"The column selected has not a dimension with valid value");
|
||||
logger.error("The column selected has not a dimension with valid value: " + column
|
||||
+ ", dimenensionValue: " + dimensionValue);
|
||||
throw new TDGWTServiceException("The column selected has not a dimension with valid value");
|
||||
} else {
|
||||
logger.debug("Retrieved: [ColumnValue:" + colValue
|
||||
+ ", DimensionValue:" + dimensionValue + "]");
|
||||
logger.debug("Retrieved: [ColumnValue:" + colValue + ", DimensionValue:" + dimensionValue + "]");
|
||||
}
|
||||
|
||||
return dimensionValue;
|
||||
|
|
|
@ -17,8 +17,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TDTypeValueMap {
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.gcube.data.analysis.tabulardata.service.operation.Task;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TRTasksManager implements Serializable {
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TabularResourceTypeMap {
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TaskStateMap {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public class ValueMap {
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.WorkerState;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WorkerStateMap {
|
||||
|
|
|
@ -14,8 +14,8 @@ import org.slf4j.LoggerFactory;
|
|||
* Client for retrieve link
|
||||
*
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class UriResolverTDClient {
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.io.Serializable;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ServiceCredentials implements Serializable {
|
||||
|
|
|
@ -5,8 +5,8 @@ package org.gcube.portlets.user.td.gwtservice.shared;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
|
|
|
@ -12,8 +12,8 @@ import com.google.web.bindery.event.shared.EventBus;
|
|||
/**
|
||||
* Chart Session
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ChartSession implements Serializable {
|
||||
|
|
|
@ -10,32 +10,24 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ChartTopRatingSession implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 4988917715929182427L;
|
||||
|
||||
|
||||
private TRId trId;
|
||||
private ColumnData column;
|
||||
private Integer sampleSize;
|
||||
private String valueOperation;
|
||||
|
||||
|
||||
public ChartTopRatingSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
* @param column
|
||||
* @param sampleSize
|
||||
* @param valueOperation
|
||||
*/
|
||||
public ChartTopRatingSession(TRId trId, ColumnData column,
|
||||
Integer sampleSize, String valueOperation) {
|
||||
|
||||
public ChartTopRatingSession(TRId trId, ColumnData column, Integer sampleSize, String valueOperation) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
this.column = column;
|
||||
|
@ -77,16 +69,8 @@ public class ChartTopRatingSession implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChartTopRatingSession [trId=" + trId + ", column=" + column
|
||||
+ ", sampleSize=" + sampleSize + ", valueOperation="
|
||||
+ valueOperation + "]";
|
||||
return "ChartTopRatingSession [trId=" + trId + ", column=" + column + ", sampleSize=" + sampleSize
|
||||
+ ", valueOperation=" + valueOperation + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingSession implements Serializable {
|
||||
|
|
|
@ -7,7 +7,8 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public class AvailableCharsetList implements Serializable {
|
||||
|
@ -21,27 +22,16 @@ public class AvailableCharsetList implements Serializable {
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param charsetList
|
||||
* @param defaultCharset
|
||||
*/
|
||||
public AvailableCharsetList(ArrayList<String> charsetList,
|
||||
String defaultCharset) {
|
||||
public AvailableCharsetList(ArrayList<String> charsetList, String defaultCharset) {
|
||||
super();
|
||||
this.charsetList = charsetList;
|
||||
this.defaultCharset = defaultCharset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the charsetList
|
||||
*/
|
||||
public ArrayList<String> getCharsetList() {
|
||||
return charsetList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the defaultCharset
|
||||
*/
|
||||
public String getDefaultCharset() {
|
||||
return defaultCharset;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVExportSession implements Serializable {
|
||||
|
|
|
@ -32,8 +32,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVFileUtil {
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVImportSession implements Serializable {
|
||||
|
|
|
@ -5,8 +5,8 @@ package org.gcube.portlets.user.td.gwtservice.shared.csv;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum CSVImportState {
|
||||
|
|
|
@ -8,16 +8,14 @@ import java.nio.charset.Charset;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVParserConfiguration implements Serializable{
|
||||
|
||||
public class CSVParserConfiguration implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -26,17 +24,11 @@ public class CSVParserConfiguration implements Serializable{
|
|||
private char delimiter;
|
||||
private char comment;
|
||||
private HeaderPresence headerPresence;
|
||||
|
||||
|
||||
public CSVParserConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param charset
|
||||
* @param delimiter
|
||||
* @param comment
|
||||
* @param hasHeader
|
||||
*/
|
||||
|
||||
public CSVParserConfiguration(Charset charset, char delimiter, char comment, HeaderPresence headerPresence) {
|
||||
super();
|
||||
this.charset = charset;
|
||||
|
@ -52,37 +44,22 @@ public class CSVParserConfiguration implements Serializable{
|
|||
this.headerPresence = headerPresence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the charset
|
||||
*/
|
||||
public Charset getCharset() {
|
||||
return charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the delimiter
|
||||
*/
|
||||
public char getDelimiter() {
|
||||
return delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the comment
|
||||
*/
|
||||
public char getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the headerPresence
|
||||
*/
|
||||
public HeaderPresence getHeaderPresence() {
|
||||
return headerPresence;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
|
|
@ -5,31 +5,34 @@ package org.gcube.portlets.user.td.gwtservice.shared.csv;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Errors for row
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CSVRowError implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 4680781887858741657L;
|
||||
|
||||
|
||||
private static int seed;
|
||||
|
||||
|
||||
private int id;
|
||||
private int lineNumber;
|
||||
private String lineValue;
|
||||
private String errorDescription;
|
||||
|
||||
public CSVRowError(){}
|
||||
|
||||
|
||||
public CSVRowError() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lineNumber the row number.
|
||||
* @param lineValue the line value.
|
||||
* @param errorDescription the error description.
|
||||
* @param lineNumber
|
||||
* the row number.
|
||||
* @param lineValue
|
||||
* the line value.
|
||||
* @param errorDescription
|
||||
* the error description.
|
||||
*/
|
||||
public CSVRowError(int lineNumber, String lineValue, String errorDescription) {
|
||||
this.id = seed++;
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.ArrayList;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CheckCSVSession implements Serializable {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue