Search in sources :

Example 1 with NamedGroup

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup 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);
    }
}
Also used : NamedGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup) TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) ExplicitGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup)

Example 2 with NamedGroup

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup in project mule by mulesoft.

the class SchemaBuilder method createGroup.

NamedGroup createGroup(QName elementRef, boolean isRequired) {
    NamedGroup namedGroup = new NamedGroup();
    namedGroup.setRef(elementRef);
    namedGroup.setMinOccurs(isRequired ? ONE : ZERO);
    return namedGroup;
}
Also used : NamedGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup)

Aggregations

NamedGroup (org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup)2 ExplicitGroup (org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup)1 TopLevelElement (org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement)1