Skip to content

Commit

Permalink
Diverse utvidelser av Appointment for å støtte Valgkort:
Browse files Browse the repository at this point in the history
* Barcode er nå tilgjengelig opsjon
* Barcode har fått beskrivelse som kan legges ved koden
* Lagt til Tag i Appointment slik at vi kan sjekke etter om Appointment er
  et valgkort i koden som skal rendre dette.
* Lagt til ny type for Link
* Det er nå mulig å spesifisere tittelen på sted.
  • Loading branch information
eivinhb committed May 9, 2019
1 parent 51332fb commit fc8342d
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 5 deletions.
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ Appointment represents a meeting set for a specific place and time
|endTime|ZonedDateTime|no|ISO8601 full DateTime. Default value 30 minutes after startTime|
|arrivalTime|String|no|Free text but can contain a ISO8601 DateTime. Example: Please arrive 15 minutes early|
|place|String|no|The name of the place. Example: Oslo City Røntgen|
|placeTitle|String|no|Optional title for place. null yield default in gui, not data|
|address|[Address](#appointmentaddress)|no||
|subTitle|String|no|Example: MR-undersøkelse av høyre kne|
|info|List|no|Additional sections of information (max 2) with a title and text|
|barcode|[Barcode](#appointmentbarcode)|no|Barcode|
|tags|Set|no|Tags to describe the document|
|links|List|no|Links for releated information to the appointment|

### Appointment.Address

Expand All @@ -39,6 +43,14 @@ Appointment represents a meeting set for a specific place and time
|city|String|no||
|country|String|no||

### Appointment.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|

### XML

```xml
Expand Down Expand Up @@ -247,6 +259,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|

### PickupNotice.Recipient

Expand Down Expand Up @@ -461,6 +474,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|

### Receipt.TaxiDetails

Expand Down
23 changes: 21 additions & 2 deletions src/main/java/no/digipost/api/datatypes/types/Appointment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;

@XmlRootElement
@Value
Expand Down Expand Up @@ -45,6 +46,11 @@ public class Appointment implements DataType {
@Description("The name of the place. Example: Oslo City Røntgen")
@Size(max = 150)
String place;

@XmlElement
@Description("Optional title for place. null yield default in gui, not data")
@Size(max = 150)
String placeTitle;

@XmlElement
@Valid
Expand All @@ -61,6 +67,18 @@ public class Appointment implements DataType {
@Description("Additional sections of information (max 2) with a title and text")
List<Info> info;

@XmlElement(name = "barcode")
@Description("Barcode")
Barcode barcode;

@XmlElement(name = "tags")
@Description("Tags to describe the document")
Set<Tag> tags;

@XmlElement(name = "links")
@Description("Links for releated information to the appointment")
List<Link> links;

@Override
public Appointment withDefaultsForMissingOptionalValues() {
return endTime == null ? this.withEndTime(startTime.plusMinutes(30)) : this;
Expand All @@ -70,7 +88,8 @@ public Appointment withDefaultsForMissingOptionalValues() {
ZonedDateTime.of(2017, 6, 27, 10, 0, 0, 0, ZoneId.systemDefault()),
ZonedDateTime.of(2017, 6, 27, 11, 0, 0, 0, ZoneId.systemDefault()),
"Oppmøte senest 15 minutter før timen",
"Oslo City Røntgen", Address.EXAMPLE,
"Oslo City Røntgen", null, Address.EXAMPLE,
"Undersøke smerter i ryggen", Collections.singletonList(
new Info("Informasjon om Oslo City Røntgen", "Oslo City Røntgen er et spesialistsenter for avansert bildediagnostikk.")));
new Info("Informasjon om Oslo City Røntgen", "Oslo City Røntgen er et spesialistsenter for avansert bildediagnostikk."))
, null, null, null);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package no.digipost.api.datatypes.types.receipt;
package no.digipost.api.datatypes.types;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -25,5 +25,9 @@ public class Barcode {
@XmlElement(name = "barcode-type")
String barcodeType;

public static Barcode EXAMPLE = new Barcode("1234567890", CODE_128);
@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);
}
41 changes: 41 additions & 0 deletions src/main/java/no/digipost/api/datatypes/types/Link.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package no.digipost.api.datatypes.types;

import lombok.*;
import lombok.experimental.Wither;
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;
import no.digipost.api.datatypes.validation.WebUrl;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import java.net.URI;
import java.time.ZoneId;
import java.time.ZonedDateTime;

@XmlType
@Value
@AllArgsConstructor
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@Wither
@Description("A link is a represention of an <a> element in html with href-url and a text. <a href='url'>description</a>")
public class Link {

@XmlElement(required = true)
@XmlSchemaType(name="anyURI")
@NotNull
@WebUrl
@Description("Target URL of this link. Must be http or https.")
URI url;

@XmlElement(required = true)
@Size(max = 70)
@Description("The text-part of av an <a> html element.")
String description;

public static Link EXAMPLE = new Link(URI.create("https://valg.no"),
"Les mer om valget på valg.no");
}
1 change: 1 addition & 0 deletions src/main/java/no/digipost/api/datatypes/types/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ public enum Tag {
VARSEL1
, VARSEL2
, POSTEN
, VALGKORT
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;
import no.digipost.api.datatypes.types.Tag;
import no.digipost.api.datatypes.types.receipt.Barcode;
import no.digipost.api.datatypes.types.Barcode;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;
import no.digipost.api.datatypes.types.Address;
import no.digipost.api.datatypes.types.Barcode;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
Expand Down

0 comments on commit fc8342d

Please sign in to comment.