this.module = module;
this.listener = listener;
}
private DcObject parseItem(DcModule module, Element eItem) throws Exception {
DcObject dco = module.getItem();
dco.setIDs();
String value;
// get the object
for (DcField field : module.getFields()) {
if ((field.isUiOnly() && field.getValueType() != DcRepository.ValueTypes._DCOBJECTCOLLECTION && field.getValueType() != DcRepository.ValueTypes._PICTURE) ||
field.getIndex() == DcObject._ID || field.getIndex() == DcObject._SYS_EXTERNAL_REFERENCES) continue;
String fieldName = Converter.getValidXmlTag(field.getSystemName());
NodeList nlField = eItem.getElementsByTagName(fieldName);
if (nlField == null || nlField.getLength() == 0) continue;
Element eField = (Element) nlField.item(0);
if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTCOLLECTION) {
// retrieve the items by their module name
DcModule referenceMod = DcModules.get(field.getReferenceIdx());
String referenceName = Converter.getValidXmlTag(referenceMod.getSystemObjectName());
NodeList elReferences = eField.getElementsByTagName(referenceName);
for (int j = 0; elReferences != null && j < elReferences.getLength(); j++) {
// retrieve the values by the display field index (the system display field index)
Element eReference = (Element) elReferences.item(j);
DcObject reference = referenceMod.getItem();
String referenceField = Converter.getValidXmlTag(reference.getField(reference.getSystemDisplayFieldIdx()).getSystemName());
NodeList nlRefField = eReference.getElementsByTagName(referenceField);
if (nlRefField != null && nlRefField.getLength() > 0) {
Node eRefField = nlRefField.item(0);
setValue(dco, field.getIndex(), eRefField.getTextContent(), listener);
} else {