Search in sources :

Example 1 with RequestResponseModifier

use of org.n52.iceland.convert.RequestResponseModifier in project arctic-sea by 52North.

the class GenericRequestOperator method checkForModifierAndProcess.

private void checkForModifierAndProcess(OwsServiceRequest request, OwsServiceResponse response) throws OwsExceptionReport {
    if (!this.modifierRepository.hasRequestResponseModifier(request, response)) {
        return;
    }
    List<RequestResponseModifier> defaultModifier = new LinkedList<>();
    List<RequestResponseModifier> remover = new LinkedList<>();
    List<RequestResponseModifier> merger = new LinkedList<>();
    this.modifierRepository.getRequestResponseModifier(request, response).stream().forEach(modifier -> {
        if (modifier.getFacilitator().isMerger()) {
            merger.add(modifier);
        } else if (modifier.getFacilitator().isAdderRemover()) {
            remover.add(modifier);
        } else {
            defaultModifier.add(modifier);
        }
    });
    // execute merger
    for (RequestResponseModifier modifier : merger) {
        modifier.modifyResponse(request, response);
    }
    // execute default
    for (RequestResponseModifier modifier : defaultModifier) {
        modifier.modifyResponse(request, response);
    }
    // execute adder/remover
    for (RequestResponseModifier modifier : remover) {
        modifier.modifyResponse(request, response);
    }
}
Also used : RequestResponseModifier(org.n52.iceland.convert.RequestResponseModifier) LinkedList(java.util.LinkedList)

Example 2 with RequestResponseModifier

use of org.n52.iceland.convert.RequestResponseModifier in project arctic-sea by 52North.

the class GenericRequestOperator method checkForModifierAndProcess.

private void checkForModifierAndProcess(OwsServiceRequest request) throws OwsExceptionReport {
    if (!this.modifierRepository.hasRequestResponseModifier(request)) {
        return;
    }
    List<RequestResponseModifier> splitter = new LinkedList<>();
    List<RequestResponseModifier> remover = new LinkedList<>();
    List<RequestResponseModifier> defaultModifier = new LinkedList<>();
    this.modifierRepository.getRequestResponseModifier(request).stream().forEach(modifier -> {
        if (modifier.getFacilitator().isSplitter()) {
            splitter.add(modifier);
        } else if (modifier.getFacilitator().isAdderRemover()) {
            remover.add(modifier);
        } else {
            defaultModifier.add(modifier);
        }
    });
    // execute adder/remover
    for (RequestResponseModifier modifier : remover) {
        modifier.modifyRequest(request);
    }
    // execute default
    for (RequestResponseModifier modifier : defaultModifier) {
        modifier.modifyRequest(request);
    }
    // execute splitter
    for (RequestResponseModifier modifier : splitter) {
        modifier.modifyRequest(request);
    }
}
Also used : RequestResponseModifier(org.n52.iceland.convert.RequestResponseModifier) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)2 RequestResponseModifier (org.n52.iceland.convert.RequestResponseModifier)2