if ( level01.getDataItems()[i] instanceof ElementaryDataItem ) {
ElementaryDataItem edi = (ElementaryDataItem)level01.getDataItems()[i];
String attrName = edi.getDataName();
DataField dataField = (DataField)edi.interpret();
if (dataField != null) {
Property attr = (Property)attrs.get(attrName);
Type type = dataField.getType() == Integer.class ? integerType : stringType;
if (attr == null) {
String timestampFormat = "";
String dateFormat = "";
String length = "" + dataField.getLength();
String fraction = "" + dataField.getFraction();
System.out.println("INFO [jIvalo] - Adding new attribute: " + attrName);
Property newAttr = addAttribute(c, attrName, type, timestampFormat, dateFormat, length, fraction);
}
else {
System.out.println("INFO [jIvalo] - Updating new attribute: " + attrName);
attr.setType(type);
setTagValue(attr, "length", "" + dataField.getLength());
setTagValue(attr, "fraction", "" + dataField.getFraction());
attrs.remove(attrName);
}
}
}
else if ( level01.getDataItems()[i] instanceof GroupDataItem ) {
GroupDataItem gdi = (GroupDataItem)level01.getDataItems()[i];
String className = c.getName() + "_" + gdi.getDataName();
Class cl = getClass(p, className);
if (cl == null) {
addClass(p, className);
System.out.println("INFO [jIvalo] Added class: " + className);
cl = getClass(p, className);
}
else {
System.out.println("INFO [jIvalo] Updating existing class: " + className);
}
if (cl != null) {
addAttributes(gdi, p, cl, model);
Property newAttr = null;
if ( level01.getDataItems()[i] instanceof GroupDataItemOccurs ) {
GroupDataItemOccurs gdio = (GroupDataItemOccurs)level01.getDataItems()[i];
newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),gdio.getOccurs(),gdio.getOccurs());
}
else {
newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),1,1);
}
if (newAttr != null) {
newAttr.setVisibility(VisibilityKind.PUBLIC_LITERAL);
addStereotype(newAttr, jIvaloAttributeStereotype);
setTagValue(newAttr, "timestampFormat", "");
setTagValue(newAttr, "dateFormat", "");
setTagValue(newAttr, "length", "0");
setTagValue(newAttr, "fraction", "0");