-
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.
Merge pull request #72 from digipost/deling
Add new datatype ShareDocumentsRequest
- Loading branch information
Showing
9 changed files
with
228 additions
and
4 deletions.
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
40 changes: 40 additions & 0 deletions
40
src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequest.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,40 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.ComplementedBy; | ||
import no.digipost.api.datatypes.DataType; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
@XmlRootElement(name = "share-documents-request") | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("A request for a user to share one or more documents") | ||
@ComplementedBy({ShareDocumentsRequestSharingStopped.class}) | ||
public class ShareDocumentsRequest implements DataType { | ||
|
||
@XmlElement(name="max-share-duration-seconds", required = true) | ||
@NotNull | ||
@Description("This is the maximum duration in which you are allowed to access the user's documents from they are shared with you") | ||
Long maxShareDurationSeconds; | ||
|
||
@XmlElement(name="purpose", required = true) | ||
@NotNull | ||
@Description("This text should explain why you need to process the recipient's documents in a short and understandable way.") | ||
String purpose; | ||
|
||
public static final ShareDocumentsRequest EXAMPLE = new ShareDocumentsRequest( | ||
14 * 24 * 60 * 60L, | ||
"We require to see your latest pay slip in order to grant you a loan." | ||
); | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestDocumentsShared.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,37 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
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 javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@XmlRootElement(name = "share-documents-request-documents-shared") | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("Documents have been shared for ShareDocumentsRequest") | ||
public class ShareDocumentsRequestDocumentsShared implements DataType { | ||
|
||
@XmlElement(name = "document-ids") | ||
@Description("The IDs of the documents related to this specific event") | ||
List<Long> documentIds; | ||
|
||
public static final ShareDocumentsRequestDocumentsShared EXAMPLE = createExample(); | ||
|
||
private static ShareDocumentsRequestDocumentsShared createExample() { | ||
List<Long> documentIds = new ArrayList<>(1); | ||
documentIds.add(123L); | ||
return new ShareDocumentsRequestDocumentsShared( | ||
documentIds | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestSharingStopped.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,22 @@ | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
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 javax.xml.bind.annotation.XmlRootElement; | ||
|
||
@XmlRootElement(name = "share-documents-request-sharing-stopped") | ||
@Value | ||
@NoArgsConstructor(force = true, access = AccessLevel.PUBLIC) | ||
@With | ||
@Description("Stop sharing of documents for ShareDocumentsRequest") | ||
public class ShareDocumentsRequestSharingStopped implements DataType { | ||
|
||
public static final ShareDocumentsRequestSharingStopped EXAMPLE = new ShareDocumentsRequestSharingStopped(); | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/no/digipost/api/datatypes/types/share/package-info.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,21 @@ | ||
@XmlSchema(namespace = DIGIPOST_DATATYPES_NAMESPACE, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlJavaTypeAdapters({ | ||
@XmlJavaTypeAdapter(ZonedDateTimeXmlAdapter.class), | ||
@XmlJavaTypeAdapter(LocalDateTimeXmlAdapter.class) | ||
}) | ||
@DataTypePackage | ||
package no.digipost.api.datatypes.types.share; | ||
|
||
import no.digipost.api.datatypes.documentation.DataTypePackage; | ||
import no.digipost.api.datatypes.marshalling.LocalDateTimeXmlAdapter; | ||
import no.digipost.api.datatypes.marshalling.ZonedDateTimeXmlAdapter; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlSchema; | ||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | ||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; | ||
|
||
import static no.digipost.api.datatypes.marshalling.DataTypesJAXBContext.DIGIPOST_DATATYPES_NAMESPACE; | ||
|
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