Search in sources :

Example 1 with InformationModelBuilder

use of org.eclipse.vorto.core.api.model.BuilderUtils.InformationModelBuilder in project vorto by eclipse.

the class ModelContentToEcoreConverter method convertInformationModel.

private InformationModel convertInformationModel(Infomodel model, ModelContent context) {
    InformationModelBuilder builder = BuilderUtils.newInformationModel(new ModelId(ModelType.InformationModel, 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());
    for (ModelProperty property : model.getFunctionblocks()) {
        FunctionblockModel fbModel = (FunctionblockModel) context.getModels().get((org.eclipse.vorto.model.ModelId) property.getType());
        org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel convertedFb = (org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel) convertFunctionblock(fbModel, context);
        builder.withReference(ModelIdFactory.newInstance(convertedFb));
        builder.withFunctionBlock(convertedFb, property.getName(), property.getDescription(), property.isMandatory());
    }
    return builder.build();
}
Also used : FunctionblockModel(org.eclipse.vorto.model.FunctionblockModel) ModelProperty(org.eclipse.vorto.model.ModelProperty) InformationModelBuilder(org.eclipse.vorto.core.api.model.BuilderUtils.InformationModelBuilder) Infomodel(org.eclipse.vorto.model.Infomodel) ModelId(org.eclipse.vorto.core.api.model.model.ModelId)

Aggregations

InformationModelBuilder (org.eclipse.vorto.core.api.model.BuilderUtils.InformationModelBuilder)1 ModelId (org.eclipse.vorto.core.api.model.model.ModelId)1 FunctionblockModel (org.eclipse.vorto.model.FunctionblockModel)1 Infomodel (org.eclipse.vorto.model.Infomodel)1 ModelProperty (org.eclipse.vorto.model.ModelProperty)1