super(ExecuteType.class, Wps10Factory.eINSTANCE);
}
@Override
public Object read(Object request, Map kvp, Map rawKvp) throws Exception {
ExecuteType execute = (ExecuteType) super.read(request, kvp, rawKvp);
Wps10Factory factory = Wps10Factory.eINSTANCE;
// grab the process, we need it to parse the data inputs
Name processName = Ows11Util.name(execute.getIdentifier());
ProcessFactory pf = GeoServerProcessors.createProcessFactory(processName);
if (pf == null) {
throw new WPSException("No such process: " + processName);
}
// parse inputs
List<InputType> inputs = parseDataInputs(pf.getParameterInfo(processName), (String) rawKvp.get("DataInputs"));
DataInputsType1 input1 = factory.createDataInputsType1();
input1.getInput().addAll(inputs);
execute.setDataInputs(input1);
if(rawKvp.containsKey("responseDocument")) {
execute.setResponseForm(parseResponseDocument(pf.getResultInfo(processName, null), (String) rawKvp.get("responseDocument")));
} else if(rawKvp.containsKey("rawDataOutput")) {
execute.setResponseForm(parseRawDataOutput(pf.getResultInfo(processName, null), (String) rawKvp.get("rawDataOutput")));
} else {
ResponseFormType responseForm = factory.createResponseFormType();
responseForm.setResponseDocument(factory.createResponseDocumentType());
execute.setResponseForm(responseForm);
}
if("true".equals(kvp.get("storeExecuteResponse"))) {
if(execute.getResponseForm().getResponseDocument() == null) {
throw new WPSException("InvalidParameterValue", "Cannot store the response for raw data outputs, " +
"please use response document instead");
}
execute.getResponseForm().getResponseDocument().setStoreExecuteResponse(true);
}
if("true".equals(kvp.get("lineage"))) {
if(execute.getResponseForm().getResponseDocument() == null) {
throw new WPSException("InvalidParameterValue", "Cannot provide lineage in the response for raw data outputs, " +
"please use response document instead");
}
execute.getResponseForm().getResponseDocument().setLineage(true);
}
if("true".equals(kvp.get("status"))) {
if(execute.getResponseForm().getResponseDocument() == null) {
throw new WPSException("InvalidParameterValue", "Cannot add status with raw data outputs, " +
"please use response document with store option instead");
}
if(!execute.getResponseForm().getResponseDocument().isStoreExecuteResponse()) {
throw new WPSException("InvalidParameterValue", "Cannot add status if the response " +
"is not stored, please add storeExecuteResponse=true your request");
}
execute.getResponseForm().getResponseDocument().setStatus(true);
}
return execute;
}