use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class CollectionSchemaDelegate method generateCollectionElement.
void generateCollectionElement(ArrayType metadataType, DslElementSyntax collectionDsl, String description, boolean required, List<TopLevelElement> all) {
LocalComplexType collectionComplexType = generateCollectionComplexType(collectionDsl, metadataType);
TopLevelElement collectionElement = builder.createTopLevelElement(collectionDsl.getElementName(), required ? ONE : ZERO, MAX_ONE);
collectionElement.setAnnotation(builder.createDocAnnotation(description));
collectionElement.setComplexType(collectionComplexType);
all.add(collectionElement);
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ConfigurationSchemaDelegate method addConnectionProviderElement.
private Optional<TopLevelElement> addConnectionProviderElement(ConfigurationModel configurationModel) {
ExtensionModel extensionModel = builder.getExtensionModel();
if (!extensionModel.getConnectionProviders().isEmpty() || !configurationModel.getConnectionProviders().isEmpty()) {
TopLevelElement objectElement = new TopLevelElement();
boolean hasImplicitConnection = getFirstImplicit(extensionModel.getConnectionProviders()) != null || getFirstImplicit(configurationModel.getConnectionProviders()) != null;
objectElement.setMinOccurs(hasImplicitConnection ? ZERO : ONE);
objectElement.setMaxOccurs(MAX_ONE);
objectElement.setRef(MULE_CONNECTION_PROVIDER_ELEMENT);
return Optional.of(objectElement);
}
return empty();
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement 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.TopLevelElement in project mule by mulesoft.
the class ExecutableTypeSchemaDelegate method registerParameters.
protected ExtensionType registerParameters(ExtensionType type, List<ParameterModel> parameterModels) {
List<TopLevelElement> childElements = new LinkedList<>();
parameterModels.forEach(parameter -> {
DslElementSyntax paramDsl = dsl.resolve(parameter);
MetadataType parameterType = parameter.getType();
boolean shouldDeclare = true;
if (parameter.getModelProperty(QNameModelProperty.class).isPresent() && !parameter.getDslConfiguration().allowsReferences()) {
shouldDeclare = false;
}
if (shouldDeclare) {
this.builder.declareAsParameter(parameterType, type, parameter, paramDsl, childElements);
}
});
appendToSequence(type, childElements);
return type;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ExecutableTypeSchemaDelegate method generateNestedProcessorElement.
private void generateNestedProcessorElement(ExtensionType type, NestedChainModel chainModel) {
final ExplicitGroup choice = new ExplicitGroup();
choice.setMinOccurs(chainModel.isRequired() ? ONE : ZERO);
choice.setMaxOccurs(UNBOUNDED);
chainModel.getAllowedStereotypes().forEach(stereotype -> {
// We need this to support both message-processor and mixed-content-message-processor
if (stereotype.equals(PROCESSOR)) {
NamedGroup group = builder.createGroup(MULE_MESSAGE_PROCESSOR_TYPE, true);
choice.getParticle().add(objectFactory.createGroup(group));
} else {
TopLevelElement localAbstractElementRef = builder.createRefElement(getSubstitutionGroup(stereotype), true);
choice.getParticle().add(objectFactory.createElement(localAbstractElementRef));
}
});
type.getSequence().getParticle().add(objectFactory.createChoice(choice));
if (chainModel.isRequired()) {
type.getSequence().setMinOccurs(ONE);
}
}
Aggregations