use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.
the class SchemaBuilder method registerParameters.
List<TopLevelElement> registerParameters(ExtensionType type, Collection<ParameterModel> parameterModels) {
List<TopLevelElement> all = new ArrayList<>(parameterModels.size());
getSortedParameterModels(parameterModels).stream().filter(p -> !p.getModelProperty(QNameModelProperty.class).isPresent()).forEach(parameterModel -> {
DslElementSyntax paramDsl = dslResolver.resolve(parameterModel);
declareAsParameter(parameterModel.getType(), type, parameterModel, paramDsl, all);
});
return all;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.
the class ConfigurationSchemaDelegate method registerExtension.
private ExtensionType registerExtension(String name) {
LocalComplexType complexType = new LocalComplexType();
Element extension = new TopLevelElement();
extension.setName(name);
extension.setSubstitutionGroup(MULE_ABSTRACT_SHARED_EXTENSION);
extension.setComplexType(complexType);
ComplexContent complexContent = new ComplexContent();
complexType.setComplexContent(complexContent);
ExtensionType complexContentExtension = new ExtensionType();
complexContentExtension.setBase(MULE_ABSTRACT_EXTENSION_TYPE);
complexContent.setExtension(complexContentExtension);
schema.getSimpleTypeOrComplexTypeOrGroup().add(extension);
return complexContentExtension;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.
the class ExecutableTypeSchemaDelegate method createExecutableType.
protected ExtensionType createExecutableType(String name, QName base, DslElementSyntax dslSyntax, boolean hasImplicitConfig) {
TopLevelComplexType complexType = new TopLevelComplexType();
complexType.setName(name);
ComplexContent complexContent = new ComplexContent();
complexType.setComplexContent(complexContent);
final ExtensionType complexContentExtension = new ExtensionType();
complexContentExtension.setBase(base);
complexContent.setExtension(complexContentExtension);
if (dslSyntax.requiresConfig()) {
Attribute configAttr = builder.createAttribute(CONFIG_ATTRIBUTE_NAME, CONFIG_ATTRIBUTE_DESCRIPTION, hasImplicitConfig, SUBSTITUTABLE_NAME);
complexContentExtension.getAttributeOrAttributeGroup().add(configAttr);
}
this.builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(complexType);
return complexContentExtension;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method createTypeExtension.
LocalComplexType createTypeExtension(QName base) {
final LocalComplexType complexType = new LocalComplexType();
ComplexContent complexContent = new ComplexContent();
complexType.setComplexContent(complexContent);
final ExtensionType extension = new ExtensionType();
extension.setBase(base);
complexContent.setExtension(extension);
return complexType;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.
the class SourceSchemaDelegate method registerSourceType.
private void registerSourceType(String name, SourceModel sourceModel, DslElementSyntax dslSyntax, boolean hasImplicitConfig) {
final ExtensionType sourceType = createExecutableType(name, MULE_ABSTRACT_MESSAGE_SOURCE_TYPE, dslSyntax, hasImplicitConfig);
initialiseSequence(sourceType);
ExplicitGroup sequence = sourceType.getSequence();
builder.addInfrastructureParameters(sourceType, sourceModel, sequence);
List<ParameterModel> visitedParameters = new LinkedList<>();
sourceModel.getParameterGroupModels().forEach(group -> {
registerParameterGroup(sourceType, group);
visitedParameters.addAll(group.getParameterModels());
});
sourceModel.getSuccessCallback().map(ParameterizedModel::getParameterGroupModels).ifPresent(groups -> groups.forEach(group -> registerCallbackParameters(sourceType, visitedParameters, group)));
sourceModel.getErrorCallback().map(ParameterizedModel::getParameterGroupModels).ifPresent(groups -> groups.forEach(group -> registerCallbackParameters(sourceType, visitedParameters, group)));
}
Aggregations