use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType in project mule by mulesoft.
the class ConnectionProviderSchemaDelegate method registerConnectionProviderElement.
void registerConnectionProviderElement(ConnectionProviderModel providerModel, DslElementSyntax elementSyntax) {
Element providerElement = new TopLevelElement();
providerElement.setName(elementSyntax.getElementName());
providerElement.setSubstitutionGroup(MULE_CONNECTION_PROVIDER_ELEMENT);
LocalComplexType complexType = new LocalComplexType();
providerElement.setComplexType(complexType);
ExtensionType providerType = new ExtensionType();
providerType.setBase(MULE_CONNECTION_PROVIDER_TYPE);
ComplexContent complexContent = new ComplexContent();
complexContent.setExtension(providerType);
complexType.setComplexContent(complexContent);
builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(providerElement);
final ExplicitGroup sequence = new ExplicitGroup();
sequence.setMinOccurs(ZERO);
sequence.setMaxOccurs(MAX_ONE);
builder.addInfrastructureParameters(providerType, providerModel, sequence);
providerModel.getParameterGroupModels().forEach(group -> {
if (!group.isShowInDsl()) {
builder.addParameterToSequence(builder.registerParameters(providerType, group.getParameterModels()), sequence);
} else {
builder.addInlineParameterGroup(group, sequence);
}
});
providerType.setSequence(sequence);
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method createComplexTypeWithAbstractElementRef.
private LocalComplexType createComplexTypeWithAbstractElementRef(MetadataType type) {
DslElementSyntax typeDsl = builder.getDslResolver().resolve(type).orElseThrow(() -> new IllegalArgumentException(format("No element ref can be created for the given type [%s]", getId(type))));
LocalComplexType complexType = new LocalComplexType();
if (typeDsl.isWrapped()) {
complexType.setChoice(builder.createTypeRefChoiceLocalOrGlobal(typeDsl, type, ONE, MAX_ONE));
} else {
ExplicitGroup sequence = new ExplicitGroup();
sequence.setMinOccurs(ONE);
sequence.setMaxOccurs(MAX_ONE);
sequence.getParticle().add(objectFactory.createElement(createRefToLocalElement(typeDsl, type)));
complexType.setSequence(sequence);
}
return complexType;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType in project mule by mulesoft.
the class SchemaBuilder method addInlineParameterGroup.
void addInlineParameterGroup(ParameterGroupModel group, ExplicitGroup parentSequence) {
DslElementSyntax groupDsl = dslResolver.resolveInline(group);
LocalComplexType complexType = objectTypeDelegate.createTypeExtension(MULE_ABSTRACT_EXTENSION_TYPE);
ExplicitGroup groupSequence = new ExplicitGroup();
List<ParameterModel> groupParameters = group.getParameterModels();
List<TopLevelElement> parameterElements = registerParameters(complexType.getComplexContent().getExtension(), groupParameters);
addParameterToSequence(parameterElements, groupSequence);
BigInteger minOccurs = ExtensionModelUtils.isRequired(group) ? ONE : ZERO;
TopLevelElement groupElement = createTopLevelElement(groupDsl.getElementName(), minOccurs, MAX_ONE);
groupElement.setComplexType(complexType);
complexType.getComplexContent().getExtension().setSequence(groupSequence);
parentSequence.getParticle().add(objectFactory.createElement(groupElement));
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType 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.LocalComplexType 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;
}
Aggregations