/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.connectparticipant.model; import java.io.Serializable; /** *
* An item - message or event - that has been sent. *
*/ public class Item implements Serializable { /** ** The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, * 2019-11-08T02:41:28.172Z. *
*
* Constraints:
* Length: 1 - 100
*/
private String absoluteTime;
/**
*
* The content of the message or event. *
*
* Constraints:
* Length: 1 - 16384
*/
private String content;
/**
*
* The type of content of the item. *
*
* Constraints:
* Length: 1 - 100
*/
private String contentType;
/**
*
* The ID of the item. *
*
* Constraints:
* Length: 1 - 256
*/
private String id;
/**
*
* Type of the item: message or event. *
*
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*/
private String type;
/**
*
* The ID of the sender in the session. *
*
* Constraints:
* Length: 1 - 256
*/
private String participantId;
/**
*
* The chat display name of the sender. *
*
* Constraints:
* Length: 1 - 256
*/
private String displayName;
/**
*
* The role of the sender. For example, is it a customer, agent, or system. *
*
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*/
private String participantRole;
/**
*
* Provides information about the attachments. *
*/ private java.util.List* The metadata related to the message. Currently this supports only * information related to message receipts. *
*/ private MessageMetadata messageMetadata; /** ** The contactId on which the transcript item was originally sent. This * field is only populated for persistent chats when the transcript item is * from the past chat session. For more information, see Enable persistent chat. *
*
* Constraints:
* Length: 1 - 256
*/
private String relatedContactId;
/**
*
* The contactId on which the transcript item was originally sent. This * field is populated only when the transcript item is from the current chat * session. *
*
* Constraints:
* Length: 1 - 256
*/
private String contactId;
/**
*
* The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, * 2019-11-08T02:41:28.172Z. *
*
* Constraints:
* Length: 1 - 100
*
* @return
* The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For * example, 2019-11-08T02:41:28.172Z. *
*/ public String getAbsoluteTime() { return absoluteTime; } /** ** The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, * 2019-11-08T02:41:28.172Z. *
*
* Constraints:
* Length: 1 - 100
*
* @param absoluteTime
* The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. * For example, 2019-11-08T02:41:28.172Z. *
*/ public void setAbsoluteTime(String absoluteTime) { this.absoluteTime = absoluteTime; } /** ** The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, * 2019-11-08T02:41:28.172Z. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 100
*
* @param absoluteTime
* The time when the message or event was sent. *
** It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. * For example, 2019-11-08T02:41:28.172Z. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withAbsoluteTime(String absoluteTime) { this.absoluteTime = absoluteTime; return this; } /** ** The content of the message or event. *
*
* Constraints:
* Length: 1 - 16384
*
* @return
* The content of the message or event. *
*/ public String getContent() { return content; } /** ** The content of the message or event. *
*
* Constraints:
* Length: 1 - 16384
*
* @param content
* The content of the message or event. *
*/ public void setContent(String content) { this.content = content; } /** ** The content of the message or event. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 16384
*
* @param content
* The content of the message or event. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withContent(String content) { this.content = content; return this; } /** ** The type of content of the item. *
*
* Constraints:
* Length: 1 - 100
*
* @return
* The type of content of the item. *
*/ public String getContentType() { return contentType; } /** ** The type of content of the item. *
*
* Constraints:
* Length: 1 - 100
*
* @param contentType
* The type of content of the item. *
*/ public void setContentType(String contentType) { this.contentType = contentType; } /** ** The type of content of the item. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 100
*
* @param contentType
* The type of content of the item. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withContentType(String contentType) { this.contentType = contentType; return this; } /** ** The ID of the item. *
*
* Constraints:
* Length: 1 - 256
*
* @return
* The ID of the item. *
*/ public String getId() { return id; } /** ** The ID of the item. *
*
* Constraints:
* Length: 1 - 256
*
* @param id
* The ID of the item. *
*/ public void setId(String id) { this.id = id; } /** ** The ID of the item. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 256
*
* @param id
* The ID of the item. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withId(String id) { this.id = id; return this; } /** ** Type of the item: message or event. *
*
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*
* @return
* Type of the item: message or event. *
* @see ChatItemType */ public String getType() { return type; } /** ** Type of the item: message or event. *
*
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*
* @param type
* Type of the item: message or event. *
* @see ChatItemType */ public void setType(String type) { this.type = type; } /** ** Type of the item: message or event. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*
* @param type
* Type of the item: message or event. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ChatItemType */ public Item withType(String type) { this.type = type; return this; } /** ** Type of the item: message or event. *
*
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*
* @param type
* Type of the item: message or event. *
* @see ChatItemType */ public void setType(ChatItemType type) { this.type = type.toString(); } /** ** Type of the item: message or event. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: TYPING, PARTICIPANT_JOINED, PARTICIPANT_LEFT,
* CHAT_ENDED, TRANSFER_SUCCEEDED, TRANSFER_FAILED, MESSAGE, EVENT,
* ATTACHMENT, CONNECTION_ACK, MESSAGE_DELIVERED, MESSAGE_READ
*
* @param type
* Type of the item: message or event. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ChatItemType */ public Item withType(ChatItemType type) { this.type = type.toString(); return this; } /** ** The ID of the sender in the session. *
*
* Constraints:
* Length: 1 - 256
*
* @return
* The ID of the sender in the session. *
*/ public String getParticipantId() { return participantId; } /** ** The ID of the sender in the session. *
*
* Constraints:
* Length: 1 - 256
*
* @param participantId
* The ID of the sender in the session. *
*/ public void setParticipantId(String participantId) { this.participantId = participantId; } /** ** The ID of the sender in the session. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 256
*
* @param participantId
* The ID of the sender in the session. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withParticipantId(String participantId) { this.participantId = participantId; return this; } /** ** The chat display name of the sender. *
*
* Constraints:
* Length: 1 - 256
*
* @return
* The chat display name of the sender. *
*/ public String getDisplayName() { return displayName; } /** ** The chat display name of the sender. *
*
* Constraints:
* Length: 1 - 256
*
* @param displayName
* The chat display name of the sender. *
*/ public void setDisplayName(String displayName) { this.displayName = displayName; } /** ** The chat display name of the sender. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 256
*
* @param displayName
* The chat display name of the sender. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withDisplayName(String displayName) { this.displayName = displayName; return this; } /** ** The role of the sender. For example, is it a customer, agent, or system. *
*
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*
* @return
* The role of the sender. For example, is it a customer, agent, or * system. *
* @see ParticipantRole */ public String getParticipantRole() { return participantRole; } /** ** The role of the sender. For example, is it a customer, agent, or system. *
*
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*
* @param participantRole
* The role of the sender. For example, is it a customer, agent, * or system. *
* @see ParticipantRole */ public void setParticipantRole(String participantRole) { this.participantRole = participantRole; } /** ** The role of the sender. For example, is it a customer, agent, or system. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*
* @param participantRole
* The role of the sender. For example, is it a customer, agent, * or system. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ParticipantRole */ public Item withParticipantRole(String participantRole) { this.participantRole = participantRole; return this; } /** ** The role of the sender. For example, is it a customer, agent, or system. *
*
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*
* @param participantRole
* The role of the sender. For example, is it a customer, agent, * or system. *
* @see ParticipantRole */ public void setParticipantRole(ParticipantRole participantRole) { this.participantRole = participantRole.toString(); } /** ** The role of the sender. For example, is it a customer, agent, or system. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: AGENT, CUSTOMER, SYSTEM
*
* @param participantRole
* The role of the sender. For example, is it a customer, agent, * or system. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ParticipantRole */ public Item withParticipantRole(ParticipantRole participantRole) { this.participantRole = participantRole.toString(); return this; } /** ** Provides information about the attachments. *
* * @return* Provides information about the attachments. *
*/ public java.util.List* Provides information about the attachments. *
* * @param attachments* Provides information about the attachments. *
*/ public void setAttachments(java.util.Collection* Provides information about the attachments. *
** Returns a reference to this object so that method calls can be chained * together. * * @param attachments
* Provides information about the attachments. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withAttachments(AttachmentItem... attachments) { if (getAttachments() == null) { this.attachments = new java.util.ArrayList* Provides information about the attachments. *
** Returns a reference to this object so that method calls can be chained * together. * * @param attachments
* Provides information about the attachments. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withAttachments(java.util.Collection* The metadata related to the message. Currently this supports only * information related to message receipts. *
* * @return* The metadata related to the message. Currently this supports only * information related to message receipts. *
*/ public MessageMetadata getMessageMetadata() { return messageMetadata; } /** ** The metadata related to the message. Currently this supports only * information related to message receipts. *
* * @param messageMetadata* The metadata related to the message. Currently this supports * only information related to message receipts. *
*/ public void setMessageMetadata(MessageMetadata messageMetadata) { this.messageMetadata = messageMetadata; } /** ** The metadata related to the message. Currently this supports only * information related to message receipts. *
** Returns a reference to this object so that method calls can be chained * together. * * @param messageMetadata
* The metadata related to the message. Currently this supports * only information related to message receipts. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withMessageMetadata(MessageMetadata messageMetadata) { this.messageMetadata = messageMetadata; return this; } /** ** The contactId on which the transcript item was originally sent. This * field is only populated for persistent chats when the transcript item is * from the past chat session. For more information, see Enable persistent chat. *
*
* Constraints:
* Length: 1 - 256
*
* @return
* The contactId on which the transcript item was originally sent. * This field is only populated for persistent chats when the * transcript item is from the past chat session. For more * information, see Enable persistent chat. *
*/ public String getRelatedContactId() { return relatedContactId; } /** ** The contactId on which the transcript item was originally sent. This * field is only populated for persistent chats when the transcript item is * from the past chat session. For more information, see Enable persistent chat. *
*
* Constraints:
* Length: 1 - 256
*
* @param relatedContactId
* The contactId on which the transcript item was originally * sent. This field is only populated for persistent chats when * the transcript item is from the past chat session. For more * information, see Enable persistent chat. *
*/ public void setRelatedContactId(String relatedContactId) { this.relatedContactId = relatedContactId; } /** ** The contactId on which the transcript item was originally sent. This * field is only populated for persistent chats when the transcript item is * from the past chat session. For more information, see Enable persistent chat. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 256
*
* @param relatedContactId
* The contactId on which the transcript item was originally * sent. This field is only populated for persistent chats when * the transcript item is from the past chat session. For more * information, see Enable persistent chat. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withRelatedContactId(String relatedContactId) { this.relatedContactId = relatedContactId; return this; } /** ** The contactId on which the transcript item was originally sent. This * field is populated only when the transcript item is from the current chat * session. *
*
* Constraints:
* Length: 1 - 256
*
* @return
* The contactId on which the transcript item was originally sent. * This field is populated only when the transcript item is from the * current chat session. *
*/ public String getContactId() { return contactId; } /** ** The contactId on which the transcript item was originally sent. This * field is populated only when the transcript item is from the current chat * session. *
*
* Constraints:
* Length: 1 - 256
*
* @param contactId
* The contactId on which the transcript item was originally * sent. This field is populated only when the transcript item is * from the current chat session. *
*/ public void setContactId(String contactId) { this.contactId = contactId; } /** ** The contactId on which the transcript item was originally sent. This * field is populated only when the transcript item is from the current chat * session. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 256
*
* @param contactId
* The contactId on which the transcript item was originally * sent. This field is populated only when the transcript item is * from the current chat session. *
* @return A reference to this updated object so that method calls can be * chained together. */ public Item withContactId(String contactId) { this.contactId = contactId; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAbsoluteTime() != null) sb.append("AbsoluteTime: " + getAbsoluteTime() + ","); if (getContent() != null) sb.append("Content: " + getContent() + ","); if (getContentType() != null) sb.append("ContentType: " + getContentType() + ","); if (getId() != null) sb.append("Id: " + getId() + ","); if (getType() != null) sb.append("Type: " + getType() + ","); if (getParticipantId() != null) sb.append("ParticipantId: " + getParticipantId() + ","); if (getDisplayName() != null) sb.append("DisplayName: " + getDisplayName() + ","); if (getParticipantRole() != null) sb.append("ParticipantRole: " + getParticipantRole() + ","); if (getAttachments() != null) sb.append("Attachments: " + getAttachments() + ","); if (getMessageMetadata() != null) sb.append("MessageMetadata: " + getMessageMetadata() + ","); if (getRelatedContactId() != null) sb.append("RelatedContactId: " + getRelatedContactId() + ","); if (getContactId() != null) sb.append("ContactId: " + getContactId()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAbsoluteTime() == null) ? 0 : getAbsoluteTime().hashCode()); hashCode = prime * hashCode + ((getContent() == null) ? 0 : getContent().hashCode()); hashCode = prime * hashCode + ((getContentType() == null) ? 0 : getContentType().hashCode()); hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getParticipantId() == null) ? 0 : getParticipantId().hashCode()); hashCode = prime * hashCode + ((getDisplayName() == null) ? 0 : getDisplayName().hashCode()); hashCode = prime * hashCode + ((getParticipantRole() == null) ? 0 : getParticipantRole().hashCode()); hashCode = prime * hashCode + ((getAttachments() == null) ? 0 : getAttachments().hashCode()); hashCode = prime * hashCode + ((getMessageMetadata() == null) ? 0 : getMessageMetadata().hashCode()); hashCode = prime * hashCode + ((getRelatedContactId() == null) ? 0 : getRelatedContactId().hashCode()); hashCode = prime * hashCode + ((getContactId() == null) ? 0 : getContactId().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Item == false) return false; Item other = (Item) obj; if (other.getAbsoluteTime() == null ^ this.getAbsoluteTime() == null) return false; if (other.getAbsoluteTime() != null && other.getAbsoluteTime().equals(this.getAbsoluteTime()) == false) return false; if (other.getContent() == null ^ this.getContent() == null) return false; if (other.getContent() != null && other.getContent().equals(this.getContent()) == false) return false; if (other.getContentType() == null ^ this.getContentType() == null) return false; if (other.getContentType() != null && other.getContentType().equals(this.getContentType()) == false) return false; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getParticipantId() == null ^ this.getParticipantId() == null) return false; if (other.getParticipantId() != null && other.getParticipantId().equals(this.getParticipantId()) == false) return false; if (other.getDisplayName() == null ^ this.getDisplayName() == null) return false; if (other.getDisplayName() != null && other.getDisplayName().equals(this.getDisplayName()) == false) return false; if (other.getParticipantRole() == null ^ this.getParticipantRole() == null) return false; if (other.getParticipantRole() != null && other.getParticipantRole().equals(this.getParticipantRole()) == false) return false; if (other.getAttachments() == null ^ this.getAttachments() == null) return false; if (other.getAttachments() != null && other.getAttachments().equals(this.getAttachments()) == false) return false; if (other.getMessageMetadata() == null ^ this.getMessageMetadata() == null) return false; if (other.getMessageMetadata() != null && other.getMessageMetadata().equals(this.getMessageMetadata()) == false) return false; if (other.getRelatedContactId() == null ^ this.getRelatedContactId() == null) return false; if (other.getRelatedContactId() != null && other.getRelatedContactId().equals(this.getRelatedContactId()) == false) return false; if (other.getContactId() == null ^ this.getContactId() == null) return false; if (other.getContactId() != null && other.getContactId().equals(this.getContactId()) == false) return false; return true; } }