Search in sources :

Example 11 with XmlString

use of org.apache.xmlbeans.XmlString in project arctic-sea by 52North.

the class Soap12Encoder method createFault.

private XmlObject createFault(final SoapFault soapFault) {
    final FaultDocument faultDoc = FaultDocument.Factory.newInstance();
    final Fault fault = faultDoc.addNewFault();
    fault.addNewCode().setValue(soapFault.getFaultCode());
    final Reasontext addNewText = fault.addNewReason().addNewText();
    addNewText.setLang(soapFault.getLocale().getDisplayLanguage());
    addNewText.setStringValue(soapFault.getFaultReason());
    if (soapFault.getDetailText() != null) {
        final XmlString xmlString = XmlString.Factory.newInstance();
        xmlString.setStringValue(soapFault.getDetailText());
        fault.addNewDetail().set(xmlString);
    }
    return faultDoc;
}
Also used : FaultDocument(org.w3.x2003.x05.soapEnvelope.FaultDocument) Reasontext(org.w3.x2003.x05.soapEnvelope.Reasontext) XmlString(org.apache.xmlbeans.XmlString) SoapFault(org.n52.shetland.w3c.soap.SoapFault) Fault(org.w3.x2003.x05.soapEnvelope.Fault)

Example 12 with XmlString

use of org.apache.xmlbeans.XmlString in project arctic-sea by 52North.

the class FesDecoderV20Test method should_parse_PropertyIsEqualTo_Filter.

/**
 * Test PropertyIsEqualTo filter decoding
 *
 * @throws OwsExceptionReport
 */
@Test
public void should_parse_PropertyIsEqualTo_Filter() throws DecodingException {
    PropertyIsEqualToDocument propertyIsEqualToDoc = PropertyIsEqualToDocument.Factory.newInstance();
    BinaryComparisonOpType propertyIsEqualToType = propertyIsEqualToDoc.addNewPropertyIsEqualTo();
    // valueReference
    XmlString valueReference = (XmlString) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_VALUE_REFERENCE, XmlString.type);
    valueReference.setStringValue(TEST_VALUE_REFERENCE);
    // literal
    LiteralType literalType = (LiteralType) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_LITERAL, LiteralType.type);
    XmlString newInstance = XmlString.Factory.newInstance();
    newInstance.setStringValue(TEST_LITERAL);
    literalType.set(newInstance);
    // create document
    FilterDocument filterDoc = FilterDocument.Factory.newInstance();
    FilterType filterType = filterDoc.addNewFilter();
    filterType.setComparisonOps(propertyIsEqualToType);
    filterType.getComparisonOps().substitute(FilterConstants.QN_PROPERTY_IS_EQUAL_TO, BinaryComparisonOpType.type);
    ComparisonFilter comparisonFilter = (ComparisonFilter) decoder.decode(filterDoc);
    // test
    assertThat(comparisonFilter.getOperator(), is(FilterConstants.ComparisonOperator.PropertyIsEqualTo));
    assertThat(comparisonFilter.getValueReference(), is(TEST_VALUE_REFERENCE));
    assertThat(comparisonFilter.getValue(), is(TEST_LITERAL));
}
Also used : PropertyIsEqualToDocument(net.opengis.fes.x20.PropertyIsEqualToDocument) FilterType(net.opengis.fes.x20.FilterType) ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) XmlString(org.apache.xmlbeans.XmlString) LiteralType(net.opengis.fes.x20.LiteralType) FilterDocument(net.opengis.fes.x20.FilterDocument) BinaryComparisonOpType(net.opengis.fes.x20.BinaryComparisonOpType) Test(org.junit.jupiter.api.Test)

Example 13 with XmlString

use of org.apache.xmlbeans.XmlString in project arctic-sea by 52North.

the class GetResultResponseEncoder method create.

@Override
protected XmlObject create(GetResultResponse response) throws EncodingException {
    GetResultResponseDocument doc = GetResultResponseDocument.Factory.newInstance(getXmlOptions());
    GetResultResponseType gtr = doc.addNewGetResultResponse();
    if (response.hasExtensions()) {
        createExtension(gtr, response.getExtensions());
    }
    XmlObject resultValues = gtr.addNewResultValues();
    if (response.hasResultValues()) {
        XmlString xmlString = XmlString.Factory.newInstance();
        xmlString.setStringValue(response.getResultValues());
        resultValues.set(xmlString);
    }
    return doc;
}
Also used : GetResultResponseDocument(net.opengis.sos.x20.GetResultResponseDocument) GetResultResponseType(net.opengis.sos.x20.GetResultResponseType) XmlString(org.apache.xmlbeans.XmlString) XmlObject(org.apache.xmlbeans.XmlObject)

Example 14 with XmlString

use of org.apache.xmlbeans.XmlString in project arctic-sea by 52North.

the class InsertResultRequestEncoder method addResultValues.

private void addResultValues(InsertResultRequest request, InsertResultType insertResult) {
    XmlString xbString = XmlString.Factory.newInstance(getXmlOptions());
    xbString.setStringValue(request.getResultValues());
    insertResult.setResultValues(xbString);
}
Also used : XmlString(org.apache.xmlbeans.XmlString)

Aggregations

XmlString (org.apache.xmlbeans.XmlString)14 XmlObject (org.apache.xmlbeans.XmlObject)6 XmlException (org.apache.xmlbeans.XmlException)4 BigInteger (java.math.BigInteger)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)3 SoapFault (org.n52.shetland.w3c.soap.SoapFault)3 Lists (com.google.common.collect.Lists)2 URI (java.net.URI)2 Collections (java.util.Collections)2 List (java.util.List)2 Set (java.util.Set)2 Collectors.joining (java.util.stream.Collectors.joining)2 QName (javax.xml.namespace.QName)2 XmlBoolean (org.apache.xmlbeans.XmlBoolean)2 XmlCursor (org.apache.xmlbeans.XmlCursor)2 XmlInteger (org.apache.xmlbeans.XmlInteger)2 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)2 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)2