use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.
the class ComponentBuilder method buileParameterFromTypes2.
private void buileParameterFromTypes2(String paraType, ParameterInfo parameter, int ioOrRecursion) {
if (ioOrRecursion < 3) {
parametersName.clear();
parametersName.add(parameter.getName());
} else if (ioOrRecursion == 3) {
parametersName.add(parameter.getName());
}
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
String typeName = type.getName();
if (paraType.equals(typeName)) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
Object obj = xmlSchemaComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce != null) {
xmlSchemaParticle = xscce.getParticle();
}
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
xmlSchemaObjectCollection = xsccr.getAttributes();
}
} else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
if (xmlSchemaObjectCollection != null) {
buildParameterFromCollection2(xmlSchemaObjectCollection, parameter, 3);
}
} else if (type instanceof XmlSchemaSimpleType) {
// Will TO DO if need.
// System.out.println("XmlSchemaSimpleType");
}
break;
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.
the class ComponentBuilder method buileParameterFromTypes.
/**
* DOC gcui Comment method "buileParameterFromTypes".
*
* @param paraType
* @param parameter
* @param operationInfo
* @param i
*/
private void buileParameterFromTypes(String paraNamespace, String paraType, ParameterInfo parameter, int ioOrRecursion) {
if (ioOrRecursion < 3) {
parametersName.clear();
parametersName.add(parameter.getName());
} else if (ioOrRecursion == 3) {
parametersName.add(parameter.getName());
}
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
String typeName = type.getName();
if (paraType.equals(typeName) && paraNamespace.equals(type.getQName().getNamespaceURI())) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
Object obj = xmlSchemaComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce.getBaseTypeName() != null) {
buileParameterFromTypes(xscce.getBaseTypeName().getNamespaceURI(), xscce.getBaseTypeName().getLocalPart(), parameter, ioOrRecursion);
}
if (xscce != null) {
xmlSchemaParticle = xscce.getParticle();
}
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
xmlSchemaObjectCollection = xsccr.getAttributes();
}
} else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
buildParameterFromCollection(xmlSchemaObjectCollection, parameter, 3);
} else if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() == 0 && xmlSchemaComplexType.isAbstract()) {
findExtendtion(xmlSchemaComplexType, parameter, 3);
}
} else if (type instanceof XmlSchemaSimpleType) {
// Will TO DO if need.
// System.out.println("XmlSchemaSimpleType");
}
break;
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project cxf by apache.
the class ImportRepairTest method createDerivedType2.
private void createDerivedType2(XmlSchema importingSchema) {
XmlSchemaComplexContent complexContent;
XmlSchemaComplexType derivedType2 = new XmlSchemaComplexType(importingSchema, true);
derivedType2.setName("derivedRestriction");
XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
restriction.setBaseTypeName(new QName(BASE_TYPE_SCHEMA2, "baseType2"));
complexContent = new XmlSchemaComplexContent();
complexContent.setContent(restriction);
derivedType2.setContentModel(complexContent);
}
use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.
the class AllTypeDialog method buileParameterFromTypes.
private void buileParameterFromTypes(String paraType, ParameterInfo parameter) {
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
String typeName = type.getName();
if (paraType.equals(typeName)) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
Object obj = xmlSchemaComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce.getBaseTypeName() != null) {
buileParameterFromTypes(xscce.getBaseTypeName().getLocalPart(), parameter);
}
if (xscce != null) {
xmlSchemaParticle = xscce.getParticle();
}
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
xmlSchemaObjectCollection = xsccr.getAttributes();
}
} else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
buildParameterFromCollection(xmlSchemaObjectCollection, parameter);
}
} else if (type instanceof XmlSchemaSimpleType) {
}
break;
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project hale by halestudio.
the class XmlSchemaReader method createProperties.
/**
* Create the properties for the given complex type
*
* @param typeDef the definition of the declaring type
* @param item the complex type item
* @param schemaLocation the schema location
* @param schemaNamespace the scheme namspace
*/
private void createProperties(XmlTypeDefinition typeDef, XmlSchemaComplexType item, String schemaLocation, String schemaNamespace) {
// item:
// <complexType ...>
XmlSchemaContentModel model = item.getContentModel();
if (model != null) {
XmlSchemaContent content = model.getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
// <complexContent>
// <extension base="...">
XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
// particle (e.g. sequence)
if (extension.getParticle() != null) {
XmlSchemaParticle particle = extension.getParticle();
createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
}
// attributes
XmlSchemaObjectCollection attributeCollection = extension.getAttributes();
if (attributeCollection != null) {
createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
}
// complex content may have a value in certain cases
// (if it is mixed it definitely has, which will override this
// setting)
typeDef.setConstraintIfNotSet(new ComplexContentHasValue(typeDef));
// </extension>
// </complexContent>
} else if (content instanceof XmlSchemaComplexContentRestriction) {
// <complexContent>
// <restriction base="...">
XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
// particle (e.g. sequence)
if (restriction.getParticle() != null) {
XmlSchemaParticle particle = restriction.getParticle();
createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
}
// attributes
XmlSchemaObjectCollection attributeCollection = restriction.getAttributes();
if (attributeCollection != null) {
createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
}
// complex content does not have a value
// (only if it is mixed, which can override this setting)
typeDef.setConstraintIfNotSet(HasValueFlag.DISABLED);
// </restriction>
// </complexContent>
} else if (content instanceof XmlSchemaSimpleContentExtension) {
// <simpleContent>
// <extension base="...">
XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
// attributes
XmlSchemaObjectCollection attributeCollection = extension.getAttributes();
if (attributeCollection != null) {
createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
}
// </extension>
// </simpleContent>
} else if (content instanceof XmlSchemaSimpleContentRestriction) {
// <simpleContent>
// <restriction base="...">
XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
// attributes
XmlSchemaObjectCollection attributeCollection = restriction.getAttributes();
if (attributeCollection != null) {
createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
}
// </restriction>
// </simpleContent>
}
} else {
// no complex content (instead e.g. <sequence>)
XmlSchemaComplexType complexType = item;
// particle (e.g. sequence)
if (item.getParticle() != null) {
XmlSchemaParticle particle = complexType.getParticle();
createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
}
// attributes
XmlSchemaObjectCollection attributeCollection = complexType.getAttributes();
if (attributeCollection != null) {
createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
}
}
// </complexType>
}
Aggregations