Search in sources :

Example 1 with EntityBuilder

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

the class ModelContentToEcoreConverter method convertEntity.

private Entity convertEntity(EntityModel entity, ModelContent context) {
    EntityBuilder builder = BuilderUtils.newEntity(new ModelId(ModelType.Datatype, entity.getId().getName(), entity.getId().getNamespace(), entity.getId().getVersion()));
    builder.withCategory(entity.getCategory());
    builder.withDescription(entity.getDescription());
    builder.withDisplayName(entity.getDisplayName());
    builder.withVortolang(entity.getVortolang());
    builder.withReferences(entity.getReferences().stream().map(r -> new ModelId(ModelType.Datatype, r.getName(), r.getNamespace(), r.getVersion())).collect(Collectors.toList()));
    for (ModelProperty sourceProperty : entity.getProperties()) {
        Property property = createProperty(sourceProperty, builder, context);
        builder.withProperty(property);
    }
    return builder.build();
}
Also used : ModelProperty(org.eclipse.vorto.model.ModelProperty) EntityBuilder(org.eclipse.vorto.core.api.model.BuilderUtils.EntityBuilder) Property(org.eclipse.vorto.core.api.model.datatype.Property) ModelProperty(org.eclipse.vorto.model.ModelProperty) ModelId(org.eclipse.vorto.core.api.model.model.ModelId)

Aggregations

EntityBuilder (org.eclipse.vorto.core.api.model.BuilderUtils.EntityBuilder)1 Property (org.eclipse.vorto.core.api.model.datatype.Property)1 ModelId (org.eclipse.vorto.core.api.model.model.ModelId)1 ModelProperty (org.eclipse.vorto.model.ModelProperty)1