From 62d52b34332dd9ecdd3ebd9258a565e8bcc42c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20Bergst=C3=B8l?= Date: Thu, 23 May 2019 11:58:00 +0200 Subject: [PATCH] =?UTF-8?q?Event=20er=20lagt=20til=20som=20datatype=20i=20?= =?UTF-8?q?DataTypeIdentifier=20Barcode=20er=20utvidet=20med=20litt=20fler?= =?UTF-8?q?e=20felter=20Oppdatert=20hibernate=20slik=20at=20vi=20kan=20bru?= =?UTF-8?q?ke=20NotEmpty=20som=20validering=20p=C3=A5=20liste.=20Dokumenta?= =?UTF-8?q?sjon=20er=20oppdatert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NOTICE | 2 +- pom.xml | 4 +- readme.md | 82 +++++++++++++++++++ .../api/datatypes/DataTypeIdentifier.java | 2 + .../digipost/api/datatypes/types/Barcode.java | 16 +++- .../digipost/api/datatypes/types/Event.java | 14 ++-- .../digipost/api/datatypes/types/jaxb.index | 1 + 7 files changed, 109 insertions(+), 12 deletions(-) diff --git a/NOTICE b/NOTICE index bf1bc702..776dad8a 100644 --- a/NOTICE +++ b/NOTICE @@ -16,7 +16,7 @@ This project includes: ClassMate under The Apache Software License, Version 2.0 digipost-data-types under The Apache Software License, Version 2.0 Expression Language 3.0 under CDDL + GPLv2 with classpath exception - Hibernate Validator Engine under Apache License, Version 2.0 + Hibernate Validator Engine under Apache License 2.0 Jackson datatype: JSR310 under The Apache Software License, Version 2.0 Jackson-annotations under The Apache Software License, Version 2.0 Jackson-core under The Apache Software License, Version 2.0 diff --git a/pom.xml b/pom.xml index 6d421a99..bede591b 100644 --- a/pom.xml +++ b/pom.xml @@ -57,12 +57,12 @@ javax.validation validation-api - 2.0.0.Final + 2.0.1.Final org.hibernate hibernate-validator - 5.4.1.Final + 6.0.16.Final runtime diff --git a/readme.md b/readme.md index f35c5719..7e9d9066 100644 --- a/readme.md +++ b/readme.md @@ -5,6 +5,7 @@ |[Appointment](#appointment)|Appointment represents a meeting set for a specific place and time| |[Boligdetaljer](#boligdetaljer)|Details about a Residence, and may be joined with Residence to retrieve the core fields of a Residence.| |[Category](#category)|Category is a way to specify which category the data of a document is related to.| +|[Event](#event)|Event represents an event that occurs over a time period or several days. Eg. a conference or an election| |[ExternalLink](#externallink)|An external URL, along with an optional description and deadline for resources such as a survey.| |[Payslip](#payslip)|For treating documents as Payslips.| |[PickupNotice](#pickupnotice)|Details about a pickup notice| @@ -174,6 +175,81 @@ Category is a way to specify which category the data of a document is related to RESIDENCE ``` +## Event + +Event represents an event that occurs over a time period or several days. Eg. a conference or an election + +### Fields + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|subTitle|String|no|Example: 'Kommunestyre- og fylkestingvalg'| +|time|List|yes|List of time intervals| +|timeLabel|String|no|Optional label for time. null yield default in gui, eg. 'Opening hours'| +|description|String|no|Free text but can contain a ISO8601 DateTime. Example: 'Please use entrance from street'| +|place|String|no|The name of the place. Example: 'Sagene skole'| +|placeLabel|String|no|Optional label for place. null yield default in gui, eg. 'Venue location'| +|address|[Address](#eventaddress)|no|| +|info|List|no|Additional sections of information (max 10) with a title and text.| +|barcode|[Barcode](#eventbarcode)|no|Barcode| +|links|List|no|Links for releated information to the appointment| + +### Event.Address + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|streetAddress|String|no|E.g. Storgata 11| +|streetAddress2|String|no|E.g. Romerike Næringspark| +|postalCode|String|no|| +|city|String|no|| +|country|String|no|| + +### Event.Barcode + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|barcodeValue|String|no|The barcode on this receipt| +|barcodeType|String|no|| +|barcodeText|String|no|Barcode text can be used to describe the barcode| +|showValueInBarcode|Boolean|no|If true, the barcode will render its value as part of the image| + +### XML + +```xml + + + Kommunestyre- og fylkestingvalg + + 2019-05-23T10:00:00+02:00 + 2019-05-23T16:00:00+02:00 + + Opening hours + Velkommen til valg! Husk legitimasjon. + Sagene skole + Election venue +
+ Storgata 23 + 0011 + Oslo + Norge +
+ + Forhåndsstemming + Du kan forhåndsstemme fra 10. august + + + 1234567890 + code-128 + Show barcode for faster identification + true + + + https://valg.no + Les mer om valget på valg.no + +
+``` + ## ExternalLink An external URL, along with an optional description and deadline for resources such as a survey. @@ -248,6 +324,7 @@ Details about a pickup notice |barcodeValue|String|no|The barcode on this receipt| |barcodeType|String|no|| |barcodeText|String|no|Barcode text can be used to describe the barcode| +|showValueInBarcode|Boolean|no|If true, the barcode will render its value as part of the image| ### PickupNotice.Recipient @@ -327,6 +404,8 @@ Valid values: 1234567890 CODE_128 + Show barcode for faster identification + true Klimanøytral Servicepakke 2018-09-10T10:00:00+02:00 @@ -463,6 +542,7 @@ Receipt represents a document containing details about a purchase |barcodeValue|String|no|The barcode on this receipt| |barcodeType|String|no|| |barcodeText|String|no|Barcode text can be used to describe the barcode| +|showValueInBarcode|Boolean|no|If true, the barcode will render its value as part of the image| ### Receipt.TaxiDetails @@ -532,6 +612,8 @@ Receipt represents a document containing details about a purchase 1234567890 code-128 + Show barcode for faster identification + true Bank Axept diff --git a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java index fd667d1e..5dbb5e93 100644 --- a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java +++ b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java @@ -3,6 +3,7 @@ import no.digipost.api.datatypes.types.Appointment; import no.digipost.api.datatypes.types.Boligdetaljer; import no.digipost.api.datatypes.types.Category; +import no.digipost.api.datatypes.types.Event; import no.digipost.api.datatypes.types.ExternalLink; import no.digipost.api.datatypes.types.Payslip; import no.digipost.api.datatypes.types.Residence; @@ -42,6 +43,7 @@ public enum DataTypeIdentifier { , SIGNED_DOCUMENT(SignedDocument.class, "SIGN", SignedDocument.EXAMPLE) , PICKUP_NOTICE(PickupNotice.class, "PKUP", PickupNotice.EXAMPLE) , PICKUP_NOTICE_STATUS(PickupNoticeStatus.class, "PKUS", PickupNoticeStatus.EXAMPLE) + , EVENT(Event.class, "EVNT", Event.EXAMPLE) ; private final Class dataType; diff --git a/src/main/java/no/digipost/api/datatypes/types/Barcode.java b/src/main/java/no/digipost/api/datatypes/types/Barcode.java index 9731b6dc..8dd61dd7 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Barcode.java +++ b/src/main/java/no/digipost/api/datatypes/types/Barcode.java @@ -7,6 +7,7 @@ import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; +import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; @@ -20,14 +21,27 @@ public class Barcode { @XmlElement(name = "barcode-value") @Description("The barcode on this receipt") + @Size(max = 20) String barcodeValue; @XmlElement(name = "barcode-type") + @Size(max = 12) String barcodeType; @XmlElement(name = "barcode-text") @Description("Barcode text can be used to describe the barcode") String barcodeText; - public static Barcode EXAMPLE = new Barcode("1234567890", CODE_128, null); + @XmlElement(name = "show-value-in-barcode", defaultValue = "false") + @Description("If true, the barcode will render its value as part of the image") + Boolean showValueInBarcode; + + public Barcode(@Size(max = 20) String barcodeValue, @Size(max = 12) String barcodeType) { + this.barcodeValue = barcodeValue; + this.barcodeType = barcodeType; + barcodeText = null; + showValueInBarcode = false; + } + + public static Barcode EXAMPLE = new Barcode("1234567890", CODE_128, "Show barcode for faster identification", true); } diff --git a/src/main/java/no/digipost/api/datatypes/types/Event.java b/src/main/java/no/digipost/api/datatypes/types/Event.java index 115a5e53..31027a6e 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Event.java +++ b/src/main/java/no/digipost/api/datatypes/types/Event.java @@ -10,7 +10,6 @@ import javax.validation.Valid; import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -32,7 +31,6 @@ public class Event implements DataType { String subTitle; @XmlElement(name = "start-time", required = true) - @NotNull @NotEmpty @Description("List of time intervals") List time; @@ -42,10 +40,10 @@ public class Event implements DataType { @Size(max = 150) String timeLabel; - @XmlElement(name = "arrival-time") + @XmlElement(name = "description") @Description("Free text but can contain a ISO8601 DateTime. Example: 'Please use entrance from street'") - @Size(max = 150) - String arrivalTime; + @Size(max = 120) + String description; @XmlElement @Description("The name of the place. Example: 'Sagene skole'") @@ -63,8 +61,8 @@ public class Event implements DataType { @XmlElement @Valid - @Size(max = 2) - @Description("Additional sections of information (max 2) with a title and text.") + @Size(max = 10) + @Description("Additional sections of information (max 10) with a title and text.") List info; @XmlElement(name = "barcode") @@ -79,7 +77,7 @@ public class Event implements DataType { "Kommunestyre- og fylkestingvalg" , singletonList(TimeInterval.EXAMPLE) , "Opening hours" - , "Husk legitimasjon" + , "Velkommen til valg! Husk legitimasjon." , "Sagene skole" , "Election venue" , Address.EXAMPLE diff --git a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index index 61a7a623..24924807 100644 --- a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index +++ b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index @@ -1,6 +1,7 @@ Appointment Residence Category +Event ExternalLink Boligdetaljer receipt.Receipt