if (inputParameter.getData().getComplexData() != null) pSerializedInputData.put(inputId, dataList); else if (inputParameter.getData().getLiteralData() != null) pSerializedInputData.put(inputId, dataList); else if (inputParameter.getData().getBoundingBoxData() != null)
throw new ExceptionReport("Unable to generate encoding " + encoding, ExceptionReport.NO_APPLICABLE_CODE); complexData = output.addNewData().addNewComplexData(); if(mimeType.contains("xml") || mimeType.contains("XML")){ complexData.set(XmlObject.Factory.parse(stream));
/** * Add literal data to the request * @param parameterID the ID of the input paramter according to the describe process * @param value the value. other types than strings have to be converted to string. The datatype is automatically determined and set accordingly to the process description */ public void addLiteralData(String parameterID, String value) { InputDescriptionType inputDesc = this.getParameterDescription(parameterID); if (inputDesc == null) { throw new IllegalArgumentException("inputDescription is null for: " + parameterID); } if (inputDesc.getLiteralData() == null) { throw new IllegalArgumentException("inputDescription is not of type literalData: " + parameterID); } InputType input = execute.getExecute().getDataInputs().addNewInput(); input.addNewIdentifier().setStringValue(parameterID); input.addNewData().addNewLiteralData().setStringValue(value); DomainMetadataType dataType = inputDesc.getLiteralData().getDataType(); if (dataType != null) { input.getData().getLiteralData().setDataType(dataType.getReference()); } }
if(input.getData().isSetComplexData()){ ComplexDataType complexData = input.getData().getComplexData(); request = request + "=" + URLEncoder.encode(input.getData().getComplexData().xmlText(), "UTF-8"); if(complexData.isSetEncoding()){ request = request + "@encoding="+complexData.getEncoding(); if(input.getData().isSetLiteralData()){ LiteralDataType literalData = input.getData().getLiteralData(); request = request + "=" + literalData.getStringValue(); if(literalData.isSetDataType()){
schema = pInputParameter.getData().getComplexData().getSchema(); encoding = pInputParameter.getData().getComplexData().getEncoding(); mimeType = pInputParameter.getData().getComplexData().getMimeType();
/** * @param pInput * @param pProcessDescription * @param pExecuteDocument * @param pInputParameter * @return * @throws ExceptionReport */ private IData createDeserializedLiteralData(ProcessDescriptionType pProcessDescription, ExecuteDocument pExecuteDocument, InputType pInputParameter, Map<String, List<String>> pSerializedInputData) throws ExceptionReport { String inputId = pInputParameter.getIdentifier().getStringValue(); String xmlDataType = pInputParameter.getData().getLiteralData().getDataType(); if (xmlDataType == null) { InputDescriptionType inputDescription = null; for (InputDescriptionType tempInputDescription : pProcessDescription.getDataInputs().getInputArray()) { if (inputId.equals(tempInputDescription.getIdentifier().getStringValue())) { inputDescription = tempInputDescription; break; } } xmlDataType = inputDescription.getLiteralData().getDataType().getReference(); } String data = pSerializedInputData.get(inputId).get(0); return BasicXMLTypeFactory.getBasicJavaObject(xmlDataType, data); }
ComplexDataType data = input.addNewData().addNewComplexData(); LiteralDataType data = input.addNewData().addNewLiteralData(); if (value == null) { throw new ExceptionReport("No value provided for literal: " BoundingBoxType data = input.addNewData().addNewBoundingBoxData(); String[] values = value.split(",");
/** * Handles BBoxValue * @param input The client input */ private void handleBBoxValue(InputType input) throws ExceptionReport { IData envelope = parseBoundingBox(input.getData().getBoundingBoxData()); List<IData> resultList = inputData.get(input.getIdentifier() .getStringValue()); if (resultList == null) { inputData.put(input.getIdentifier().getStringValue(), resultList = new ArrayList<IData>(1)); } resultList.add(envelope); }
public void updateResponseForLiteralData(ExecuteResponseDocument res, String dataTypeReference){ OutputDataType output = prepareOutput(res); String processValue = BasicXMLTypeFactory.getStringRepresentation(dataTypeReference, obj); LiteralDataType literalData = output.addNewData().addNewLiteralData(); if (dataTypeReference != null) { literalData.setDataType(dataTypeReference); } literalData.setStringValue(processValue); if(obj instanceof AbstractLiteralDataBinding){ String uom = ((AbstractLiteralDataBinding)obj).getUnitOfMeasurement(); if(uom != null && !uom.equals("")){ literalData.setUom(uom); } } }
public void updateResponseForBBOXData(ExecuteResponseDocument res, IBBOXData bbox) { OutputDataType output = prepareOutput(res); BoundingBoxType bboxData = output.addNewData().addNewBoundingBoxData(); if (bbox.getCRS() != null) { bboxData.setCrs(bbox.getCRS()); } bboxData.setLowerCorner(Doubles.asList(bbox.getLowerCorner())); bboxData.setUpperCorner(Doubles.asList(bbox.getUpperCorner())); bboxData.setDimensions(BigInteger.valueOf(bbox.getDimension())); } }
/** * delivers the parsed ComplexData by index * @param index index of the output element starting with 0 * @param binding Class of the output binding, e.g. GenericFileDataBinding * @return the parsed ComplexData in the requested format defined by the binding * @throws WPSClientException */ public IData getComplexDataByIndex(int index, Class<?> binding) throws WPSClientException { ExecuteResponseDocument doc = null; if(response instanceof ExecuteResponseDocument){ doc = (ExecuteResponseDocument) response; }else{ throw new WPSClientException("Output cannot be determined by index since it is either raw data or an exception report"); } OutputDataType[] outputs = doc.getExecuteResponse().getProcessOutputs().getOutputArray(); int counter = 0; for(OutputDataType output : outputs) { if(output.getData().getComplexData() != null) { if(counter == index) { return this.parseProcessOutput(output.getIdentifier().getStringValue(), binding); } counter ++; } } return null; }
String parameter = input.getData().getLiteralData().getStringValue(); String xmlDataType = input.getData().getLiteralData().getDataType(); String uom = input.getData().getLiteralData().getUom(); boolean foundAllowedValue = false; for(ValueType allowedValue : allowedValues){ if(input.getData().getLiteralData().getStringValue().equals(allowedValue.getStringValue())){ foundAllowedValue = true;
if (inputParameter.getData().getComplexData() != null) pDeSerializedInputData.put(inputId, dataList); else if (inputParameter.getData().getLiteralData() != null) pDeSerializedInputData.put(inputId, dataList); else if (inputParameter.getData().getBoundingBoxData() != null)
schema = pInputParameter.getData().getComplexData().getSchema(); encoding = pInputParameter.getData().getComplexData().getEncoding(); mimeType = pInputParameter.getData().getComplexData().getMimeType();
/** * @param pInput * @param pProcessDescription * @param pExecuteDocument * @param pInputParameter * @return * @throws ExceptionReport */ private String createSerializedLiteralData(WebProcessingServiceInput pInput, ProcessDescriptionType pProcessDescription, ExecuteDocument pExecuteDocument, InputType pInputParameter) throws ExceptionReport { String inputId = pInputParameter.getIdentifier().getStringValue(); String xmlDataType = pInputParameter.getData().getLiteralData().getDataType(); if (xmlDataType == null) { InputDescriptionType inputDescription = null; for (InputDescriptionType tempInputDescription : pProcessDescription.getDataInputs().getInputArray()) { if (inputId.equals(tempInputDescription.getIdentifier().getStringValue())) { inputDescription = tempInputDescription; break; } } xmlDataType = inputDescription.getLiteralData().getDataType().getReference(); } IData data = pInput.getInputData().get(inputId).get(0); return BasicXMLTypeFactory.getStringRepresentation(xmlDataType, data); }
throw new WPSClientException("Encoding not supported"); ComplexDataType data = input.addNewData().addNewComplexData();
if(input.getData().getComplexData() != null) { handleComplexData(input, inputId); else if(input.getData().getLiteralData() != null) { handleLiteralData(input); else if(input.getData().getBoundingBoxData() != null) { handleBBoxValue(input);
try { NodeList candidateNodes = processOutput.getData().getComplexData().getDomNode().getChildNodes();
&& input.getData().getLiteralData() != null) { if (input.getData().getLiteralData().getDataType() != null) { if (inputDesc.getLiteralData() != null) if (inputDesc.getLiteralData().getDataType() != null) if (!input .getData() .getLiteralData() .getDataType() .equals( inputDesc .getLiteralData() .getDataType() .getReference())) { + input .getData() .getLiteralData() .getDataType() + " for input "
/** * add an input element. sets the data in the xml request * * @param parameterID the ID of the input (see process description) * @param value the actual value as String (for xml data xml for binary data is should be base64 encoded data) * @param schema schema if applicable otherwise null * @param encoding encoding if not the default encoding (for default encoding set it to null) (i.e. binary data, use base64) * @param mimeType mimetype of the data, has to be set * @throws WPSClientException */ public void addComplexData(String parameterID, String value, String schema, String encoding, String mimeType) throws WPSClientException { InputDescriptionType inputDesc = getParameterDescription(parameterID); if (inputDesc == null) { throw new IllegalArgumentException("inputDesription is null for: " + parameterID); } if (inputDesc.getComplexData() == null) { throw new IllegalArgumentException("inputDescription is not of type ComplexData: " + parameterID); } InputType input = execute.getExecute().getDataInputs().addNewInput(); input.addNewIdentifier().setStringValue(inputDesc.getIdentifier().getStringValue()); ComplexDataType data = input.addNewData().addNewComplexData(); setComplexData(data, value, schema, mimeType, encoding); }