@PublicApi public class EffectResponse extends Object
resolving
an effect description
. This could be a piece of
runnable code
, an error message, or an "empty" response,
indicating that no change is needed.Modifier and Type | Class and Description |
---|---|
static class |
EffectResponse.Empty
Represents an empty response, which means that the requested change
is possible, but not required.
|
static class |
EffectResponse.Error
Represents an error response, which means that the requested change
is impossible.
|
static class |
EffectResponse.Valid
Represents a valid response, which means that the requested change
is both needed and possible.
|
Modifier and Type | Method and Description |
---|---|
static EffectResponse |
empty(I18nText description,
List<ItemIdentity> affectedItems)
Constructs an empty response, which means that the requested change
is possible, but not required.
|
static EffectResponse |
error(I18nText error,
I18nText description,
List<ItemIdentity> affectedItems)
Constructs an error response, which means that the requested change
is impossible.
|
List<ItemIdentity> |
getAffectedItems()
Returns the list of
item IDs affected by the change. |
I18nText |
getDescription()
Returns a human-readable description of the change, phrased as a
possibility, e.g.
|
Effect |
getEffect()
Returns the actual effect, or
null if error or empty. |
I18nText |
getError()
Describes why this effect cannot be applied, e.g.
|
I18nText |
getSuccessMessage()
Returns a human-readable description of the change, as if it already
happened, e.g.
|
boolean |
isEmpty()
Returns whether this response is empty, which means that there are no
errors, but no change is needed, for example, because the item is already
in the required state.
|
boolean |
isError()
Returns whether this response is an error, which means this change cannot
be applied.
|
static EffectResponse |
valid(Effect effect,
I18nText successMessage,
I18nText description,
List<ItemIdentity> affectedItems)
Constructs a valid response, which means that the requested change
is both needed and possible.
|
@Nullable public Effect getEffect()
null
if error or empty.@NotNull public List<ItemIdentity> getAffectedItems()
item IDs
affected by the change.
Could be empty.@NotNull public I18nText getDescription()
Returns a human-readable description of the change, phrased as a possibility, e.g. "Assign FOO-123 to John Doe".
This description cannot be null
even for error and empty
responses. The effect provider is required to produce the best possible
description, even for error responses (see error(I18nText, I18nText, List)
).
@Nullable public I18nText getSuccessMessage()
Returns a human-readable description of the change, as if it already happened, e.g. "Assigned FOO-123 to John Doe."
This description is null
for error and empty responses.
@Nullable public I18nText getError()
null
for valid
and empty responses.public boolean isError()
getError()
public boolean isEmpty()
@NotNull public static EffectResponse valid(@NotNull Effect effect, @NotNull I18nText successMessage, @NotNull I18nText description, @NotNull List<ItemIdentity> affectedItems)
effect
- The actual runnable code that effects the change.successMessage
- A human-readable description of the change as if
it already happened, see getSuccessMessage()
.description
- A human-readable description of the change as
a possibility, see getDescription()
.affectedItems
- The list of affected item IDs,
see getAffectedItems()
.@NotNull public static EffectResponse error(@NotNull I18nText error, @NotNull I18nText description, @NotNull List<ItemIdentity> affectedItems)
error
- The error message describing why this change cannot
be applied, see getError()
.description
- A human-readable description of the change as
a possibility, see getDescription()
. Note that this
description cannot be null
even for error responses.
If an item mentioned in the effect description does not exist,
the provider is supposed to use its internal identifier
(e.g. issue ID) instead of the user-friendly identifier (issue key),
but it still must produce a description.affectedItems
- The list of affected item IDs,
see getAffectedItems()
.@NotNull public static EffectResponse empty(@NotNull I18nText description, @NotNull List<ItemIdentity> affectedItems)
description
- A human-readable description of the change as
a possibility, see getDescription()
.affectedItems
- The list of affected item IDs,
see getAffectedItems()
.Copyright © 2024 Tempo Software. All Rights Reserved.