/* genarate the attribs array */
private void populateAttribList() throws WrapperFault
{
ElementInfo elemi = type.getExtensionBaseType();
if (elemi != null)
{
extensionBaseAttrib = new AttributeInfo(this.classname);
extensionBaseAttrib.setParamName(elemi.getName().getLocalPart());
extensionBaseAttrib.setTypeName(
CUtils.getclass4qname(elemi.getType().getName()));
extensionBaseAttrib.setType(elemi.getType());
extensionBaseAttrib.setElementName(elemi.getName());
}
ArrayList attribfeilds = new ArrayList();
ArrayList elementfeilds = new ArrayList();
Iterator names = type.getAttributeNames();
while (names.hasNext())
{
attribfeilds.add(names.next());
}
names = type.getElementnames();
while (names.hasNext())
{
elementfeilds.add(names.next());
}
int intAttrFieldSz = attribfeilds.size();
attributeParamCount = intAttrFieldSz;
int intEleFieldSz = elementfeilds.size();
this.attribs = new AttributeInfo[intAttrFieldSz + intEleFieldSz];
for (int i = 0; i < intAttrFieldSz; i++)
{
this.attribs[i] = new AttributeInfo(this.classname);
this.attribs[i].setParamName((String) attribfeilds.get(i));
Type attribType =
type.getTypForAttribName(this.attribs[i].getParamName());
if (CUtils.isSimpleType(attribType.getName()))
this.attribs[i].setTypeName(
CUtils.getclass4qname(attribType.getName()));
else
{
this.attribs[i].setTypeName(
attribType.getLanguageSpecificName());
this.attribs[i].setSimpleType(false);
}
this.attribs[i].setType(attribType);
this.attribs[i].setAttribute(true);
this.attribs[i].setElementName(attribType.getName());
//TODO this is wrong. correct immediately. this will cause attributes serialized incorrectly
//TODO : how to find whether this attribute is optional or not ?
}
for (int i = intAttrFieldSz; i < intAttrFieldSz + intEleFieldSz; i++)
{
this.attribs[i] = new AttributeInfo(this.classname);
this.attribs[i].setParamName(
(String) elementfeilds.get(i - attributeParamCount));
ElementInfo elem =
type.getElementForElementName(this.attribs[i].getParamName());
Type elementType = elem.getType();
if (CUtils.isAnyType(elementType.getName()))
{
this.attribs[i].setAnyType(true);
}
if (CUtils.isSimpleType(elementType.getName()))
this.attribs[i].setTypeName(
CUtils.getclass4qname(elementType.getName()));
else
{
this.attribs[i].setTypeName(
elementType.getLanguageSpecificName());
this.attribs[i].setSimpleType(false);
}
this.attribs[i].setType(elementType);
this.attribs[i].setElementName(elem.getName());
//Dushshantha:
//setting the choice element availability.
this.attribs[i].setChoiceElement(elem.getChoiceElement());
//..................................................
//Chinthana:
//setting the all element availability.
this.attribs[i].setAllElement(elem.getAllElement());
//04/05/2005..................................................
//Dushshantha:
//states whether the atribute is namespace qualified
this.attribs[i].setNsQualified(elem.getNsQualified());
//setting the minoccures
this.attribs[i].setMinOccurs(elem.getMinOccurs());
//12/05/2005..................................................
if (elementType.isArray())
{ //soap encoding arrays.
Type arrayType = WrapperUtils.getArrayType(elementType);
//get contained type
this.attribs[i].setArray(true);
if (CUtils.isSimpleType(arrayType.getName()))
{
this.attribs[i].setTypeName(
CUtils.getclass4qname(arrayType.getName()));
this.attribs[i].setSimpleType(true);
}
else
{
this.attribs[i].setTypeName(
arrayType.getLanguageSpecificName());
this.attribs[i].setSimpleType(false);
}
this.attribs[i].setType(arrayType);
//set contained type as type
}
else
if (elem.getMaxOccurs() > 1)
{
//arrays but the same type as was set above
this.attribs[i].setArray(true);
}
if (elem.getMinOccurs() == 0)
this.attribs[i].setOptional(true);
this.attribs[i].setNillable(elem.getNillable());
}
}