Skip to content

Commit

Permalink
Event er lagt til som datatype i DataTypeIdentifier
Browse files Browse the repository at this point in the history
Barcode er utvidet med litt flere felter
Oppdatert hibernate slik at vi kan bruke NotEmpty som validering på liste.
Dokumentasjon er oppdatert
  • Loading branch information
eivinhb committed May 23, 2019
1 parent 7fbb72d commit 62d52b3
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.4.1.Final</version>
<version>6.0.16.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
82 changes: 82 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -174,6 +175,81 @@ Category is a way to specify which category the data of a document is related to
<category xmlns="http://api.digipost.no/schema/datatypes">RESIDENCE</category>
```

## 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<event xmlns="http://api.digipost.no/schema/datatypes">
<sub-title>Kommunestyre- og fylkestingvalg</sub-title>
<start-time>
<start-time>2019-05-23T10:00:00+02:00</start-time>
<end-time>2019-05-23T16:00:00+02:00</end-time>
</start-time>
<timeLabel>Opening hours</timeLabel>
<description>Velkommen til valg! Husk legitimasjon.</description>
<place>Sagene skole</place>
<placeLabel>Election venue</placeLabel>
<address>
<street-address>Storgata 23</street-address>
<postal-code>0011</postal-code>
<city>Oslo</city>
<country>Norge</country>
</address>
<info>
<title>Forhåndsstemming</title>
<text>Du kan forhåndsstemme fra 10. august</text>
</info>
<barcode>
<barcode-value>1234567890</barcode-value>
<barcode-type>code-128</barcode-type>
<barcode-text>Show barcode for faster identification</barcode-text>
<show-value-in-barcode>true</show-value-in-barcode>
</barcode>
<links>
<url>https://valg.no</url>
<description>Les mer om valget på valg.no</description>
</links>
</event>
```

## ExternalLink

An external URL, along with an optional description and deadline for resources such as a survey.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -327,6 +404,8 @@ Valid values:
<barcode>
<barcode-value>1234567890</barcode-value>
<barcode-type>CODE_128</barcode-type>
<barcode-text>Show barcode for faster identification</barcode-text>
<show-value-in-barcode>true</show-value-in-barcode>
</barcode>
<product-name>Klimanøytral Servicepakke</product-name>
<arrival-date-time>2018-09-10T10:00:00+02:00</arrival-date-time>
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -532,6 +612,8 @@ Receipt represents a document containing details about a purchase
<barcode>
<barcode-value>1234567890</barcode-value>
<barcode-type>code-128</barcode-type>
<barcode-text>Show barcode for faster identification</barcode-text>
<show-value-in-barcode>true</show-value-in-barcode>
</barcode>
<payments>
<type>Bank Axept</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<? extends DataType> dataType;
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/no/digipost/api/datatypes/types/Barcode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
14 changes: 6 additions & 8 deletions src/main/java/no/digipost/api/datatypes/types/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<TimeInterval> time;
Expand All @@ -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'")
Expand All @@ -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> info;

@XmlElement(name = "barcode")
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Appointment
Residence
Category
Event
ExternalLink
Boligdetaljer
receipt.Receipt
Expand Down

0 comments on commit 62d52b3

Please sign in to comment.