use of org.eclipse.vorto.core.api.model.BuilderUtils.FunctionblockBuilder in project vorto by eclipse.
the class ModelContentToEcoreConverter method convertFunctionblock.
private org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel convertFunctionblock(FunctionblockModel model, ModelContent context) {
FunctionblockBuilder builder = BuilderUtils.newFunctionblock(new ModelId(ModelType.Functionblock, model.getId().getName(), model.getId().getNamespace(), model.getId().getVersion()));
builder.withCategory(model.getCategory());
builder.withDescription(model.getDescription());
builder.withDisplayName(model.getDisplayName());
builder.withVortolang(model.getVortolang());
if (model.getSuperType() != null)
builder.withSuperType(convertSupertype(model.getSuperType(), model, context));
for (ModelProperty sourceProperty : model.getStatusProperties()) {
Property property = createProperty(sourceProperty, builder, context);
builder.withStatusProperty(property);
}
for (ModelProperty sourceProperty : model.getConfigurationProperties()) {
Property property = createProperty(sourceProperty, builder, context);
builder.withConfiguration(property);
}
for (Operation operation : model.getOperations()) {
builder.withOperation(operation.getName(), createReturnTypeOrNull(operation.getResult(), builder, context), operation.getDescription(), operation.isBreakable(), createParams(operation.getParams(), builder, context));
}
for (ModelEvent event : model.getEvents()) {
EventBuilder eventBuilder = BuilderUtils.newEvent(event.getName());
for (ModelProperty sourceProperty : event.getProperties()) {
Property property = createProperty(sourceProperty, builder, context);
eventBuilder.withProperty(property);
}
builder.withEvent(eventBuilder.build());
}
return builder.build();
}
Aggregations