use of org.geotoolkit.wps.xml.v200.Data in project fiware-cygnus by telefonicaid.
the class NotifyContextRequestNGSIv2Deserializer method deserialize.
@Override
public NotifyContextRequestNGSIv2 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = json.getAsJsonObject();
String subscriptionId = jsonObject.get("subscriptionId").getAsString();
ArrayList<Data> data = deserializeAllData(jsonObject.getAsJsonArray("data"));
NotifyContextRequestNGSIv2 ncr = new NotifyContextRequestNGSIv2();
ncr.setSubscriptionId(subscriptionId);
ncr.setData(data);
return ncr;
}
use of org.geotoolkit.wps.xml.v200.Data in project geotoolkit by Geomatys.
the class ExecuteTest method testRequestAndMarshall.
@Test
public void testRequestAndMarshall() throws Exception {
final WebProcessingClient client = new WebProcessingClient(new URL("http://test.com"), null, WPSVersion.v100);
final ExecuteRequest request = client.createExecute();
final Execute execute = request.getContent();
final GeographicCRS epsg4326 = CommonCRS.WGS84.geographic();
final GeneralEnvelope env = new GeneralEnvelope(epsg4326);
env.setRange(0, 10, 10);
env.setRange(1, 10, 10);
execute.setIdentifier("identifier");
final List<DataInput> inputs = execute.getInput();
inputs.add(new DataInput("literal", new Data(new LiteralValue("10", null, null))));
inputs.add(new DataInput("bbox", new Data(new BoundingBoxType(env))));
inputs.add(new DataInput("complex", new Data(new Format("UTF-8", WPSMimeType.APP_GML.val(), WPSSchema.OGC_GML_3_1_1.getValue(), null), new PointType(new DirectPosition2D(epsg4326, 0, 0)))));
inputs.add(new DataInput("reference", new Reference("http://link.to/reference/", null, null)));
execute.getOutput().add(new OutputDefinition("output", false));
assertEquals("WPS", execute.getService());
assertEquals("1.0.0", execute.getVersion().toString());
assertEquals(execute.getIdentifier().getValue(), "identifier");
final StringWriter stringWriter = new StringWriter();
final Marshaller marshaller = WPSMarshallerPool.getInstance().acquireMarshaller();
marshaller.marshal(execute, stringWriter);
String result = stringWriter.toString();
try (final InputStream expected = expectedRequest()) {
assertXmlEquals(expected, result, "xmlns:*", "crs", "srsName");
}
WPSMarshallerPool.getInstance().recycle(marshaller);
}
use of org.geotoolkit.wps.xml.v200.Data in project geotoolkit by Geomatys.
the class WPS2Process method fillOutputs.
private static void fillOutputs(Parameters outParams, DataOutput out) {
if (out != null) {
final GeneralParameterDescriptor param = outParams.getDescriptor().descriptor(out.getId());
if (param instanceof ParameterDescriptorGroup) {
// expecting a complex output
final Parameters group = Parameters.castOrWrap(outParams.addGroup(out.getId()));
for (DataOutput output : out.getOutput()) {
fillOutputs(group, output);
}
} else {
// simple output
final ExtendedParameterDescriptor outDesc = (ExtendedParameterDescriptor) outParams.getDescriptor().descriptor(out.getId());
final DataAdaptor adaptor = (DataAdaptor) outDesc.getUserObject().get(DataAdaptor.USE_ADAPTOR);
final Object value = adaptor.fromWPS2Input(out);
outParams.getOrCreate(outDesc).setValue(value);
}
} else {
throw new UnsupportedOperationException("unsupported data type");
}
}
Aggregations