-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataType for accessing shared document in share-documents-request
We want to register when and by who a shared document has been accessed. These events must contain all necessary information regarding the shared document, because metadata about the shared document itself is not known once the sharing has stopped. This enables both sender and receiver to see a history of access even after the sharing is stopped. Additionally, the SharingStopped type is extended with optional fields explaining which party stopped the sharing. This is especially important for senders, who may be confused by the state of their sharing request in the event that the receiver stops the sharing before the sender has had the chance to access the shared documen.
- Loading branch information
Showing
13 changed files
with
319 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/no/digipost/api/datatypes/types/share/MessagingParty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
public enum MessagingParty { | ||
SENDER, | ||
RECEIVER | ||
} |
43 changes: 43 additions & 0 deletions
43
...ain/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestDocumentAccessed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.xml.bind.annotation.XmlElement; | ||
import jakarta.xml.bind.annotation.XmlRootElement; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.DataType; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
@XmlRootElement(name = "share-documents-request-document-accessed") | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("Documents have been accessed for ShareDocumentsRequest by the receiver.") | ||
public class ShareDocumentsRequestDocumentAccessed implements DataType { | ||
|
||
@XmlElement(name = "accessed-time", required = true) | ||
@Description("The point of time the document was accessed,") | ||
ZonedDateTime accessedTime; | ||
|
||
@XmlElement(name="accessed-by", required = true) | ||
@NotNull | ||
@Description("Name of the person or organisation who accessed the shared document.") | ||
String accessedBy; | ||
|
||
@XmlElement(required = true) | ||
SharedDocumentData sharedDocumentData; | ||
|
||
public static final ShareDocumentsRequestDocumentAccessed EXAMPLE = new ShareDocumentsRequestDocumentAccessed( | ||
ZonedDateTime.of(2024, 9, 16, 10, 0, 0, 0, ZoneId.of("+02:00")), | ||
"Whoever Accessed", | ||
SharedDocumentData.EXAMPLE | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import jakarta.xml.bind.annotation.XmlElement; | ||
import jakarta.xml.bind.annotation.XmlType; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
import java.math.BigInteger; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
@XmlType | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("Contains details about a shared document") | ||
public class SharedDocumentData { | ||
|
||
@XmlElement(name = "delivery-time", required = true) | ||
ZonedDateTime deliveryTime; | ||
|
||
@XmlElement(required = true) | ||
String subject; | ||
|
||
@XmlElement(name = "file-type", required = true) | ||
String fileType; | ||
|
||
@XmlElement(name = "file-size-bytes", required = true) | ||
BigInteger fileSizeBytes; | ||
|
||
@XmlElement(required = true) | ||
SharedDocumentOrigin origin; | ||
|
||
public static final SharedDocumentData EXAMPLE = new SharedDocumentData( | ||
ZonedDateTime.of(2024, 9, 16, 10, 0, 0, 0, ZoneId.of("+02:00")), | ||
"Subject", | ||
"PDF", | ||
BigInteger.ONE, | ||
new SharedDocumentOrigin().withOrganisation(SharedDocumentOriginOrganisation.EXAMPLE) | ||
); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOrigin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import jakarta.xml.bind.annotation.XmlElement; | ||
import jakarta.xml.bind.annotation.XmlType; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
@XmlType | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PUBLIC) | ||
@With | ||
@Description("Contains details about a single item (line) on the receipt") | ||
public class SharedDocumentOrigin { | ||
|
||
@XmlElement(name = "private-person", required = false) | ||
SharedDocumentOriginPrivatePerson privatePerson; | ||
@XmlElement(name = "organisation", required = false) | ||
SharedDocumentOriginOrganisation organisation; | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginOrganisation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import jakarta.xml.bind.annotation.XmlAttribute; | ||
import jakarta.xml.bind.annotation.XmlType; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
@XmlType | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("Origin of shared document is an organisation") | ||
public class SharedDocumentOriginOrganisation { | ||
|
||
@XmlAttribute(name = "organisation-number", required = true) | ||
String organisationNumber; | ||
@XmlAttribute(name = "name", required = true) | ||
String name; | ||
|
||
public static final SharedDocumentOriginOrganisation EXAMPLE = new SharedDocumentOriginOrganisation( | ||
"984661185", | ||
"Posten Bring AS" | ||
); | ||
|
||
} |
Oops, something went wrong.