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); } } }
/** * 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()); } }
LiteralDataType data = input.addNewData().addNewLiteralData(); if (value == null) { throw new ExceptionReport("No value provided for literal: "