Search in sources :

Example 1 with ModelEvent

use of org.eclipse.vorto.model.ModelEvent in project vorto by eclipse.

the class ModelDtoFactory method createEvent.

private static ModelEvent createEvent(Event event, Optional<MappingModel> mappingModel) {
    ModelEvent modelEvent = new ModelEvent();
    modelEvent.setName(event.getName());
    modelEvent.setProperties(event.getProperties().stream().map(p -> createProperty(p, mappingModel)).collect(Collectors.toList()));
    return modelEvent;
}
Also used : ModelEvent(org.eclipse.vorto.model.ModelEvent)

Example 2 with ModelEvent

use of org.eclipse.vorto.model.ModelEvent 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();
}
Also used : EventBuilder(org.eclipse.vorto.core.api.model.BuilderUtils.EventBuilder) FunctionblockBuilder(org.eclipse.vorto.core.api.model.BuilderUtils.FunctionblockBuilder) ModelProperty(org.eclipse.vorto.model.ModelProperty) Operation(org.eclipse.vorto.model.Operation) Property(org.eclipse.vorto.core.api.model.datatype.Property) ModelProperty(org.eclipse.vorto.model.ModelProperty) ModelEvent(org.eclipse.vorto.model.ModelEvent) ModelId(org.eclipse.vorto.core.api.model.model.ModelId)

Aggregations

ModelEvent (org.eclipse.vorto.model.ModelEvent)2 EventBuilder (org.eclipse.vorto.core.api.model.BuilderUtils.EventBuilder)1 FunctionblockBuilder (org.eclipse.vorto.core.api.model.BuilderUtils.FunctionblockBuilder)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 Operation (org.eclipse.vorto.model.Operation)1