use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class LiteralAdaptor method fromWPS2Input.
@Override
public T fromWPS2Input(DataOutput candidate) {
final Data data = candidate.getData();
final LiteralValue literalData = data.getLiteralData();
final String value = literalData.getValue();
return convert(value);
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class OctetStreamAdaptor method toWPS2Input.
@Override
public DataInput toWPS2Input(Path candidate) throws UnconvertibleObjectException {
if (candidate instanceof ReferenceProxy)
return super.toWPS2Input(candidate);
final byte[] bytes;
try {
bytes = Files.readAllBytes(candidate);
} catch (IOException ex) {
throw new UnconvertibleObjectException(ex.getMessage(), ex);
}
final String base64 = Base64.getEncoder().encodeToString(bytes);
final DataInput dit = new DataInput();
final Data data = new Data();
data.setEncoding("base64");
data.getContent().add(base64);
dit.setData(data);
return dit;
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class WKTAdaptor method toWPS2Input.
@Override
public DataInput toWPS2Input(Object candidate) throws UnconvertibleObjectException {
if (candidate instanceof ReferenceProxy)
return super.toWPS2Input(candidate);
final ComplexData cdt = new ComplexData();
cdt.getContent().add(new org.geotoolkit.wps.xml.v200.Format(encoding, mimeType, null, null));
Geometry geom = (Geometry) candidate;
int srid = 0;
int dimension = 2;
try {
CoordinateReferenceSystem crs = Geometries.wrap(geom).get().getCoordinateReferenceSystem();
if (crs != null) {
dimension = crs.getCoordinateSystem().getDimension();
final IdentifiedObjectFinder finder = IdentifiedObjects.newFinder("EPSG");
// TODO: Ensure no project strongly rely on that, then remove. It's pure non-sense/madness.
// Note: If you read this after march 2020: do not ask : delete.
finder.setIgnoringAxes(true);
final CoordinateReferenceSystem epsgcrs = (CoordinateReferenceSystem) finder.findSingleton(crs);
if (epsgcrs != null) {
srid = IdentifiedObjects.lookupEPSG(epsgcrs);
// force geometry in longitude first
final CoordinateReferenceSystem crs2 = ((AbstractCRS) crs).forConvention(AxesConvention.RIGHT_HANDED);
if (crs2 != crs) {
geom = org.apache.sis.internal.feature.jts.JTS.transform(geom, crs2);
}
if (crs2 != null)
dimension = crs2.getCoordinateSystem().getDimension();
}
}
} catch (FactoryException | MismatchedDimensionException | TransformException ex) {
throw new UnconvertibleObjectException(ex.getMessage(), ex);
}
// String wkt = geom.toText();
WKTWriter writer = new WKTWriter(dimension);
String wkt = writer.write(geom);
if (srid > 0) {
wkt = "SRID=" + srid + ";" + wkt;
}
cdt.getContent().add(wkt);
final Data data = new Data();
data.getContent().add(cdt);
final DataInput dit = new DataInput();
dit.setData(data);
return dit;
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class XMLAdaptor method toWPS2Input.
@Override
public DataInput toWPS2Input(Node candidate) throws UnconvertibleObjectException {
if (candidate instanceof ReferenceProxy) {
return super.toWPS2Input(candidate);
}
final ComplexData cdt = new ComplexData();
cdt.getContent().add(new org.geotoolkit.wps.xml.v200.Format(encoding, mimeType, schema, null));
if (candidate instanceof Document) {
candidate = ((Document) candidate).getDocumentElement();
}
cdt.getContent().add(candidate);
final Data data = new Data();
data.getContent().add(cdt);
final DataInput dit = new DataInput();
dit.setData(data);
return dit;
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project fiware-cygnus by telefonicaid.
the class NotifyContextRequestNGSIv2Deserializer method deserializeData.
private Data deserializeData(JsonObject jsonObject) {
Data data = new Data();
data.setId(jsonObject.get("id").getAsString());
data.setType(jsonObject.get("type").getAsString());
data.setAtributes(deserializeAttributes(jsonObject));
return data;
}
Aggregations