Search in sources :

Example 1 with FunctionResourceType

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

the class FunctionRowCodec method decode.

@Override
public FunctionRow decode(final BsonReader reader, final DecoderContext decoderContext) {
    Document bson = documentCodec.decode(reader, decoderContext);
    String resourceId = bson.getString(RESOURCE_ID);
    FunctionResourceType type = FunctionResourceType.valueOf(bson.getString(TYPE));
    String attributeId = bson.getString(ATTRIBUTE_ID);
    String dependentCollectionId = bson.getString(DEPENDENT_COLLECTION_ID);
    String dependentLinkTypeId = bson.getString(DEPENDENT_LINK_TYPE_ID);
    String dependentAttributeId = bson.getString(DEPENDENT_ATTRIBUTE_ID);
    return new FunctionRow(resourceId, type, attributeId, dependentCollectionId, dependentLinkTypeId, dependentAttributeId);
}
Also used : FunctionResourceType(io.lumeer.api.model.function.FunctionResourceType) FunctionRow(io.lumeer.api.model.function.FunctionRow) Document(org.bson.Document)

Example 2 with FunctionResourceType

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

the class FunctionFacade method functionRowToParameter.

private FunctionParameterDocuments functionRowToParameter(FunctionRow row) {
    String resourceId = row.getDependentCollectionId() != null ? row.getDependentCollectionId() : row.getDependentLinkTypeId();
    FunctionResourceType type = row.getDependentCollectionId() != null ? FunctionResourceType.COLLECTION : FunctionResourceType.LINK;
    return new FunctionParameterDocuments(type, resourceId, row.getDependentAttributeId());
}
Also used : FunctionResourceType(io.lumeer.api.model.function.FunctionResourceType)

Aggregations

FunctionResourceType (io.lumeer.api.model.function.FunctionResourceType)2 FunctionRow (io.lumeer.api.model.function.FunctionRow)1 Document (org.bson.Document)1