Search in sources :

Example 1 with RequestMethodType

use of net.opengis.ows.v_1_0_0.RequestMethodType in project ddf by codice.

the class CswEndpoint method buildOperation.

/**
 * Creates an Operation object for the OperationsMetadata section TODO: We currently don't use the
 * constraint or metadata elements, those can be added in as desired
 *
 * @param name The name of the operation
 * @param types The request types supported (GET/POST)
 * @return The constructed Operation object
 */
private Operation buildOperation(String name, List<QName> types) {
    Operation op = new Operation();
    op.setName(name);
    ArrayList<DCP> dcpList = new ArrayList<>();
    DCP dcp = new DCP();
    HTTP http = new HTTP();
    for (QName type : types) {
        RequestMethodType rmt = new RequestMethodType();
        rmt.setHref(uri.getBaseUri().toASCIIString());
        JAXBElement<RequestMethodType> requestElement = new JAXBElement<>(type, RequestMethodType.class, rmt);
        if (type.equals(CswConstants.POST)) {
            requestElement.getValue().getConstraint().add(createDomainType(CswConstants.POST_ENCODING, CswConstants.XML));
        }
        http.getGetOrPost().add(requestElement);
    }
    dcp.setHTTP(http);
    dcpList.add(dcp);
    op.setDCP(dcpList);
    return op;
}
Also used : DCP(net.opengis.ows.v_1_0_0.DCP) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) HTTP(net.opengis.ows.v_1_0_0.HTTP) Operation(net.opengis.ows.v_1_0_0.Operation) JAXBElement(javax.xml.bind.JAXBElement) RequestMethodType(net.opengis.ows.v_1_0_0.RequestMethodType)

Example 2 with RequestMethodType

use of net.opengis.ows.v_1_0_0.RequestMethodType in project arctic-sea by 52North.

the class OwsEncoderv110 method encodeOwsDCP.

private void encodeOwsDCP(OwsDCP dcp, DCP xdcp) {
    if (dcp.isHTTP()) {
        HTTP xhttp = xdcp.addNewHTTP();
        OwsHttp http = dcp.asHTTP();
        SortedSet<OwsRequestMethod> requestMethods = http.getRequestMethods();
        requestMethods.forEach(method -> {
            RequestMethodType xmethod;
            switch(method.getHttpMethod()) {
                case HTTPMethods.GET:
                    xmethod = xhttp.addNewGet();
                    break;
                case HTTPMethods.POST:
                    xmethod = xhttp.addNewPost();
                    break;
                default:
                    return;
            }
            encodeOnlineResource(method, xmethod);
            method.getConstraints().forEach(x -> encodeOwsDomain(x, xmethod.addNewConstraint()));
        });
    }
}
Also used : OwsHttp(org.n52.shetland.ogc.ows.OwsHttp) HTTP(net.opengis.ows.x11.HTTPDocument.HTTP) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) RequestMethodType(net.opengis.ows.x11.RequestMethodType)

Aggregations

ArrayList (java.util.ArrayList)1 JAXBElement (javax.xml.bind.JAXBElement)1 QName (javax.xml.namespace.QName)1 DCP (net.opengis.ows.v_1_0_0.DCP)1 HTTP (net.opengis.ows.v_1_0_0.HTTP)1 Operation (net.opengis.ows.v_1_0_0.Operation)1 RequestMethodType (net.opengis.ows.v_1_0_0.RequestMethodType)1 HTTP (net.opengis.ows.x11.HTTPDocument.HTTP)1 RequestMethodType (net.opengis.ows.x11.RequestMethodType)1 OwsHttp (org.n52.shetland.ogc.ows.OwsHttp)1 OwsRequestMethod (org.n52.shetland.ogc.ows.OwsRequestMethod)1