Skip to content

Commit

Permalink
Utvide PickupNotice med tags. Vi skal bruke disse for å angi
Browse files Browse the repository at this point in the history
"metadata" i dokumentet. Slik metadata er til for å kunne styre
innholdet i selve dokumentet.
  • Loading branch information
eivinhb committed Jan 11, 2019
1 parent 9e692de commit 86582a3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ Details about a pickup notice
|thePackage|[Package](#pickupnoticepackage)|no|package information|
|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|

### PickupNotice.Barcode

Expand Down Expand Up @@ -378,6 +379,7 @@ Valid values:
<cod-fee>0</cod-fee>
</cost>
<status>READY_FOR_PICKUP</status>
<tags>POSTEN</tags>
</pickup-notice>
```

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/no/digipost/api/datatypes/types/Tag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package no.digipost.api.datatypes.types;

public enum Tag {
VARSEL1
, VARSEL2
, POSTEN
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.experimental.Wither;
import no.digipost.api.datatypes.ComplementedBy;
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.ComplementedBy;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.Set;

@XmlRootElement(name = "pickup-notice")
@Value
Expand Down Expand Up @@ -83,6 +86,10 @@ public class PickupNotice implements DataType {
@Description("The state the package is at present time")
Status status;

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

@Override
public PickupNotice withDefaultsForMissingOptionalValues() {
if (status == null) {
Expand All @@ -105,7 +112,8 @@ public PickupNotice withDefaultsForMissingOptionalValues() {
, PickupPlace.EXAMPLE
, Package.EXAMPLE
, Cost.EXAMPLE
, Status.READY_FOR_PICKUP
, Status.READY_FOR_PICKUP,
Collections.singleton(Tag.POSTEN)
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
package no.digipost.api.datatypes.types.pickup;

public enum Status {READY_FOR_PICKUP, PICKED_UP, RETURNED, UNKNOWN, DEVIATION}
public enum Status {
READY_FOR_PICKUP
, PICKED_UP
, RETURNED
, UNKNOWN
, DEVIATION
}

0 comments on commit 86582a3

Please sign in to comment.