Class MessageDelivery
- java.lang.Object
-
- no.digipost.api.client.representations.Representation
-
- no.digipost.api.client.representations.MessageDelivery
-
- All Implemented Interfaces:
MayHaveSender
public class MessageDelivery extends Representation implements MayHaveSender
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Document>
attachments
protected Channel
deliveryMethod
protected java.time.ZonedDateTime
deliveryTime
protected java.lang.String
messageId
protected Document
primaryDocument
protected long
senderId
protected MessageStatus
status
-
Fields inherited from class no.digipost.api.client.representations.Representation
links
-
Fields inherited from interface no.digipost.api.client.representations.MayHaveSender
NO_SENDER
-
-
Constructor Summary
Constructors Constructor Description MessageDelivery()
MessageDelivery(java.lang.String messageId, Channel channel, MessageStatus status, java.time.ZonedDateTime deliveryTime)
-
Method Summary
Modifier and Type Method Description java.util.stream.Stream<Document>
getAllDocuments()
java.util.List<Document>
getAttachments()
Channel
getChannel()
java.time.ZonedDateTime
getDeliveryTime()
Document
getDocument(java.util.UUID uuid)
Link
getEncryptionKeyLink()
protected java.util.List<Link>
getLinks()
java.lang.String
getMessageId()
Document
getPrimaryDocument()
Link
getSelfLink()
java.util.Optional<SenderId>
getSenderId()
Always returns the resolved sender-id of the message, i.e.java.util.Optional<SenderOrganization>
getSenderOrganization()
Link
getSendLink()
MessageStatus
getStatus()
boolean
isAlreadyDeliveredToDigipost()
boolean
isSameMessageAs(Message message)
protected void
setLinks(java.util.List<Link> links)
boolean
willBeDeliveredInDigipost()
-
Methods inherited from class no.digipost.api.client.representations.Representation
addLink, getLinkByRelationName
-
-
-
-
Field Detail
-
messageId
protected java.lang.String messageId
-
deliveryMethod
protected Channel deliveryMethod
-
senderId
protected long senderId
-
status
protected MessageStatus status
-
deliveryTime
protected java.time.ZonedDateTime deliveryTime
-
primaryDocument
protected Document primaryDocument
-
attachments
protected java.util.List<Document> attachments
-
-
Constructor Detail
-
MessageDelivery
public MessageDelivery()
-
MessageDelivery
public MessageDelivery(java.lang.String messageId, Channel channel, MessageStatus status, java.time.ZonedDateTime deliveryTime)
-
-
Method Detail
-
getLinks
protected java.util.List<Link> getLinks()
-
setLinks
protected void setLinks(java.util.List<Link> links)
-
getMessageId
public java.lang.String getMessageId()
-
getAttachments
public java.util.List<Document> getAttachments()
-
isSameMessageAs
public boolean isSameMessageAs(Message message)
-
getStatus
public MessageStatus getStatus()
-
getEncryptionKeyLink
public Link getEncryptionKeyLink()
-
getSendLink
public Link getSendLink()
-
willBeDeliveredInDigipost
public boolean willBeDeliveredInDigipost()
-
isAlreadyDeliveredToDigipost
public boolean isAlreadyDeliveredToDigipost()
-
getSelfLink
public Link getSelfLink()
-
getChannel
public Channel getChannel()
-
getDeliveryTime
public java.time.ZonedDateTime getDeliveryTime()
-
getPrimaryDocument
public Document getPrimaryDocument()
-
getAllDocuments
public java.util.stream.Stream<Document> getAllDocuments()
- Returns:
- an ordered Stream containing every
Document
in this delivery. The primary document will be the first element of the stream, with the attachments following.
-
getDocument
public Document getDocument(java.util.UUID uuid)
-
getSenderId
public java.util.Optional<SenderId> getSenderId()
Always returns the resolved sender-id of the message, i.e. what the receiver of the message sees as the sender of the message. If the originatingMessage
has specified nosender-id
norsender-organization
, it will be set to the broker-id which was specified in the X-Digipost-UserId header of the initiating request.- Specified by:
getSenderId
in interfaceMayHaveSender
- Returns:
- always the sender-id, never
null
.
-
getSenderOrganization
public java.util.Optional<SenderOrganization> getSenderOrganization()
- Specified by:
getSenderOrganization
in interfaceMayHaveSender
- Returns:
- always
Optional.empty()
- See Also:
getSenderId()
-
-