Search in sources :

Example 1 with AttributeFilterEquation

use of io.lumeer.api.model.AttributeFilterEquation in project engine by Lumeer.

the class AttributeFilterEquationCodec method convertFromDocument.

public static AttributeFilterEquation convertFromDocument(final Document document) {
    AttributeFilter filter = AttributeFilterCodec.convertFromDocument(document.get(FILTER, Document.class));
    String operator = document.getString(OPERATOR);
    List<AttributeFilterEquation> equations;
    List equationsList = document.get(EQUATIONS, List.class);
    if (equationsList != null) {
        equations = new ArrayList<Document>(equationsList).stream().map(AttributeFilterEquationCodec::convertFromDocument).collect(Collectors.toList());
    } else {
        equations = Collections.emptyList();
    }
    return new AttributeFilterEquation(equations, filter, operator);
}
Also used : AttributeFilterEquation(io.lumeer.api.model.AttributeFilterEquation) AttributeFilter(io.lumeer.api.model.AttributeFilter) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Document(org.bson.Document)

Example 2 with AttributeFilterEquation

use of io.lumeer.api.model.AttributeFilterEquation in project engine by Lumeer.

the class AttributeLockExceptionGroupCodec method convertFromDocument.

public static AttributeLockExceptionGroup convertFromDocument(final Document document) {
    AttributeFilterEquation equation = AttributeFilterEquationCodec.convertFromDocument(document.get(EQUATION, Document.class));
    List<String> typeValue = document.getList(TYPE_VALUE, String.class);
    String type = document.getString(TYPE);
    return new AttributeLockExceptionGroup(equation, typeValue, type);
}
Also used : AttributeFilterEquation(io.lumeer.api.model.AttributeFilterEquation) AttributeLockExceptionGroup(io.lumeer.api.model.AttributeLockExceptionGroup) Document(org.bson.Document)

Aggregations

AttributeFilterEquation (io.lumeer.api.model.AttributeFilterEquation)2 Document (org.bson.Document)2 AttributeFilter (io.lumeer.api.model.AttributeFilter)1 AttributeLockExceptionGroup (io.lumeer.api.model.AttributeLockExceptionGroup)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1