public void processElement( ArchDescription archDescription, Object o, InfiniteProgressPanel progressPanel) { if (o instanceof JAXBElement) o = ((JAXBElement) o).getValue(); EADInfo eadInfo = new EADInfo(); for (Object eadElem : getChildren(o)) { Action a = eadInfo.getActionFromClass(eadElem); if (a != null) { a.processElement(archDescription, eadElem, progressPanel); } } }
public void processElement( ArchDescription archDescription, Object o, InfiniteProgressPanel progressPanel) { if (o instanceof JAXBElement) o = ((JAXBElement) o).getValue(); String findingAidStatus = ""; findingAidStatus = ((Eadheader) o).getFindaidstatus(); EADHelper.setProperty(archDescription, "findingAidStatus", findingAidStatus, Resources.class); EADInfo eadInfo = new EADInfo(); for (Object eadElem : getChildren(o)) { Action a = eadInfo.getActionFromClass(eadElem); if (progressPanel != null && progressPanel.isProcessCancelled()) { return; } else if (a != null) { a.processElement(archDescription, eadElem, progressPanel); } } }
public void processElement( ArchDescription archDescription, Object did, InfiniteProgressPanel progressPanel) { if (did instanceof JAXBElement) did = ((JAXBElement) did).getValue(); ArrayList didChildren = (ArrayList) getChildren(did); Iterator it = null; Object eadElem = null; Action action = null; EADInfo eadInfo = new EADInfo(); it = didChildren.iterator(); while (it.hasNext()) { eadElem = it.next(); action = eadInfo.getActionFromClass(eadElem); if (null != action) { action.processElement(archDescription, eadElem, progressPanel); } } // This is code that processes the <container> elements // It is a bit complicated because of the mapping from EAD to AT data model // get list of containers ArrayList containers = (ArrayList) EADHelper.getClassesFromList(didChildren, Container.class); ArchDescriptionAnalogInstances instance; // The instance map will store a <name, value> pair which is the id of the // <container> element and a corresponding ArchDescriptionAnalogInstances object HashMap instanceMap = new HashMap(); // iterate through the container elements if (containers != null && containers.size() > 0) { if (archDescription instanceof Resources) { instance = new ArchDescriptionAnalogInstances(archDescription); } for (int e = 0; e < containers.size(); e++) { // status 0 indicates a parent container element // status 1 indicates a child container element // status 2 means there is no id/parent attribute present in the container element int status = 0; Container container = (Container) containers.get(e); instance = new ArchDescriptionAnalogInstances(); if (container.getId() != null && container.getId().length() > 0) { if (instanceMap.get(container.getId()) == null) instanceMap.put(container.getId(), instance); else instance = (ArchDescriptionAnalogInstances) instanceMap.get(container.getId()); if (container.getLabel() != null) instance.setInstanceType(container.getLabel()); status = 0; } else if (container.getParent() != null && container.getParent().size() > 0) { Container pContainer = (Container) container.getParent().get(0); if (instanceMap.get(pContainer.getId()) == null) instanceMap.put(pContainer.getId(), instance); else instance = (ArchDescriptionAnalogInstances) instanceMap.get(pContainer.getId()); status = 1; } else { if (instanceMap.get("no_id") == null) instanceMap.put("no_id", instance); else instance = (ArchDescriptionAnalogInstances) instanceMap.get("no_id"); status = 2; String type = container.getLabel(); if (type != null && type.length() > 0) instance.setInstanceType(type); } // parse container element and populate the instance object parseContainers(instance, status, container); } // iterate through and save all the ArchDescrptionAnalogInstances object Iterator it2 = instanceMap.values().iterator(); while (it2.hasNext()) { instance = (ArchDescriptionAnalogInstances) it2.next(); if (archDescription instanceof ResourcesComponents) { instance.setResourcesComponents((ResourcesComponents) archDescription); ((ResourcesCommon) archDescription).addInstance(instance); } else if (archDescription instanceof Resources) { instance.setResource((Resources) archDescription); ((ResourcesCommon) archDescription).addInstance(instance); } } } }