@Before
 public void setUp() {
   Unit unit = new Unit();
   unit.setHsaIdentity("abc-123");
   unit.setDn(DN.createDNFromString("ou=Tandreglering Halmstad,ou=lthalland.se,o=lth"));
   this.unitCache.add(unit);
 }
  /**
   * Gets a list of units which are in the specified distance of the provided address.
   *
   * @param address The address to check distance to
   * @param units The list of units to check against.
   * @param meters The distance from the provided address which the units should be within to be a
   *     part of the result.
   * @param googleMapsKey The Google Maps key to use.
   * @return A list of Units that is within the distance of the address.
   */
  public ArrayList<Unit> getCloseUnits(
      String address, List<Unit> units, int meters, String googleMapsKey) {
    // Create GeoCoordinate from given address
    double[] coordinates =
        this.geocodeToWGS84FromString(address, googleMapsKey, GeoAddressAccuracy.POST_CODE_LEVEL);
    ArrayList<Unit> closeUnits = new ArrayList<Unit>();
    if (coordinates == null) {
      // If we could not geocode address, return a list with no units.
      return closeUnits;
    }
    GeoCoordinate targetCoordinate = this.getGeoCoordinate(coordinates);

    // Calculate distance in miles
    double milesToTarget = this.getMilesFromMetres(meters);

    for (Unit u : units) {
      if (u.getGeoCoordinate() != null) {
        double distMiles = u.getGeoCoordinate().distanceTo(targetCoordinate);
        if (distMiles < milesToTarget) {
          double dist = distMiles * METRES_PER_MILE / 1000;
          DecimalFormat f = new DecimalFormat("#.##");
          u.setDistanceToTarget(f.format(dist));
          closeUnits.add(u);
        }
      }
    }
    return closeUnits;
  }
 @Test
 public void selectedHealthcareTypeIsAddedToCriterionUnit() throws Exception {
   Unit unit = new Unit();
   unit.setHsaIdentity("ABC-123");
   SikSearchResultList<Unit> searchResult = new SikSearchResultList<Unit>();
   searchResult.add(unit);
   this.searchService.addSearchAdvancedUnitsSearchResult(searchResult);
   // 18 == Vårdcentral
   this.form.setHealthcareType("18");
   this.strategy.performSearch(this.form, new UnitNameComparator(), 0, this.searchService, false);
   assertEquals("search service call count", 1, this.searchService.searchAdvancedUnitsCallCount);
   assertEquals(
       "search unit healthcare type",
       "Vårdcentral",
       this.searchService.unitCriterion.getHealthcareTypes().get(0).getDisplayName());
 }
  /**
   * Geocode all units to RT90.
   *
   * @param googleKey Google Maps key.
   * @return List with units with coordinates.
   * @throws KivNoDataFoundException If no result was found.
   */
  public List<Unit> getAllUnitsGeocoded(String googleKey) throws KivNoDataFoundException {
    List<String> allUnitsHsaIdentity = this.getAllUnitsHsaIdentity();
    List<Unit> allUnitsWithPositionInfo = new ArrayList<Unit>();
    GeoUtil geoUtil = new GeoUtil();
    try {
      for (String hsaId : allUnitsHsaIdentity) {
        // Get coordinates from Google.
        Unit u = this.getSearchService().getUnitByHsaId(hsaId);
        if (u != null) {
          if (u.getHsaStreetAddressIsValid()) {
            int[] rt90Coordinates = geoUtil.geocodeToRT90(u.getHsaStreetAddress(), googleKey);
            if (rt90Coordinates != null) {
              u.setRt90X(rt90Coordinates[0]);
              u.setRt90Y(rt90Coordinates[1]);
            } else {
              u.setRt90X(-1);
              u.setRt90Y(-1);
            }

            allUnitsWithPositionInfo.add(u);
          }
        }
      }
      return allUnitsWithPositionInfo;
    } catch (KivNoDataFoundException e) {
      throw e;
    } catch (KivException e) {
      LOGGER.error(e);
      return new ArrayList<Unit>();
    }
  }
 private boolean comapreUnits(Unit kivwsUnit, Unit kivLdapUnit) {
   if (kivLdapUnit.getAccessibilityDatabaseId() == null) {
     if (kivwsUnit.getAccessibilityDatabaseId() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getAccessibilityDatabaseId()
       .equals(kivwsUnit.getAccessibilityDatabaseId())) {
     return false;
   }
   if (kivLdapUnit.getAccessibilityInformation() == null) {
     if (kivwsUnit.getAccessibilityInformation() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getAccessibilityInformation()
       .equals(kivwsUnit.getAccessibilityInformation())) {
     return false;
   }
   if (kivLdapUnit.getCareType() == null) {
     if (kivwsUnit.getCareType() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getCareType().equals(kivwsUnit.getCareType())) {
     return false;
   }
   if (kivLdapUnit.getCareTypeText() == null) {
     if (kivwsUnit.getCareTypeText() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getCareTypeText().equals(kivwsUnit.getCareTypeText())) {
     return false;
   }
   if (kivLdapUnit.getContractCode() == null) {
     if (kivwsUnit.getContractCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getContractCode().equals(kivwsUnit.getContractCode())) {
     return false;
   }
   if (kivLdapUnit.getCreateTimestamp() == null) {
     if (kivwsUnit.getCreateTimestamp() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getCreateTimestamp().equals(kivwsUnit.getCreateTimestamp())) {
     return false;
   }
   if (kivLdapUnit.getDescription() == null) {
     if (kivwsUnit.getDescription() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getDescription().equals(kivwsUnit.getDescription())) {
     return false;
   }
   if (kivLdapUnit.getDistanceToTarget() == null) {
     if (kivwsUnit.getDistanceToTarget() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getDistanceToTarget().equals(kivwsUnit.getDistanceToTarget())) {
     return false;
   }
   if (kivLdapUnit.getDn() == null) {
     if (kivwsUnit.getDn() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getDn().equals(kivwsUnit.getDn())) {
     return false;
   }
   if (kivLdapUnit.getFacsimileTelephoneNumber() == null) {
     if (kivwsUnit.getFacsimileTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getFacsimileTelephoneNumber()
       .equals(kivwsUnit.getFacsimileTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getGeoCoordinate() == null) {
     if (kivwsUnit.getGeoCoordinate() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getGeoCoordinate().equals(kivwsUnit.getGeoCoordinate())) {
     return false;
   }
   if (kivLdapUnit.getHealthcareTypes() == null) {
     if (kivwsUnit.getHealthcareTypes() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHealthcareTypes().equals(kivwsUnit.getHealthcareTypes())) {
     return false;
   }
   if (kivLdapUnit.getHsaAdministrationForm() == null) {
     if (kivwsUnit.getHsaAdministrationForm() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaAdministrationForm()
       .equals(kivwsUnit.getHsaAdministrationForm())) {
     return false;
   }
   if (kivLdapUnit.getHsaAdministrationFormText() == null) {
     if (kivwsUnit.getHsaAdministrationFormText() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaAdministrationFormText()
       .equals(kivwsUnit.getHsaAdministrationFormText())) {
     return false;
   }
   if (kivLdapUnit.getHsaBusinessClassificationCode() == null) {
     if (kivwsUnit.getHsaBusinessClassificationCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaBusinessClassificationCode()
       .equals(kivwsUnit.getHsaBusinessClassificationCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaBusinessClassificationText() == null) {
     if (kivwsUnit.getHsaBusinessClassificationText() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaBusinessClassificationText()
       .equals(kivwsUnit.getHsaBusinessClassificationText())) {
     return false;
   }
   if (kivLdapUnit.getHsaBusinessType() == null) {
     if (kivwsUnit.getHsaBusinessType() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaBusinessType().equals(kivwsUnit.getHsaBusinessType())) {
     return false;
   }
   if (kivLdapUnit.getHsaConsigneeAddress() == null) {
     if (kivwsUnit.getHsaConsigneeAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaConsigneeAddress().equals(kivwsUnit.getHsaConsigneeAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaCountyCode() == null) {
     if (kivwsUnit.getHsaCountyCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaCountyCode().equals(kivwsUnit.getHsaCountyCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaCountyName() == null) {
     if (kivwsUnit.getHsaCountyName() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaCountyName().equals(kivwsUnit.getHsaCountyName())) {
     return false;
   }
   if (kivLdapUnit.getHsaDestinationIndicator() == null) {
     if (kivwsUnit.getHsaDestinationIndicator() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaDestinationIndicator()
       .equals(kivwsUnit.getHsaDestinationIndicator())) {
     return false;
   }
   if (kivLdapUnit.getHsaDropInHours() == null) {
     if (kivwsUnit.getHsaDropInHours() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaDropInHours().equals(kivwsUnit.getHsaDropInHours())) {
     return false;
   }
   if (kivLdapUnit.getHsaEndDate() == null) {
     if (kivwsUnit.getHsaEndDate() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaEndDate().equals(kivwsUnit.getHsaEndDate())) {
     return false;
   }
   if (kivLdapUnit.getHsaGeographicalCoordinates() == null) {
     if (kivwsUnit.getHsaGeographicalCoordinates() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaGeographicalCoordinates()
       .equals(kivwsUnit.getHsaGeographicalCoordinates())) {
     return false;
   }
   if (kivLdapUnit.getHsaIdentity() == null) {
     if (kivwsUnit.getHsaIdentity() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaIdentity().equals(kivwsUnit.getHsaIdentity())) {
     return false;
   }
   if (kivLdapUnit.getHsaInternalAddress() == null) {
     if (kivwsUnit.getHsaInternalAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaInternalAddress().equals(kivwsUnit.getHsaInternalAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaInternalPagerNumber() == null) {
     if (kivwsUnit.getHsaInternalPagerNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaInternalPagerNumber()
       .equals(kivwsUnit.getHsaInternalPagerNumber())) {
     return false;
   }
   if (kivLdapUnit.getHsaManagementCode() == null) {
     if (kivwsUnit.getHsaManagementCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaManagementCode().equals(kivwsUnit.getHsaManagementCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaManagementName() == null) {
     if (kivwsUnit.getHsaManagementName() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaManagementName().equals(kivwsUnit.getHsaManagementName())) {
     return false;
   }
   if (kivLdapUnit.getHsaManagementText() == null) {
     if (kivwsUnit.getHsaManagementText() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaManagementText().equals(kivwsUnit.getHsaManagementText())) {
     return false;
   }
   if (kivLdapUnit.getHsaMunicipalityCode() == null) {
     if (kivwsUnit.getHsaMunicipalityCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaMunicipalityCode().equals(kivwsUnit.getHsaMunicipalityCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaMunicipalityName() == null) {
     if (kivwsUnit.getHsaMunicipalityName() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaMunicipalityName().equals(kivwsUnit.getHsaMunicipalityName())) {
     return false;
   }
   if (kivLdapUnit.getHsaMunicipalitySectionCode() == null) {
     if (kivwsUnit.getHsaMunicipalitySectionCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaMunicipalitySectionCode()
       .equals(kivwsUnit.getHsaMunicipalitySectionCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaMunicipalitySectionName() == null) {
     if (kivwsUnit.getHsaMunicipalitySectionName() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaMunicipalitySectionName()
       .equals(kivwsUnit.getHsaMunicipalitySectionName())) {
     return false;
   }
   if (kivLdapUnit.getHsaPatientVisitingRules() == null) {
     if (kivwsUnit.getHsaPatientVisitingRules() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaPatientVisitingRules()
       .equals(kivwsUnit.getHsaPatientVisitingRules())) {
     return false;
   }
   if (kivLdapUnit.getHsaPostalAddress() == null) {
     if (kivwsUnit.getHsaPostalAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaPostalAddress().equals(kivwsUnit.getHsaPostalAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaPublicTelephoneNumber() == null) {
     if (kivwsUnit.getHsaPublicTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaPublicTelephoneNumber()
       .equals(kivwsUnit.getHsaPublicTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getHsaRoute() == null) {
     if (kivwsUnit.getHsaRoute() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaRoute().equals(kivwsUnit.getHsaRoute())) {
     return false;
   }
   if (kivLdapUnit.getHsaRouteConcatenated() == null) {
     if (kivwsUnit.getHsaRouteConcatenated() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaRouteConcatenated().equals(kivwsUnit.getHsaRouteConcatenated())) {
     return false;
   }
   if (kivLdapUnit.getHsaSedfDeliveryAddress() == null) {
     if (kivwsUnit.getHsaSedfDeliveryAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaSedfDeliveryAddress()
       .equals(kivwsUnit.getHsaSedfDeliveryAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaSedfInvoiceAddress() == null) {
     if (kivwsUnit.getHsaSedfInvoiceAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaSedfInvoiceAddress()
       .equals(kivwsUnit.getHsaSedfInvoiceAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaSedfSwitchboardTelephoneNo() == null) {
     if (kivwsUnit.getHsaSedfSwitchboardTelephoneNo() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaSedfSwitchboardTelephoneNo()
       .equals(kivwsUnit.getHsaSedfSwitchboardTelephoneNo())) {
     return false;
   }
   if (kivLdapUnit.getHsaSmsTelephoneNumber() == null) {
     if (kivwsUnit.getHsaSmsTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaSmsTelephoneNumber()
       .equals(kivwsUnit.getHsaSmsTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getHsaStreetAddress() == null) {
     if (kivwsUnit.getHsaStreetAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaStreetAddress().equals(kivwsUnit.getHsaStreetAddress())) {
     return false;
   }
   if (kivLdapUnit.getHsaSurgeryHours() == null) {
     if (kivwsUnit.getHsaSurgeryHours() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaSurgeryHours().equals(kivwsUnit.getHsaSurgeryHours())) {
     return false;
   }
   if (kivLdapUnit.getHsaTelephoneNumber() == null) {
     if (kivwsUnit.getHsaTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaTelephoneNumber().equals(kivwsUnit.getHsaTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getHsaTelephoneTime() == null) {
     if (kivwsUnit.getHsaTelephoneTime() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaTelephoneTime().equals(kivwsUnit.getHsaTelephoneTime())) {
     return false;
   }
   if (kivLdapUnit.getHsaTextPhoneNumber() == null) {
     if (kivwsUnit.getHsaTextPhoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaTextPhoneNumber().equals(kivwsUnit.getHsaTextPhoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getHsaUnitPrescriptionCode() == null) {
     if (kivwsUnit.getHsaUnitPrescriptionCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getHsaUnitPrescriptionCode()
       .equals(kivwsUnit.getHsaUnitPrescriptionCode())) {
     return false;
   }
   if (kivLdapUnit.getHsaVisitingRuleAge() == null) {
     if (kivwsUnit.getHsaVisitingRuleAge() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaVisitingRuleAge().equals(kivwsUnit.getHsaVisitingRuleAge())) {
     return false;
   }
   if (kivLdapUnit.getHsaVisitingRules() == null) {
     if (kivwsUnit.getHsaVisitingRules() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getHsaVisitingRules().equals(kivwsUnit.getHsaVisitingRules())) {
     return false;
   }
   if (kivLdapUnit.getInternalWebsite() == null) {
     if (kivwsUnit.getInternalWebsite() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getInternalWebsite().equals(kivwsUnit.getInternalWebsite())) {
     return false;
   }
   if (kivLdapUnit.getIsUnit() != kivwsUnit.getIsUnit()) {
     return false;
   }
   if (kivLdapUnit.getLabeledURI() == null) {
     if (kivwsUnit.getLabeledURI() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getLabeledURI().equals(kivwsUnit.getLabeledURI())) {
     return false;
   }
   if (kivLdapUnit.getLdapDistinguishedName() == null) {
     if (kivwsUnit.getLdapDistinguishedName() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getLdapDistinguishedName()
       .equals(kivwsUnit.getLdapDistinguishedName())) {
     return false;
   }
   if (kivLdapUnit.getLocality() == null) {
     if (kivwsUnit.getLocality() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getLocality().equals(kivwsUnit.getLocality())) {
     return false;
   }
   if (kivLdapUnit.getMail() == null) {
     if (kivwsUnit.getMail() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getMail().equals(kivwsUnit.getMail())) {
     return false;
   }
   if (kivLdapUnit.getManager() == null) {
     if (kivwsUnit.getManager() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getManager().equals(kivwsUnit.getManager())) {
     return false;
   }
   if (kivLdapUnit.getManagerDN() == null) {
     if (kivwsUnit.getManagerDN() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getManagerDN().equals(kivwsUnit.getManagerDN())) {
     return false;
   }
   if (kivLdapUnit.getMobileTelephoneNumber() == null) {
     if (kivwsUnit.getMobileTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getMobileTelephoneNumber()
       .equals(kivwsUnit.getMobileTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getModifyTimestamp() == null) {
     if (kivwsUnit.getModifyTimestamp() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getModifyTimestamp().equals(kivwsUnit.getModifyTimestamp())) {
     return false;
   }
   if (kivLdapUnit.getMvkCaseTypes() == null) {
     if (kivwsUnit.getMvkCaseTypes() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getMvkCaseTypes().equals(kivwsUnit.getMvkCaseTypes())) {
     return false;
   }
   if (kivLdapUnit.getName() == null) {
     if (kivwsUnit.getName() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getName().equals(kivwsUnit.getName())) {
     return false;
   }
   if (kivLdapUnit.getObjectClass() == null) {
     if (kivwsUnit.getObjectClass() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getObjectClass().equals(kivwsUnit.getObjectClass())) {
     return false;
   }
   if (kivLdapUnit.getOrganizationalUnitNameShort() == null) {
     if (kivwsUnit.getOrganizationalUnitNameShort() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getOrganizationalUnitNameShort()
       .equals(kivwsUnit.getOrganizationalUnitNameShort())) {
     return false;
   }
   if (kivLdapUnit.getOu() == null) {
     if (kivwsUnit.getOu() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getOu().equals(kivwsUnit.getOu())) {
     return false;
   }
   if (kivLdapUnit.getPagerTelephoneNumber() == null) {
     if (kivwsUnit.getPagerTelephoneNumber() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getPagerTelephoneNumber().equals(kivwsUnit.getPagerTelephoneNumber())) {
     return false;
   }
   if (kivLdapUnit.getRt90X() != kivwsUnit.getRt90X()) {
     return false;
   }
   if (kivLdapUnit.getRt90Y() != kivwsUnit.getRt90Y()) {
     return false;
   }
   if (kivLdapUnit.isShowAgeInterval() != kivwsUnit.isShowAgeInterval()) {
     return false;
   }
   if (kivLdapUnit.isShowVisitingRules() != kivwsUnit.isShowVisitingRules()) {
     return false;
   }
   if (kivLdapUnit.getVgrAO3kod() == null) {
     if (kivwsUnit.getVgrAO3kod() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrAO3kod().equals(kivwsUnit.getVgrAO3kod())) {
     return false;
   }
   if (kivLdapUnit.getVgrAO3kodText() == null) {
     if (kivwsUnit.getVgrAO3kodText() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrAO3kodText().equals(kivwsUnit.getVgrAO3kodText())) {
     return false;
   }
   if (kivLdapUnit.getVgrAnsvarsnummer() == null) {
     if (kivwsUnit.getVgrAnsvarsnummer() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrAnsvarsnummer().equals(kivwsUnit.getVgrAnsvarsnummer())) {
     return false;
   }
   if (kivLdapUnit.getVgrEANCode() == null) {
     if (kivwsUnit.getVgrEANCode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrEANCode().equals(kivwsUnit.getVgrEANCode())) {
     return false;
   }
   if (kivLdapUnit.getVgrEDICode() == null) {
     if (kivwsUnit.getVgrEDICode() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrEDICode().equals(kivwsUnit.getVgrEDICode())) {
     return false;
   }
   if (kivLdapUnit.getVgrInternalSedfInvoiceAddress() == null) {
     if (kivwsUnit.getVgrInternalSedfInvoiceAddress() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getVgrInternalSedfInvoiceAddress()
       .equals(kivwsUnit.getVgrInternalSedfInvoiceAddress())) {
     return false;
   }
   if (kivLdapUnit.getVgrOrganizationalRole() == null) {
     if (kivwsUnit.getVgrOrganizationalRole() != null) {
       return false;
     }
   } else if (!kivLdapUnit
       .getVgrOrganizationalRole()
       .equals(kivwsUnit.getVgrOrganizationalRole())) {
     return false;
   }
   if (kivLdapUnit.getVgrRefInfo() == null) {
     if (kivwsUnit.getVgrRefInfo() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrRefInfo().equals(kivwsUnit.getVgrRefInfo())) {
     return false;
   }
   if (kivLdapUnit.getVgrTempInfo() == null) {
     if (kivwsUnit.getVgrTempInfo() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrTempInfo().equals(kivwsUnit.getVgrTempInfo())) {
     return false;
   }
   if (kivLdapUnit.getVgrTempInfoBody() == null) {
     if (kivwsUnit.getVgrTempInfoBody() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrTempInfoBody().equals(kivwsUnit.getVgrTempInfoBody())) {
     return false;
   }
   if (kivLdapUnit.getVgrTempInfoEnd() == null) {
     if (kivwsUnit.getVgrTempInfoEnd() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrTempInfoEnd().equals(kivwsUnit.getVgrTempInfoEnd())) {
     return false;
   }
   if (kivLdapUnit.getVgrTempInfoStart() == null) {
     if (kivwsUnit.getVgrTempInfoStart() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVgrTempInfoStart().equals(kivwsUnit.getVgrTempInfoStart())) {
     return false;
   }
   if (kivLdapUnit.isVgrVardVal() != kivwsUnit.isVgrVardVal()) {
     return false;
   }
   if (kivLdapUnit.getVisitingHours() == null) {
     if (kivwsUnit.getVisitingHours() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVisitingHours().equals(kivwsUnit.getVisitingHours())) {
     return false;
   }
   if (kivLdapUnit.getVisitingRuleReferral() == null) {
     if (kivwsUnit.getVisitingRuleReferral() != null) {
       return false;
     }
   } else if (!kivLdapUnit.getVisitingRuleReferral().equals(kivwsUnit.getVisitingRuleReferral())) {
     return false;
   }
   if (Double.doubleToLongBits(kivLdapUnit.getWgs84Lat())
       != Double.doubleToLongBits(kivwsUnit.getWgs84Lat())) {
     return false;
   }
   if (Double.doubleToLongBits(kivLdapUnit.getWgs84Long())
       != Double.doubleToLongBits(kivwsUnit.getWgs84Long())) {
     return false;
   }
   return true;
 }