本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaComplexType.getContentModel方法的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaComplexType.getContentModel方法的具体用法?Java XmlSchemaComplexType.getContentModel怎么用?Java XmlSchemaComplexType.getContentModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ws.commons.schema.XmlSchemaComplexType
的用法示例。
在下文中一共展示了XmlSchemaComplexType.getContentModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleAllCasesOfComplexTypes
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType,
AxisMessage message,
List partNameList,
String qnameSuffix) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null) {
processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList,
qnameSuffix);
}
} else {
// now lets handle case with extensions
processComplexContentModel(cmplxType, message, partNameList, qnameSuffix);
}
// handle attributes here
processAttributes(cmplxType, message, partNameList, qnameSuffix);
}
}
示例2: extractParticle
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
/**
* Extract a particle from a complex type
* returns null if it can't be extracted.
*/
private XmlSchemaParticle extractParticle(XmlSchemaComplexType complexType) {
XmlSchemaParticle particle = complexType.getParticle();
// handle case where the complexType is an extension
if (particle == null && complexType.getContentModel() != null
&& complexType.getContentModel().getContent() != null) {
XmlSchemaContent content = complexType.getContentModel().getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension complexContent = (XmlSchemaComplexContentExtension) content;
particle = complexContent.getParticle();
}
}
return particle;
}
示例3: extractBaseTypeName
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
/**
* Extract a particle from a complex type, respecting both extensions and restrictions
* returns null if there isn't one.
*/
private String extractBaseTypeName(XmlSchemaComplexType complexType) {
String baseTypeName = null;
if (complexType.getBaseSchemaTypeName() != null) {
baseTypeName = complexType.getBaseSchemaTypeName().getLocalPart();
} else if (complexType.getContentModel() != null && complexType.getContentModel().getContent() != null) {
XmlSchemaContent content = complexType.getContentModel().getContent();
if (content instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction contentRestriction = (XmlSchemaComplexContentRestriction) content;
if (contentRestriction.getBaseTypeName() != null) {
baseTypeName = contentRestriction.getBaseTypeName().getLocalPart();
}
}
}
return baseTypeName;
}
示例4: walkComplexType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
protected void walkComplexType(XmlSchema xmlSchema, XmlSchemaComplexType obj) {
walkAnnotated(xmlSchema, obj);
XmlSchemaObjectCollection attributes = obj.getAttributes();
for (int i = 0; i < attributes.getCount(); i++) {
XmlSchemaObject attribute = attributes.getItem(i);
if (attribute instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute) attribute);
} else if (attribute instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef) attribute);
}
}
XmlSchemaContentModel xmlSchemaContentModel = obj.getContentModel();
XmlSchemaParticle xmlSchemaParticle = obj.getParticle();
if (xmlSchemaContentModel != null) {
if (xmlSchemaContentModel instanceof XmlSchemaSimpleContent) {
walkSimpleContent(xmlSchema, (XmlSchemaSimpleContent)xmlSchemaContentModel);
} else if (xmlSchemaContentModel instanceof XmlSchemaComplexContent) {
walkComplexContent(xmlSchema, (XmlSchemaComplexContent)xmlSchemaContentModel);
}
} else if (xmlSchemaParticle != null) {
if (xmlSchemaParticle instanceof XmlSchemaSequence) {
walkSequence(xmlSchema, (XmlSchemaSequence)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaChoice) {
walkChoice(xmlSchema, (XmlSchemaChoice)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaAll) {
walkAll(xmlSchema, (XmlSchemaAll)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaGroupRef) {
walkGroupRef(xmlSchema, (XmlSchemaGroupRef)xmlSchemaParticle);
}
}
}
示例5: handleAllCasesOfComplexTypes
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private boolean handleAllCasesOfComplexTypes(XmlSchemaType schemaType,
AxisMessage message,
List partNameList,
String qnameSuffix) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
XmlSchemaObjectCollection xmlObjectCollection = cmplxType.getAttributes();
if (xmlObjectCollection.getCount() != 0)
return false;
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null) {
return processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList,
qnameSuffix);
}
} else {
// now lets handle case with extensions
return processComplexContentModel(cmplxType, message, partNameList, qnameSuffix);
}
// handle attributes here
// processAttributes(cmplxType, message, partNameList, qnameSuffix);
}
return false;
}
示例6: processXMLSchemaComplexType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private static void processXMLSchemaComplexType(XmlSchemaType schemaType,
TypeMapper mapper,
String opName,
Map schemaMap,
String qnameSuffix) {
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
if (cmplxType.getContentModel() == null) {
processSchemaSequence(cmplxType.getParticle(), mapper, opName, schemaMap, qnameSuffix);
} else {
processComplexContentModel(cmplxType, mapper, opName, schemaMap, qnameSuffix);
}
processAttributes(cmplxType, opName, qnameSuffix, mapper);
}
}
示例7: processComplexContentModel
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private static void processComplexContentModel(XmlSchemaComplexType cmplxType,
TypeMapper mapper,
String opName,
Map<String,XmlSchema> schemaMap,
String qnameSuffix) {
XmlSchemaContentModel contentModel = cmplxType.getContentModel();
if (contentModel instanceof XmlSchemaComplexContent) {
XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent) contentModel;
XmlSchemaContent content = xmlSchemaComplexContent.getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension schemaExtension = (XmlSchemaComplexContentExtension) content;
// process particles inside this extension, if any
processSchemaSequence(schemaExtension.getParticle(), mapper, opName, schemaMap, qnameSuffix);
XmlSchemaType extensionSchemaType = null;
for (XmlSchema xmlSchema : schemaMap.values()) {
extensionSchemaType = getSchemaType(xmlSchema,schemaExtension.getBaseTypeName());
if (extensionSchemaType != null){
break;
}
}
processXMLSchemaComplexType(extensionSchemaType, mapper, opName, schemaMap, qnameSuffix);
}
}
}
示例8: processComplexType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private BeanWriterMetaInfoHolder processComplexType(
QName parentElementQName,
XmlSchemaComplexType complexType,
XmlSchema parentSchema) throws SchemaCompilationException {
XmlSchemaParticle particle = complexType.getParticle();
BeanWriterMetaInfoHolder metaInfHolder = new BeanWriterMetaInfoHolder();
if (particle != null) {
//Process the particle
processParticle(parentElementQName, particle, metaInfHolder, parentSchema);
}
//process attributes - first look for the explicit attributes
processAttributes(complexType.getAttributes(),metaInfHolder,parentSchema);
//process any attribute
//somehow the xml schema parser does not seem to pickup the any attribute!!
XmlSchemaAnyAttribute anyAtt = complexType.getAnyAttribute();
if (anyAtt != null) {
processAnyAttribute(metaInfHolder, anyAtt);
}
//process content ,either complex or simple
if (complexType.getContentModel() != null) {
processContentModel(complexType.getContentModel(),
metaInfHolder,
parentSchema);
}
return metaInfHolder;
}
示例9: isSoapArray
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private static boolean isSoapArray(XmlSchemaComplexType complexType) {
// Soap arrays are based on complex content restriction
XmlSchemaContentModel contentModel = complexType.getContentModel();
if (contentModel == null) {
return false;
}
XmlSchemaContent content = contentModel.getContent();
if (!(content instanceof XmlSchemaComplexContentRestriction)) {
return false;
}
XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
return SOAP_ARRAY.equals(restriction.getBaseTypeName());
}
示例10: extractParticleWithRestriction
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
/**
* Extract a particle from a complex type
* returns null if it can't be extracted.
*/
private XmlSchemaParticle extractParticleWithRestriction(XmlSchemaComplexType complexType) {
XmlSchemaParticle particle = complexType.getParticle();
if (particle == null && complexType.getContentModel() != null
&& complexType.getContentModel().getContent() != null) {
XmlSchemaContent content = complexType.getContentModel().getContent();
if (content instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction complexContent = (XmlSchemaComplexContentRestriction) content;
particle = complexContent.getParticle();
}
}
return particle;
}
示例11: convertComplexType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private static final void convertComplexType(final XmlSchemaComplexType complexType, final XmlSchema schema,
final Xsd2UmlConfig config, final Visitor handler, final QName complexTypeName,
final List<TaggedValue> taggedValues) {
final Identifier complexTypeId = config.ensureId(complexTypeName);
final List<Attribute> attributes = new LinkedList<Attribute>();
if (complexType.getContentModel() != null && complexType.getContentModel().getContent() != null) {
final XmlSchemaContent content = complexType.getContentModel().getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
final XmlSchemaComplexContentExtension complexContentExtension = (XmlSchemaComplexContentExtension) content;
attributes.addAll(parseFields(complexContentExtension, schema, config));
// The base of the restriction is interpreted as a UML
// generalization.
final QName base = complexContentExtension.getBaseTypeName();
final Identifier baseId = config.ensureId(base);
// Hack here to support anonymous complex types in the context
// of elements.
// Need to fix the SLI MongoDB schemes so that all types are
// named.
handler.visit(new Generalization(config.getPlugin().nameFromComplexTypeExtension(complexTypeName, base),
complexTypeId, baseId));
} else if (content instanceof XmlSchemaComplexContentRestriction) {
throw new AssertionError(content);
} else if (content instanceof XmlSchemaSimpleContentExtension) {
throw new AssertionError(content);
} else if (content instanceof XmlSchemaSimpleContentRestriction) {
throw new AssertionError(content);
} else {
throw new AssertionError(content);
}
}
attributes.addAll(parseFields(complexType, schema, config));
final String name = config.getPlugin().nameFromSchemaTypeName(complexTypeName);
handler.visit(new ClassType(complexTypeId, name, false, attributes, taggedValues));
}
示例12: merge
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private static void merge(XmlSchema schema, XmlSchemaComplexType first, XmlSchemaComplexType second) {
// check if the type is dynamic and can be merged
if (SchemaMeta.isDynamic(first)) {
// merge attributes
mergeAttributes(schema, first.getAttributes(), second.getAttributes());
// merge sequence of xsd:element if any
XmlSchemaSequence firstSequence = (XmlSchemaSequence) first.getParticle();
XmlSchemaSequence secondSequence = (XmlSchemaSequence) second.getParticle();
if (firstSequence != null || secondSequence != null) {
// create missing sequence
if (firstSequence == null) {
firstSequence = XmlSchemaUtils.makeDynamic(SchemaMeta.getReferencedDatabaseObjects(first), new XmlSchemaSequence());
first.setParticle(firstSequence);
} else if (secondSequence == null) {
secondSequence = XmlSchemaUtils.makeDynamic(SchemaMeta.getReferencedDatabaseObjects(second), new XmlSchemaSequence());
}
// merge sequence
mergeParticules(schema, firstSequence, secondSequence);
} else {
// suppose the type contains an extension
XmlSchemaSimpleContent firstContent = (XmlSchemaSimpleContent) first.getContentModel();
XmlSchemaSimpleContent secondContent = (XmlSchemaSimpleContent) second.getContentModel();
if (firstContent != null && secondContent != null) {
SchemaMeta.adoptReferences(schema, firstContent, secondContent);
XmlSchemaSimpleContentExtension firstContentExtension = (XmlSchemaSimpleContentExtension) firstContent.getContent();
XmlSchemaSimpleContentExtension secondContentExtension = (XmlSchemaSimpleContentExtension) secondContent.getContent();
mergeAttributes(schema, firstContentExtension.getAttributes(), secondContentExtension.getAttributes());
SchemaMeta.adoptReferences(schema, firstContentExtension, secondContentExtension);
}
}
}
SchemaMeta.adoptReferences(schema, first, second);
}
示例13: processComplexContentModel
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
private void processComplexContentModel(XmlSchemaComplexType cmplxType,
AxisMessage message,
List partNameList,
String qnameSuffix) throws CodeGenerationException {
XmlSchemaContentModel contentModel = cmplxType.getContentModel();
if (contentModel instanceof XmlSchemaComplexContent) {
XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent) contentModel;
XmlSchemaContent content = xmlSchemaComplexContent.getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension schemaExtension = (XmlSchemaComplexContentExtension) content;
// process particles inside this extension, if any
if (schemaExtension.getParticle() != null) {
processXMLSchemaSequence(schemaExtension.getParticle(), message, partNameList,
qnameSuffix);
}
// now we need to get the schema of the extension type from the parent schema. For that let's first retrieve
// the parent schema
AxisService axisService = message.getAxisOperation().getAxisService();
ArrayList schemasList = axisService.getSchema();
XmlSchema parentSchema = null;
XmlSchema schema = null;
XmlSchemaType extensionSchemaType = null;
for (Iterator iter = schemasList.iterator(); iter.hasNext();) {
schema = (XmlSchema) iter.next();
extensionSchemaType = getSchemaType(schema, schemaExtension.getBaseTypeName());
if (extensionSchemaType != null) {
break;
}
}
// ok now we got the parent schema. Now let's get the extension's schema type
handleAllCasesOfComplexTypes(extensionSchemaType, message, partNameList,
qnameSuffix);
}
}
}
示例14: processSimpleExtensionBaseType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
/**
* Process Simple Extension Base Type.
*
* @param extBaseType
* @param metaInfHolder
*/
public void processSimpleExtensionBaseType(QName extBaseType,
BeanWriterMetaInfoHolder metaInfHolder,
XmlSchema parentSchema) throws SchemaCompilationException {
//find the class name
String className = findClassName(extBaseType, false);
// if the base type is an primitive then we do not have to extend them
// and it is considered as a property
// on the otherhand if the base type is an generated class then we have to
// extend from it
if (baseSchemaTypeMap.containsKey(extBaseType)) {
//this means the schema type actually returns a different QName
if (changedTypeMap.containsKey(extBaseType)) {
metaInfHolder.registerMapping(extBaseType,
changedTypeMap.get(extBaseType),
className, SchemaConstants.ELEMENT_TYPE);
} else {
metaInfHolder.registerMapping(extBaseType,
extBaseType,
className, SchemaConstants.ELEMENT_TYPE);
}
metaInfHolder.setSimple(true);
// we have already process when it comes to this place
} else if (processedTypemap.containsKey(extBaseType)) {
//set the extension base class name
XmlSchema resolvedSchema = getParentSchema(parentSchema,extBaseType,COMPONENT_TYPE);
if (resolvedSchema == null) {
throw new SchemaCompilationException("can not find the type " + extBaseType
+ " from the parent schema " + parentSchema.getTargetNamespace());
} else {
XmlSchemaType type = resolvedSchema.getTypeByName(extBaseType);
if (type instanceof XmlSchemaSimpleType) {
metaInfHolder.setSimple(true);
metaInfHolder.setExtension(true);
metaInfHolder.setExtensionClassName(className);
copyMetaInfoHierarchy(metaInfHolder, extBaseType, resolvedSchema);
} else if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
if (complexType.getContentModel() == null) {
// do not set as a simple type since we want to
// print the element names
metaInfHolder.setExtension(true);
metaInfHolder.setExtensionClassName(className);
copyMetaInfoHierarchy(metaInfHolder, extBaseType, resolvedSchema);
}
}
}
} else {
metaInfHolder.setSimple(true);
}
//get the binary state and add that to the status map
if (isBinary(extBaseType)) {
metaInfHolder.addtStatus(extBaseType,
SchemaConstants.BINARY_TYPE);
}
}
示例15: parseComplexType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入方法依赖的package包/类
@SuppressWarnings("PMD.AvoidReassigningParameters") // makes code simpler
private NeutralSchema parseComplexType(XmlSchemaComplexType schemaComplexType, NeutralSchema complexSchema,
XmlSchema schema) {
//if(complexSchema != null && complexSchema.getType() != null && complexSchema.getType().equals("application")) {
//boolean isRequiredSchema = true; //for debugging
//}
if ((schemaComplexType.getContentModel() != null) && (schemaComplexType.getContentModel().getContent() != null)) {
XmlSchemaContent content = schemaComplexType.getContentModel().getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension schemaComplexContent = (XmlSchemaComplexContentExtension) content;
XmlSchemaComplexType complexBaseType = getComplexBaseType(schemaComplexContent, schema);
if (complexBaseType != null) {
complexSchema = parseComplexType(complexBaseType, complexSchema, schema);
}
this.parseFields(schemaComplexContent, complexSchema, schema);
} else if (content instanceof XmlSchemaSimpleContentExtension) {
QName baseTypeName = ((XmlSchemaSimpleContentExtension) content).getBaseTypeName();
NeutralSchema simpleContentSchema = schemaFactory.createSchema(baseTypeName);
complexSchema.addField(complexSchema.getType(), simpleContentSchema);
parseAttributes(((XmlSchemaSimpleContentExtension) content).getAttributes(), complexSchema, schema);
}
}
// Annotations are inherited by ComplexType fields so we need to parse these first.
parseAnnotations(complexSchema, schemaComplexType);
this.parseFields(schemaComplexType, complexSchema, schema);
// Check for ChoiceSchemas. We only support complex types that contain choice if choice is
// the ONLY element. If we find one, swap out the current ComplexSchema object that contains
// this single choice schema for the actual choice schema itself.
for (NeutralSchema ns : complexSchema.getFields().values()) {
if (ns instanceof ChoiceSchema) {
if (complexSchema.getFields().size() > 1 && !mergedChoiceSchemas.contains(ns)) {
throw new RuntimeException(
"Choice elements are only supported on complex objects with no other fields: "
+ schemaComplexType.getName());
} else if (!mergedChoiceSchemas.contains(ns)) {
ns.setType(complexSchema.getType());
complexSchema.getAppInfo();
mergedChoiceSchemas.add(ns);
if(ns.getType().equals("serviceDescriptorType")) {
ns.addAnnotation(complexSchema.getAppInfo());
}
return ns;
}
}
}
return complexSchema;
}