Skip to content

Commit f8ba7f9

Browse files
author
Micha Kiener
committed
SPR-6419, manager implementation
1 parent 7dbbe64 commit f8ba7f9

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

org.springframework.context/src/main/java/org/springframework/conversation/ConversationEndingType.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,49 @@ public enum ConversationEndingType {
4343

4444
/**
4545
* 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.
4748
*/
4849
FAILURE_SUCCESS,
4950

5051
/**
5152
* 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.
5355
*/
5456
FAILURE_CANCEL,
5557

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+
*/
5763
TIMED_OUT,
5864

5965
/**
6066
* 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.
6269
*/
6370
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+
}
6491
}

0 commit comments

Comments
 (0)