Class ZxingGenerator

java.lang.Object
org.europa.together.application.ZxingGenerator
All Implemented Interfaces:
QrCodeGenerator

@Repository public class ZxingGenerator extends Object implements QrCodeGenerator
Implementation of the QR Code Generator.
  • Constructor Details

    • ZxingGenerator

      public ZxingGenerator()
      Constructor.
  • Method Details

    • setup

      public void setup(String fileOutputPath, int dimensions)
      Description copied from interface: QrCodeGenerator
      Configure the generator with the dimension (height and width) of the QR Code Image. Height = Weight; the produced image will be always an square. It also define where the file will be stored.
      Specified by:
      setup in interface QrCodeGenerator
      Parameters:
      fileOutputPath - s String
      dimensions - as int
    • generateDataForvCard

      public String generateDataForvCard(Map<String,String> contact)
      Description copied from interface: QrCodeGenerator
      Create a vCard (Version 3.0) data structure. URL: https://en.wikipedia.org/wiki/VCard

      Property Set:
      gender: Mr.
      name: Doe
      surname: John
      title:
      organization:
      role
      home-street:
      home-city:
      home-zipcode:
      home-state:
      home-country:
      home-phone:
      home-mobile:
      work-street:
      work-city:
      work-zipcode:
      work-state:
      work-country:
      work-phone:
      work-mobile:
      e-mail: john.doe@sample.org
      homepage:
      Specified by:
      generateDataForvCard in interface QrCodeGenerator
      Parameters:
      contact - as Map
      Returns:
      dataStructure as String
    • generateDataForCalendarEvent

      public String generateDataForCalendarEvent(String event, ZonedDateTime start, ZonedDateTime end)
      Description copied from interface: QrCodeGenerator
      Encode an calender event.
      Specified by:
      generateDataForCalendarEvent in interface QrCodeGenerator
      Parameters:
      event - as String
      start - as ZonedDateTime
      end - as ZonedDateTime
      Returns:
      dataStructure as String
    • generateDataForUrl

      public String generateDataForUrl(String url)
      Description copied from interface: QrCodeGenerator
      Encode an URL which will opened in a web browser.
      Specified by:
      generateDataForUrl in interface QrCodeGenerator
      Parameters:
      url - as String
      Returns:
      dataStructure as String
    • generateDataForGeoLocation

      public String generateDataForGeoLocation(String latitude, String longitude)
      Description copied from interface: QrCodeGenerator
      A geo URI may be used to encode a point on the earth, including altitude. For example, to encode the Google's New York office, which is at 40.71872 deg N latitude, 73.98905 deg W longitude, at a point 100 meters above the office, one would encode "geo:40.71872,-73.98905,100".
      A reader might open a local mapping application like Google Maps to this location and zoom accordingly, or could open a link to this location on a mapping web site like Google Maps in the device's web browser.
      Specified by:
      generateDataForGeoLocation in interface QrCodeGenerator
      Parameters:
      latitude - as String
      longitude - as String
      Returns:
      dataStructure as String
    • encode

      public boolean encode(String data)
      Description copied from interface: QrCodeGenerator
      Encode from a given String the image and store it on the configured path.
      Specified by:
      encode in interface QrCodeGenerator
      Parameters:
      data - as String
      Returns:
      true on success
    • decode

      public String decode(File qrCode)
      Description copied from interface: QrCodeGenerator
      Extract (decode) from a image file the information as String.
      Specified by:
      decode in interface QrCodeGenerator
      Parameters:
      qrCode - as File
      Returns:
      the content as String