Added the filter for parameter names. It returns only TaskOperator matching the input filters
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@169039 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fad77cedec
commit
3accf33882
|
@ -10,6 +10,7 @@ import org.gcube.common.workspacetaskexecutor.shared.ExecutableItem;
|
|||
import org.gcube.common.workspacetaskexecutor.shared.ExecutableTask;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOperator;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOutput;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.WSItemObject;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||
|
@ -226,12 +227,12 @@ public class WorkspaceDataMinerTaskExecutor implements ExecutableTask<TaskConfig
|
|||
|
||||
|
||||
/**
|
||||
* Load item details.
|
||||
* Load item.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @return the WS item object
|
||||
*/
|
||||
public WSItemObject loadItemDetails(String itemId){
|
||||
public WSItemObject loadItem(String itemId){
|
||||
WorkspaceItem item = null;
|
||||
Validate.notNull(itemId, "Input parameter itemId is null");
|
||||
try{
|
||||
|
@ -441,12 +442,41 @@ public class WorkspaceDataMinerTaskExecutor implements ExecutableTask<TaskConfig
|
|||
/**
|
||||
* Gets the list operators.
|
||||
*
|
||||
* @param filterForParameterNames the filter for parameter names. It returns only {@link TaskOperator} matching the input filters
|
||||
* @return the list operators
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public List<TaskOperator> getListOperators() throws Exception{
|
||||
public List<TaskOperator> getListOperators(String[] filterForParameterNames) throws Exception{
|
||||
|
||||
DataMinerAccessPoint dap = getDataMinerAccessPoint();
|
||||
|
||||
if(filterForParameterNames==null || filterForParameterNames.length==0){
|
||||
logger.info("Returning "+dap.getListOperators().size()+ " operator/s. No filter applied");
|
||||
return dap.getListOperators();
|
||||
}
|
||||
|
||||
//APPLYING FILTERS ON PARAMETER NAME/TYPE
|
||||
for (TaskOperator taskOperator : dap.getListOperators()) {
|
||||
logger.trace("***Algor: "+taskOperator.getName());
|
||||
List<TaskParameter> io = taskOperator.getInputOperators();
|
||||
boolean filterPassed = false;
|
||||
for (TaskParameter taskParameter : io) {
|
||||
logger.trace("key: "+taskParameter.getKey() + ", value: "+taskParameter.getValue() +", defaultValue: "+taskParameter.getDefaultValue());
|
||||
for (String filterParameterName : filterForParameterNames) {
|
||||
if(taskParameter.getKey().compareToIgnoreCase(filterParameterName)==0){
|
||||
filterPassed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!filterPassed){
|
||||
logger.info("Removed key: "+taskParameter.getKey() + " It does not match filters: "+filterForParameterNames);
|
||||
io.remove(taskParameter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dap.getListOperators();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue