Skip to content

Commit

Permalink
Add Language to all the datatypes that have fields that contain prose
Browse files Browse the repository at this point in the history
like information which can be written in different languages. This
should then be used to correct language in de displayed document.
  • Loading branch information
eivinhb committed Feb 6, 2020
1 parent 3193f96 commit 3dcbbf0
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 33 deletions.
6 changes: 6 additions & 0 deletions datatypes-examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<title>Informasjon om Oslo City Røntgen</title>
<text>Oslo City Røntgen er et spesialistsenter for avansert bildediagnostikk.</text>
</info>
<language>NB</language>
</appointment>

<boligdetaljer xmlns="http://api.digipost.no/schema/datatypes">
Expand Down Expand Up @@ -63,6 +64,7 @@
<description>Gå til avsenders side for å gjøre en handling</description>
<button-text>Ta meg til handling!</button-text>
</callToAction>
<language>NB</language>
</boligdetaljer>

<event xmlns="http://api.digipost.no/schema/datatypes">
Expand Down Expand Up @@ -96,6 +98,7 @@
<url>https://valg.no</url>
<description>Les mer om valget på valg.no</description>
</links>
<language>NB</language>
</event>

<externalLink xmlns="http://api.digipost.no/schema/datatypes">
Expand Down Expand Up @@ -181,6 +184,7 @@
</cost>
<status>READY_FOR_PICKUP</status>
<tags>POSTEN</tags>
<language>NB</language>
</pickup-notice>

<pickup-notice-status xmlns="http://api.digipost.no/schema/datatypes">
Expand Down Expand Up @@ -230,6 +234,7 @@
<title>Regler</title>
<text>Det er ikke lov å rive ut sider i bøkene, eller søle med ketchup. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet urna condimentum, pulvinar neque ac, tempor tellus. Vestibulum ante ipsum primis in faucibus orci luctus et </text>
</info>
<language>NB</language>
</proof>

<receipt xmlns="http://api.digipost.no/schema/datatypes">
Expand Down Expand Up @@ -330,6 +335,7 @@
<order-number>123456</order-number>
<membership-number>HG1234HH8778</membership-number>
<comment>Hip Coffee to the good citizens of Løkka</comment>
<language>NB</language>
</receipt>

<residence xmlns="http://api.digipost.no/schema/datatypes">
Expand Down
14 changes: 14 additions & 0 deletions datatypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<xs:element minOccurs="0" name="address" type="tns:address"/>
<xs:element minOccurs="0" name="sub-title" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="info" type="tns:info"/>
<xs:element default="NB" minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -76,6 +77,7 @@
<xs:element minOccurs="0" name="andelsnummer" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="heftelser" type="tns:heftelse"/>
<xs:element minOccurs="0" name="callToAction" type="tns:externalLink"/>
<xs:element default="NB" minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -155,6 +157,7 @@
<xs:element minOccurs="0" name="barcodeLabel" type="xs:string"/>
<xs:element minOccurs="0" name="barcode" type="tns:barcode"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="links" type="tns:link"/>
<xs:element minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -240,6 +243,7 @@
<xs:element minOccurs="0" name="cost" type="tns:cost"/>
<xs:element minOccurs="0" name="status" type="tns:status"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="tags" type="tns:tag"/>
<xs:element default="NB" minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -305,6 +309,7 @@
<xs:element minOccurs="0" name="proof-id-value" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="attribute" type="tns:info"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="info" type="tns:info"/>
<xs:element default="NB" minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -384,6 +389,7 @@
<xs:element minOccurs="0" name="order-number" type="xs:string"/>
<xs:element minOccurs="0" name="membership-number" type="xs:string"/>
<xs:element minOccurs="0" name="comment" type="xs:string"/>
<xs:element default="NB" minOccurs="0" name="language" type="tns:language"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -439,6 +445,14 @@
</xs:sequence>
</xs:complexType>

<xs:simpleType name="language">
<xs:restriction base="xs:string">
<xs:enumeration value="NN"/>
<xs:enumeration value="NB"/>
<xs:enumeration value="EN"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="status">
<xs:restriction base="xs:string">
<xs:enumeration value="PICKED_UP"/>
Expand Down
60 changes: 60 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Appointment represents a meeting set for a specific place and time
|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|
|language|[Language](#appointmentlanguage)|no|Languange for the document|

### Appointment.Address

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

### Appointment.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand All @@ -60,6 +69,7 @@ Appointment represents a meeting set for a specific place and time
<title>Informasjon om Oslo City Røntgen</title>
<text>Oslo City Røntgen er et spesialistsenter for avansert bildediagnostikk.</text>
</info>
<language>NB</language>
</appointment>
```

Expand All @@ -85,6 +95,7 @@ Details about a Residence, and may be joined with Residence to retrieve the core
|andelsnummer|String|no||
|heftelser|List|no||
|callToAction|[ExternalLink](#boligdetaljerexternallink)|no|An optional ExternalLink prompting the user to perform an action on an external site|
|language|[Language](#boligdetaljerlanguage)|no|Languange for the document|

### Boligdetaljer.Residence

Expand Down Expand Up @@ -124,6 +135,14 @@ Details about a Residence, and may be joined with Residence to retrieve the core
|description|String|no|A short, optional text-field, describing the external link.|
|buttonText|String|no|Optional text which will be displayed on the button.|

### Boligdetaljer.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand Down Expand Up @@ -172,6 +191,7 @@ Details about a Residence, and may be joined with Residence to retrieve the core
<description>Gå til avsenders side for å gjøre en handling</description>
<button-text>Ta meg til handling!</button-text>
</callToAction>
<language>NB</language>
</boligdetaljer>
```

Expand All @@ -194,6 +214,7 @@ Event represents an event that occurs over a time period or several days. Eg. a
|barcodeLabel|String|no|Optional label for barcode. null yield default in gui, eg. ''|
|barcode|[Barcode](#eventbarcode)|no|Barcode|
|links|List|no|Links for releated information to the appointment|
|language|[Language](#eventlanguage)|no|Languange for the document|

### Event.Address

Expand All @@ -214,6 +235,14 @@ Event represents an event that occurs over a time period or several days. Eg. a
|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|

### Event.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand Down Expand Up @@ -248,6 +277,7 @@ Event represents an event that occurs over a time period or several days. Eg. a
<url>https://valg.no</url>
<description>Les mer om valget på valg.no</description>
</links>
<language>NB</language>
</event>
```

Expand Down Expand Up @@ -354,6 +384,7 @@ Details about a pickup notice
|cost|[Cost](#pickupnoticecost)|no|Information about value, mva, customs processing and more|
|status|[Status](#pickupnoticestatus)|no|The state the package is at present time|
|tags|Set|no|Tags to describe the document|
|language|[Language](#pickupnoticelanguage)|no|Languange for the document|

### PickupNotice.Barcode

Expand Down Expand Up @@ -432,6 +463,14 @@ Valid values:
* UNKNOWN
* DEVIATION

### PickupNotice.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand Down Expand Up @@ -497,6 +536,7 @@ Valid values:
</cost>
<status>READY_FOR_PICKUP</status>
<tags>POSTEN</tags>
<language>NB</language>
</pickup-notice>
```

Expand Down Expand Up @@ -548,6 +588,7 @@ Represents a legal document (Certificate, Licence, Permit, etc.) issued to a sin
|proofIdValue|String|no|A field for extra information identifying this proof, such as a membership number|
|attribute|List|no|Extra information for the proof, a set of key-value pairs|
|info|List|no|Extra instructions for the holder of the proof, such as special terms|
|language|[Language](#prooflanguage)|no|Languange for the document|

### Proof.ValidPeriod

Expand Down Expand Up @@ -601,6 +642,14 @@ Represents a legal document (Certificate, Licence, Permit, etc.) issued to a sin
|city|String|no||
|country|String|no||

### Proof.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand Down Expand Up @@ -646,6 +695,7 @@ Represents a legal document (Certificate, Licence, Permit, etc.) issued to a sin
<title>Regler</title>
<text>Det er ikke lov å rive ut sider i bøkene, eller søle med ketchup. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet urna condimentum, pulvinar neque ac, tempor tellus. Vestibulum ante ipsum primis in faucibus orci luctus et </text>
</info>
<language>NB</language>
</proof>
```

Expand Down Expand Up @@ -679,6 +729,7 @@ Receipt represents a document containing details about a purchase
|orderNumber|String|no||
|membershipNumber|String|no||
|comment|String|no||
|language|[Language](#receiptlanguage)|no|Languange for the document|

### Receipt.Address

Expand Down Expand Up @@ -741,6 +792,14 @@ Receipt represents a document containing details about a purchase
|address|[Address](#receiptaddress)|no||
|terms|String|no||

### Receipt.Language

Valid values:

* NB
* NN
* EN

### XML

```xml
Expand Down Expand Up @@ -842,6 +901,7 @@ Receipt represents a document containing details about a purchase
<order-number>123456</order-number>
<membership-number>HG1234HH8778</membership-number>
<comment>Hip Coffee to the good citizens of Løkka</comment>
<language>NB</language>
</receipt>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;
import lombok.experimental.Wither;
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;

Expand Down Expand Up @@ -63,6 +62,10 @@ public class Appointment implements DataType {
@Description("Additional sections of information (max 2) with a title and text")
List<Info> info;

@XmlElement(defaultValue = "NB")
@Description("Languange for the document")
Language language;

@Override
public Appointment withDefaultsForMissingOptionalValues() {
return endTime == null ? this.withEndTime(startTime.plusMinutes(30)) : this;
Expand All @@ -76,5 +79,6 @@ public Appointment withDefaultsForMissingOptionalValues() {
, Address.EXAMPLE
, "Undersøke smerter i ryggen"
, singletonList(new Info("Informasjon om Oslo City Røntgen", "Oslo City Røntgen er et spesialistsenter for avansert bildediagnostikk."))
, Language.NB
);
}
Loading

0 comments on commit 3dcbbf0

Please sign in to comment.