Updated Branches: refs/heads/api_refactoring 6a032e029 -> 03b47cb50
api: Temp. fix to be backward compatible to old way of id passing For some apis, the param=-1 is used to evaluate conditionals. Allow -1 to be passed for now. This is a APITODO/FIXME to fix stuff in service layer and then only get rid of it. Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/03b47cb5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/03b47cb5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/03b47cb5 Branch: refs/heads/api_refactoring Commit: 03b47cb5010f0244b861cf0f9b6c9f12ce4dced3 Parents: 6a032e0 Author: Rohit Yadav <[email protected]> Authored: Fri Dec 21 14:39:04 2012 -0800 Committer: Rohit Yadav <[email protected]> Committed: Fri Dec 21 14:41:14 2012 -0800 ---------------------------------------------------------------------- server/src/com/cloud/api/ApiDispatcher.java | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/03b47cb5/server/src/com/cloud/api/ApiDispatcher.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 99ba05d..839073e 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -617,6 +617,12 @@ public class ApiDispatcher { case UUID: if (paramObj.toString().isEmpty()) break; + if (paramObj.toString().equals("-1")) { + // FIXME: This is to handle a lot of hardcoded special cases where -1 is sent + // APITODO: Find and get rid of all hardcoded params in API Cmds and service layer + field.set(cmdObj, -1L); + break; + } // There may be multiple entities defined on the @Entity of a Response.class // UUID CommandType would expect only one entityType, so use the first entityType Class<?>[] entities = annotation.entityType()[0].getAnnotation(Entity.class).value();
