Task #17166 Synoptic table generated synoptic table to FARM

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@181221 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-07-12 14:35:00 +00:00
parent 5cb762fcd0
commit 67970afe90
10 changed files with 147 additions and 12 deletions

View File

@ -19,7 +19,8 @@ public enum DataMinerAlgorithms {
BOXPLOT("BOXPLOT","BOXPLOT"), BOXPLOT("BOXPLOT","BOXPLOT"),
DEA_ANALYSIS("DEA_ANALYSIS", "DEA_ANALYSIS"), DEA_ANALYSIS("DEA_ANALYSIS", "DEA_ANALYSIS"),
CORRELATION("CORRELATION", "CORRELATION"), CORRELATION("CORRELATION", "CORRELATION"),
PERFORMFISH_SYNOPTICTABLE_BATCH("PERFORMFISH_SYNOPTICTABLE_BATCH", "PERFORMFISH_SYNOPTICTABLE_BATCH"); PERFORMFISH_SYNOPTICTABLE_BATCH("PERFORMFISH_SYNOPTICTABLE_BATCH", "PERFORMFISH_SYNOPTICTABLE_BATCH"),
PERFORMFISH_SYNOPTIC_TABLE_FARM("PERFORMFISH_SYNOPTIC_TABLE_FARM","PERFORMFISH_SYNOPTIC_TABLE_FARM");
String id; String id;
String name; String name;

View File

@ -35,8 +35,10 @@ public class PerformFishAnalyticsConstant {
public static final String DM_INPUT_TABLE = "inputTable"; public static final String DM_INPUT_TABLE = "inputTable";
public static final String DM_ZONE_LABELS = "zonesLabels"; public static final String DM_ZONE_LABELS = "zonesLabels";
public static final String DM_QUARTER_LABELS = "quartersLabels"; public static final String DM_QUARTER_LABELS = "quartersLabels";
public static final String DM_ALLYEARS_PARAM = "allyears";
public static final String DM_VALUE_ALL = "ALL"; public static final String DM_VALUE_ALL = "ALL";
public static final String PERFORM_FISH_AREA_PARAM = "area"; public static final String PERFORM_FISH_AREA_PARAM = "area";
public static final String PERFORM_FISH_QUARTER_PARAM = "quarter"; public static final String PERFORM_FISH_QUARTER_PARAM = "quarter";
public static final String PERFORM_FISH_PERIOD_PARAM = "period"; public static final String PERFORM_FISH_PERIOD_PARAM = "period";

View File

@ -103,4 +103,7 @@ public interface PerformFishAnalyticsService extends RemoteService {
DataMinerResponse callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse, DataMinerResponse callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
Map<String, List<String>> mapParameters) throws Exception; Map<String, List<String>> mapParameters) throws Exception;
DataMinerResponse callDMServiceToLoadSynopticAnnualTable(PerformFishResponse thePerformFishResponse,
Map<String, List<String>> mapParameters) throws Exception;
} }

View File

@ -89,4 +89,8 @@ public interface PerformFishAnalyticsServiceAsync
void callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse, void callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
Map<String, List<String>> mapParameters, AsyncCallback<DataMinerResponse> asyncCallback); Map<String, List<String>> mapParameters, AsyncCallback<DataMinerResponse> asyncCallback);
void callDMServiceToLoadSynopticAnnualTable(PerformFishResponse thePerformFishResponse,
Map<String, List<String>> mapParameters, AsyncCallback<DataMinerResponse> asyncCallback);
} }

View File

@ -18,6 +18,8 @@ import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEventHandler; import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent; 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.LoadPopulationTypeEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadSynopticTableEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.LoadSynopticTableEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent; 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.PerformFishFieldFormChangedEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent; import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent;
@ -50,6 +52,7 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.Panel;
@ -294,8 +297,81 @@ public class PerformFishAnnualAnalyticsController {
} }
}); });
eventBus.addHandler(LoadSynopticTableEvent.TYPE, new LoadSynopticTableEventHandler() {
@Override
public void onLoadSynopticTable(LoadSynopticTableEvent loadSynopticTableEvent) {
callAlgorithmSynopticTableFarm();
}
});
} }
/**
* Call algorithm synoptic table farm.
*/
protected void callAlgorithmSynopticTableFarm() {
final DataMinerAlgorithms algorithm = DataMinerAlgorithms.PERFORMFISH_SYNOPTIC_TABLE_FARM;
final SubmitRequestPanel submitRequestPanel = new SubmitRequestPanel("", 1);
String tabTitle = "Synoptic Table";
final Tab tab = viewAnnualController.createTab(submitRequestPanel, tabTitle+" #"+(viewAnnualController.currentNumberOfTab()+1));
StringBuilder dataInputsFormatter = new StringBuilder();
Map<String, String> performFishResponseMap = thePerformFishResponse.getMapParameters();
dataInputsFormatter = appendDMInputTable(performFishResponseMap, dataInputsFormatter, PerformFishAnalyticsConstant.PFSERVICE_TO_DM_MAPPING_TABLE.LethalIncidentsTable);
dataInputsFormatter = appendDMInputTable(performFishResponseMap, dataInputsFormatter, PerformFishAnalyticsConstant.PFSERVICE_TO_DM_MAPPING_TABLE.AnnualTable);
dataInputsFormatter = appendDMInputTable(performFishResponseMap, dataInputsFormatter, PerformFishAnalyticsConstant.PFSERVICE_TO_DM_MAPPING_TABLE.AntibioticsTable);
dataInputsFormatter = appendDMInputTable(performFishResponseMap, dataInputsFormatter, PerformFishAnalyticsConstant.PFSERVICE_TO_DM_MAPPING_TABLE.AntiparasiticTable);
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_ALLYEARS_PARAM+"="+ PerformFishAnalyticsConstant.DM_VALUE_ALL +";");
//dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_ALLYEARS_PARAM+"=2016;");
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 HTMLPanel panelContainer = submitRequestPanel.getContainerPanel();
final LoaderIcon loaderIcon = new LoaderIcon("Submitting request to "+algorithm+"...");
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().callDMServiceToLoadSynopticAnnualTable(thePerformFishResponse, mapParameters, new AsyncCallback<DataMinerResponse>() {
@Override
public void onSuccess(DataMinerResponse dmResponse) {
loaderIcon.setVisible(false);
checkTabSpinner(submitRequestPanel, tab);
//field_unary_algorithm.setVisible(true);
GWT.log("I'm displaying: "+dmResponse);
displayOutputFilesAsStaticEntities(dmResponse, algorithm, null, null, null, panelContainer, false);
}
@Override
public void onFailure(Throwable caught) {
loaderIcon.setVisible(false);
checkTabSpinner(submitRequestPanel, tab);
displayOutputFilesAsStaticEntities(null, algorithm, null, null, null, panelContainer, true);
}
});
}
/**
* Submit request to DM.
*
* @param dmAlgorithm the dm algorithm
*/
private void submitRequestToDM(DataMinerAlgorithms dmAlgorithm) { private void submitRequestToDM(DataMinerAlgorithms dmAlgorithm) {
switch (dmAlgorithm) { switch (dmAlgorithm) {
@ -332,8 +408,9 @@ public class PerformFishAnnualAnalyticsController {
/** /**
* Call data miner service for chart type correlation. * Call data miner service for chart type correlation.
* *
* @param performFishResponse the perform fish response * @param focusID the focus ID
* @param performFishRequestParameters the perform fish request parameters * @param inputKPI the input KPI
* @param outputKPI the output KPI
*/ */
private void callDataMinerServiceForChartTypeCorrelation(String focusID, final List<KPI> inputKPI, final List<KPI> outputKPI) { private void callDataMinerServiceForChartTypeCorrelation(String focusID, final List<KPI> inputKPI, final List<KPI> outputKPI) {
@ -611,7 +688,7 @@ public class PerformFishAnnualAnalyticsController {
* @param performFishResponseMap the perform fish response map * @param performFishResponseMap the perform fish response map
* @param dataInputsFormatter the data inputs formatter * @param dataInputsFormatter the data inputs formatter
* @param table the table * @param table the table
* @return * @return the string builder
*/ */
private StringBuilder appendDMInputTable(Map<String, String> performFishResponseMap, StringBuilder dataInputsFormatter, PFSERVICE_TO_DM_MAPPING_TABLE table) { private StringBuilder appendDMInputTable(Map<String, String> performFishResponseMap, StringBuilder dataInputsFormatter, PFSERVICE_TO_DM_MAPPING_TABLE table) {
@ -747,7 +824,7 @@ public class PerformFishAnnualAnalyticsController {
break; break;
case DEA_CHART: case DEA_CHART:
break; break;
case PERFORMFISH_SYNOPTICTABLE_BATCH: case PERFORMFISH_SYNOPTIC_TABLE_FARM:
cssTableStyle = "synoptictable"; cssTableStyle = "synoptictable";
break; break;
} }

View File

@ -208,6 +208,14 @@ public class PerformFishAnnualAnalyticsViewController {
GWT.log("Found the passed batch type: "+populationType); GWT.log("Found the passed batch type: "+populationType);
selectedPopulation = result.get(0).getPopulation(); selectedPopulation = result.get(0).getPopulation();
form.addPopulationTypes(populationName, Arrays.asList(populationType), selectedPopulation); form.addPopulationTypes(populationName, Arrays.asList(populationType), selectedPopulation);
if (populationType.getName().equalsIgnoreCase(PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_AGGREGATED_CLOSED_BATCHES.name())) {
visibleSynopticTable(true);
enableSynopticTable(true);
} else {
visibleSynopticTable(false);
enableSynopticTable(false);
}
} }
} }
}else{ }else{
@ -227,6 +235,7 @@ public class PerformFishAnnualAnalyticsViewController {
} }
/** /**
* Sets the root population type for kp is. * Sets the root population type for kp is.
* *
@ -459,4 +468,25 @@ public class PerformFishAnnualAnalyticsViewController {
this.reloadPerformFishServiceData = reloadPerformFishServiceData; this.reloadPerformFishServiceData = reloadPerformFishServiceData;
} }
/**
* Enable synoptic table.
*
* @param b the b
*/
public void enableSynopticTable(boolean b) {
recapPage.activeSynopticTable(b);
}
/**
* Visible synoptic table.
*
* @param b the b
*/
public void visibleSynopticTable(boolean b){
recapPage.setVisibleLoadSynopsisPanel(b);
}
} }

View File

@ -140,10 +140,10 @@ public class PerformFishAnalyticsController {
PopulationType opt = selectedPopulationTypeEvent.getSelectedPopulationType(); PopulationType opt = selectedPopulationTypeEvent.getSelectedPopulationType();
viewController.setRootPopulationTypeForKPIs(selectedPopulationTypeEvent.getSelectedPopulationType()); viewController.setRootPopulationTypeForKPIs(selectedPopulationTypeEvent.getSelectedPopulationType());
if (opt.getName().equalsIgnoreCase(PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_INDIVIDUAL_CLOSED_BATCHES.name())) { if (opt.getName().equalsIgnoreCase(PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_INDIVIDUAL_CLOSED_BATCHES.name()) || opt.getName().equalsIgnoreCase(PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_INDIVIDUAL.name())) {
viewController.visibleSynopticTable(true); viewController.visibleSynopticTable(true);
} else { } else {
viewController.visibleSynopticTable(true); viewController.visibleSynopticTable(false);
} }
} }
}); });
@ -783,7 +783,4 @@ public class PerformFishAnalyticsController {
} }
} }
} }

View File

@ -152,7 +152,8 @@ public class RecapSubmitPage extends Composite {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
// boolean isValidForm = vivalidatePerformFishInputFields(); // boolean isValidForm = vivalidatePerformFishInputFields();
PerformFishAnalyticsController.eventBus.fireEvent(new LoadSynopticTableEvent(annualAnalysis)); theEventBus.fireEvent(new LoadSynopticTableEvent(annualAnalysis));
} }
}); });

View File

@ -42,7 +42,7 @@
Synopsis Synopsis
</g:Label> </g:Label>
<b:Button ui:field="uib_button_load_synoptic_table" <b:Button ui:field="uib_button_load_synoptic_table"
enabled="false" addStyleNames="the_margin_top" name="PERFORMFISH_SYNOPTICTABLE_BATCH">Load Synoptic Table</b:Button> enabled="false" addStyleNames="the_margin_top" name="PERFORMFISH_SYNOPTICTABLE_BATCH">Generate Synoptic Table</b:Button>
</g:VerticalPanel> </g:VerticalPanel>
</g:HTMLPanel> </g:HTMLPanel>

View File

@ -503,6 +503,26 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
} }
@Override
public DataMinerResponse callDMServiceToLoadSynopticAnnualTable(PerformFishResponse thePerformFishResponse,
Map<String, List<String>> mapParameters) throws Exception {
log.info("Validating Perform-Fish service response...");
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
dmRequestParameters.put("request", Arrays.asList("Execute"));
dmRequestParameters.put("service", Arrays.asList("WPS"));
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
dmRequestParameters.put("lang", Arrays.asList("en-US"));
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTIC_TABLE_FARM"));
dmRequestParameters.putAll(mapParameters);
return callTheDataMiner(dmRequestParameters);
}
/** /**
* Call the data miner perform fish correlation analysis. * Call the data miner perform fish correlation analysis.
* *