use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method registerPojoGlobalElements.
private void registerPojoGlobalElements(DslElementSyntax typeDsl, ObjectType type, ObjectType baseType, String description) {
if (registeredGlobalElementTypes.containsKey(globalTypeKey(typeDsl))) {
return;
}
QName typeQName = getTypeQName(typeDsl, type);
TopLevelElement abstractElement = registerAbstractElement(type, typeQName, typeDsl, baseType);
if (typeDsl.supportsTopLevelDeclaration() || (typeDsl.supportsChildDeclaration() && typeDsl.isWrapped()) || getSubstitutionGroup(type).isPresent() || !builder.getTypesMapping().getSuperTypes(type).isEmpty()) {
registerConcreteGlobalElement(typeDsl, description, abstractElement.getName(), typeQName);
}
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method registerAbstractElement.
private TopLevelElement registerAbstractElement(MetadataType type, QName typeQName, DslElementSyntax typeDsl, ObjectType baseType) {
TopLevelElement element = registeredGlobalElementTypes.get(typeDsl.getPrefix() + getAbstractElementName(typeDsl));
if (element != null) {
return element;
}
Optional<DslElementSyntax> baseDsl = builder.getDslResolver().resolve(baseType);
if (typeDsl.isWrapped()) {
createGlobalMuleExtensionAbstractElement(typeQName, typeDsl, baseDsl);
}
TopLevelElement abstractElement = new TopLevelElement();
abstractElement.setName(getAbstractElementName(typeDsl));
abstractElement.setAbstract(true);
if (!typeDsl.supportsTopLevelDeclaration()) {
abstractElement.setType(typeQName);
}
if (baseDsl.isPresent() || typeDsl.supportsTopLevelDeclaration()) {
QName substitutionGroup = getAbstractElementSubstitutionGroup(typeDsl, baseDsl);
abstractElement.setSubstitutionGroup(substitutionGroup);
}
// If user defined, substitutionGroup will be overridden
getSubstitutionGroup(type).ifPresent((substitutionGroup) -> abstractElement.setSubstitutionGroup(builder.resolveSubstitutionGroup(substitutionGroup)));
builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(abstractElement);
registeredGlobalElementTypes.put(typeDsl.getPrefix() + getAbstractElementName(typeDsl), abstractElement);
return abstractElement;
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method registerConcreteGlobalElement.
void registerConcreteGlobalElement(DslElementSyntax typeDsl, String description, String abstractElementName, QName typeQName) {
if (registeredGlobalElementTypes.containsKey(globalTypeKey(typeDsl))) {
return;
}
TopLevelElement objectElement = new TopLevelElement();
objectElement.setName(typeDsl.getElementName());
objectElement.setSubstitutionGroup(new QName(typeDsl.getNamespace(), abstractElementName, typeDsl.getPrefix()));
objectElement.setAnnotation(builder.createDocAnnotation(description));
objectElement.setComplexType(createTypeExtension(typeQName));
if (typeDsl.supportsTopLevelDeclaration()) {
objectElement.getComplexType().getComplexContent().getExtension().getAttributeOrAttributeGroup().add(builder.createNameAttribute(false));
}
builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(objectElement);
registeredGlobalElementTypes.put(globalTypeKey(typeDsl), objectElement);
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class ObjectTypeSchemaDelegate method addAbstractTypeRef.
private void addAbstractTypeRef(DslElementSyntax paramDsl, String description, MetadataType metadataType, List<TopLevelElement> all, boolean required) {
BigInteger minOccurs = !paramDsl.supportsAttributeDeclaration() && required ? ONE : ZERO;
TopLevelElement objectElement = builder.createTopLevelElement(paramDsl.getElementName(), minOccurs, MAX_ONE);
objectElement.setAnnotation(builder.createDocAnnotation(description));
objectElement.setComplexType(createComplexTypeWithAbstractElementRef(metadataType));
all.add(objectElement);
}
use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement in project mule by mulesoft.
the class OperationSchemaDelegate method registerProcessorElement.
void registerProcessorElement(ComponentModel componentModel, String typeName, DslElementSyntax dslSyntax) {
Element element = new TopLevelElement();
element.setName(dslSyntax.getElementName());
element.setType(new QName(builder.getSchema().getTargetNamespace(), typeName));
element.setAnnotation(builder.createDocAnnotation(componentModel.getDescription()));
element.setSubstitutionGroup(getOperationSubstitutionGroup(componentModel));
builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(element);
}
Aggregations