typeName = simpleType.getName();
}
SDOTypeHelper sdoTypeHelper = (SDOTypeHelper) aHelperContext.getTypeHelper();
String typeURI = schema.getTargetNamespace();
SDODataType sdoDataType = (SDODataType) sdoTypeHelper.getType(typeURI, typeName);
QName qName = new QName(schema.getTargetNamespace(), simpleType.getName());
if(null == sdoDataType) {
SDOType existingType = (SDOType)getGeneratedTypes().get(qName);
if(null == existingType) {
existingType = (SDOType) aHelperContext.getTypeHelper().getType(qName.getNamespaceURI(), qName.getLocalPart());
}
if(existingType != null && existingType.isFinalized()) {
return (SDODataType)existingType;
}
sdoDataType = new SDODataType(typeURI, typeName, sdoTypeHelper);
String instanceClassValue = (String) simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_INSTANCECLASS_QNAME);
if (instanceClassValue != null) {
sdoDataType.setInstanceProperty(SDOConstants.JAVA_CLASS_PROPERTY, instanceClassValue);
}
if(existingType != null) {
//Existing type was started in an import, but not as an instance of
//SDODataType. Remove original type and copy referencing properties
generatedTypes.remove(qName);
generatedTypesByXsdQName.remove(qName);
Iterator nonFinalizedProps = existingType.getNonFinalizedReferencingProps().iterator();
Iterator nonFinalizedUris = existingType.getNonFinalizedMappingURIs().iterator();
while(nonFinalizedProps.hasNext()) {
SDOProperty next = (SDOProperty)nonFinalizedProps.next();
next.setType(sdoDataType);
sdoDataType.getNonFinalizedReferencingProps().add(next);
sdoDataType.getNonFinalizedMappingURIs().add(nonFinalizedUris.next());
}
if(anonymousTypes.contains(existingType)) {
anonymousTypes.remove(existingType);
}
}
sdoDataType.setXsdLocalName(simpleType.getName());
sdoDataType.setXsd(true);
if(!sdoDataType.getQName().equals(sdoDataType.getXsdType())) {
// sdoDataType.setInstanceProperty(nameProperty, typeName);
}
generatedTypesByXsdQName.put(qName, sdoDataType);
getGeneratedTypes().put(sdoDataType.getQName(), sdoDataType);
} else if(!returnAllTypes) {
processedSimpleTypes.put(qName, simpleType);
}
return sdoDataType;
}