added listInOperator and listOutOperator
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@167582 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a7b0d4cfa5
commit
07f7184e8e
|
@ -78,24 +78,48 @@ public class DMConverter {
|
|||
* To task operator.
|
||||
*
|
||||
* @param op the op
|
||||
* @param inputParameters the input parameters
|
||||
* @param outputParameters the output parameters
|
||||
* @return the task operator
|
||||
*/
|
||||
public static TaskOperator toTaskOperator(Operator op){
|
||||
public static TaskOperator toTaskOperator(Operator op, List<Parameter> inputParameters, List<Parameter> outputParameters){
|
||||
|
||||
if(op==null)
|
||||
return null;
|
||||
|
||||
List<TaskParameter> listOperator = null;
|
||||
if(op.getOperatorParameters()!=null){
|
||||
listOperator = new ArrayList<TaskParameter>(op.getOperatorParameters().size());
|
||||
for (Parameter param : op.getOperatorParameters()) {
|
||||
// List<TaskParameter> listOperator = null;
|
||||
// if(op.getOperatorParameters()!=null){
|
||||
// listOperator = new ArrayList<TaskParameter>(op.getOperatorParameters().size());
|
||||
// for (Parameter param : op.getOperatorParameters()) {
|
||||
// TaskParameter tp = toTaskParameter(param);
|
||||
// if(tp!=null)
|
||||
// listOperator.add(tp);
|
||||
// }
|
||||
// }
|
||||
|
||||
//Converting input parameters
|
||||
List<TaskParameter> listInOperator = null;
|
||||
if(inputParameters!=null){
|
||||
listInOperator = new ArrayList<TaskParameter>(inputParameters.size());
|
||||
for (Parameter param :inputParameters) {
|
||||
TaskParameter tp = toTaskParameter(param);
|
||||
if(tp!=null)
|
||||
listOperator.add(tp);
|
||||
listInOperator.add(tp);
|
||||
}
|
||||
}
|
||||
|
||||
return new TaskOperator(op.getId(), op.getName(), op.getBriefDescription(), op.getDescription(), listOperator,op.hasImage());
|
||||
//Converting output parameters
|
||||
List<TaskParameter> listOutOperator = null;
|
||||
if(outputParameters!=null){
|
||||
listOutOperator = new ArrayList<TaskParameter>(inputParameters.size());
|
||||
for (Parameter param : outputParameters) {
|
||||
TaskParameter tp = toTaskParameter(param);
|
||||
if(tp!=null)
|
||||
listOutOperator.add(tp);
|
||||
}
|
||||
}
|
||||
|
||||
return new TaskOperator(op.getId(), op.getName(), op.getBriefDescription(), op.getDescription(), listInOperator, listOutOperator, op.hasImage());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -397,7 +397,9 @@ public class DataMinerAccessPoint {
|
|||
|
||||
if(firstCategory.getOperators()!=null&& !firstCategory.getOperators().isEmpty()){
|
||||
for (Operator operator : firstCategory.getOperators()) {
|
||||
TaskOperator to = DMConverter.toTaskOperator(operator);
|
||||
List<Parameter> inputParameters=sClient.getInputParameters(operator);
|
||||
List<Parameter> outputParameters=sClient.getOutputParameters(operator);
|
||||
TaskOperator to = DMConverter.toTaskOperator(operator, inputParameters, outputParameters);
|
||||
if(to!=null)
|
||||
listOperator.add(to);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.List;
|
|||
/**
|
||||
* The Class TaskOperator.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* May 17, 2018
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* May 18, 2018
|
||||
*/
|
||||
public class TaskOperator implements Serializable{
|
||||
|
||||
|
@ -24,8 +24,9 @@ public class TaskOperator implements Serializable{
|
|||
private String name;
|
||||
private String briefDescription;
|
||||
private String description;
|
||||
private List<TaskParameter> operatorParameters = new ArrayList<TaskParameter>();
|
||||
private List<TaskParameter> inputOperators = new ArrayList<TaskParameter>();
|
||||
private boolean hasImage = false;
|
||||
private List<TaskParameter> outputOperators;
|
||||
|
||||
/**
|
||||
* Instantiates a new task operator.
|
||||
|
@ -42,18 +43,20 @@ public class TaskOperator implements Serializable{
|
|||
* @param name the name
|
||||
* @param briefDescription the brief description
|
||||
* @param description the description
|
||||
* @param operatorParameters the operator parameters
|
||||
* @param inputOperatorParameters the input operator parameters
|
||||
* @param outputOeratorParameters the output oerator parameters
|
||||
* @param hasImage the has image
|
||||
*/
|
||||
public TaskOperator(
|
||||
String id, String name, String briefDescription, String description,
|
||||
List<TaskParameter> operatorParameters, boolean hasImage) {
|
||||
List<TaskParameter> inputOperatorParameters, List<TaskParameter> outputOeratorParameters, boolean hasImage) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.briefDescription = briefDescription;
|
||||
this.description = description;
|
||||
this.operatorParameters = operatorParameters;
|
||||
this.inputOperators = inputOperatorParameters;
|
||||
this.outputOperators = outputOeratorParameters;
|
||||
this.hasImage = hasImage;
|
||||
}
|
||||
|
||||
|
@ -103,13 +106,13 @@ public class TaskOperator implements Serializable{
|
|||
|
||||
|
||||
/**
|
||||
* Gets the operator parameters.
|
||||
* Gets the input operators.
|
||||
*
|
||||
* @return the operatorParameters
|
||||
* @return the inputOperators
|
||||
*/
|
||||
public List<TaskParameter> getOperatorParameters() {
|
||||
public List<TaskParameter> getInputOperators() {
|
||||
|
||||
return operatorParameters;
|
||||
return inputOperators;
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,6 +127,17 @@ public class TaskOperator implements Serializable{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the output operators.
|
||||
*
|
||||
* @return the outputOperators
|
||||
*/
|
||||
public List<TaskParameter> getOutputOperators() {
|
||||
|
||||
return outputOperators;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the id.
|
||||
*
|
||||
|
@ -169,13 +183,13 @@ public class TaskOperator implements Serializable{
|
|||
|
||||
|
||||
/**
|
||||
* Sets the operator parameters.
|
||||
* Sets the input operators.
|
||||
*
|
||||
* @param operatorParameters the operatorParameters to set
|
||||
* @param inputOperators the inputOperators to set
|
||||
*/
|
||||
public void setOperatorParameters(List<TaskParameter> operatorParameters) {
|
||||
public void setInputOperators(List<TaskParameter> inputOperators) {
|
||||
|
||||
this.operatorParameters = operatorParameters;
|
||||
this.inputOperators = inputOperators;
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,6 +203,17 @@ public class TaskOperator implements Serializable{
|
|||
this.hasImage = hasImage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the output operators.
|
||||
*
|
||||
* @param outputOperators the outputOperators to set
|
||||
*/
|
||||
public void setOutputOperators(List<TaskParameter> outputOperators) {
|
||||
|
||||
this.outputOperators = outputOperators;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
@ -204,14 +229,17 @@ public class TaskOperator implements Serializable{
|
|||
builder.append(briefDescription);
|
||||
builder.append(", description=");
|
||||
builder.append(description);
|
||||
builder.append(", operatorParameters=");
|
||||
builder.append(operatorParameters);
|
||||
builder.append(", inputOperators=");
|
||||
builder.append(inputOperators);
|
||||
builder.append(", hasImage=");
|
||||
builder.append(hasImage);
|
||||
builder.append(", outputOperators=");
|
||||
builder.append(outputOperators);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue