Arik Hadas has uploaded a new change for review. Change subject: core: add failCanDoAction method with variable replacements ......................................................................
core: add failCanDoAction method with variable replacements CommandBase had a failCanDoAction method that added an error message and returned false, but when we wanted to have variable replacements couldn't use it, and we still had to call addCanDoActionMessages and return false. This patch adds another failCanDoAction method that also gets variable replacements and add them as well. Change-Id: I57dc350f507db43db2ddd47e835eca67ea96b4ed Signed-off-by: Arik Hadas <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/18006/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java index 12e36eb..29b45d8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java @@ -1919,7 +1919,7 @@ * The message to add. */ protected void addCanDoActionMessage(VdcBllMessages message) { - getReturnValue().getCanDoActionMessages().add(message.name()); + addCanDoActionMessage(message.name()); } /** @@ -1935,6 +1935,22 @@ } /** + * Add validation message plus variable replacements and return false. + * + * @param message the message to add + * @param variableReplacements variable replacements + * @return false always + * @see {@link #addCanDoActionMessage(String)} + */ + protected final boolean failCanDoAction(VdcBllMessages message, String ... variableReplacements) { + addCanDoActionMessage(message); + for (String variableReplacement : variableReplacements) { + addCanDoActionMessage(variableReplacement); + } + return false; + } + + /** * Add a message to the {@link CommandBase#canDoAction()}'s return value. * This return value will be sent to the client for the detailed information of why the action can't be performed. * -- To view, visit http://gerrit.ovirt.org/18006 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57dc350f507db43db2ddd47e835eca67ea96b4ed Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
