/**
  * Used to inform if Vcard can be used.
  *
  * @return True if the address has data in street, zipcode and city, otherwise false.
  */
 public boolean getHasVcardData() {
   if (StringUtil.isEmpty(street)
       || StringUtil.isEmpty(zipCode.getZipCode())
       || StringUtil.isEmpty(city)) {
     return false;
   }
   return true;
 }
  /**
   * @inheritDoc
   * @return True if the address is empty.
   */
  @Override
  public boolean isEmpty() {
    boolean empty = true;

    empty &= StringUtil.isEmpty(street);
    empty &= StringUtil.isEmpty(zipCode.getZipCode());
    empty &= StringUtil.isEmpty(city);

    if (additionalInfo != null && additionalInfo.size() > 0) {
      for (int i = 0; i < additionalInfo.size(); i++) {
        empty &= StringUtil.isEmpty(additionalInfo.get(i));
      }
    }
    return empty;
  }
 /**
  * Geocode an address to WGS84.
  *
  * @param hsaStreetAddress The street address.
  * @param googleKey The Google Maps key to use.
  * @return An array of WGS84 coordinates.
  */
 public double[] geocodeToWGS84FromHsaAddress(Address hsaStreetAddress, String googleKey) {
   logger.debug(CLASS_NAME + ".geocodeToWGS84()");
   // We can't do anything if we don't have at least a street name, zip code or city.
   if (hsaStreetAddress == null
       || StringUtil.isEmpty(hsaStreetAddress.getStreet())
           && StringUtil.isEmpty(hsaStreetAddress.getZipCode().getZipCode())
           && StringUtil.isEmpty(hsaStreetAddress.getCity())) {
     return null;
   }
   String address =
       hsaStreetAddress.getStreet().trim()
           + ", "
           + hsaStreetAddress.getZipCode().getFormattedZipCode().toString().trim()
           + " "
           + hsaStreetAddress.getCity().trim()
           + ", sweden";
   return this.geocodeToWGS84FromString(address, googleKey, GeoAddressAccuracy.STREET_LEVEL);
 }
 /**
  * @param rt90String HSA formatted RT90 coords: X: 1234567, Y: 1234567.
  * @return An array of RT90 coordinates.
  */
 public static int[] parseRT90HsaString(String rt90String) {
   int[] result = null;
   if (!StringUtil.isEmpty(rt90String)) {
     if (rt90String.indexOf("X:") >= 0 && rt90String.indexOf("Y:") >= 0) {
       int rt90X = Integer.parseInt(rt90String.substring(3, 10));
       int rt90Y = Integer.parseInt(rt90String.substring(15));
       result = new int[] {rt90X, rt90Y};
     }
   }
   return result;
 }
 /**
  * Return a list of PagedSearchMetaData objects which chops up the full list in to minor chunks.
  * Used in case of indexing all units.
  *
  * @param pageSizeString The number of search results to show per page.
  * @return A list of PagedSearchMetaData objects.
  * @throws KivNoDataFoundException If no result was found.
  */
 public List<PagedSearchMetaData> getAllUnitsPageList(String pageSizeString)
     throws KivNoDataFoundException {
   List<PagedSearchMetaData> result;
   try {
     List<String> unitHsaIdList = this.getSearchService().getAllUnitsHsaIdentity();
     if (StringUtil.isInteger(pageSizeString)) {
       int temp = Integer.parseInt(pageSizeString);
       if (temp > this.pageSize) {
         // we can only increase the page size
         this.pageSize = temp;
       }
     }
     result = PagedSearchMetaDataHelper.buildPagedSearchMetaData(unitHsaIdList, this.pageSize);
   } catch (KivNoDataFoundException e) {
     throw e;
   } catch (KivException e) {
     LOGGER.error(e);
     result = new ArrayList<PagedSearchMetaData>();
   }
   return result;
 }
 /**
  * Gets a comma-separated string of all additional info strings. Nice to be able to get the hole
  * string at once in a facelet.
  *
  * @return A comma-separated string of all additional info strings.
  */
 public String getConcatenatedAdditionalInfo() {
   return StringUtil.concatenate(additionalInfo);
 }
 /**
  * Gets an URLEncoded version of the street and city.
  *
  * @return An URLEncoded string which consists of street and city.
  */
 public String getEncodedAddress() {
   String addressStr = this.getStreet() + ", " + this.getCity();
   return StringUtil.urlEncode(addressStr, "iso-8859-1");
 }