Search in sources :

Example 16 with DslElementModel

use of org.mule.runtime.config.api.dsl.model.DslElementModel in project mule by mulesoft.

the class DeclarationBasedElementModelFactory method addInlineGroupElement.

private <T> void addInlineGroupElement(ParameterGroupModel group, DslElementSyntax elementDsl, InternalComponentConfiguration.Builder parentConfig, DslElementModel.Builder<T> parentElement, Optional<ParameterGroupElementDeclaration> declaration) {
    elementDsl.getChild(group.getName()).ifPresent(groupDsl -> {
        DslElementModel.Builder<ParameterGroupModel> groupElementBuilder = DslElementModel.<ParameterGroupModel>builder().withModel(group).withDsl(groupDsl).isExplicitInDsl(declaration.isPresent());
        InternalComponentConfiguration.Builder groupConfigBuilder = InternalComponentConfiguration.builder().withIdentifier(asIdentifier(groupDsl));
        addGroupParameterElements(group, groupDsl, groupConfigBuilder, groupElementBuilder, declaration);
        ComponentConfiguration groupConfig = groupConfigBuilder.build();
        groupElementBuilder.withConfig(groupConfig);
        parentConfig.withNestedComponent(groupConfig);
        parentElement.containing(groupElementBuilder.build());
    });
}
Also used : InternalComponentConfiguration(org.mule.runtime.dsl.internal.component.config.InternalComponentConfiguration) ComponentConfiguration(org.mule.runtime.dsl.api.component.config.ComponentConfiguration) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) DslElementModel(org.mule.runtime.config.api.dsl.model.DslElementModel) InternalComponentConfiguration(org.mule.runtime.dsl.internal.component.config.InternalComponentConfiguration)

Example 17 with DslElementModel

use of org.mule.runtime.config.api.dsl.model.DslElementModel in project mule by mulesoft.

the class DeclarationBasedElementModelFactory method createConfigurationElement.

private DslElementModel<ConfigurationModel> createConfigurationElement(ConfigurationModel model, ConfigurationElementDeclaration configDeclaration) {
    DslElementSyntax configDsl = dsl.resolve(model);
    InternalComponentConfiguration.Builder configuration = InternalComponentConfiguration.builder().withIdentifier(asIdentifier(configDsl)).withParameter(NAME_ATTRIBUTE_NAME, configDeclaration.getRefName());
    DslElementModel.Builder<ConfigurationModel> element = createParameterizedElementModel(model, configDsl, configDeclaration, configuration);
    configDeclaration.getConnection().ifPresent(connection -> addConnectionProvider(connection, model, configuration, element));
    return element.withConfig(configuration.build()).build();
}
Also used : ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) DslElementModel(org.mule.runtime.config.api.dsl.model.DslElementModel) InternalComponentConfiguration(org.mule.runtime.dsl.internal.component.config.InternalComponentConfiguration)

Aggregations

DslElementModel (org.mule.runtime.config.api.dsl.model.DslElementModel)17 InternalComponentConfiguration (org.mule.runtime.dsl.internal.component.config.InternalComponentConfiguration)14 ComponentConfiguration (org.mule.runtime.dsl.api.component.config.ComponentConfiguration)13 DslElementSyntax (org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax)12 MetadataType (org.mule.metadata.api.model.MetadataType)10 ConfigurationModel (org.mule.runtime.api.meta.model.config.ConfigurationModel)10 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)9 List (java.util.List)8 Optional (java.util.Optional)8 Optional.empty (java.util.Optional.empty)8 ComponentIdentifier (org.mule.runtime.api.component.ComponentIdentifier)8 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)8 Reference (org.mule.runtime.api.util.Reference)8 ArrayType (org.mule.metadata.api.model.ArrayType)7 ObjectType (org.mule.metadata.api.model.ObjectType)7 MetadataTypeVisitor (org.mule.metadata.api.visitor.MetadataTypeVisitor)7 Map (java.util.Map)6 Collectors.toList (java.util.stream.Collectors.toList)6 Stream.concat (java.util.stream.Stream.concat)6 StringUtils.isNotBlank (org.apache.commons.lang3.StringUtils.isNotBlank)6