use of org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException in project arctic-sea by 52North.
the class SweCommonDecoderV20 method parseAbstractDataComponent.
private SweAbstractDataComponent parseAbstractDataComponent(AbstractDataComponentType abstractDataComponent) throws DecodingException {
SweAbstractDataComponent sosAbstractDataComponent = null;
if (abstractDataComponent instanceof BooleanType) {
sosAbstractDataComponent = parseBoolean((BooleanType) abstractDataComponent);
} else if (abstractDataComponent instanceof CategoryType) {
sosAbstractDataComponent = parseCategory((CategoryType) abstractDataComponent);
} else if (abstractDataComponent instanceof CountRangeType) {
sosAbstractDataComponent = parseCountRange((CountRangeType) abstractDataComponent);
} else if (abstractDataComponent instanceof CountType) {
sosAbstractDataComponent = parseCount((CountType) abstractDataComponent);
} else if (abstractDataComponent instanceof QuantityType) {
sosAbstractDataComponent = parseQuantity((QuantityType) abstractDataComponent);
} else if (abstractDataComponent instanceof QuantityRangeType) {
sosAbstractDataComponent = parseQuantityRange((QuantityRangeType) abstractDataComponent);
} else if (abstractDataComponent instanceof TextType) {
sosAbstractDataComponent = parseText((TextType) abstractDataComponent);
} else if (abstractDataComponent instanceof TimeType) {
sosAbstractDataComponent = parseTime((TimeType) abstractDataComponent);
} else if (abstractDataComponent instanceof TimeRangeType) {
sosAbstractDataComponent = parseTimeRange((TimeRangeType) abstractDataComponent);
} else if (abstractDataComponent instanceof VectorType) {
sosAbstractDataComponent = parseVector((VectorType) abstractDataComponent);
} else if (abstractDataComponent instanceof DataRecordType) {
SweDataRecord sosDataRecord = parseDataRecord((DataRecordType) abstractDataComponent);
DataRecordDocument dataRecordDoc = DataRecordDocument.Factory.newInstance(getXmlOptions());
dataRecordDoc.setDataRecord((DataRecordType) abstractDataComponent);
sosDataRecord.setXml(dataRecordDoc.xmlText(getXmlOptions()));
sosAbstractDataComponent = sosDataRecord;
} else if (abstractDataComponent instanceof DataArrayType) {
SweDataArray sosDataArray = parseDataArray((DataArrayType) abstractDataComponent);
DataArrayDocument dataArrayDoc = DataArrayDocument.Factory.newInstance(getXmlOptions());
dataArrayDoc.setDataArray1((DataArrayType) abstractDataComponent);
sosDataArray.setXml(dataArrayDoc.xmlText(getXmlOptions()));
sosAbstractDataComponent = sosDataArray;
} else {
throw new UnsupportedDecoderXmlInputException(this, abstractDataComponent);
}
if (sosAbstractDataComponent != null) {
if (abstractDataComponent.isSetDefinition()) {
sosAbstractDataComponent.setDefinition(abstractDataComponent.getDefinition());
}
if (abstractDataComponent.isSetDescription()) {
sosAbstractDataComponent.setDescription(abstractDataComponent.getDescription());
}
if (abstractDataComponent.isSetIdentifier()) {
sosAbstractDataComponent.setIdentifier(abstractDataComponent.getIdentifier());
}
if (abstractDataComponent.isSetLabel()) {
sosAbstractDataComponent.setLabel(abstractDataComponent.getLabel());
}
}
return sosAbstractDataComponent;
}
use of org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException in project arctic-sea by 52North.
the class SweCommonDecoderV20 method decode.
@Override
public Object decode(Object element) throws DecodingException {
if (element instanceof DataArrayPropertyType) {
final DataArrayPropertyType dataArrayPropertyType = (DataArrayPropertyType) element;
return parseAbstractDataComponent(dataArrayPropertyType.getDataArray1());
} else if (element instanceof DataRecordPropertyType) {
final DataRecordPropertyType dataRecordPropertyType = (DataRecordPropertyType) element;
return parseAbstractDataComponent(dataRecordPropertyType.getDataRecord());
} else if (element instanceof AbstractDataComponentDocument) {
return parseAbstractDataComponentDocument((AbstractDataComponentDocument) element);
} else if (element instanceof AbstractDataComponentType) {
return parseAbstractDataComponent((AbstractDataComponentType) element);
} else if (element instanceof Coordinate[]) {
return parseCoordinates((Coordinate[]) element);
} else if (element instanceof AnyScalarPropertyType[]) {
return parseAnyScalarPropertyTypeArray((AnyScalarPropertyType[]) element);
} else if (element instanceof TextEncodingDocument) {
final TextEncodingDocument textEncodingDoc = (TextEncodingDocument) element;
final SweTextEncoding sosTextEncoding = parseTextEncoding(textEncodingDoc.getTextEncoding());
sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
return sosTextEncoding;
} else if (element instanceof TextEncodingType) {
TextEncodingDocument textEncodingDoc = TextEncodingDocument.Factory.newInstance(getXmlOptions());
TextEncodingType textEncoding = (TextEncodingType) element;
textEncodingDoc.setTextEncoding(textEncoding);
SweTextEncoding sosTextEncoding = parseTextEncoding(textEncoding);
sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
return sosTextEncoding;
} else if (element instanceof TextPropertyType) {
return parseAbstractDataComponent(((TextPropertyType) element).getText());
} else if (element instanceof CountPropertyType) {
return parseAbstractDataComponent(((CountPropertyType) element).getCount());
} else if (element instanceof BooleanPropertyType) {
return parseAbstractDataComponent(((BooleanPropertyType) element).getBoolean());
} else if (element instanceof CategoryPropertyType) {
return parseAbstractDataComponent(((CategoryPropertyType) element).getCategory());
} else if (element instanceof QuantityPropertyType) {
return parseAbstractDataComponent(((QuantityPropertyType) element).getQuantity());
} else if (element instanceof DataStreamPropertyType) {
return parseDataStream(((DataStreamPropertyType) element).getDataStream());
} else if (element instanceof DataStreamType) {
return parseDataStream((DataStreamType) element);
} else if (element instanceof DataStreamDocument) {
return parseDataStream(((DataStreamDocument) element).getDataStream());
} else if (element instanceof XmlObject) {
throw new UnsupportedDecoderXmlInputException(this, (XmlObject) element);
} else {
throw new UnsupportedDecoderInputException(this, element);
}
}
use of org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException in project arctic-sea by 52North.
the class SwesDecoderv20 method decode.
@Override
public OwsServiceRequest decode(XmlObject xmlObject) throws DecodingException {
LOGGER.debug("REQUESTTYPE:" + xmlObject.getClass());
XmlHelper.validateDocument(xmlObject);
if (xmlObject instanceof DescribeSensorDocument) {
return parseDescribeSensor((DescribeSensorDocument) xmlObject);
} else if (xmlObject instanceof InsertSensorDocument) {
return parseInsertSensor((InsertSensorDocument) xmlObject);
} else if (xmlObject instanceof UpdateSensorDescriptionDocument) {
return parseUpdateSensorDescription((UpdateSensorDescriptionDocument) xmlObject);
} else if (xmlObject instanceof DeleteSensorDocument) {
return parseDeleteSensor((DeleteSensorDocument) xmlObject);
} else {
throw new UnsupportedDecoderXmlInputException(this, xmlObject);
}
}
use of org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException in project arctic-sea by 52North.
the class FesDecoderv20 method parseSpatialFilterType.
/**
* Parses the spatial filter of a request.
*
* @param xbSpatialOpsType
* XmlBean representing the feature of interest parameter of the
* request
* @return Returns SpatialFilter created from the passed foi request
* parameter
*
* @throws DecodingException
* * if creation of the SpatialFilter failed
*/
private SpatialFilter parseSpatialFilterType(SpatialOpsType xbSpatialOpsType) throws DecodingException {
SpatialFilter spatialFilter = new SpatialFilter();
try {
if (xbSpatialOpsType instanceof BBOXType) {
spatialFilter.setOperator(FilterConstants.SpatialOperator.BBOX);
BBOXType xbBBOX = (BBOXType) xbSpatialOpsType;
if (isValueReferenceExpression(xbBBOX.getExpression())) {
spatialFilter.setValueReference(parseValueReference(xbBBOX.getExpression()));
}
XmlCursor geometryCursor = xbSpatialOpsType.newCursor();
if (geometryCursor.toChild(GmlConstants.QN_ENVELOPE_32)) {
Object sosGeometry = decodeXmlObject(Factory.parse(geometryCursor.getDomNode()));
if (sosGeometry instanceof Geometry) {
spatialFilter.setGeometry((Geometry) sosGeometry);
} else if (sosGeometry instanceof ReferencedEnvelope) {
spatialFilter.setGeometry((ReferencedEnvelope) sosGeometry);
} else {
throw new UnsupportedDecoderXmlInputException(this, xbSpatialOpsType);
}
} else {
throw new DecodingException(Sos2Constants.GetObservationParams.spatialFilter, "The requested spatial filter operand is not supported by this SOS!");
}
geometryCursor.dispose();
} else {
throw new DecodingException(Sos2Constants.GetObservationParams.spatialFilter, "The requested spatial filter is not supported by this SOS!");
}
} catch (XmlException xmle) {
throw new DecodingException("Error while parsing spatial filter!", xmle);
}
return spatialFilter;
}
use of org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException in project arctic-sea by 52North.
the class FesDecoderv20 method parseBinaryComparisonFilter.
private ComparisonFilter parseBinaryComparisonFilter(BinaryComparisonOpType comparisonOpsType) throws DecodingException {
ComparisonFilter comparisonFilter = new ComparisonFilter();
String localName = XmlHelper.getLocalName(comparisonOpsType);
if (ComparisonOperator.PropertyIsEqualTo.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsEqualTo);
} else if (ComparisonOperator.PropertyIsNotEqualTo.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsNotEqualTo);
} else if (ComparisonOperator.PropertyIsLessThan.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsLessThan);
} else if (ComparisonOperator.PropertyIsGreaterThan.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsGreaterThan);
} else if (ComparisonOperator.PropertyIsLessThanOrEqualTo.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsLessThanOrEqualTo);
} else if (ComparisonOperator.PropertyIsGreaterThanOrEqualTo.name().equals(localName)) {
comparisonFilter.setOperator(ComparisonOperator.PropertyIsGreaterThanOrEqualTo);
} else {
throw new UnsupportedDecoderXmlInputException(this, comparisonOpsType);
}
if (comparisonOpsType.isSetMatchCase()) {
comparisonFilter.setMatchCase(comparisonOpsType.getMatchCase());
}
parseExpressions(comparisonOpsType.getExpressionArray(), comparisonFilter);
return comparisonFilter;
}
Aggregations