|
From: <jt...@hy...> - 2007-03-27 23:35:55
|
Author: jtravis Date: 2007-03-27 15:35:40 -0800 (Tue, 27 Mar 2007) New Revision: 3929 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3929 Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy Log: Allow for an string array of length 1 when doing findSingle, to make UI programming simpler Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy =================================================================== --- trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy 2007-03-27 23:16:14 UTC (rev 3928) +++ trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy 2007-03-27 23:35:40 UTC (rev 3929) @@ -96,6 +96,14 @@ NAME_FINDERS.keySet()) def resourceVal = args[resourceType] + if (resourceVal instanceof String[]) { + if (resourceVal.length != 1) { + throw new IllegalArgumentException("findSingle does not " + + "accept > 1 id") + } + resourceVal = resourceVal[0] + } + def argType = (resourceVal instanceof String) ? 'str' : 'int' if (argType == 'str') { |