Francesco Mangiacrapa 3 years ago
commit
0caf09e0e2
  1. 37
      .classpath
  2. 53
      .project
  3. 13
      .settings/.jsdtscope
  4. 2
      .settings/com.google.appengine.eclipse.core.prefs
  5. 5
      .settings/com.google.gdt.eclipse.core.prefs
  6. 2
      .settings/com.google.gwt.eclipse.core.prefs
  7. 6
      .settings/org.eclipse.core.resources.prefs
  8. 8
      .settings/org.eclipse.jdt.core.prefs
  9. 3
      .settings/org.eclipse.jpt.core.prefs
  10. 3
      .settings/org.eclipse.jst.jsp.core.prefs
  11. 4
      .settings/org.eclipse.m2e.core.prefs
  12. 10
      .settings/org.eclipse.wst.common.component
  13. 7
      .settings/org.eclipse.wst.common.project.facet.core.prefs.xml
  14. 9
      .settings/org.eclipse.wst.common.project.facet.core.xml
  15. 1
      .settings/org.eclipse.wst.jsdt.ui.superType.container
  16. 1
      .settings/org.eclipse.wst.jsdt.ui.superType.name
  17. 2
      .settings/org.eclipse.wst.validation.prefs
  18. 1
      .tern-project
  19. 335
      pom.xml
  20. 23
      src/main/java/org/gcube/portlets/user/performfishanalytics/PerformFishAnalytics.gwt.xml
  21. 57
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/DataMinerAlgorithms.java
  22. 20
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalytics.java
  23. 46
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsConstant.java
  24. 97
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsService.java
  25. 80
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsServiceAsync.java
  26. 720
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java
  27. 491
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsViewController.java
  28. 152
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/dialog/DialogConfirm.java
  29. 81
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/dialog/DialogResult.java
  30. 164
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/dialog/PanelConfirmBuilder.java
  31. 38
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/AddedBatchIdEvent.java
  32. 21
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/AddedBatchIdEventHandler.java
  33. 96
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/CallAlgorithmEvent.java
  34. 22
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/CallAlgorithmEventHandler.java
  35. 68
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/LoadPopulationTypeEvent.java
  36. 21
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/LoadPopulationTypeEventHandler.java
  37. 63
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/PerformFishFieldFormChangedEvent.java
  38. 21
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/PerformFishFieldFormChangedEventHandler.java
  39. 84
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SelectedKPIEvent.java
  40. 20
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SelectedKPIEventHandler.java
  41. 55
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SelectedPopulationTypeEvent.java
  42. 22
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SelectedPopulationTypeEventHandler.java
  43. 57
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SubmitRequestEvent.java
  44. 21
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/event/SubmitRequestEventHandler.java
  45. 76
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/Icons.java
  46. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/download.png
  47. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/github.png
  48. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/javadoc.png
  49. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/loading.gif
  50. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/loading2.gif
  51. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/loading3.gif
  52. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/loading4.gif
  53. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/maven.png
  54. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/top.png
  55. BIN
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/resources/wiki.png
  56. 116
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/BaseDockLayoutPanel.java
  57. 100
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/BodyPanel.java
  58. 308
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/CopyOfCustomTreeModel.java
  59. 281
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/Copy_2_of_CustomTreeModel.java
  60. 225
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/CustomTreeModel.java
  61. 79
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/HeaderPanel.java
  62. 61
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/KPICell.java
  63. 65
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/LoaderIcon.java
  64. 68
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/totest/CellTreeExample.java
  65. 122
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/totest/LeafCell.java
  66. 111
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/totest/NewCustomTreeModel.java
  67. 60
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/totest/PopulationTypeCell.java
  68. 54
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/util/CorrelationValueToColourUtil.java
  69. 173
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/view/util/ExtendedCheckboxCell.java
  70. 1000
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.java
  71. 104
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.ui.xml
  72. 300
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BatchIDAndListKPIView.java
  73. 23
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BatchIDAndListKPIView.ui.xml
  74. 500
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.java
  75. 99
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.ui.xml
  76. 45
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PortletTitle.java
  77. 18
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PortletTitle.ui.xml
  78. 297
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/RecapSubmitPage.java
  79. 29
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/RecapSubmitPage.ui.xml
  80. 104
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ShowResult.java
  81. 11
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ShowResult.ui.xml
  82. 119
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SubmitRequestPanel.java
  83. 16
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SubmitRequestPanel.ui.xml
  84. 185
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/TabPanelView.java
  85. 15
      src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/TabPanelView.ui.xml
  86. 50
      src/main/java/org/gcube/portlets/user/performfishanalytics/portlet/PerformFishAnalyticsPortlet.java
  87. 931
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/PerformFishAnalyticsServiceImpl.java
  88. 154
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/ToAvoidIndirectSerialization.java
  89. 176
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/database/EntityManagerFactoryCreator.java
  90. 81
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/database/JavaPersistenceHandler.java
  91. 361
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/persistence/AbstractPersistence.java
  92. 78
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/persistence/GenericPersistence.java
  93. 51
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/persistence/GenericPersistenceDaoBuilder.java
  94. 46
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/persistence/PopulationEntityListener.java
  95. 202
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/ContextUtil.java
  96. 46
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/DataMinerUtil.java
  97. 58
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/DatabaseUtil.java
  98. 46
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/FileUtil.java
  99. 157
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/GcoreEndpointReader.java
  100. 64
      src/main/java/org/gcube/portlets/user/performfishanalytics/server/util/GsonUtil.java

37
.classpath

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.0.1-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/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

53
.project

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>performfish-analytics-portlet</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

13
.settings/.jsdtscope

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

2
.settings/com.google.appengine.eclipse.core.prefs

@ -0,0 +1,2 @@
eclipse.preferences.version=1
filesCopiedToWebInfLib=

5
.settings/com.google.gdt.eclipse.core.prefs

@ -0,0 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/performfish-analytics-portlet/target
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

2
.settings/com.google.gwt.eclipse.core.prefs

@ -0,0 +1,2 @@
eclipse.preferences.version=1
entryPointModules=

6
.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

8
.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

3
.settings/org.eclipse.jpt.core.prefs

@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.jpt.core.platform=eclipselink2_4
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true

3
.settings/org.eclipse.jst.jsp.core.prefs

@ -0,0 +1,3 @@
eclipse.preferences.version=1
validateFragments=false
validation.use-project-settings=true

4
.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

10
.settings/org.eclipse.wst.common.component

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="performfish-analytics-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="performfish-analytics-portlet"/>
<property name="java-output-path" value="/performfish-analytics-portlet/target/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes"/>
</wb-module>
</project-modules>

7
.settings/org.eclipse.wst.common.project.facet.core.prefs.xml

@ -0,0 +1,7 @@
<root>
<facet id="jpt.jpa">
<node name="libprov">
<attribute name="provider-id" value="jpa-no-op-library-provider"/>
</node>
</facet>
</root>

9
.settings/org.eclipse.wst.common.project.facet.core.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jpt.jpa" version="2.0"/>
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="java" version="1.7"/>
</faceted-project>

1
.settings/org.eclipse.wst.jsdt.ui.superType.container

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

1
.settings/org.eclipse.wst.jsdt.ui.superType.name

@ -0,0 +1 @@
Window

2
.settings/org.eclipse.wst.validation.prefs

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

1
.tern-project

@ -0,0 +1 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}

335
pom.xml

@ -0,0 +1,335 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>performfish-analytics-portlet</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Archetype for GWT</name>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.7.0</gwt.version>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<additionalparam>-Xdoclint:none</additionalparam>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<!-- USED BY ECLIPSELINK -->
<repository>
<id>eclipselink</id>
<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/eclipselink/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Google Web Toolkit (GWT) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- Eclipselink dependencies -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.common</groupId> -->
<!-- <artifactId>workspace-task-executor-library</artifactId> -->
<!-- <version>[0.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.17</version>
</dependency>
<!-- H2 Database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.8</version>
</dependency>
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>client-context-library</artifactId>
<version>[1.0.0-SNAPSHOT,)</version>
<scope>compile</scope>
</dependency>
<!-- PORTAL MANAGER -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<!-- User Management Core -->
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>PerformFishAnalytics.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

23
src/main/java/org/gcube/portlets/user/performfishanalytics/PerformFishAnalytics.gwt.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='PerformFishAnalytics'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalytics' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

57
src/main/java/org/gcube/portlets/user/performfishanalytics/client/DataMinerAlgorithms.java

@ -0,0 +1,57 @@
/**
*
*/
package org.gcube.portlets.user.performfishanalytics.client;
/**
* The Enum DataMinerAlgorithms.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 8, 2019
*/
public enum DataMinerAlgorithms {
DEA_CHART("DEA_CHART", "DEA_CHART"),
SCATTER("SCATTER", "SCATTER"),
SPEEDOMETER("SPEEDOMETER","SPEEDOMETER"),
BOXPLOT("BOXPLOT","BOXPLOT"),
DEA_ANALYSIS("DEA_ANALYSIS", "DEA_ANALYSIS"),
CORRELATION("CORRELATION", "CORRELATION");
String id;
String name;
/**
* Instantiates a new data miner algorithms.
*
* @param id the id
* @param name the name
*/
DataMinerAlgorithms(String id, String name){
this.id = id;
this.name = name;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
}

20
src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalytics.java

@ -0,0 +1,20 @@
package org.gcube.portlets.user.performfishanalytics.client;
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
import com.google.gwt.core.client.EntryPoint;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class PerformFishAnalytics implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
new PerformFishAnalyticsController();
}
}

46
src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsConstant.java

@ -0,0 +1,46 @@
/**
*
*/
package org.gcube.portlets.user.performfishanalytics.client;
/**
* The Class PerformFishAnalyticsConstant.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Jan 30, 2019
*/
public class PerformFishAnalyticsConstant {
public static final String FARMID_PARAM = "farmid";
public static final String BATCHTYPE_PARAM = "batchtype";
// PERFORM-FISH SERVICE KEYS
public static final String BATCHES_TABLE_INTERNAL = "BatchesTable_internal";
public static final String BATCHES_TABLE = "BatchesTable";
// PARAMETERS TO CALL DATAMINER
public static final String DATA_INPUTS = "DataInputs";
public static final String DM_SCALEP_PARAM = "scaleP";
public static final String DM_BATCHTYPE_PARAM = "batchtype";
public static final String DM_CHARTTYPE_PARAM = "charttype";
public static final String DM_FARMFILE_PARAM = "farmFile";
public static final String DM_FOCUS_PARAM = "focus";
public static final String DM_INPUT_KPI_PARAM = "inputKPI";
public static final String DM_OUTPUT_KPI_PARAM = "outputKPI";
public static final int CSV_BATCHES_TABLE_MINIMUM_SIZE = 4;
public static final String PERFORM_FISH_AREA_PARAM = "area";
public static final String PERFORM_FISH_QUARTER_PARAM = "quarter";
public static final String PERFORM_FISH_PERIOD_PARAM = "period";
public static final String PERFORM_FISH_FARMID_PARAM = "farmid";
public static final String PERFORM_FISH_BATCH_TYPE_PARAM = "batch_type";
public static final String PERFORM_FISH_SPECIES_ID_PARAM = "speciesid";
public static final String DM_FOCUS_ID_ALL_VALUE = "ALL";
public static enum POPULATION_LEVEL{BATCH, FARM};
}

97
src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsService.java

@ -0,0 +1,97 @@
package org.gcube.portlets.user.performfishanalytics.client;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
import org.gcube.portlets.user.performfishanalytics.shared.dataminer.DataMinerResponse;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("performfish")
public interface PerformFishAnalyticsService extends RemoteService {
/**
* @param populationName
* @return
* @throws Exception
*/
List<PopulationType> getListPopulationType(String populationName)
throws Exception;
/**
* @param populationTypeId
* @return
* @throws Exception
*/
PopulationType getPopulationTypeWithListKPI(String populationTypeId)
throws Exception;
/**
* @param initParams
* @return
* @throws Exception
*/
PerformFishInitParameter decryptAndValidParameters(
PerformFishInitParameter initParams)
throws Exception;
/**
* @param mapParameters
* @return
* @throws Exception
*/
PerformFishResponse submitRequestToPerformFishService(Map<String, List<String>> mapParameters) throws Exception;
DataMinerResponse callingDataMinerPerformFishCorrelationAnalysis(
PerformFishResponse result, Map<String, List<String>> mapParameters) throws Exception;
/**
* @param file
* @return
* @throws Exception
*/
String getImageFile(OutputFile file)
throws Exception;
/**
* @param file
* @return
* @throws Exception
*/
CSVFile readCSVFile(String URL)
throws Exception;
/**
* @param file
* @return
* @throws Exception
*/
CSVFile getCSVFile(OutputFile file, boolean deleteAfter)
throws Exception;
/**
* @param mapParameters
* @return
* @throws Exception
*/
DataMinerResponse callingDataMinerPerformFishAnalysis(
Map<String, List<String>> mapParameters)
throws Exception;
/**
* @param farmID
* @return
* @throws Exception
*/
boolean checkGrantToAccessFarmID(String farmID)
throws Exception;
}

80
src/main/java/org/gcube/portlets/user/performfishanalytics/client/PerformFishAnalyticsServiceAsync.java

@ -0,0 +1,80 @@
package org.gcube.portlets.user.performfishanalytics.client;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
import org.gcube.portlets.user.performfishanalytics.shared.dataminer.DataMinerResponse;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface PerformFishAnalyticsServiceAsync
{
/**
* Utility class to get the RPC Async interface from client-side code
*/
public static final class Util
{
private static PerformFishAnalyticsServiceAsync instance;
public static final PerformFishAnalyticsServiceAsync getInstance()
{
if ( instance == null )
{
instance = (PerformFishAnalyticsServiceAsync) GWT.create( PerformFishAnalyticsService.class );
}
return instance;
}
private Util()
{
// Utility class should not be instantiated
}
}
void getListPopulationType(
String populationName, AsyncCallback<List<PopulationType>> callback);
void getPopulationTypeWithListKPI(
String populationTypeId, AsyncCallback<PopulationType> callback);
void decryptAndValidParameters(
PerformFishInitParameter initParams,
AsyncCallback<PerformFishInitParameter> callback);
void submitRequestToPerformFishService(
Map<String, List<String>> mapParameters,
AsyncCallback<PerformFishResponse> callback);
void callingDataMinerPerformFishCorrelationAnalysis(
PerformFishResponse result, Map<String, List<String>> mapParameters,
AsyncCallback<DataMinerResponse> callback);
void getImageFile(OutputFile file, AsyncCallback<String> callback);
void readCSVFile(String URL, AsyncCallback<CSVFile> callback);
void getCSVFile(
OutputFile file, boolean deleteAfter, AsyncCallback<CSVFile> callback);
void callingDataMinerPerformFishAnalysis(
Map<String, List<String>> mapParameters,
AsyncCallback<DataMinerResponse> callback);
void checkGrantToAccessFarmID(String farmID, AsyncCallback<Boolean> callback);
}

720
src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java

@ -0,0 +1,720 @@
/**
*
*/
package org.gcube.portlets.user.performfishanalytics.client.controllers;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.performfishanalytics.client.DataMinerAlgorithms;
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant;
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant.POPULATION_LEVEL;
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsServiceAsync;
import org.gcube.portlets.user.performfishanalytics.client.event.AddedBatchIdEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.AddedBatchIdEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulationTypeEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulationTypeEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.AnalyticsPanelResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
import org.gcube.portlets.user.performfishanalytics.shared.dataminer.DataMinerResponse;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* The Class PerformFishAnalyticsController.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 16, 2019
*/
public class PerformFishAnalyticsController {
/**
*
*/
public final static HandlerManager eventBus = new HandlerManager(null);
private PerformFishAnalyticsViewController viewController;
private PerformFishInitParameter decryptParameters;
/**
* Instantiates a new perform fish analytics controller.
*/
public PerformFishAnalyticsController() {
registerHandlers();
viewController = new PerformFishAnalyticsViewController();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
final String batchtypeParam = Window.Location.getParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM);
final String farmidParam = Window.Location.getParameter(PerformFishAnalyticsConstant.FARMID_PARAM);
if(batchtypeParam==null || batchtypeParam.isEmpty()){
Window.alert("You must pass a valid '"+PerformFishAnalyticsConstant.BATCHTYPE_PARAM+"' param");
return;
}
if(farmidParam==null || farmidParam.isEmpty()){
Window.alert("You must pass a valid '"+PerformFishAnalyticsConstant.FARMID_PARAM+"' param");
return;
}
PerformFishInitParameter initParams = new PerformFishInitParameter();
initParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam);
initParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam);
PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(initParams, new AsyncCallback<PerformFishInitParameter>() {
@Override
public void onSuccess(PerformFishInitParameter result) {
decryptParameters = result;
eventBus.fireEvent(new LoadPopulationTypeEvent(POPULATION_LEVEL.BATCH.name(), null));
}
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
});
}
});
}
/**
* Register handlers.
*/
private void registerHandlers() {
eventBus.addHandler(LoadPopulationTypeEvent.TYPE, new LoadPopulationTypeEventHandler() {
@Override
public void onLoadPopulationType(
LoadPopulationTypeEvent loadPopulationEvent) {
viewController.loadPopulationTypeForLevelAndBatchType(loadPopulationEvent.getPopulationName(), decryptParameters);
}
});
eventBus.addHandler(CallAlgorithmEvent.TYPE, new CallAlgorithmEventHandler() {
@Override
public void onCall(CallAlgorithmEvent callAlgorithmEvent) {
callAlgorithm(callAlgorithmEvent.getAlgorithm(), callAlgorithmEvent.getFocusID(), callAlgorithmEvent.getInputKPI(), callAlgorithmEvent.getOutputKPI());
}
});
eventBus.addHandler(SelectedPopulationTypeEvent.TYPE, new SelectedPopulationTypeEventHandler() {
@Override
public void onSelectedPopulationType(
SelectedPopulationTypeEvent selectedPopulationTypeEvent) {
viewController.setRootPopulationTypeForKPIs(selectedPopulationTypeEvent.getSelectedPopulationType());
}
});
eventBus.addHandler(SelectedKPIEvent.TYPE, new SelectedKPIEventHandler() {
@Override
public void onSelectedKPI(SelectedKPIEvent selectedKPI) {
viewController.manageKPI(selectedKPI.getKpi(), selectedKPI.isChecked(), selectedKPI.getSelectedPopulationType());
int selectedKPIsSize = viewController.getSelectedKPIs().size();
viewController.manageAlgorithmsSubmit(selectedKPIsSize);
}
});
eventBus.addHandler(PerformFishFieldFormChangedEvent.TYPE, new PerformFishFieldFormChangedEventHandler() {
@Override
public void onFieldFormChanged(
PerformFishFieldFormChangedEvent performFishFieldFormChangedEvent) {
viewController.setReloadPerformFishServiceData(true);
boolean isValidForm = viewController.validatePerformFishInputFields();
if(isValidForm){
viewController.hideErrors();
final Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();
String farmId = decryptParameters.getParameters().get(PerformFishAnalyticsConstant.FARMID_PARAM);
String batchType = viewController.getForm().getBatchType();
String species = viewController.getForm().getSpecies();
List<String> listArea = viewController.getForm().getArea();
List<String> listPeriod = viewController.getForm().getPeriod();
List<String> listQuarter = viewController.getForm().getQuarter();
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM, Arrays.asList(farmId));
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM, Arrays.asList(batchType));
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_SPECIES_ID_PARAM, Arrays.asList(species));
if(!listArea.isEmpty()){
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_AREA_PARAM, listArea);
}
if(!listPeriod.isEmpty()){
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_PERIOD_PARAM, listPeriod);
}
if(!listQuarter.isEmpty()){
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_QUARTER_PARAM, listQuarter);
}
final Modal modal = new Modal(true);
modal.setCloseVisible(false);
modal.hide(false);
final VerticalPanel vp = new VerticalPanel();
LoaderIcon loader = new LoaderIcon("Submitting request to perform-fish service...");
vp.add(loader);
loader.show(true);
modal.add(vp);
PerformFishAnalyticsServiceAsync.Util.getInstance().submitRequestToPerformFishService(mapParameters, new AsyncCallback<PerformFishResponse>() {
@Override
public void onFailure(Throwable caught) {
modal.hide();
Window.alert(caught.getMessage());
// Map<String, String> map = new HashMap<String, String>();
// map.put(PerformFishAnalyticsConstant.BATCHES_TABLE, "https://data.d4science.org/shub/d26ce359-ec85-44a5-84f6-50cc9ce05f03");
// map.put(PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL, "https://data1-d.d4science.org/shub/E_WERuV1JhandFcWdUN0tUK2xtRVB3Tm9XT3AyLzlaWUVsVW9ZM2diRVU0V2wxWDNYUFlYVVhhQlU4K0FvV3h1Tg==");
// callDataMinerServiceForChartTypeCorrelation(new PerformFishResponse(map, null));
}
@Override
public void onSuccess(PerformFishResponse performFishResponse) {
modal.hide();
viewController.managePerformFishServiceResponse(performFishResponse, mapParameters, POPULATION_LEVEL.BATCH);
// Window.alert("FAKE ON-SUCCESS");
// Map<String, String> map = new HashMap<String, String>();
// map.put(PerformFishAnalyticsConstant.BATCHES_TABLE, "https://data.d4science.org/shub/d26ce359-ec85-44a5-84f6-50cc9ce05f03");
// map.put(PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL, "https://data1-d.d4science.org/shub/E_WERuV1JhandFcWdUN0tUK2xtRVB3Tm9XT3AyLzlaWUVsVW9ZM2diRVU0V2wxWDNYUFlYVVhhQlU4K0FvV3h1Tg==");
// callDataMinerServiceForChartTypeCorrelation(new PerformFishResponse(map, null));
}
});
modal.show();
}else{
//IF IT IS NOT A VALID FORM WE NEED TO DISABLE DATAMINER REQUESTS
viewController.enableAllAlgorithmsSubmits(false);
}
}
});
eventBus.addHandler(AddedBatchIdEvent.TYPE, new AddedBatchIdEventHandler() {
@Override
public void onAddedBatchId(AddedBatchIdEvent checkValidBatchIdEvent) {
viewController.validateBatchIdSelection();
//viewController.resyncSelectedKPIs();
}
});
eventBus.addHandler(SubmitRequestEvent.TYPE, new SubmitRequestEventHandler() {
@Override
public void onSubmitRequest(SubmitRequestEvent submitRequestEvent) {
boolean isValidBatchId = viewController.validateBatchIdSelection();
boolean isValidKPI = viewController.validateKPIFields();
List<KPI> selectedKPI = viewController.getSelectedKPIs();
viewController.manageAlgorithmsSubmit(selectedKPI.size());
if(isValidBatchId && isValidKPI){
switch (submitRequestEvent.getChartType()) {
case BOXPLOT:
//UNARY
callAlgorithm(submitRequestEvent.getChartType(), viewController.getSelectedBatchID().get(0), selectedKPI, null);
break;
case SCATTER:
if(selectedKPI.size()==2)
callAlgorithm(submitRequestEvent.getChartType(), viewController.getSelectedBatchID().get(0), selectedKPI, null);
else
Window.alert("Something seems wrong... You must select exactly two KPIs to execute the "+submitRequestEvent.getChartType());
break;
case CORRELATION:
callDataMinerServiceForChartTypeCorrelation(viewController.getPerformFishResponse(), viewController.getRequestMapParameters());
break;
case SPEEDOMETER:
//UNARY
callAlgorithm(submitRequestEvent.getChartType(), viewController.getSelectedBatchID().get(0), selectedKPI, selectedKPI);
break;
default:
break;
}
}
return;
}
});
}
/**
* Call data miner service for chart type correlation.
*
* @param performFishResponse the perform fish response
* @param performFishRequestParameters the perform fish request parameters
*/
private void callDataMinerServiceForChartTypeCorrelation(final PerformFishResponse performFishResponse, final Map<String, List<String>> performFishRequestParameters) {
GWT.log("Read perform fish response: "+performFishResponse);
String batchTableURL = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
if(batchTableURL==null || batchTableURL.isEmpty())
Window.alert("Something seems wrong. No batches tables matching with parameter "+PerformFishAnalyticsConstant.BATCHES_TABLE+" returned from service");
final Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();
StringBuilder dataInputsFormatter = new StringBuilder();
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_SCALEP_PARAM+"=BATCH;");
String theBatchType = viewController.getForm().getBatchType();
theBatchType = theBatchType.replace("_CLOSED_BATCHES", ""); //REMOVING SUFFIX _CLOSED_BATCHES FOR DATAMINER CALL
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_BATCHTYPE_PARAM+"="+theBatchType+";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_CHARTTYPE_PARAM+"="+ DataMinerAlgorithms.CORRELATION+";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_FARMFILE_PARAM+"="+batchTableURL+";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_FOCUS_PARAM+"=ID;");
String kpiCodes = "";
for (KPI kpi : viewController.getSelectedKPIs()) {
kpiCodes+=kpi.getCode()+"|";
}
//remove last |
kpiCodes = kpiCodes.substring(0, kpiCodes.length()-1);
dataInputsFormatter.append("inputKPI="+kpiCodes+";");
//dataInputsFormatter.append("outputKPI=;");
String dataInParameters = dataInputsFormatter.toString();
GWT.log("Calling DM service with client input parameters: "+dataInParameters);
mapParameters.put(PerformFishAnalyticsConstant.DATA_INPUTS, Arrays.asList(dataInParameters));
// final Modal modal = new Modal(true);
// modal.setCloseVisible(false);
// modal.hide(false);
final SubmitRequestPanel submitRequestPanel = new SubmitRequestPanel("");
submitRequestPanel.showLoader(true, "Submitting "+DataMinerAlgorithms.CORRELATION.getName()+" request to DM Service...");
String tabTitle = DataMinerAlgorithms.CORRELATION.getName().substring(0,1).toUpperCase()+DataMinerAlgorithms.CORRELATION.getName().toLowerCase().substring(1, DataMinerAlgorithms.CORRELATION.getName().length()); //CAMEL CASE
final Tab tab = viewController.createTab(submitRequestPanel, tabTitle+" #"+(viewController.currentNumberOfTab()+1));
PerformFishAnalyticsServiceAsync.Util.getInstance().callingDataMinerPerformFishCorrelationAnalysis(performFishResponse, mapParameters, new AsyncCallback<DataMinerResponse>() {
@Override
public void onSuccess(DataMinerResponse dmResponse) {
submitRequestPanel.showLoader(false, null);
viewController.noSpinner(tab);
final AnalyticsPanelResult analyticsPanelResult = new AnalyticsPanelResult();
analyticsPanelResult.addSelectedAreas(performFishRequestParameters.get(PerformFishAnalyticsConstant.PERFORM_FISH_AREA_PARAM));
analyticsPanelResult.addSelectedKPIs(viewController.getSelectedKPIs());
analyticsPanelResult.addListBatchIds(viewController.getListBatchesID());
analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, viewController.getForm().getBatchType());
analyticsPanelResult.addResults(dmResponse);
submitRequestPanel.addWidget(analyticsPanelResult);
//viewController.geTabPanelView().addResult(resultPanel, "Analysis #"+(viewController.geTabPanelView().countTab()+1));
//modal.hide();
}
@Override
public void onFailure(Throwable caught) {
GWT.log(caught.toString());
submitRequestPanel.showLoader(false, null);
viewController.noSpinner(tab);
Alert error = new Alert(caught.getMessage());
error.setClose(false);
error.setType(AlertType.ERROR);
submitRequestPanel.addWidget(error);
Button butt = new Button("OK");
butt.setType(ButtonType.INFO);
//butt.getElement().getStyle().setProperty("text-align", "center");
butt.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//modal.hide();
}
});
submitRequestPanel.addWidget(butt);
}
});
//modal.show();
}
/**
* Creating new TAB and calling DM algorithm.
*
* @param algorithm the algorithm
* @param focusID the focus id
* @param inputKPI the input kpi
* @param outputKPI the output kpi
*/
private void callAlgorithm(DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI){
List<String> listBatchID = viewController.getSelectedBatchID();
if(listBatchID==null || listBatchID.size()==0)
Window.alert("Something seems wrong, no selected BatchID, try again");
SubmitRequestPanel submitRequestPanel = new SubmitRequestPanel("");
//submitRequestPanel.getElement().addClassName("ext-horizontal-panel");
String tabTitle = algorithm.getName().substring(0,1).toUpperCase()+algorithm.getName().toLowerCase().substring(1, algorithm.getName().length()); //CAMEL CASE
Tab tab = viewController.createTab(submitRequestPanel, tabTitle+" #"+(viewController.currentNumberOfTab()+1));
switch (algorithm) {
case BOXPLOT:
case SPEEDOMETER:
//submitRequestPanel.setTheTitle(title);
for (KPI kpi : inputKPI) {
String title = "KPI: "+kpi.getName();
HTML toBigTitle = new HTML(title);
toBigTitle.getElement().addClassName("to-big-title");
submitRequestPanel.addWidget(toBigTitle);
HorizontalPanel hp = new HorizontalPanel();
hp.getElement().addClassName("ext-horizontal-panel");
callDataMinerServiceForChart(viewController.getPerformFishResponse(), POPULATION_LEVEL.BATCH, Arrays.asList(kpi), Arrays.asList(kpi), algorithm, focusID, hp, tab);
//resultPanel.add(hp);
submitRequestPanel.addWidget(hp);
}
break;
case SCATTER:
if(inputKPI.get(0)==null || inputKPI.get(1)==null){
submitRequestPanel.setTheTitle("Something seems wrong, one or more of the selected KPIs are not valid. Please try again");
return;
// Window.alert("Something seems wrong, no selected BatchID, try again");
}
String titleScatter = "KPI: "+inputKPI.get(0).getName() +" vs "+inputKPI.get(1).getName();
submitRequestPanel.setTheTitle(titleScatter);
default:
callDataMinerServiceForChart(viewController.getPerformFishResponse(), POPULATION_LEVEL.BATCH, inputKPI, outputKPI, algorithm, focusID, submitRequestPanel.getContainerPanel(), tab);
}
}
/**
* Call data miner service for chart.
*
* @param performFishResponse the perform fish response
* @param scalePValue the scale p value
* @param inputKPI the input kpi
* @param outputKPI the output kpi
* @param chartType the chart type
* @param focusID the focus id
* @param panelContainer the panel
* @param tab
*/
private void callDataMinerServiceForChart(PerformFishResponse performFishResponse, POPULATION_LEVEL scalePValue, final List<KPI> inputKPI, final List<KPI> outputKPI, final DataMinerAlgorithms chartType, final String focusID, final ComplexPanel panelContainer, final Tab tab) {
GWT.log("Read perform fish response: "+performFishResponse);
String batchTableURL = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
if(batchTableURL==null || batchTableURL.isEmpty())
Window.alert("Something seems wrong. No batches tables matching with parameter "+PerformFishAnalyticsConstant.BATCHES_TABLE+" returned from service");
StringBuilder dataInputsFormatter = new StringBuilder();
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_SCALEP_PARAM+"="+scalePValue.name()+";");
String theBatchType = viewController.getForm().getBatchType();
theBatchType = theBatchType.replace("_CLOSED_BATCHES", ""); //REMOVING SUFFIX _CLOSED_BATCHES FOR DATAMINER CALL
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_BATCHTYPE_PARAM+"="+theBatchType+";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_CHARTTYPE_PARAM+"="+ chartType +";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_FARMFILE_PARAM+"="+batchTableURL+";");
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_FOCUS_PARAM+"="+focusID+";");
//dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_FOCUS_PARAM+"=ID;");
if(inputKPI!=null && inputKPI.size()>0){
String kpiCodes = "";
for (KPI kpi : inputKPI) {
kpiCodes+=kpi.getCode()+"|";
}
//remove last |
kpiCodes = kpiCodes.substring(0, kpiCodes.length()-1);
GWT.log("Input KPICodes: "+kpiCodes);
//ADDING KPIs code
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_INPUT_KPI_PARAM+"="+kpiCodes+";");
}
if(outputKPI!=null && outputKPI.size()>0){
String kpiCodes = "";
for (KPI kpi : outputKPI) {
kpiCodes+=kpi.getCode()+"|";
}
//remove last |
kpiCodes = kpiCodes.substring(0, kpiCodes.length()-1);
GWT.log("Output KPICodes: "+kpiCodes);
//ADDING KPIs code
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_OUTPUT_KPI_PARAM+"="+kpiCodes+";");
}
String dataInParameters = dataInputsFormatter.toString();
GWT.log("Calling DM service with client input parameters: "+dataInParameters);
Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();
mapParameters.put(PerformFishAnalyticsConstant.DATA_INPUTS, Arrays.asList(dataInParameters));
final LoaderIcon loaderIcon = new LoaderIcon("Submitting request to "+chartType+" Analysis...");
loaderIcon.setVisible(true);
panelContainer.setVisible(true);
panelContainer.add(loaderIcon);
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
loaderIcon.setFocus(true);
}});
PerformFishAnalyticsServiceAsync.Util.getInstance().callingDataMinerPerformFishAnalysis(mapParameters, new AsyncCallback<DataMinerResponse>() {
@Override
public void onSuccess(DataMinerResponse dmResponse) {
viewController.noSpinner(tab);
loaderIcon.setVisible(false);
//field_unary_algorithm.setVisible(true);
GWT.log("I'm displaying: "+dmResponse);
displayOutputFilesAsStaticEntities(dmResponse, chartType, inputKPI, outputKPI, focusID, panelContainer, false);
}
@Override
public void onFailure(Throwable caught) {
viewController.noSpinner(tab);
loaderIcon.setVisible(false);
displayOutputFilesAsStaticEntities(null, chartType, inputKPI, outputKPI, focusID, panelContainer, true);
}
});
}
/**
* Display output files as static entities.
*
* @param dmResponse the dm response
* @param chartType the chart type
* @param inputKPIs the input kp is
* @param outputKPIs the output kp is
* @param focusID the focus id
* @param container the container
* @param displayError the display error
*/
private void displayOutputFilesAsStaticEntities(DataMinerResponse dmResponse, final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID, final Panel container, boolean displayError){
String title = displayError?"No results ":"";
/*title+=chartType;
title+=inputKPIs.size()>1?" [Input KPIs: ":" [Input KPI: ";
for (KPI kpi : inputKPIs) {
title+=" "+kpi.getName()+",";
}
title = title.substring(0,title.length()-1)+"]";
if(outputKPIs!=null && outputKPIs.size()>0){
title+=inputKPIs.size()>1?" [Output KPIs: ":" [Output KPI: ";
for (KPI kpi : outputKPIs) {
title+=" "+kpi.getName()+",";
}
title = title.substring(0,title.length()-1)+"]";
}*/
//title+= " Focus "+focusID;
if(displayError){
Alert alert = new Alert(title);
alert.setType(AlertType.ERROR);
alert.setClose(false);
alert.getElement().getStyle().setMargin(10, Unit.PX);
container.add(alert);
return;
}
final String toTitle = title;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
switch (outputFile.getDataType()) {
case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
//showAlert(caught.getMessage(), AlertType.ERROR, true, uib_vp_deanalanlysis_request_container);
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(String base64Content) {
//String title = toTitle;
// switch (chartType) {
// case BOXPLOT:
// break;
// case SPEEDOMETER:
// title+= " BATCH ID: "+focusID;
// break;
// default:
// break;
// }
String title = toTitle;
switch (chartType) {
case BOXPLOT:
title = chartType.getName()+" - on all batches<br>";
title += "Blue dots indicate the selected batch(es): "+focusID;
break;
case CORRELATION:
break;
case DEA_ANALYSIS:
break;
case SCATTER:
break;
case SPEEDOMETER:
title = "Speedometer<br>";
title+= "Selected BATCH ID: "+focusID+"<br>";
title+= "Normalized with respect to all batches in the VRE";
break;
case DEA_CHART:
break;
}
ShowResult showResult = new ShowResult(title);
showResult.showImage(base64Content);
container.add(showResult);
}
});
break;
case CSV:
PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true, new AsyncCallback<CSVFile>() {
@Override
public void onFailure(Throwable caught) {
//showAlert(caught.getMessage(), AlertType.ERROR, true, uib_vp_deanalanlysis_request_container);
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(CSVFile result) {
GWT.log("Displaying: "+result);
// String title = toTitle;
// switch (chartType) {
// case BOXPLOT:
// title+= " Statistics on all data";
// break;
// case SPEEDOMETER:
// title+= " BATCH ID: "+focusID;
// break;
// default:
// break;
// }
String title = toTitle;
switch (chartType) {
case BOXPLOT:
if(result.getFileName().contains("_user")){
title = "My Batch(es)";
}else{
title = "All batches in the VRE (including mine)";
}
break;
case CORRELATION:
break;
case DEA_ANALYSIS:
break;
case SCATTER:
break;
case SPEEDOMETER:
break;
case DEA_CHART:
break