Пример #1
0
 private static void denormalizeAdress(InstitutionOwnerEntity ioe) {
   for (HealthInstitutionEntity hie : ioe.getHealthInstitutionEntity()) {
     pushdownAdress(ioe, hie);
     for (OrganizationalUnitEntity oue : hie.getOrganizationalUnitEntities()) {
       pushdownAdress(hie, oue);
       for (OrganizationalUnitEntity son : oue.getSons()) {
         pushdownAdress(oue, son);
       }
     }
   }
 }
Пример #2
0
  @Override
  public void startElement(String uri, String localName, String qName, Attributes atts)
      throws SAXException {
    elementValue = new String();

    if ("InstitutionOwnerEntity".equals(qName)) {
      curIOE = new InstitutionOwnerEntity();
    } else if ("HealthInstitutionEntity".equals(qName)) {
      curHIE = new HealthInstitutionEntity();
      curIOE.setHealthInstitutionEntity(curHIE);
    } else if ("OrganizationalUnitEntity".equals(qName)) {
      if (curOUE == null) {
        // Father is a HealthInstitutionEntity
        curOUE = new OrganizationalUnitEntity(null);
        curHIE.setOrganizationalUnitEntity(curOUE);
        curOUE.setHealthInstitutionEntity(curHIE);
      } else {
        // Father is a OrganizationalUnitEntity
        curOUE = new OrganizationalUnitEntity(curOUE);
      }

      curOUE.setBelongsTo(curHIE);
    }
  }
Пример #3
0
  @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));
      }
    }
  }