diff --git a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/input/type/LiteralInputType.java b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/input/type/LiteralInputType.java index d7302b2796..755e7e87eb 100644 --- a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/input/type/LiteralInputType.java +++ b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/input/type/LiteralInputType.java @@ -55,6 +55,8 @@ public class LiteralInputType extends InputType { private ValueWithRef dataType; + private String defaultValue; + private ValueWithRef defaultUom; private ValueWithRef[] supportedUoms; @@ -69,7 +71,7 @@ public class LiteralInputType extends InputType { private boolean anyValue; - private ValueWithRef reference; + private ValueWithRef valuesReference; /** * Creates a new {@link LiteralInputType} instance. @@ -85,20 +87,21 @@ public class LiteralInputType extends InputType { * @param allowedValues * @param range * @param anyValue - * @param reference + * @param valuesReference */ public LiteralInputType( CodeType id, LanguageString inputTitle, LanguageString inputAbstract, String minOccurs, - String maxOccurs, ValueWithRef dataType, ValueWithRef defaultUom, + String maxOccurs, ValueWithRef dataType, String defaultValue, ValueWithRef defaultUom, ValueWithRef[] supportedUoms, String[] allowedValues, Range[] range, boolean anyValue, ValueWithRef reference ) { super( id, inputTitle, inputAbstract, minOccurs, maxOccurs ); this.dataType = dataType; + this.defaultValue = defaultValue; this.defaultUom = defaultUom; this.supportedUoms = supportedUoms; this.allowedValues = allowedValues; this.range = range; this.anyValue = anyValue; - this.reference = reference; + this.valuesReference = reference; } @Override @@ -160,4 +163,23 @@ public ValueWithRef[] getSupportedUoms() { public boolean isAnyValue() { return anyValue; } + + /** + * Returns the default value for the literal input as a String. + * + * @return Default value for the literal input. + */ + public String getDefaultValue() { + return defaultValue; + } + + /** + * Returns the values reference that references an externally defined finite set of values and ranges for the + * literal input. + * + * @return Values reference for the literal input. + */ + public ValueWithRef getValuesReference() { + return valuesReference; + } } diff --git a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/process/ProcessDetails.java b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/process/ProcessDetails.java index 82f5f7d2f9..7531185ecc 100644 --- a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/process/ProcessDetails.java +++ b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/main/java/org/deegree/protocol/wps/client/process/ProcessDetails.java @@ -315,6 +315,9 @@ private LiteralInputType parseLiteralData( OMElement input, CodeType id, Languag String dataTypeRefStr = omDataType.getAttributeValue( new QName( owsNS, "reference" ) ); ValueWithRef dataType = new ValueWithRef( dataTypeStr, dataTypeRefStr ); + OMElement omDefaultValue = input.getFirstChildWithName( new QName( null, "DefaultValue" ) ); + String defaultValue = omDefaultValue == null ? null : omDefaultValue.getText(); + XPath xpath = new XPath( "UOMs/Default/ows:UOM", nsContext ); OMElement omDefaultUom = omResponse.getElement( input, xpath ); ValueWithRef defaultUom = null; @@ -382,8 +385,8 @@ private LiteralInputType parseLiteralData( OMElement input, CodeType id, Languag if ( rangeList != null ) { rangeArray = rangeList.toArray( new Range[rangeList.size()] ); } - return new LiteralInputType( id, inputTitle, inputAbstract, minOccurs, maxOccurs, dataType, defaultUom, - supportedUom, valuesArray, rangeArray, anyValue, valuesRef ); + return new LiteralInputType( id, inputTitle, inputAbstract, minOccurs, maxOccurs, dataType, defaultValue, + defaultUom, supportedUom, valuesArray, rangeArray, anyValue, valuesRef ); } private InputType parseComplexData( OMElement input, CodeType id, LanguageString inputTitle, diff --git a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/test/java/org/deegree/protocol/wps/client/WPSClientTest.java b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/test/java/org/deegree/protocol/wps/client/WPSClientTest.java index 645f8ca348..290032e333 100644 --- a/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/test/java/org/deegree/protocol/wps/client/WPSClientTest.java +++ b/deegree-core/deegree-core-protocol/deegree-protocol-commons/src/test/java/org/deegree/protocol/wps/client/WPSClientTest.java @@ -622,4 +622,32 @@ public void testFailedExecute_2() execution.executeAsync(); Assert.assertTrue(execution.getState() != ExecutionState.SUCCEEDED); // we shouldn't arrive here } + + @Test + public void testProcessDescriptionWithDefaultValue() + throws OWSExceptionReport, IOException { + + String demoWPSURL = TestProperties.getProperty( "demo_wps_url2" ); + String demoWPSProcessorName = TestProperties.getProperty( "demo_wps_def_processor" ); + Assume.assumeNotNull( demoWPSURL ); + Assume.assumeNotNull( demoWPSProcessorName ); + + WPSClient wpsClient = new WPSClient( new URL( demoWPSURL ) ); + + org.deegree.protocol.wps.client.process.Process p1 = wpsClient.getProcess( demoWPSProcessorName ); + + Assert.assertNotNull( p1 ); + + boolean foundDefaultValue = false; + + for ( InputType inputType : p1.getInputTypes() ) { + if ( inputType instanceof LiteralInputType ) { + LiteralInputType literal = (LiteralInputType) inputType; + if ( literal.getDefaultValue() != null ) + foundDefaultValue = true; + } + } + + Assert.assertTrue( "Could not find default value for any of the literal inputs", foundDefaultValue ); + } }