Search in sources :

Example 1 with AbstractEsParameter

use of org.n52.iceland.statistics.api.parameters.AbstractEsParameter in project arctic-sea by 52North.

the class DefaultElasticsearchSchemas method resolveParameterField.

private void resolveParameterField(AbstractEsParameter value, Map<String, Object> map) {
    if (value instanceof SingleEsParameter) {
        SingleEsParameter single = (SingleEsParameter) value;
        map.put(single.getName(), single.getTypeAsMap());
    } else if (value instanceof ObjectEsParameter) {
        ObjectEsParameter object = (ObjectEsParameter) value;
        // loadup all the children
        // the wrapper properties map is needed to elasticsearch
        Map<String, Object> subproperties = new HashMap<>(1);
        Map<String, Object> childrenMap = new HashMap<>(value.getAllChildren().size());
        subproperties.put(PROPERTIES_KEY, childrenMap);
        for (AbstractEsParameter child : object.getAllChildren()) {
            resolveParameterField(child, childrenMap);
        }
        map.put(object.getName(), subproperties);
    } else {
        throw new IllegalArgumentException("Invalid schema parameter value " + value.toString());
    }
}
Also used : ObjectEsParameter(org.n52.iceland.statistics.api.parameters.ObjectEsParameter) AbstractEsParameter(org.n52.iceland.statistics.api.parameters.AbstractEsParameter) SingleEsParameter(org.n52.iceland.statistics.api.parameters.SingleEsParameter) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 AbstractEsParameter (org.n52.iceland.statistics.api.parameters.AbstractEsParameter)1 ObjectEsParameter (org.n52.iceland.statistics.api.parameters.ObjectEsParameter)1 SingleEsParameter (org.n52.iceland.statistics.api.parameters.SingleEsParameter)1