if (op == null) {
throw new GfacException("Operation can not be Null", FaultCode.InvaliedLocalArgumnet);
}
MethodType[] methods = pt.getMethodArray();
MethodType method = null;
if (methods != null) {
for (MethodType oldMethod : methods) {
if (op.getMethodName().equals(oldMethod.getMethodName())) {
method = oldMethod;
}
}
}
if (method == null) {
method = pt.addNewMethod();
}
method.setMethodName(op.getMethodName());
method.setMethodDescription(op.getMethodDescription());
ApplicationType appType = method.getApplication();
if (appType == null) {
appType = method.addNewApplication();
}
appType.setParamValuesOnly(true);
ApplicationName appNameType = appType.getApplicationName();
if (appNameType == null) {
appNameType = appType.addNewApplicationName();
}
QName appName = new QName(serviceInfo.getObjectNamespace(), serviceInfo.getApplicationName());
appNameType.setStringValue(appName.getLocalPart());
appNameType.setTargetNamespace(appName.getNamespaceURI());
appType.setApplicationDescription(op.getMethodDescription());
// Boolean parameters from Service screen
if (op.isStageOutputDataFiles()) {
method.setStageOutputDataFiles(true);
}
if (op.isForceFileStagingToWorkDir()) {
method.setForceFileStagingToWorkDir(true);
}
if (op.isUseLEADNameListFile()) {
appType.setUseLEADNameListFile(true);
}
if (op.isUseLEADNameListPropertiesFile()) {
appType.setUseLEADNameListPropertiesFile(true);
}
InputParameterType[] inputs = method.getInputParameterArray();
HashMap<String, InputParameterType> inputMap = new HashMap<String, InputParameterType>();
if (inputs != null) {
for (InputParameterType inputParameterType : inputs) {
inputMap.put(inputParameterType.getParameterName(), inputParameterType);
}
}
OutputParameterType[] outputs = method.getOutputParameterArray();
HashMap<String, OutputParameterType> outputMap = new HashMap<String, OutputParameterType>();
if (inputs != null) {
for (OutputParameterType outputParameterType : outputs) {
outputMap.put(outputParameterType.getParameterName(), outputParameterType);
}
}
ArrayList<ParamObject> inputparams = op.getInputParms();
for (int y = 0; y < inputparams.size(); y++) {
ParamObject param = (ParamObject) inputparams.get(y);
InputParameterType inputParm = inputMap.get(param.getName());
if (inputParm == null) {
inputParm = method.addNewInputParameter();
}
inputParm.setParameterName(param.getName());
inputParm.setParameterDescription(param.getDesc());
InputDataType.Enum type = InputDataType.Enum.forString(param.getType());
inputParm.setParameterType(type);
}
ArrayList<ParamObject> outputparams = op.getOutputParms();
for (int y = 0; y < outputparams.size(); y++) {
ParamObject param = (ParamObject) outputparams.get(y);
OutputParameterType outputParm = outputMap.get(param.getName());
if (outputParm == null) {
outputParm = method.addNewOutputParameter();
}
outputParm.setParameterName(param.getName());
outputParm.setParameterDescription(param.getDesc());
OutputDataType.Enum type = OutputDataType.Enum.forString(param.getType());
outputParm.setParameterType(type);