complex.setSupported( wpsf.createComplexDataCombinationsType() );
for ( ProcessParameterIO ppio : ppios ) {
ComplexPPIO cppio = (ComplexPPIO) ppio;
ComplexDataDescriptionType format = null;
if (ppio instanceof RawDataPPIO) {
String[] mimeTypes = AbstractRawData.getMimeTypes(p);
for (String mimeType : mimeTypes) {
ComplexDataDescriptionType ddt = wpsf
.createComplexDataDescriptionType();
ddt.setMimeType(mimeType);
// heuristic to figure out if a format is text based, or not, we
// might want to expose this as a separate annotation/property down the
// road
if (!mimeType.contains("json") && !mimeType.contains("text")
&& !mimeType.contains("xml") && !mimeType.contains("gml")) {
ddt.setEncoding("base64");
}
complex.getSupported().getFormat().add(ddt);
if (format == null) {
format = ddt;
}
}
} else {
format = wpsf.createComplexDataDescriptionType();
format.setMimeType(cppio.getMimeType());
if (cppio instanceof BinaryPPIO) {
format.setEncoding("base64");
}
// add to supported
complex.getSupported().getFormat().add(format);
}
//handle the default
if ( complex.getDefault() == null ) {
ComplexDataDescriptionType def = wpsf.createComplexDataDescriptionType();
def.setMimeType( format.getMimeType() );
complex.setDefault( wpsf.createComplexDataCombinationType() );
complex.getDefault().setFormat( def );
}
}