// skip the output mime choice params, they will be filled automatically by WPS
if (outputMimeParameters.contains(p.key)) {
continue;
}
InputDescriptionType input = wpsf.createInputDescriptionType();
inputs.getInput().add( input );
input.setIdentifier( Ows11Util.code( p.key ) );
input.setTitle( Ows11Util.languageString( p.title ) );
input.setAbstract( Ows11Util.languageString( p.description ) );
// WPS spec specifies non-negative for unlimited inputs, so -1 -> 0
input.setMaxOccurs( p.maxOccurs == -1
? BigInteger.valueOf( Long.MAX_VALUE ) : BigInteger.valueOf( p.maxOccurs ) );
input.setMinOccurs( BigInteger.valueOf( p.minOccurs ) );
List<ProcessParameterIO> ppios = ProcessParameterIO.findAll( p, context);
if ( ppios.isEmpty() ) {
throw new WPSException( "Could not find process parameter for type " + p.key + "," + p.type );
}
//handle the literal case
if (ppios.get( 0 ) instanceof LiteralPPIO ) {
LiteralPPIO lppio = (LiteralPPIO) ppios.get( 0 );
LiteralInputType literal = wpsf.createLiteralInputType();
input.setLiteralData( literal );
// map the java class to an xml type name
if ( !String.class.equals(lppio.getType()) ) {
Class type = lppio.getType();
if(PRIMITIVE_TO_WRAPPER.containsKey(type)) {
type = PRIMITIVE_TO_WRAPPER.get(type);
}
Name typeName = xsp.name(type);
if ( typeName != null ) {
literal.setDataType(Ows11Util.type("xs:" + typeName.getLocalPart()));
}
}
if (p.metadata.get(Parameter.OPTIONS) != null) {
List<Object> options = (List<Object>) p.metadata.get(Parameter.OPTIONS);
Object[] optionsArray = options.toArray(new Object[options.size()]);
addAllowedValues(literal, optionsArray);
} else if (lppio.getType().isEnum()) {
Object[] enumValues = lppio.getType().getEnumConstants();
addAllowedValues(literal, enumValues);
} else {
literal.setAnyValue( owsf.createAnyValueType() );
}
try {
if (p.sample != null) {
literal.setDefaultValue(lppio.encode(p.sample));
}
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to fill the default value for input " + p.key
+ " of process " + name, e);
}
} else if(ppios.get( 0 ) instanceof BoundingBoxPPIO) {
input.setBoundingBoxData(buildSupportedCRSType());
} else {
//handle the complex data case
SupportedComplexDataInputType complex = wpsf.createSupportedComplexDataInputType();
input.setComplexData( complex );
complex.setSupported( wpsf.createComplexDataCombinationsType() );
for ( ProcessParameterIO ppio : ppios ) {
ComplexPPIO cppio = (ComplexPPIO) ppio;