ref 17252: Enable DEA Analysis

https://support.d4science.org/issues/17252

Updated DEA Analysis

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@182241 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-11-11 14:42:11 +00:00
parent 5ba3a81d18
commit afc4ed08ed
7 changed files with 85 additions and 83 deletions

View File

@ -418,7 +418,6 @@ public class DeaAnnualPanelResult extends Composite {
return dataInputParameters; return dataInputParameters;
} }
/** /**
* Show alert. * Show alert.
* *
@ -528,9 +527,9 @@ public class DeaAnnualPanelResult extends Composite {
// flexTable.setWidget(1, 0, new HTML("Level:")); // flexTable.setWidget(1, 0, new HTML("Level:"));
// flexTable.setWidget(1, 1, new // flexTable.setWidget(1, 1, new
// HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_SCALEP_PARAM))); // HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_SCALEP_PARAM)));
//flexTable.setWidget(1, 0, new HTML("Focus ID:")); // flexTable.setWidget(1, 0, new HTML("Focus ID:"));
//flexTable.setWidget(1, 1, new HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_FOCUS_PARAM))); // flexTable.setWidget(1, 1, new
// HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_FOCUS_PARAM)));
String KPINames = ""; String KPINames = "";
for (KPI kpi : selectedKPIs) { for (KPI kpi : selectedKPIs) {
@ -540,7 +539,6 @@ public class DeaAnnualPanelResult extends Composite {
flexTable.setWidget(1, 0, new HTML("KPI:")); flexTable.setWidget(1, 0, new HTML("KPI:"));
flexTable.setWidget(1, 1, new HTML(KPINames)); flexTable.setWidget(1, 1, new HTML(KPINames));
fillDeaListBoxes(); fillDeaListBoxes();
} catch (Exception e) { } catch (Exception e) {
@ -608,7 +606,6 @@ public class DeaAnnualPanelResult extends Composite {
hp.add(deaAnalysis); hp.add(deaAnalysis);
uib_vp_deanalanlysis_algorithm_container.add(hp); uib_vp_deanalanlysis_algorithm_container.add(hp);
final FlexTable flexTable = new FlexTable(); final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("colgrouptable"); flexTable.setStyleName("colgrouptable");
@ -708,6 +705,9 @@ public class DeaAnnualPanelResult extends Composite {
return; return;
} }
final FlexTable resultsPanel = new FlexTable();
container.add(resultsPanel);
final String toTitle = title; final String toTitle = title;
for (final OutputFile outputFile : dmResponse.getListOutput()) { for (final OutputFile outputFile : dmResponse.getListOutput()) {
@ -728,36 +728,9 @@ public class DeaAnnualPanelResult extends Composite {
public void onSuccess(String base64Content) { public void onSuccess(String base64Content) {
String title = toTitle; String title = toTitle;
switch (chartType) {
case BOXPLOT:
break;
case SPEEDOMETER:
title += " Focus ID: " + focusID;
break;
case CORRELATION:
break;
case DEA_ANALYSIS:
break;
case DEA_CHART:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH_HATCHERY:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH_PREGROW:
break;
case PERFORMFISH_SYNOPTIC_TABLE_FARM:
break;
case SCATTER:
break;
default:
break;
}
ShowResult showResult = new ShowResult(title, TextAlign.LEFT); ShowResult showResult = new ShowResult(title, TextAlign.LEFT);
showResult.showImage(base64Content); showResult.showImage(base64Content);
container.add(showResult); showOrderedResults(resultsPanel, outputFile.getName(), showResult);
} }
}); });
@ -777,37 +750,10 @@ public class DeaAnnualPanelResult extends Composite {
GWT.log("Displaying: " + result); GWT.log("Displaying: " + result);
String cssTableStyle = "simpletable"; String cssTableStyle = "simpletable";
String title = toTitle; String title = toTitle;
switch (chartType) {
case BOXPLOT:
title += " Statistics on all data";
break;
case SPEEDOMETER:
title += " Focus ID: " + focusID;
break;
case CORRELATION:
break;
case DEA_ANALYSIS:
break;
case DEA_CHART:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH_HATCHERY:
break;
case PERFORMFISH_SYNOPTICTABLE_BATCH_PREGROW:
break;
case PERFORMFISH_SYNOPTIC_TABLE_FARM:
break;
case SCATTER:
break;
default:
break;
}
ShowResult showResult = new ShowResult(title, TextAlign.LEFT); ShowResult showResult = new ShowResult(title, TextAlign.LEFT);
showResult.showCSVFile(result, cssTableStyle); showResult.showCSVFile(result, cssTableStyle);
container.add(showResult); showOrderedResults(resultsPanel, outputFile.getName(), showResult);
} }
}); });
break; break;
@ -820,6 +766,32 @@ public class DeaAnnualPanelResult extends Composite {
} }
private void showOrderedResults(FlexTable flexTable, String outputName, ShowResult showResult) {
if (outputName == null || outputName.isEmpty()) {
flexTable.setWidget(5, 0, showResult);
} else {
if (outputName.contains("dea")) {
flexTable.setWidget(0, 0, showResult);
} else {
if (outputName.contains("efficiency_aggregated")) {
flexTable.setWidget(1, 0, showResult);
} else {
if (outputName.contains("efficiency_legend")) {
flexTable.setWidget(2, 0, showResult);
} else {
if (outputName.contains("efficiency_per_id")) {
flexTable.setWidget(3, 0, showResult);
} else {
flexTable.setWidget(4, 0, showResult);
}
}
}
}
}
}
/** /**
* Call data miner service for chart. * Call data miner service for chart.
* *

View File

@ -528,8 +528,9 @@ public class DeaPanelResult extends Composite {
flexTable.setWidget(0, 1, new HTML(toShowBatchTypeValue)); flexTable.setWidget(0, 1, new HTML(toShowBatchTypeValue));
flexTable.setWidget(1, 0, new HTML("Level:")); flexTable.setWidget(1, 0, new HTML("Level:"));
flexTable.setWidget(1, 1, new HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_SCALEP_PARAM))); flexTable.setWidget(1, 1, new HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_SCALEP_PARAM)));
//flexTable.setWidget(2, 0, new HTML("Batch ID:")); // flexTable.setWidget(2, 0, new HTML("Batch ID:"));
//flexTable.setWidget(2, 1, new HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_FOCUS_PARAM))); // flexTable.setWidget(2, 1, new
// HTML(dataInputParameters.get(PerformFishAnalyticsConstant.DM_FOCUS_PARAM)));
String KPINames = ""; String KPINames = "";
for (KPI kpi : selectedKPIs) { for (KPI kpi : selectedKPIs) {
@ -704,10 +705,12 @@ public class DeaPanelResult extends Composite {
return; return;
} }
final FlexTable resultsPanel = new FlexTable();
container.add(resultsPanel);
final String toTitle = title; final String toTitle = title;
for (final OutputFile outputFile : dmResponse.getListOutput()) { for (final OutputFile outputFile : dmResponse.getListOutput()) {
switch (outputFile.getDataType()) { switch (outputFile.getDataType()) {
case IMAGE: case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile, PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
@ -726,7 +729,7 @@ public class DeaPanelResult extends Composite {
String title = toTitle; String title = toTitle;
ShowResult showResult = new ShowResult(title, TextAlign.LEFT); ShowResult showResult = new ShowResult(title, TextAlign.LEFT);
showResult.showImage(base64Content); showResult.showImage(base64Content);
container.add(showResult); showOrderedResults(resultsPanel, outputFile.getName(), showResult);
} }
}); });
@ -749,7 +752,7 @@ public class DeaPanelResult extends Composite {
ShowResult showResult = new ShowResult(title, TextAlign.LEFT); ShowResult showResult = new ShowResult(title, TextAlign.LEFT);
showResult.showCSVFile(result, cssTableStyle); showResult.showCSVFile(result, cssTableStyle);
container.add(showResult); showOrderedResults(resultsPanel, outputFile.getName(), showResult);
} }
}); });
break; break;
@ -762,6 +765,32 @@ public class DeaPanelResult extends Composite {
} }
private void showOrderedResults(FlexTable flexTable, String outputName, ShowResult showResult) {
if (outputName == null || outputName.isEmpty()) {
flexTable.setWidget(5, 0, showResult);
} else {
if (outputName.contains("dea")) {
flexTable.setWidget(0, 0, showResult);
} else {
if (outputName.contains("efficiency_aggregated")) {
flexTable.setWidget(1, 0, showResult);
} else {
if (outputName.contains("efficiency_legend")) {
flexTable.setWidget(2, 0, showResult);
} else {
if (outputName.contains("efficiency_per_id")) {
flexTable.setWidget(3, 0, showResult);
} else {
flexTable.setWidget(4, 0, showResult);
}
}
}
}
}
}
/** /**
* Call data miner service for chart. * Call data miner service for chart.
* *

View File

@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -372,7 +373,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
if(response==null) if(response==null)
throw new Exception("The response is null"); throw new Exception("The response is null");
Map<String, String> theResponseParams = GsonUtil.toMap(response); LinkedHashMap<String, String> theResponseParams = GsonUtil.toMap(response);
log.debug("The response was converted into map: "+theResponseParams); log.debug("The response was converted into map: "+theResponseParams);
UUID respSessionID = UUID.randomUUID(); UUID respSessionID = UUID.randomUUID();

View File

@ -4,8 +4,7 @@
package org.gcube.portlets.user.performfishanalytics.server.util; package org.gcube.portlets.user.performfishanalytics.server.util;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.Map;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -31,14 +30,14 @@ public class GsonUtil {
* @param json the json * @param json the json
* @return the map * @return the map
*/ */
public static Map<String, String> toMap(String json){ public static LinkedHashMap<String, String> toMap(String json){
log.debug("Converting JSON: "+json); log.debug("Converting JSON: "+json);
Gson gson = new Gson(); Gson gson = new Gson();
Type type = new TypeToken<Map<String, String>>(){}.getType(); Type type = new TypeToken<LinkedHashMap<String, String>>(){}.getType();
Map<String, String> myMap = gson.fromJson(json, type); LinkedHashMap<String, String> myMap = gson.fromJson(json, type);
log.debug("Converted as map: "+myMap); log.debug("Converted as map: "+myMap);
//FOR GWT SERIALIZATION //FOR GWT SERIALIZATION
Map<String,String> theGWTMap = new HashMap<String, String>(myMap.size()); LinkedHashMap<String,String> theGWTMap = new LinkedHashMap<String, String>(myMap.size());
theGWTMap.putAll(myMap); theGWTMap.putAll(myMap);
return theGWTMap; return theGWTMap;
} }

View File

@ -3,6 +3,7 @@
*/ */
package org.gcube.portlets.user.performfishanalytics.server.util.dataminer; package org.gcube.portlets.user.performfishanalytics.server.util.dataminer;
import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -17,7 +18,7 @@ public class DataMinerOutputData {
private String fileDescription; private String fileDescription;
private String mimeType; private String mimeType;
private String publicURL; private String publicURL;
private Map<String, String> dataMinerOutputData; private LinkedHashMap<String, String> dataMinerOutputData;
/** /**
* Instantiates a new data miner output data. * Instantiates a new data miner output data.
@ -37,7 +38,7 @@ public class DataMinerOutputData {
*/ */
public DataMinerOutputData( public DataMinerOutputData(
String fileDescription, String mimeType, String publicURL, String fileDescription, String mimeType, String publicURL,
Map<String, String> dataMinerOutputData) { LinkedHashMap<String, String> dataMinerOutputData) {
super(); super();
this.fileDescription = fileDescription; this.fileDescription = fileDescription;
@ -131,7 +132,7 @@ public class DataMinerOutputData {
* *
* @param dataMinerOutputData the dataMinerOutputData to set * @param dataMinerOutputData the dataMinerOutputData to set
*/ */
public void setDataMinerOutputData(Map<String, String> dataMinerOutputData) { public void setDataMinerOutputData(LinkedHashMap<String, String> dataMinerOutputData) {
this.dataMinerOutputData = dataMinerOutputData; this.dataMinerOutputData = dataMinerOutputData;
} }

View File

@ -6,9 +6,8 @@ package org.gcube.portlets.user.performfishanalytics.server.util.xml;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
@ -127,7 +126,7 @@ public class WPSParserUtil {
Element mdMetadata = (Element) nodes.item(i); Element mdMetadata = (Element) nodes.item(i);
DataMinerOutputData dmOutput = new DataMinerOutputData(); DataMinerOutputData dmOutput = new DataMinerOutputData();
Map<String, String> map = new HashMap<String, String>(); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
String tagSearch = "d4science:Data"; String tagSearch = "d4science:Data";
NodeList nodeList = mdMetadata.getElementsByTagName(tagSearch); NodeList nodeList = mdMetadata.getElementsByTagName(tagSearch);

View File

@ -4,6 +4,7 @@
package org.gcube.portlets.user.performfishanalytics.shared.performfishservice; package org.gcube.portlets.user.performfishanalytics.shared.performfishservice;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -20,7 +21,7 @@ public class PerformFishResponse implements Serializable{
*/ */
private static final long serialVersionUID = 6064068032560730872L; private static final long serialVersionUID = 6064068032560730872L;
private Map<String, String> mapParameters; private LinkedHashMap<String, String> mapParameters;
private String respSessionId; private String respSessionId;
@ -37,7 +38,7 @@ public class PerformFishResponse implements Serializable{
* @param respSessionId the resp session id * @param respSessionId the resp session id
*/ */
public PerformFishResponse( public PerformFishResponse(
Map<String, String> mapParameters, String respSessionId) { LinkedHashMap<String, String> mapParameters, String respSessionId) {
super(); super();
this.mapParameters = mapParameters; this.mapParameters = mapParameters;
@ -72,7 +73,7 @@ public class PerformFishResponse implements Serializable{
* *
* @param mapParameters the mapParameters to set * @param mapParameters the mapParameters to set
*/ */
public void setMapParameters(Map<String, String> mapParameters) { public void setMapParameters(LinkedHashMap<String, String> mapParameters) {
this.mapParameters = mapParameters; this.mapParameters = mapParameters;
} }