| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| QrCodeGenerator | 21 | 0 | - | 0 | 0 |
| 1 | package org.europa.together.business; | |
| 2 | ||
| 3 | import java.io.File; | |
| 4 | import java.time.ZonedDateTime; | |
| 5 | import java.util.Map; | |
| 6 | import org.apiguardian.api.API; | |
| 7 | import static org.apiguardian.api.API.Status.STABLE; | |
| 8 | import org.springframework.stereotype.Component; | |
| 9 | ||
| 10 | /** | |
| 11 | * Generates Quick Response Codes (QR Codes). The generator provides | |
| 12 | * DataStructures like calendar entry or contact information (PIM). It's | |
| 13 | * implemented an encoder and also an decoder. | |
| 14 | * | |
| 15 | * @author elmar.dott@gmail.com | |
| 16 | * @version 1.2 | |
| 17 | * @since 1.0 | |
| 18 | */ | |
| 19 | @API(status = STABLE, since = "1.0", consumers = "ZxingGenerator") | |
| 20 | @Component | |
| 21 | public interface QrCodeGenerator { | |
| 22 | ||
| 23 | /** | |
| 24 | * Identifier for the given feature. | |
| 25 | */ | |
| 26 | @API(status = STABLE, since = "1.2") | |
| 27 | String FEATURE_ID = "CM-07"; | |
| 28 | ||
| 29 | /** | |
| 30 | * Configure the generator with the dimension (height and width) of the QR | |
| 31 | * Code Image. Height = Weight; the produced image will be always an square. | |
| 32 | * It also define where the file will be stored. | |
| 33 | * | |
| 34 | * @param dimensions as int | |
| 35 | * @param fileOutputPath s String | |
| 36 | */ | |
| 37 | @API(status = STABLE, since = "1.0") | |
| 38 | void setup(String fileOutputPath, int dimensions); | |
| 39 | ||
| 40 | /** | |
| 41 | * Encode from a given String the image and store it on the configured path. | |
| 42 | * | |
| 43 | * @param data as String | |
| 44 | * @return true on success | |
| 45 | */ | |
| 46 | @API(status = STABLE, since = "1.0") | |
| 47 | boolean encode(String data); | |
| 48 | ||
| 49 | /** | |
| 50 | * Extract (decode) from a image file the information as String. | |
| 51 | * | |
| 52 | * @param qrCode as File | |
| 53 | * @return the content as String | |
| 54 | */ | |
| 55 | @API(status = STABLE, since = "1.0") | |
| 56 | String decode(File qrCode); | |
| 57 | ||
| 58 | /** | |
| 59 | * Create a vCard (Version 3.0) data structure. URL: | |
| 60 | * https://en.wikipedia.org/wiki/VCard<br><br> | |
| 61 | * | |
| 62 | * Property Set:<br> | |
| 63 | * gender: Mr.<br> | |
| 64 | * name: Doe<br> | |
| 65 | * surname: John<br> | |
| 66 | * title: <br> | |
| 67 | * | |
| 68 | * organization: <br> | |
| 69 | * role <br> | |
| 70 | * | |
| 71 | * home-street: <br> | |
| 72 | * home-city: <br> | |
| 73 | * home-zipcode: <br> | |
| 74 | * home-state: <br> | |
| 75 | * home-country: <br> | |
| 76 | * home-phone: <br> | |
| 77 | * home-mobile: <br> | |
| 78 | * | |
| 79 | * work-street: <br> | |
| 80 | * work-city: <br> | |
| 81 | * work-zipcode: <br> | |
| 82 | * work-state: <br> | |
| 83 | * work-country: <br> | |
| 84 | * work-phone: <br> | |
| 85 | * work-mobile: <br> | |
| 86 | * | |
| 87 | * e-mail: john.doe@sample.org<br> | |
| 88 | * homepage: <br> | |
| 89 | * | |
| 90 | * | |
| 91 | * @param contact as Map | |
| 92 | * @return dataStructure as String | |
| 93 | */ | |
| 94 | @API(status = STABLE, since = "1.0") | |
| 95 | String generateDataForvCard(Map<String, String> contact); | |
| 96 | ||
| 97 | /** | |
| 98 | * Encode an calender event. | |
| 99 | * | |
| 100 | * @param event as String | |
| 101 | * @param start as ZonedDateTime | |
| 102 | * @param end as ZonedDateTime | |
| 103 | * @return dataStructure as String | |
| 104 | */ | |
| 105 | @API(status = STABLE, since = "2.1") | |
| 106 | String generateDataForCalendarEvent(String event, ZonedDateTime start, ZonedDateTime end); | |
| 107 | ||
| 108 | /** | |
| 109 | * Encode an URL which will opened in a web browser. | |
| 110 | * | |
| 111 | * @param url as String | |
| 112 | * @return dataStructure as String | |
| 113 | */ | |
| 114 | @API(status = STABLE, since = "1.0") | |
| 115 | String generateDataForUrl(String url); | |
| 116 | ||
| 117 | /** | |
| 118 | * A geo URI may be used to encode a point on the earth, including altitude. | |
| 119 | * For example, to encode the Google's New York office, which is at 40.71872 | |
| 120 | * deg N latitude, 73.98905 deg W longitude, at a point 100 meters above the | |
| 121 | * office, one would encode "geo:40.71872,-73.98905,100". | |
| 122 | * <br> | |
| 123 | * A reader might open a local mapping application like Google Maps to this | |
| 124 | * location and zoom accordingly, or could open a link to this location on a | |
| 125 | * mapping web site like Google Maps in the device's web browser. | |
| 126 | * | |
| 127 | * @param longitude as String | |
| 128 | * @param latitude as String | |
| 129 | * @return dataStructure as String | |
| 130 | */ | |
| 131 | @API(status = STABLE, since = "1.0") | |
| 132 | String generateDataForGeoLocation(String latitude, String longitude); | |
| 133 | } |