protected static DigitalObject getSDefTwo() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); return getTestSDef("test:sdef2", "sdef2", methodDefs); }
/** * Recursively add permutations for all possible values of domains[index]. */ private static void addPermutations(String prefix, ParamDomain[] domains, int index, char delimiter, Set<String> set) { if (index + 1 > domains.length) { // no more parameters; prefix is a permutation set.add(prefix); return; } else { ParamDomain domain = domains[index]; if (domain.size() > 0) { // add permutations for each domain value of this parameter for (String domainValue : domain) { String newPrefix = prefix + delimiter + domain.getParameterName() + "=" + domainValue; addPermutations(newPrefix, domains, index + 1, '&', set); } } if (!domain.isRequired()) { // add permutations where this parameter is unspecified addPermutations(prefix, domains, index + 1, delimiter, set); } } }
@Override public boolean equals(Object obj) { if (super.equals(obj)) { ParamDomain p = (ParamDomain) obj; return _parameterName.equals(p.getParameterName()) && _isRequired == p.isRequired(); } else { return false; } }
xml.append(" <UserInputParm parmName=\"" + paramName + "\" passBy=\"VALUE\" defaultValue=\"\" required=\"" + domain.isRequired() + "\">\n"); if (domain.size() > 0) { xml.append(" <ValidParmValues>\n"); for (String value : domain) {
/** * Get an instance from an existing array of <code>MethodParmDef</code>s. * * @param methodName * the name of the method this map describes. * @param parmDefs * existing parameter definitions. * @param userInputOnly * if true, only USER_INPUT parameters from the given array will be * used. */ public ParamDomainMap(String methodName, MethodParmDef[] parmDefs, boolean userInputOnly) { _methodName = methodName; for (MethodParmDef element : parmDefs) { if (!userInputOnly || element.parmType.equals(MethodParmDef.USER_INPUT)) { ParamDomain domain = new ParamDomain(element.parmName, element.parmRequired, element.parmDomainValues); put(element.parmName, domain); } } }
/** * Construct a <code>ParamDomain</code> with values from the given array. * * @param parameterName * the parameter whose domain is being described. * @param isRequired * whether specifying a value is required. * @param domainValues * the domain values. */ public ParamDomain(String parameterName, boolean isRequired, String[] domainValues) { _parameterName = parameterName; _isRequired = isRequired; for (String element : domainValues) { add(element); } }
protected static DigitalObject getSDefThree() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", false); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); return getTestSDef("test:sdef3", "sdef3", methodDefs); }
protected static DigitalObject getSDefFour() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); argOneDomain = new ParamDomain("argOne", false); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDef("test:sdef4", "sdef4", methodDefs); }
protected static DigitalObject getSDefThreeB() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", false); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDef("test:sdef3b", "sdef3b", methodDefs); }
protected static DigitalObject getSDefTwoB() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDef("test:sdef2b", "sdef2b", methodDefs); }
protected static DigitalObject getSDepThree() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", false); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); return getTestSDep("test:sdep3", "sdep3", "test:sdef3", methodDefs, getMap("methodOne", new String[] {"KEY1"}, null, null), getMap("KEY1", new String[] {"text/xml"}, null, null), getMap("methodOne", new String[] {"text/xml"}, null, null)); }
protected static DigitalObject getSDepTwo() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); return getTestSDep("test:sdep2", "sdep2", "test:sdef2", methodDefs, getMap("methodOne", new String[] {"KEY1"}, null, null), getMap("KEY1", new String[] {"text/xml"}, null, null), getMap("methodOne", new String[] {"text/xml"}, null, null)); }
protected static DigitalObject getSDepThreeB() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", false); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDep("test:sdep3b", "sdep3b", "test:sdef3b", methodDefs, getMap("methodOne", new String[] {"KEY1"}, "methodTwo", new String[] {"KEY2"}), getMap("KEY1", new String[] {"text/xml"}, "KEY2", new String[] {"text/xml"}), getMap("methodOne", new String[] {"text/xml"}, "methodTwo", new String[] {"text/xml"})); }
protected static DigitalObject getSDepFour() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); argOneDomain = new ParamDomain("argOne", false); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDep("test:sdep4", "sdep4", "test:sdef4", methodDefs, getMap("methodOne", new String[] {"KEY1"}, "methodTwo", new String[] {"KEY2"}), getMap("KEY1", new String[] {"text/xml"}, "KEY2", new String[] {"text/xml"}), getMap("methodOne", new String[] {"text/xml"}, "methodTwo", new String[] {"text/xml"})); }
protected static DigitalObject getSDepTwoB() { Set<ParamDomainMap> methodDefs = new HashSet<ParamDomainMap>(); ParamDomainMap methodOne = new ParamDomainMap("methodOne"); ParamDomain argOneDomain = new ParamDomain("argOne", true); argOneDomain.add("val1"); argOneDomain.add("val2"); methodOne.put("argOne", argOneDomain); methodDefs.add(methodOne); ParamDomainMap methodTwo = new ParamDomainMap("methodTwo"); methodTwo.put("argOne", argOneDomain); methodDefs.add(methodTwo); return getTestSDep("test:sdep2b", "sdep2b", "test:zdef2b", methodDefs, getMap("methodOne", new String[] {"KEY1"}, "methodTwo", new String[] {"KEY2"}), getMap("KEY1", new String[] {"text/xml"}, "KEY2", new String[] {"text/xml"}), getMap("methodOne", new String[] {"text/xml"}, "methodTwo", new String[] {"text/xml"})); }