private void addAfdelinger(OrganizationalUnitEntity oue) { if (oue.getShakIdentifier() != null) { // Ignore all 'SygehusAfdeling' with no SKS SygehusAfdeling sa = XMLModelMapper.toSygehusAfdeling(oue); dataSets.getSygehusAfdelingDS().add(sa); for (OrganizationalUnitEntity soue : oue.getSons()) { addAfdelinger(soue); } } }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("SnapshotDate".equals(qName)) { try { createDatasets(parseXSDDate(elementValue)); } catch (ParseException e) { throw new SAXException(e); } } else if ("InstitutionOwnerEntity".equals(qName)) { denormalizeAdress(curIOE); for (HealthInstitutionEntity institutuinEntity : curIOE.getHealthInstitutionEntity()) { if (institutuinEntity.getInstitutionType() == 394761003L || institutuinEntity.getInstitutionType() == 550671000005100L) { // Lægepraksis og special læger. Praksis praksis = XMLModelMapper.toPraksis(institutuinEntity); for (OrganizationalUnitEntity oue : institutuinEntity.getOrganizationalUnitEntities()) { // Yder for Lægepraksis. Yder yder = XMLModelMapper.toYder(oue); dataSets.getYderDS().add(yder); if (!oue.getSons().isEmpty()) { new SAXException( "Lægepraksis skal ikke have en level 2 OrganizationalUnitEntity. SORId=" + oue.getSorIdentifier() + " har!!"); } } dataSets.getPraksisDS().add(praksis); } else if (institutuinEntity.getInstitutionType() == 22232009L) { // Sygehus. Sygehus s = XMLModelMapper.toSygehus(institutuinEntity); for (OrganizationalUnitEntity oue : institutuinEntity.getOrganizationalUnitEntities()) { addAfdelinger(oue); } dataSets.getSygehusDS().add(s); } else if (institutuinEntity.getInstitutionType() == 264372000L) { // Apotek. for (OrganizationalUnitEntity oue : institutuinEntity.getOrganizationalUnitEntities()) { Apotek a = XMLModelMapper.toApotek(oue); dataSets.getApotekDS().add(a); } } } curIOE = null; } else if ("HealthInstitutionEntity".equals(qName)) { curHIE = null; } else if ("OrganizationalUnitEntity".equals(qName)) { curOUE = curOUE.getParrent(); } else { try { setProperty(stripNS(qName), elementValue); } catch (Exception e) { throw (new SAXException(e)); } } }