refs 4823: DataMiner - Preserve the order of the output (Example Bionym Local)

Task-Url: https://support.d4science.org/issues/4823

In the case of Check The Computation, now the interaface shows the input parameters in the order requested by the algorithm and the output parameters sorted by name

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@130969 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-08-04 13:34:52 +00:00
parent 0c14d3966e
commit e310813cde
11 changed files with 417 additions and 247 deletions

View File

@ -32,6 +32,7 @@ public class ComputationsPanel extends SimpleContainer {
public ComputationsPanel() { public ComputationsPanel() {
super(); super();
Log.debug("ComputationsPanel");
init(); init();
create(); create();
bind(); bind();

View File

@ -37,8 +37,9 @@ public class ComputationsViewerPanel extends FramedPanel {
public ComputationsViewerPanel(ComputationData computationData) { public ComputationsViewerPanel(ComputationData computationData) {
super(); super();
Log.debug("ComputationsPanel"); Log.debug("ComputationsViewerPanel");
this.computationData=computationData; this.computationData = computationData;
Log.debug("ComputationData: " + computationData);
init(); init();
create(); create();
@ -54,19 +55,25 @@ public class ComputationsViewerPanel extends FramedPanel {
setResize(true); setResize(true);
setHeadingText("Computations Viewer"); setHeadingText("Computations Viewer");
setBodyStyle("backgroundColor:white;"); setBodyStyle("backgroundColor:white;");
} }
private void create() { private void create() {
v = new VerticalLayoutContainer(); try {
v.setScrollMode(ScrollMode.AUTO); v = new VerticalLayoutContainer();
add(v); v.setScrollMode(ScrollMode.AUTO);
createView(); add(v);
forceLayout(); createView();
forceLayout();
} catch (Throwable e) {
Log.error("Error creating ComputationsViewerPanel: "
+ e.getLocalizedMessage());
e.printStackTrace();
}
} }
private void createView() { private void createView() {
if (computationData == null) { if (computationData == null) {
Log.error("ComputationData is null!"); Log.error("ComputationData is null!");
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
@ -74,6 +81,15 @@ public class ComputationsViewerPanel extends FramedPanel {
return; return;
} }
if (computationData.getComputationId() == null
|| computationData.getComputationId().getId() == null
|| computationData.getComputationId().getId().isEmpty()) {
Log.error("Error in computationId: " + computationData);
UtilsGXT3.alert("Error",
"No information on computation id is retrieved!");
return;
}
SimpleContainer sectionTitle = new SimpleContainer(); SimpleContainer sectionTitle = new SimpleContainer();
// title // title
HtmlLayoutContainer title = new HtmlLayoutContainer( HtmlLayoutContainer title = new HtmlLayoutContainer(
@ -82,7 +98,8 @@ public class ComputationsViewerPanel extends FramedPanel {
+ "</b></center>"); + "</b></center>");
sectionTitle.add(title, new MarginData()); sectionTitle.add(title, new MarginData());
sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX); sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX);
// v.add(sectionTitle, new VerticalLayoutData(1, -1, new Margins(0))); // v.add(sectionTitle, new VerticalLayoutData(1, -1, new
// Margins(0)));
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10))); v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10)));
if (computationData.getOutputParameters() != null if (computationData.getOutputParameters() != null
@ -105,195 +122,258 @@ public class ComputationsViewerPanel extends FramedPanel {
FieldSet operatorFieldSet = operatorView(); FieldSet operatorFieldSet = operatorView();
v.add(operatorFieldSet, new VerticalLayoutData(-1, -1, new Margins(10))); v.add(operatorFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
} }
private FieldSet operatorView() { private FieldSet operatorView() {
VerticalLayoutContainer operatorVBox = new VerticalLayoutContainer(); try {
TextField operatorNameField = new TextField();
operatorNameField.setValue(computationData.getComputationId()
.getOperatorName());
operatorNameField.setReadOnly(true);
FieldLabel operatorNameLabel = new FieldLabel(operatorNameField,
"Operator Name");
operatorNameLabel.setLabelWidth(200);
operatorNameLabel.setLabelWordWrap(true);
operatorVBox.add(operatorNameLabel, new VerticalLayoutData(1, -1,
new Margins(0,4,0,4)));
TextArea operatorDescriptionField = new TextArea(); VerticalLayoutContainer operatorVBox = new VerticalLayoutContainer();
operatorDescriptionField.setHeight(40); TextField operatorNameField = new TextField();
operatorDescriptionField.setValue(computationData operatorNameField.setValue(computationData.getComputationId()
.getOperatorDescription()); .getOperatorName());
operatorDescriptionField.setReadOnly(true); operatorNameField.setReadOnly(true);
FieldLabel operatorDescriptionLabel = new FieldLabel( FieldLabel operatorNameLabel = new FieldLabel(operatorNameField,
operatorDescriptionField, "Operator Description"); "Operator Name");
operatorDescriptionLabel.setLabelWidth(200); operatorNameLabel.setLabelWidth(200);
operatorDescriptionLabel.setLabelWordWrap(true); operatorNameLabel.setLabelWordWrap(true);
operatorDescriptionLabel.setHeight(65); operatorVBox.add(operatorNameLabel, new VerticalLayoutData(1, -1,
operatorVBox.add(operatorDescriptionLabel, new VerticalLayoutData(1, new Margins(0, 4, 0, 4)));
-1, new Margins(0,5,0,5)));
FieldSet operatorFieldSet = new FieldSet(); TextArea operatorDescriptionField = new TextArea();
operatorFieldSet.setHeadingText("Operator Details"); operatorDescriptionField.setHeight(40);
operatorFieldSet.setCollapsible(true); operatorDescriptionField.setValue(computationData
operatorFieldSet.setHeight(130); .getOperatorDescription());
operatorFieldSet.add(operatorVBox); operatorDescriptionField.setReadOnly(true);
operatorFieldSet.getElement().getStyle().setMarginBottom(120, Unit.PX); FieldLabel operatorDescriptionLabel = new FieldLabel(
operatorFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX); operatorDescriptionField, "Operator Description");
return operatorFieldSet; operatorDescriptionLabel.setLabelWidth(200);
operatorDescriptionLabel.setLabelWordWrap(true);
operatorDescriptionLabel.setHeight(65);
operatorVBox.add(operatorDescriptionLabel, new VerticalLayoutData(
1, -1, new Margins(0, 5, 0, 5)));
FieldSet operatorFieldSet = new FieldSet();
operatorFieldSet.setHeadingText("Operator Details");
operatorFieldSet.setCollapsible(true);
operatorFieldSet.setHeight(130);
operatorFieldSet.add(operatorVBox);
operatorFieldSet.getElement().getStyle()
.setMarginBottom(120, Unit.PX);
operatorFieldSet.getElement().getStyle()
.setMarginRight(20, Unit.PX);
return operatorFieldSet;
} catch (Throwable e) {
Log.error("Error in ComputationsViewerPanel in operator: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw e;
}
} }
private FieldSet detailsView() { private FieldSet detailsView() {
VerticalLayoutContainer detailsVBox = new VerticalLayoutContainer(); try {
TextField startDateField = new TextField(); VerticalLayoutContainer detailsVBox = new VerticalLayoutContainer();
startDateField.setValue(computationData.getStartDate()); TextField startDateField = new TextField();
startDateField.setReadOnly(true); startDateField.setValue(computationData.getStartDate());
FieldLabel startDateLabel = new FieldLabel(startDateField, "Start Date"); startDateField.setReadOnly(true);
startDateLabel.setLabelWidth(200); FieldLabel startDateLabel = new FieldLabel(startDateField,
startDateLabel.setLabelWordWrap(true); "Start Date");
detailsVBox.add(startDateLabel, new VerticalLayoutData(1, -1, startDateLabel.setLabelWidth(200);
new Margins(0,4,0,4))); startDateLabel.setLabelWordWrap(true);
detailsVBox.add(startDateLabel, new VerticalLayoutData(1, -1,
new Margins(0, 4, 0, 4)));
TextField endDateField = new TextField(); TextField endDateField = new TextField();
endDateField.setValue(computationData.getEndDate()); endDateField.setValue(computationData.getEndDate());
endDateField.setReadOnly(true); endDateField.setReadOnly(true);
FieldLabel endDateLabel = new FieldLabel(endDateField, "End Date"); FieldLabel endDateLabel = new FieldLabel(endDateField, "End Date");
endDateLabel.setLabelWidth(200); endDateLabel.setLabelWidth(200);
endDateLabel.setLabelWordWrap(true); endDateLabel.setLabelWordWrap(true);
detailsVBox.add(endDateLabel, new VerticalLayoutData(1, -1, detailsVBox.add(endDateLabel, new VerticalLayoutData(1, -1,
new Margins(0,4,0,4))); new Margins(0, 4, 0, 4)));
TextField statusField = new TextField(); TextField statusField = new TextField();
statusField.setValue(computationData.getStatus()); statusField.setValue(computationData.getStatus());
statusField.setReadOnly(true); statusField.setReadOnly(true);
FieldLabel statusLabel = new FieldLabel(statusField, "Status"); FieldLabel statusLabel = new FieldLabel(statusField, "Status");
statusLabel.setLabelWidth(200); statusLabel.setLabelWidth(200);
statusLabel.setLabelWordWrap(true); statusLabel.setLabelWordWrap(true);
detailsVBox.add(statusLabel, new VerticalLayoutData(1, -1, new Margins( detailsVBox.add(statusLabel, new VerticalLayoutData(1, -1,
0,4,0,4))); new Margins(0, 4, 0, 4)));
TextField vreField = new TextField(); TextField vreField = new TextField();
vreField.setValue(computationData.getVre()); vreField.setValue(computationData.getVre());
vreField.setReadOnly(true); vreField.setReadOnly(true);
FieldLabel vreLabel = new FieldLabel(vreField, "VRE"); FieldLabel vreLabel = new FieldLabel(vreField, "VRE");
vreLabel.setLabelWidth(200); vreLabel.setLabelWidth(200);
vreLabel.setLabelWordWrap(true); vreLabel.setLabelWordWrap(true);
detailsVBox detailsVBox.add(vreLabel, new VerticalLayoutData(1, -1,
.add(vreLabel, new VerticalLayoutData(1, -1, new Margins(0,4,0,4))); new Margins(0, 4, 0, 4)));
FieldSet detailsFieldSet = new FieldSet(); FieldSet detailsFieldSet = new FieldSet();
detailsFieldSet.setHeadingText("Computation Details"); detailsFieldSet.setHeadingText("Computation Details");
detailsFieldSet.setCollapsible(true); detailsFieldSet.setCollapsible(true);
detailsFieldSet.add(detailsVBox); detailsFieldSet.add(detailsVBox);
detailsFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX); detailsFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
return detailsFieldSet; return detailsFieldSet;
} catch (Throwable e) {
Log.error("Error in ComputationsViewerPanel in details: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw e;
}
} }
private FieldSet inputView() { private FieldSet inputView() {
VerticalLayoutContainer inputVBox = new VerticalLayoutContainer(); try {
LinkedHashMap<String, ComputationValue> input = computationData VerticalLayoutContainer inputVBox = new VerticalLayoutContainer();
.getInputParameters(); LinkedHashMap<String, ComputationValue> input = computationData
for (String key : input.keySet()) { .getInputParameters();
ComputationValue computationValue = input.get(key); for (String key : input.keySet()) {
FieldLabel fieldLabel = null; ComputationValue computationValue = input.get(key);
SimpleContainer simpleContainer; Log.debug("Input: [key=" + key + ", ComputationValue="
switch (computationValue.getType()) { + computationValue + "]");
case File: FieldLabel fieldLabel = null;
ComputationValueFile computationValueFile=(ComputationValueFile) computationValue; SimpleContainer simpleContainer;
simpleContainer=new ComputationValueFilePanel(computationValueFile); if(computationValue==null){
fieldLabel = new FieldLabel(simpleContainer, key); TextField textField = new TextField();
fieldLabel.setLabelWidth(200); textField.setReadOnly(true);
fieldLabel.setLabelWordWrap(true); fieldLabel = new FieldLabel(textField, key);
break; fieldLabel.setLabelWidth(200);
case Image: fieldLabel.setLabelWordWrap(true);
ComputationValueImage computationValueImage=(ComputationValueImage) computationValue; inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
simpleContainer=new ComputationValueImagePanel(computationValueImage); new Margins(0, 4, 0, 4)));
fieldLabel = new FieldLabel(simpleContainer, key); continue;
fieldLabel.setLabelWidth(200); }
fieldLabel.setLabelWordWrap(true);
break;
case FileList: switch (computationValue.getType()) {
ComputationValueFileList computationValueFileList=(ComputationValueFileList) computationValue; case File:
simpleContainer=new ComputationValueFileListPanel(computationValueFileList); ComputationValueFile computationValueFile = (ComputationValueFile) computationValue;
fieldLabel = new FieldLabel(simpleContainer, key); simpleContainer = new ComputationValueFilePanel(
fieldLabel.setLabelWidth(200); computationValueFile);
fieldLabel.setLabelWordWrap(true); fieldLabel = new FieldLabel(simpleContainer, key);
break; fieldLabel.setLabelWidth(200);
case String: fieldLabel.setLabelWordWrap(true);
default: break;
TextField textField = new TextField(); case Image:
textField.setValue(computationValue.getValue()); ComputationValueImage computationValueImage = (ComputationValueImage) computationValue;
textField.setReadOnly(true); simpleContainer = new ComputationValueImagePanel(
fieldLabel = new FieldLabel(textField, key); computationValueImage);
fieldLabel.setLabelWidth(200); fieldLabel = new FieldLabel(simpleContainer, key);
fieldLabel.setLabelWordWrap(true); fieldLabel.setLabelWidth(200);
break; fieldLabel.setLabelWordWrap(true);
break;
case FileList:
ComputationValueFileList computationValueFileList = (ComputationValueFileList) computationValue;
simpleContainer = new ComputationValueFileListPanel(
computationValueFileList);
fieldLabel = new FieldLabel(simpleContainer, key);
fieldLabel.setLabelWidth(200);
fieldLabel.setLabelWordWrap(true);
break;
case String:
default:
TextField textField = new TextField();
textField.setValue(computationValue.getValue());
textField.setReadOnly(true);
fieldLabel = new FieldLabel(textField, key);
fieldLabel.setLabelWidth(200);
fieldLabel.setLabelWordWrap(true);
break;
}
inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
new Margins(0, 4, 0, 4)));
} }
inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
new Margins(0,4,0,4)));
}
FieldSet inputFieldSet = new FieldSet(); FieldSet inputFieldSet = new FieldSet();
inputFieldSet.setHeadingText("Input Parameters"); inputFieldSet.setHeadingText("Input Parameters");
inputFieldSet.setCollapsible(true); inputFieldSet.setCollapsible(true);
inputFieldSet.add(inputVBox); inputFieldSet.add(inputVBox);
inputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX); inputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
return inputFieldSet; return inputFieldSet;
} catch (Throwable e) {
Log.error("Error in ComputationsViewerPanel creating input view: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw e;
}
} }
private FieldSet outputView() { private FieldSet outputView() {
VerticalLayoutContainer outputVBox = new VerticalLayoutContainer(); try {
LinkedHashMap<String, ComputationValue> output = computationData VerticalLayoutContainer outputVBox = new VerticalLayoutContainer();
.getOutputParameters(); LinkedHashMap<String, ComputationValue> output = computationData
for (String key : output.keySet()) { .getOutputParameters();
ComputationValue computationValue = output.get(key); for (String key : output.keySet()) {
FieldLabel fieldLabel = null; ComputationValue computationValue = output.get(key);
SimpleContainer simpleContainer; Log.debug("Output: [key=" + key + ", ComputationValue="
switch (computationValue.getType()) { + computationValue + "]");
case File: FieldLabel fieldLabel = null;
ComputationValueFile computationValueFile=(ComputationValueFile) computationValue; SimpleContainer simpleContainer;
simpleContainer=new ComputationValueFilePanel(computationValueFile); if(computationValue==null){
fieldLabel = new FieldLabel(simpleContainer, key); TextField textField = new TextField();
fieldLabel.setLabelWidth(200); textField.setReadOnly(true);
fieldLabel.setLabelWordWrap(true); fieldLabel = new FieldLabel(textField, key);
break; fieldLabel.setLabelWidth(200);
case Image: fieldLabel.setLabelWordWrap(true);
ComputationValueImage computationValueImage=(ComputationValueImage) computationValue; outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
simpleContainer=new ComputationValueImagePanel(computationValueImage); new Margins(0, 4, 0, 4)));
fieldLabel = new FieldLabel(simpleContainer, key); continue;
fieldLabel.setLabelWidth(200); }
fieldLabel.setLabelWordWrap(true);
break; switch (computationValue.getType()) {
case FileList: case File:
ComputationValueFileList computationValueFileList=(ComputationValueFileList) computationValue; ComputationValueFile computationValueFile = (ComputationValueFile) computationValue;
simpleContainer=new ComputationValueFileListPanel(computationValueFileList); simpleContainer = new ComputationValueFilePanel(
fieldLabel = new FieldLabel(simpleContainer, key); computationValueFile);
fieldLabel.setLabelWidth(200); fieldLabel = new FieldLabel(simpleContainer, key);
fieldLabel.setLabelWordWrap(true); fieldLabel.setLabelWidth(200);
case String: fieldLabel.setLabelWordWrap(true);
default: break;
TextField textField = new TextField(); case Image:
textField.setValue(computationValue.getValue()); ComputationValueImage computationValueImage = (ComputationValueImage) computationValue;
textField.setReadOnly(true); simpleContainer = new ComputationValueImagePanel(
fieldLabel = new FieldLabel(textField, key); computationValueImage);
fieldLabel.setLabelWidth(200); fieldLabel = new FieldLabel(simpleContainer, key);
fieldLabel.setLabelWordWrap(true); fieldLabel.setLabelWidth(200);
break; fieldLabel.setLabelWordWrap(true);
break;
case FileList:
ComputationValueFileList computationValueFileList = (ComputationValueFileList) computationValue;
simpleContainer = new ComputationValueFileListPanel(
computationValueFileList);
fieldLabel = new FieldLabel(simpleContainer, key);
fieldLabel.setLabelWidth(200);
fieldLabel.setLabelWordWrap(true);
case String:
default:
TextField textField = new TextField();
textField.setValue(computationValue.getValue());
textField.setReadOnly(true);
fieldLabel = new FieldLabel(textField, key);
fieldLabel.setLabelWidth(200);
fieldLabel.setLabelWordWrap(true);
break;
}
outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
new Margins(0, 4, 0, 4)));
} }
outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
new Margins(0,4,0,4)));
}
FieldSet outputFieldSet = new FieldSet(); FieldSet outputFieldSet = new FieldSet();
outputFieldSet.setHeadingText("Output Result"); outputFieldSet.setHeadingText("Output Result");
outputFieldSet.setCollapsible(true); outputFieldSet.setCollapsible(true);
outputFieldSet.add(outputVBox); outputFieldSet.add(outputVBox);
outputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX); outputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
return outputFieldSet; return outputFieldSet;
} catch (Throwable e) {
Log.error("Error in ComputationsViewerPanel creating output view: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw e;
}
} }
} }

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.dataminermanager.server; package org.gcube.portlets.user.dataminermanager.server;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -343,6 +344,8 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
logger.debug("OutputDataByComputationItemt(): " + itemDescription); logger.debug("OutputDataByComputationItemt(): " + itemDescription);
Map<String, String> properties = StorageUtil.getProperties( Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId()); aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties); logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(aslSession, session); SClient smClient = SessionUtil.getSClient(aslSession, session);
ComputationData computationData = smClient ComputationData computationData = smClient

View File

@ -261,7 +261,7 @@ public class SClient4WPS extends SClient {
operatorsClass.add(op); operatorsClass.add(op);
//logger.debug("OperatorClass: " + operatorsClass); // logger.debug("OperatorClass: " + operatorsClass);
return operatorsClass; return operatorsClass;
} }
@ -356,7 +356,7 @@ public class SClient4WPS extends SClient {
return; return;
} catch (Throwable e) { } catch (Throwable e) {
logger.error("RequestCapability(): "+e.getLocalizedMessage()); logger.error("RequestCapability(): " + e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new Exception(e.getLocalizedMessage(), e); throw new Exception(e.getLocalizedMessage(), e);
} finally { } finally {
@ -989,7 +989,7 @@ public class SClient4WPS extends SClient {
@Override @Override
public OutputData getOutputDataByComputationId(ComputationId computationId) public OutputData getOutputDataByComputationId(ComputationId computationId)
throws Exception { throws Exception {
Map<String, Resource> resources = retrieveOutput(computationId); LinkedHashMap<String, Resource> resources = retrieveOutput(computationId);
MapResource mapResource = new MapResource("mapResource", "Resources", MapResource mapResource = new MapResource("mapResource", "Resources",
"Resources", resources); "Resources", resources);
OutputData outputData = new OutputData(computationId, mapResource); OutputData outputData = new OutputData(computationId, mapResource);
@ -997,10 +997,10 @@ public class SClient4WPS extends SClient {
return outputData; return outputData;
} }
private Map<String, Resource> retrieveOutput(ComputationId computationId) private LinkedHashMap<String, Resource> retrieveOutput(
throws Exception { ComputationId computationId) throws Exception {
Map<String, Resource> outputResource = new LinkedHashMap<>(); LinkedHashMap<String, Resource> outputResource = new LinkedHashMap<>();
Map<String, Parameter> outputParameters = new LinkedHashMap<>(); LinkedHashMap<String, Parameter> outputParameters = new LinkedHashMap<>();
ProcessInformations processInformations = runningProcess ProcessInformations processInformations = runningProcess
.get(computationId); .get(computationId);
@ -1289,73 +1289,159 @@ public class SClient4WPS extends SClient {
@Override @Override
public ComputationData getComputationDataByComputationProperties( public ComputationData getComputationDataByComputationProperties(
Map<String, String> computationProperties) throws Exception { Map<String, String> computationProperties) throws Exception {
if (computationProperties == null || computationProperties.isEmpty()) { try {
throw new Exception("Invalid computation properties: " if (computationProperties == null
+ computationProperties); || computationProperties.isEmpty()) {
} throw new Exception("Invalid computation properties: "
+ computationProperties);
}
String compId = computationProperties.get("computation_id"); String compId = computationProperties.get("computation_id");
String operatorId = computationProperties.get("operator_id"); String operatorId = computationProperties.get("operator_id");
String operatorName = computationProperties.get("operator_name"); String operatorName = computationProperties.get("operator_name");
String operatorDescritpion = computationProperties String operatorDescritpion = computationProperties
.get("operator_description"); .get("operator_description");
String vre = computationProperties.get("VRE"); String vre = computationProperties.get("VRE");
String startDate = computationProperties.get("start_date"); String startDate = computationProperties.get("start_date");
String endDate = computationProperties.get("end_date"); String endDate = computationProperties.get("end_date");
String status = computationProperties.get("status"); String status = computationProperties.get("status");
String executionType = computationProperties.get("execution_type"); String executionType = computationProperties.get("execution_type");
ComputationId computationId = new ComputationId(); ComputationId computationId = new ComputationId();
computationId.setId(compId); computationId.setId(compId);
computationId.setOperatorId(operatorId); computationId.setOperatorId(operatorId);
computationId.setOperatorName(operatorName); computationId.setOperatorName(operatorName);
LinkedHashMap<String, String> inputValueParameters = new LinkedHashMap<>(); LinkedHashMap<String, String> inputValueParameters = new LinkedHashMap<>();
LinkedHashMap<String, String> outputValueParameters = new LinkedHashMap<>(); LinkedHashMap<String, String> outputValueParameters = new LinkedHashMap<>();
for (String key : computationProperties.keySet()) { for (String key : computationProperties.keySet()) {
if (key != null) { if (key != null) {
if (key.startsWith("input")) { if (key.startsWith("input")) {
int inputSeparatorIndex = key.indexOf("_"); int inputSeparatorIndex = key.indexOf("_");
String inputKey = key.substring(inputSeparatorIndex + 1); String inputKey = key
if (inputKey.compareToIgnoreCase("user.name") != 0 .substring(inputSeparatorIndex + 1);
&& inputKey.compareToIgnoreCase("scope") != 0) { if (inputKey.compareToIgnoreCase("user.name") != 0
inputValueParameters.put(inputKey, && inputKey.compareToIgnoreCase("scope") != 0) {
computationProperties.get(key)); inputValueParameters.put(inputKey,
computationProperties.get(key));
} }
} else { } else {
if (key.startsWith("output")) { if (key.startsWith("output")) {
int outputSeparatorIndex = key.indexOf("_"); int outputSeparatorIndex = key.indexOf("_");
String outputKey = key String outputKey = key
.substring(outputSeparatorIndex + 1); .substring(outputSeparatorIndex + 1);
outputValueParameters.put(outputKey, outputValueParameters.put(outputKey,
computationProperties.get(key)); computationProperties.get(key));
}
} }
} }
} }
ComputationValueBuilder computationValueBuilder = new ComputationValueBuilder(
inputValueParameters);
LinkedHashMap<String, ComputationValue> inputParameters = computationValueBuilder
.create();
computationValueBuilder = new ComputationValueBuilder(
outputValueParameters);
LinkedHashMap<String, ComputationValue> outputParameters = computationValueBuilder
.create();
logger.debug("inputParameters: " + inputParameters);
logger.debug("outputParameters: " + outputParameters);
LinkedHashMap<String, ComputationValue> inputParametersSorted = new LinkedHashMap<>();
LinkedHashMap<String, ComputationValue> outputParametersSorted = new LinkedHashMap<>();
ProcessInformations processInfos = describeProcess(operatorId);
if (processInfos != null) {
for (InputDescriptionType inputDesc : processInfos.getInputs()) {
if (inputDesc != null
&& inputDesc.getIdentifier() != null
&& inputDesc.getIdentifier().getStringValue() != null) {
logger.debug("InputParametr Match: "
+ inputDesc.getIdentifier().getStringValue());
ComputationValue inputComputationValue = inputParameters
.get(inputDesc.getIdentifier().getStringValue());
inputParametersSorted.put(inputDesc.getIdentifier()
.getStringValue(), inputComputationValue);
}
}
} else {
inputParametersSorted.putAll(inputParameters);
}
ArrayList<String> keys=new ArrayList<>(outputParameters.keySet());
Comparator<String> comparator = new Comparator<String>() {
public int compare(String c1, String c2) {
Integer c1Int=null;
try {
c1Int=Integer.valueOf(c1);
} catch(NumberFormatException e){
}
Integer c2Int=null;
try {
c2Int=Integer.valueOf(c2);
} catch(NumberFormatException e){
}
if(c1Int!=null && c2Int!=null){
return c1Int.compareTo(c2Int);
} else {
if(c1Int==null && c2Int==null){
return c1.compareTo(c2);
} else {
if(c1Int==null){
return -1;
} else {
return 1;
}
}
}
}
};
Collections.sort(keys, comparator);
for(String key:keys){
ComputationValue outputComputationValue = outputParameters
.get(key);
outputParametersSorted.put(key, outputComputationValue);
}
ComputationData computationData = new ComputationData(
computationId, inputParametersSorted,
outputParametersSorted, operatorDescritpion, startDate,
endDate, status, executionType, vre);
logger.debug("ComputationData: " + computationData);
return computationData;
} catch (DataMinerServiceException e) {
logger.error("Error in getComutationDataByComputationProperties: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw e;
} catch (Throwable e) {
logger.error("Error in getComutationDataByComputationProperties: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new Exception(e.getLocalizedMessage(), e);
} }
ComputationValueBuilder computationValueBuilder = new ComputationValueBuilder(
inputValueParameters);
LinkedHashMap<String, ComputationValue> inputParameters = computationValueBuilder
.create();
computationValueBuilder = new ComputationValueBuilder(
outputValueParameters);
LinkedHashMap<String, ComputationValue> outputParameters = computationValueBuilder
.create();
ComputationData computationData = new ComputationData(computationId,
inputParameters, outputParameters, operatorDescritpion,
startDate, endDate, status, executionType, vre);
logger.debug("ComputationData: " + computationData);
return computationData;
} }
} }

View File

@ -19,9 +19,9 @@ public class Constants {
public static final String DEFAULT_USER = "giancarlo.panichi"; public static final String DEFAULT_USER = "giancarlo.panichi";
public static final String DEFAULT_ROLE = "OrganizationMember"; public static final String DEFAULT_ROLE = "OrganizationMember";
//public static final String DEFAULT_SCOPE = "/gcube/devsec/devVRE"; public static final String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
// public final static String DEFAULT_SCOPE = "/gcube/devNext"; // public final static String DEFAULT_SCOPE = "/gcube/devNext";
public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext"; //public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";

View File

@ -16,6 +16,7 @@ public class ComputationValue implements Serializable {
public ComputationValue() { public ComputationValue() {
super(); super();
this.type = ComputationValueType.String;
} }
public ComputationValue(ComputationValueType type) { public ComputationValue(ComputationValueType type) {

View File

@ -13,7 +13,7 @@ public class ComputationValueFile extends ComputationValue {
private String mimeType; private String mimeType;
public ComputationValueFile() { public ComputationValueFile() {
super(); super(ComputationValueType.File);
} }
public ComputationValueFile(String url, String fileName, String mimeType) { public ComputationValueFile(String url, String fileName, String mimeType) {

View File

@ -15,7 +15,7 @@ public class ComputationValueFileList extends ComputationValue {
private String separator; private String separator;
public ComputationValueFileList() { public ComputationValueFileList() {
super(); super(ComputationValueType.FileList);
} }
public ComputationValueFileList(ArrayList<ComputationValue> fileList, public ComputationValueFileList(ArrayList<ComputationValue> fileList,

View File

@ -13,7 +13,7 @@ public class ComputationValueImage extends ComputationValue {
private String mimeType; private String mimeType;
public ComputationValueImage(){ public ComputationValueImage(){
super(); super(ComputationValueType.Image);
} }
public ComputationValueImage(String url, String fileName, String mimeType) { public ComputationValueImage(String url, String fileName, String mimeType) {

View File

@ -4,6 +4,7 @@
package org.gcube.portlets.user.dataminermanager.shared.data.output; package org.gcube.portlets.user.dataminermanager.shared.data.output;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
/** /**
@ -18,7 +19,7 @@ public class MapResource extends Resource implements Serializable {
* *
*/ */
private static final long serialVersionUID = 8772836076910728324L; private static final long serialVersionUID = 8772836076910728324L;
private Map<String, Resource> map; private LinkedHashMap<String, Resource> map;
/** /**
* *
@ -29,7 +30,7 @@ public class MapResource extends Resource implements Serializable {
} }
public MapResource(String resourceId, String name, String description, public MapResource(String resourceId, String name, String description,
Map<String, Resource> map) { LinkedHashMap<String, Resource> map) {
super(resourceId, name, description, ResourceType.MAP); super(resourceId, name, description, ResourceType.MAP);
this.map = map; this.map = map;
} }
@ -38,7 +39,7 @@ public class MapResource extends Resource implements Serializable {
return map; return map;
} }
public void setMap(Map<String, Resource> map) { public void setMap(LinkedHashMap<String, Resource> map) {
this.map = map; this.map = map;
} }

View File

@ -10,7 +10,7 @@
<!-- <inherits name="com.google.gwt.logging.Logging" /> --> <!-- <inherits name="com.google.gwt.logging.Logging" /> -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" /> <inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
<!-- Debug CSS style --> <!-- Debug CSS style -->
<set-configuration-property name="CssResource.style" <set-configuration-property name="CssResource.style"
value="pretty" /> value="pretty" />
@ -36,14 +36,12 @@
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED" value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> --> /> -->
<set-property name="log_ConsoleLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> <set-property name="log_SystemLogger" value="DISABLED" />
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />