Search in sources :

Example 1 with AttributeLockExceptionGroup

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

the class AttributeLockCodec method convertFromDocument.

public static AttributeLock convertFromDocument(final Document document) {
    if (document == null) {
        return null;
    }
    boolean locked = document.getBoolean(LOCKED, false);
    List<AttributeLockExceptionGroup> exceptionGroups;
    List groupsList = document.get(EXCEPTION_GROUPS, List.class);
    if (groupsList != null) {
        exceptionGroups = new ArrayList<Document>(groupsList).stream().map(AttributeLockExceptionGroupCodec::convertFromDocument).collect(Collectors.toList());
    } else {
        exceptionGroups = Collections.emptyList();
    }
    return new AttributeLock(exceptionGroups, locked);
}
Also used : ArrayList(java.util.ArrayList) AttributeLockExceptionGroup(io.lumeer.api.model.AttributeLockExceptionGroup) ArrayList(java.util.ArrayList) List(java.util.List) AttributeLock(io.lumeer.api.model.AttributeLock)

Example 2 with AttributeLockExceptionGroup

use of io.lumeer.api.model.AttributeLockExceptionGroup 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

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