@@ -43,22 +43,49 @@ public enum ConversationEndingType {
43
43
44
44
/**
45
45
* Explicitly ended using a success path, but an exception occurred while
46
- * committing.
46
+ * committing. Do not use this type directly, it is indirectly used by the
47
+ * conversation manager.
47
48
*/
48
49
FAILURE_SUCCESS ,
49
50
50
51
/**
51
52
* Explicitly ended using a cancel path, but an exception occurred while
52
- * canceling.
53
+ * canceling. Do not use this type directly, it is indirectly used by the
54
+ * conversation manager.
53
55
*/
54
56
FAILURE_CANCEL ,
55
57
56
- /** Implicitly ended through a time out of the conversation object. */
58
+ /**
59
+ * Implicitly ended through a time out of the conversation object. Do not
60
+ * use this type directly, it is indirectly used by the conversation
61
+ * manager.
62
+ */
57
63
TIMED_OUT ,
58
64
59
65
/**
60
66
* Implicitly ended while creating a new conversation and ending the current
61
- * one.
67
+ * one. Do not use this type directly, it is indirectly used by the
68
+ * conversation manager.
62
69
*/
63
70
TRANSCRIBED ;
71
+
72
+ /**
73
+ * Returns the ending type for the specified one if ending a conversation
74
+ * failed with an exception. It only works for {@link #SUCCESS} and
75
+ * {@link #CANCEL} as the other types are only used internally. For every
76
+ * other type, the same type is being returned in order to use this method
77
+ * as a convenience no mather which type provided.
78
+ *
79
+ * @param type the ending type specified by an ending annotation
80
+ * @return the type to be used instead as ending failed
81
+ */
82
+ public static ConversationEndingType getFailureType (ConversationEndingType type ) {
83
+ if (type == SUCCESS ) {
84
+ return FAILURE_SUCCESS ;
85
+ } else if (type == CANCEL ) {
86
+ return FAILURE_CANCEL ;
87
+ }
88
+
89
+ return type ;
90
+ }
64
91
}
0 commit comments