forked from microsoft/botbuilder-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActivity.java
More file actions
1549 lines (1347 loc) · 50 KB
/
Activity.java
File metadata and controls
1549 lines (1347 loc) · 50 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.bot.schema;
import com.microsoft.bot.schema.teams.TeamChannelData;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* The Activity class contains all properties that individual, more specific activities
* could contain. It is a superset type.
*/
public class Activity {
private static final ObjectMapper MAPPER = new ObjectMapper();
@JsonProperty(value = "type")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String type;
@JsonProperty(value = "id")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String id;
@JsonProperty(value = "timestamp")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.nX", timezone = "UTC")
private OffsetDateTime timestamp;
@JsonProperty(value = "localTimestamp")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
//@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
//2019-10-07T09:49:37-05:00
private OffsetDateTime localTimestamp;
@JsonProperty(value = "localTimezone")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String localTimezone;
@JsonProperty(value = "callerId")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String callerId;
@JsonProperty(value = "serviceUrl")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String serviceUrl;
@JsonProperty(value = "channelId")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String channelId;
@JsonProperty(value = "from")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private ChannelAccount from;
@JsonProperty(value = "conversation")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private ConversationAccount conversation;
@JsonProperty(value = "recipient")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private ChannelAccount recipient;
@JsonProperty(value = "textFormat")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private TextFormatTypes textFormat;
@JsonProperty(value = "attachmentLayout")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private AttachmentLayoutTypes attachmentLayout;
@JsonProperty(value = "membersAdded")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ChannelAccount> membersAdded;
@JsonProperty(value = "membersRemoved")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ChannelAccount> membersRemoved;
@JsonProperty(value = "reactionsAdded")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<MessageReaction> reactionsAdded;
@JsonProperty(value = "reactionsRemoved")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<MessageReaction> reactionsRemoved;
@JsonProperty(value = "topicName")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String topicName;
@JsonProperty(value = "historyDisclosed")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private boolean historyDisclosed;
@JsonProperty(value = "locale")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String locale;
@JsonProperty(value = "text")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String text;
@JsonProperty(value = "speak")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String speak;
@JsonProperty(value = "inputHint")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private InputHints inputHint;
@JsonProperty(value = "summary")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String summary;
@JsonProperty(value = "suggestedActions")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private SuggestedActions suggestedActions;
@JsonProperty(value = "attachments")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Attachment> attachments;
@JsonProperty(value = "entities")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Entity> entities;
@JsonProperty(value = "channelData")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Object channelData;
@JsonProperty(value = "action")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String action;
@JsonProperty(value = "replyToId")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String replyToId;
@JsonProperty(value = "label")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String label;
@JsonProperty(value = "valueType")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String valueType;
@JsonProperty(value = "value")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Object value;
@JsonProperty(value = "name")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String name;
@JsonProperty(value = "relatesTo")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private ConversationReference relatesTo;
@JsonProperty(value = "code")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private EndOfConversationCodes code;
@JsonProperty(value = "expiration")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private LocalDateTime expiration;
@JsonProperty(value = "importance")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String importance;
@JsonProperty(value = "deliveryMode")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String deliveryMode;
@JsonProperty(value = "listenFor")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<String> listenFor;
@JsonProperty(value = "textHighlights")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TextHighlight> textHighlights;
/**
* Holds the overflow properties that aren't first class
* properties in the object. This allows extensibility
* while maintaining the object.
*/
private HashMap<String, JsonNode> properties = new HashMap<>();
/**
* Default constructor. Normally this wouldn't be used as the ActivityType is normally required.
*/
protected Activity() {
setTimestamp(OffsetDateTime.now(ZoneId.of("UTC")));
}
/**
* Construct an Activity of the specified type.
* @param withType The activity type.
*/
public Activity(String withType) {
this();
setType(withType);
}
/**
* Create a TRACE type Activity.
*
* @param withName Name of the operation
* @return A Trace type Activity.
*/
public static Activity createTraceActivity(String withName) {
return createTraceActivity(withName, null, null, null);
}
/**
* Create a TRACE type Activity.
*
* @param withName Name of the operation
* @param withValueType valueType if helpful to identify the value schema (default is value.GetType().Name)
* @param withValue The content for this trace operation.
* @param withLabel A descriptive label for this trace operation.
* @return A Trace type Activity.
*/
public static Activity createTraceActivity(String withName,
String withValueType,
Object withValue,
String withLabel) {
return new Activity(ActivityTypes.TRACE) {{
setName(withName);
setLabel(withLabel);
if (withValue != null) {
setValueType((withValueType == null) ? withValue.getClass().getTypeName() : withValueType);
} else {
setValueType(withValueType);
}
setValue(withValue);
}};
}
/**
* Create a MESSAGE type Activity.
* @return A message Activity type.
*/
public static Activity createMessageActivity() {
return new Activity(ActivityTypes.MESSAGE) {{
setAttachments(new ArrayList<>());
setEntities(new ArrayList<>());
}};
}
/**
* Create a CONTACT_RELATION_UPDATE type Activity.
* @return A contact relation update type Activity.
*/
public static Activity createContactRelationUpdateActivity() {
return new Activity(ActivityTypes.CONTACT_RELATION_UPDATE);
}
/**
* Create a CONVERSATION_UPDATE type Activity.
* @return A conversation update type Activity.
*/
public static Activity createConversationUpdateActivity() {
return new Activity(ActivityTypes.CONVERSATION_UPDATE) {{
setMembersAdded(new ArrayList<>());
setMembersRemoved(new ArrayList<>());
}};
}
/**
* Creates a TYPING type Activity.
* @return The new typing activity.
*/
public static Activity createTypingActivity() {
return new Activity(ActivityTypes.TYPING);
}
/**
* Creates a HANDOFF type Activity.
* @return The new handoff activity.
*/
public static Activity createHandoffActivity() {
return new Activity(ActivityTypes.HANDOFF);
}
/**
* Creates a END_OF_CONVERSATION type of Activity.
* @return The new end of conversation activity.
*/
public static Activity createEndOfConversationActivity() {
return new Activity(ActivityTypes.END_OF_CONVERSATION);
}
/**
* Creates a EVENT type of Activity.
* @return The new event activity.
*/
public static Activity createEventActivity() {
return new Activity(ActivityTypes.EVENT);
}
/**
* Creates a INVOKE type of Activity.
* @return The new invoke activity.
*/
public static Activity createInvokeActivity() {
return new Activity(ActivityTypes.INVOKE);
}
/**
* Clone a activity.
*
* @param activity The activity to clone.
* @return new cloned activity
*/
public static Activity clone(Activity activity) {
Activity clone = new Activity(activity.getType()) {{
setId(activity.getId());
setTimestamp(activity.getTimestamp());
setLocalTimestamp(activity.getLocalTimestamp());
setLocalTimeZone(activity.getLocalTimezone());
setChannelData(activity.getChannelData());
setFrom(ChannelAccount.clone(activity.getFrom()));
setRecipient(ChannelAccount.clone(activity.getRecipient()));
setConversation(ConversationAccount.clone(activity.getConversation()));
setChannelId(activity.getChannelId());
setServiceUrl(activity.getServiceUrl());
setChannelId(activity.getChannelId());
setEntities(Entity.cloneList(activity.getEntities()));
setReplyToId(activity.getReplyToId());
setSpeak(activity.getSpeak());
setText(activity.getText());
setInputHint(activity.getInputHint());
setSummary(activity.getSummary());
setSuggestedActions(SuggestedActions.clone(activity.getSuggestedActions()));
setAttachments(Attachment.cloneList(activity.getAttachments()));
setAction(activity.getAction());
setLabel(activity.getLabel());
setValueType(activity.getValueType());
setValue(activity.getValue());
setName(activity.getName());
setRelatesTo(ConversationReference.clone(activity.getRelatesTo()));
setCode(activity.getCode());
setExpiration(activity.getExpiration());
setImportance(activity.getImportance());
setDeliveryMode(activity.getDeliveryMode());
setTextHighlights(activity.getTextHighlights());
setCallerId(activity.getCallerId());
setHistoryDisclosed(activity.getHistoryDisclosed());
setLocale(activity.getLocale());
setReactionsAdded(MessageReaction.cloneList(activity.getReactionsAdded()));
setReactionsRemoved(MessageReaction.cloneList(activity.getReactionsRemoved()));
setExpiration(activity.getExpiration());
setMembersAdded(ChannelAccount.cloneList(activity.getMembersAdded()));
setMembersRemoved(ChannelAccount.cloneList(activity.getMembersRemoved()));
setTextFormat(activity.getTextFormat());
setAttachmentLayout(activity.getAttachmentLayout());
setTopicName(activity.getTopicName());
if (activity.getListenFor() != null) {
setListenFor(new ArrayList<>(activity.getListenFor()));
}
}};
for (Map.Entry<String, JsonNode> entry : activity.getProperties().entrySet()) {
clone.setProperties(entry.getKey(), entry.getValue());
}
return clone;
}
/**
* Gets the {@link ActivityTypes} of the activity.
* @return The Activity type.
*/
public String getType() {
return this.type;
}
/**
* Sets the {@link ActivityTypes} of the activity.
* @param withType The type of the Activity.
*/
public void setType(String withType) {
this.type = withType;
}
/**
* Convenience method to return if the Activity is of the specified type.
* @param compareTo The type to compare to.
* @return True if the Activity is of the specified type.
*/
public boolean isType(String compareTo) {
return StringUtils.equals(type, compareTo);
}
/**
* Returns the ID that uniquely identifies the activity on the channel.
* @return The activity id.
*/
public String getId() {
return this.id;
}
/**
* Sets the ID that uniquely identifies the activity on the channel.
* @param withId The activity ID.
*/
public void setId(String withId) {
this.id = withId;
}
/**
* Gets the date and time that the message was sent, in UTC, expressed in ISO-8601 format.
* @return The UTC timestamp of the activity.
*/
public OffsetDateTime getTimestamp() {
return this.timestamp;
}
/**
* Sets the date and time that the message was sent, in UTC, expressed in ISO-8601 format.
* @param withTimestamp The UTC timestamp of the activity.
*/
public void setTimestamp(OffsetDateTime withTimestamp) {
this.timestamp = withTimestamp;
}
/**
* Gets the local date and time of the message, expressed in ISO-8601 format.
* For example, 2016-09-23T13:07:49.4714686-07:00.
* @return The local timestamp of the activity.
*/
public OffsetDateTime getLocalTimestamp() {
return this.localTimestamp;
}
/**
* Contains the local date and time of the message, expressed in ISO-8601 format.
* For example, 2016-09-23T13:07:49.4714686-07:00.
* @param withLocalTimestamp The local timestamp of the activity.
*/
public void setLocalTimestamp(OffsetDateTime withLocalTimestamp) {
this.localTimestamp = withLocalTimestamp;
}
/**
* Gets the name of the local timezone of the message, expressed in IANA Time Zone database format.
* For example, America/Los_Angeles.
* @return The local timezone.
*/
public String getLocalTimezone() {
return this.localTimezone;
}
/**
* Sets the name of the local timezone of the message, expressed in IANA Time Zone database format.
* For example, America/Los_Angeles.
* @param withLocalTimezone The local timezone.
*/
public void setLocalTimeZone(String withLocalTimezone) {
this.localTimezone = withLocalTimezone;
}
/**
* Gets a string containing an IRI identifying the caller of a bot. This field is not intended to be transmitted
* over the wire, but is instead populated by bots and clients based on cryptographically verifiable data
* that asserts the identity of the callers (e.g. tokens).
* @return The caller IRI.
*/
public String getCallerId() {
return this.callerId;
}
/**
* Sets the IRI identifying the caller of a bot. This field is not intended to be transmitted
* over the wire, but is instead populated by bots and clients based on cryptographically verifiable data
* that asserts the identity of the callers (e.g. tokens).
* @param withCallerId The caller id.
*/
public void setCallerId(String withCallerId) {
this.callerId = withCallerId;
}
/**
* Sets the URL that specifies the channel's service endpoint. Set by the channel.
* @return The service URL.
*/
public String getServiceUrl() {
return this.serviceUrl;
}
/**
* Sets the URL that specifies the channel's service endpoint. Set by the channel.
* @param withServiceUrl The service URL of the Activity.
*/
public void setServiceUrl(String withServiceUrl) {
this.serviceUrl = withServiceUrl;
}
/**
* Gets the ID that uniquely identifies the channel. Set by the channel.
* @return The channel ID.
*/
public String getChannelId() {
return this.channelId;
}
/**
* Sets the ID that uniquely identifies the channel. Set by the channel.
* @param withChannelId The channel ID.
*/
public void setChannelId(String withChannelId) {
this.channelId = withChannelId;
}
/**
* Identifies the sender of the message.
* @return The {@link ChannelAccount} of the sender.
*/
public ChannelAccount getFrom() {
return this.from;
}
/**
* Identifies the sender of the message.
* @param withFrom The {@link ChannelAccount} of the sender.
*/
public void setFrom(ChannelAccount withFrom) {
this.from = withFrom;
}
/**
* Identifies the conversation to which the activity belongs.
* @return The {@link ConversationAccount}.
*/
public ConversationAccount getConversation() {
return this.conversation;
}
/**
* Identifies the conversation to which the activity belongs.
* @param withConversation The {@link ConversationAccount}.
*/
public void setConversation(ConversationAccount withConversation) {
this.conversation = withConversation;
}
/**
* Identifies the recipient of the message.
* @return The {@link ChannelAccount} of the recipient.
*/
public ChannelAccount getRecipient() {
return this.recipient;
}
/**
* Identifies the recipient of the message.
* @param withRecipient The {@link ChannelAccount} of the recipient.
*/
public void setRecipient(ChannelAccount withRecipient) {
this.recipient = withRecipient;
}
/**
* Format of text fields Default:markdown. Possible values include:
* 'markdown', 'plain', 'xml'.
* @return The TextFormatTypes type.
*/
public TextFormatTypes getTextFormat() {
return this.textFormat;
}
/**
* Format of text fields.
* @param withTextFormat The TextFormatTypes type.
*/
public void setTextFormat(TextFormatTypes withTextFormat) {
this.textFormat = withTextFormat;
}
/**
* The layout hint for multiple attachments.
* @return The Attachment type.
*/
public AttachmentLayoutTypes getAttachmentLayout() {
return this.attachmentLayout;
}
/**
* Sets the layout hint for multiple attachments.
* @param withAttachmentLayout The attachment type.
*/
public void setAttachmentLayout(AttachmentLayoutTypes withAttachmentLayout) {
this.attachmentLayout = withAttachmentLayout;
}
/**
* Gets the collection of reactions added to the conversation.
* @return A List of {@link MessageReaction}.
*/
public List<MessageReaction> getReactionsAdded() {
return this.reactionsAdded;
}
/**
* Sets the collection of reactions added to the conversation.
* @param withReactionsAdded A List of {@link MessageReaction}.
*/
public void setReactionsAdded(List<MessageReaction> withReactionsAdded) {
this.reactionsAdded = withReactionsAdded;
}
/**
* Gets the collection of reactions removed from the conversation.
* @return A List of {@link MessageReaction}.
*/
public List<MessageReaction> getReactionsRemoved() {
return this.reactionsRemoved;
}
/**
* Sets the collection of reactions removed from the conversation.
* @param withReactionsRemoved A List of {@link MessageReaction}.
*/
public void setReactionsRemoved(List<MessageReaction> withReactionsRemoved) {
this.reactionsRemoved = withReactionsRemoved;
}
/**
* A locale name for the contents of the text field.
* The locale name is a combination of an ISO 639 two- or three-letter culture code associated with a language
* and an ISO 3166 two-letter subculture code associated with a country or region.
* <p>
* The locale name can also correspond to a valid BCP-47 language tag.
* @return The content locale.
*/
public String getLocale() {
return this.locale;
}
/**
* A locale name for the contents of the text field.
* The locale name is a combination of an ISO 639 two- or three-letter culture code associated with a language
* and an ISO 3166 two-letter subculture code associated with a country or region.
* <p>
* The locale name can also correspond to a valid BCP-47 language tag.
* @param withLocale The content locale.
*/
public void setLocale(String withLocale) {
this.locale = withLocale;
}
/**
* Gets the text content of the message.
* @return The text content.
*/
public String getText() {
return this.text;
}
/**
* Sets the text content of the message.
* @param withText The text content.
*/
public void setText(String withText) {
this.text = withText;
}
/**
* The text to speak.
* @return The SSML text to speak.
*/
public String getSpeak() {
return this.speak;
}
/**
* Sets the text to speak.
* @param withSpeak The SSML text to speak.
*/
public void setSpeak(String withSpeak) {
this.speak = withSpeak;
}
/**
* Indicates whether your bot is accepting, expecting, or ignoring user input after the message
* is delivered to the client.
* @return The input hint for the activity.
*/
public InputHints getInputHint() {
return this.inputHint;
}
/**
* Indicates whether your bot is accepting, expecting, or ignoring user input after the message
* is delivered to the client.
* @param withInputHint The input hint for the activity.
*/
public void setInputHint(InputHints withInputHint) {
this.inputHint = withInputHint;
}
/**
* Gets the text to display if the channel cannot render cards.
* @return The summary text.
*/
public String getSummary() {
return this.summary;
}
/**
* Sets the text to display if the channel cannot render cards.
* @param withSummary The summary text.
*/
public void setSummary(String withSummary) {
this.summary = withSummary;
}
/**
* Gets the suggested actions for the activity.
* @return The SuggestedActions for the activity.
*/
public SuggestedActions getSuggestedActions() {
return this.suggestedActions;
}
/**
* The suggested actions for the activity.
* @param withSuggestedActions The SuggestedActions for the Activity.
*/
public void setSuggestedActions(SuggestedActions withSuggestedActions) {
this.suggestedActions = withSuggestedActions;
}
/**
* Gets the attachments to the Activity.
* @return A List of {@link Attachment}.
*/
public List<Attachment> getAttachments() {
return this.attachments;
}
/**
* Sets the attachments to the Activity.
* @param withAttachments A List of {@link Attachment}.
*/
public void setAttachments(List<Attachment> withAttachments) {
this.attachments = withAttachments;
}
/**
* Returns payload version of the Entities in an Activity.
*
* Entities can vary in the number of fields. The {@link Entity} class holds the additional
* fields in {@link Entity#getProperties()}.
*
* To convert to other entity types, use {@link Entity#getAs(Class)}.
* @see Mention
* @see Place
* @see GeoCoordinates
* @see Activity#getMentions()
*
* {@code
* getEntities().stream()
* .filter(entity -> entity.getType().equalsIgnoreCase("mention"))
* .map(entity -> entity.getAs(Mention.class))
* .collect(Collectors.toCollection(ArrayList::new));
* }
*
* @return A List of {@link Entity}.
*/
public List<Entity> getEntities() {
return this.entities;
}
/**
* Sets payload version of the Entities in an Activity.
* @param withEntities The payload entities.
* @see Entity
*/
public void setEntities(List<Entity> withEntities) {
this.entities = withEntities;
}
/**
* Gets channel-specific content.
* @return Channel specific data.
*/
public Object getChannelData() {
return this.channelData;
}
/**
* Sets channel-specific content.
* @param withChannelData Channel specific data as a JsonNode.
*/
public void setChannelData(Object withChannelData) {
this.channelData = withChannelData;
}
/**
* Gets the ID of the message to which this message is a reply.
* @return The reply to ID.
*/
public String getReplyToId() {
return this.replyToId;
}
/**
* Sets the ID of the message to which this message is a reply.
* @param withReplyToId The reply to ID.
*/
public void setReplyToId(String withReplyToId) {
this.replyToId = withReplyToId;
}
/**
* Gets the a code for endOfConversation activities that indicates why the conversation ended.
* @return The endOfConversation code.
*/
public EndOfConversationCodes getCode() {
return this.code;
}
/**
* Sets the a code for endOfConversation activities that indicates why the conversation ended.
* @param withCode The endOfConversation code.
*/
public void setCode(EndOfConversationCodes withCode) {
this.code = withCode;
}
/**
* Gets the time at which the activity should be considered to be expired and should not be
* presented to the recipient.
* @return the activity expiration.
*/
public LocalDateTime getExpiration() {
return this.expiration;
}
/**
* Sets the time at which the activity should be considered to be expired and should not be
* presented to the recipient.
* @param withExpiration The activity expiration.
*/
public void setExpiration(LocalDateTime withExpiration) {
this.expiration = withExpiration;
}
/**
* Gets the importance of the activity.
* @return The activity importance.
*/
public String getImportance() {
return this.importance;
}
/**
* Sets the importance of the activity.
* @param withImportance The activity importance.
*/
public void setImportance(String withImportance) {
this.importance = withImportance;
}
/**
* A delivery hint to signal to the recipient alternate delivery paths for the activity.
* <p>
* The default delivery mode is \"default\".
* @return The delivery mode hint.
*/
public String getDeliveryMode() {
return this.deliveryMode;
}
/**
* A delivery hint to signal to the recipient alternate delivery paths for the activity.
* <p>
* The default delivery mode is \"default\".
* @param withDeliveryMode The delivery mode hint.
*/
public void setDeliveryMode(String withDeliveryMode) {
this.deliveryMode = withDeliveryMode;
}
/**
* Gets the list of phrases and references that speech and language priming systems should listen for.
* @return List of phrases to listen for.
*/
public List<String> getListenFor() {
return this.listenFor;
}
/**
* Sets the list of phrases and references that speech and language priming systems should listen for.
* @param withListenFor List of phrases to listen for.
*/
public void setListenFor(List<String> withListenFor) {
this.listenFor = withListenFor;
}
/**
* Gets the collection of text fragments to highlight when the activity contains a ReplyToId value.
* @return List of {@link TextHighlight}.
*/
public List<TextHighlight> getTextHighlights() {
return this.textHighlights;
}
/**
* Sets the collection of text fragments to highlight when the activity contains a ReplyToId value.
* @param withTextHighlights List of {@link TextHighlight}.
*/
public void setTextHighlights(List<TextHighlight> withTextHighlights) {
this.textHighlights = withTextHighlights;
}
/**
* Holds the overflow properties that aren't first class
* properties in the object. This allows extensibility
* while maintaining the object.
* @return Map of additional properties.
*/
@JsonAnyGetter
public Map<String, JsonNode> getProperties() {
return this.properties;
}
/**
* Holds the overflow properties that aren't first class
* properties in the object. This allows extensibility
* while maintaining the object.
* @param key The key of the property to set.
* @param withValue The value for the property.
*/
@JsonAnySetter
public void setProperties(String key, JsonNode withValue) {
this.properties.put(key, withValue);
}
/**
* Gets the updated topic name of the conversation.
* @return The topic name.
*/
public String getTopicName() {
return this.topicName;
}
/**
* Sets the updated topic name of the conversation.
* @param withTopicName The topic name.
*/
public void setTopicName(String withTopicName) {
this.topicName = withTopicName;
}
/**
* Gets whether the prior history of the channel is disclosed.
* @return True if the history is disclosed.
*/
public boolean getHistoryDisclosed() {
return this.historyDisclosed;
}
/**
* Sets whether the prior history of the channel is disclosed.
* @param withHistoryDisclosed True if the history is disclosed.
*/
public void setHistoryDisclosed(boolean withHistoryDisclosed) {
this.historyDisclosed = withHistoryDisclosed;
}
/**
* Gets the collection of members added to the conversation.
* @return List of {@link ChannelAccount} of added members.
*/
public List<ChannelAccount> getMembersAdded() {
return this.membersAdded;