@Test public void testFormExtraction() { String script = "${input_form=}"; Map<String, Input> forms = Input.extractSimpleQueryForm(script); assertEquals(1, forms.size()); Input form = forms.get("input_form"); assertEquals("input_form", form.name); assertNull(form.displayName); assertEquals("", form.defaultValue); assertNull(form.options); script = "${input_form(Input Form)=xxx}"; forms = Input.extractSimpleQueryForm(script); form = forms.get("input_form"); assertEquals("xxx", form.defaultValue); script = "${select_form(Selection Form)=op1,op1|op2(Option 2)|op3}"; form = Input.extractSimpleQueryForm(script).get("select_form"); assertEquals("select_form", form.name); assertEquals("op1", form.defaultValue); assertArrayEquals(new ParamOption[]{new ParamOption("op1", null), new ParamOption("op2", "Option 2"), new ParamOption("op3", null)}, form.options); script = "${checkbox:checkbox_form=op1,op1|op2|op3}"; form = Input.extractSimpleQueryForm(script).get("checkbox_form"); assertEquals("checkbox_form", form.name); assertEquals("checkbox", form.type); assertArrayEquals(new Object[]{"op1"}, (Object[]) form.defaultValue); assertArrayEquals(new ParamOption[]{new ParamOption("op1", null), new ParamOption("op2", null), new ParamOption("op3", null)}, form.options); script = "${checkbox:checkbox_form(Checkbox Form)=op1|op3,op1(Option 1)|op2|op3}"; form = Input.extractSimpleQueryForm(script).get("checkbox_form"); assertEquals("checkbox_form", form.name); assertEquals("Checkbox Form", form.displayName); assertEquals("checkbox", form.type); assertArrayEquals(new Object[]{"op1", "op3"}, (Object[]) form.defaultValue); assertArrayEquals(new ParamOption[]{new ParamOption("op1", "Option 1"), new ParamOption("op2", null), new ParamOption("op3", null)}, form.options); script = "${checkbox:checkbox_form(Checkbox Form)=,op1(Option 1)|op2(Option 2)|op3(Option 3)}"; form = Input.extractSimpleQueryForm(script).get("checkbox_form"); assertEquals("checkbox_form", form.name); assertEquals("Checkbox Form", form.displayName); assertEquals("checkbox", form.type); assertArrayEquals(new Object[]{}, (Object[]) form.defaultValue); assertArrayEquals(new ParamOption[]{new ParamOption("op1", "Option 1"), new ParamOption("op2", "Option 2"), new ParamOption("op3", "Option 3")}, form.options); }
public static LinkedHashMap<String, Input> extractSimpleQueryForm(String script) { LinkedHashMap<String, Input> forms = new LinkedHashMap<>(); if (script == null) { return forms; } String replaced = script; Matcher match = VAR_PTN.matcher(replaced); while (match.find()) { Input form = getInputForm(match); forms.put(form.name, form); } forms.remove("pql"); return forms; }
Input implements Serializable { public static LinkedHashMap<String, Input> extractSimpleQueryForm(String script) { LinkedHashMap<String, Input> forms = new LinkedHashMap<>(); if (script == null) { return forms; } String replaced = script; Matcher match = VAR_PTN.matcher(replaced); while (match.find()) { Input form = getInputForm(match); forms.put(form.name, form); } forms.remove("pql"); return forms; } }
Input implements Serializable { public static LinkedHashMap<String, Input> extractSimpleQueryForm(String script) { LinkedHashMap<String, Input> forms = new LinkedHashMap<>(); if (script == null) { return forms; } String replaced = script; Matcher match = VAR_PTN.matcher(replaced); while (match.find()) { Input form = getInputForm(match); forms.put(form.name, form); } forms.remove("pql"); return forms; } Input(String name, Object defaultValue, String type);  Input(String name, Object defaultValue, String type, ParamOption[] options);  Input(String name, String displayName, String type, String argument, Object defaultValue,
      ParamOption[] options, boolean hidden); }
Input implements Serializable { public static LinkedHashMap<String, Input> extractSimpleQueryForm(String script) { LinkedHashMap<String, Input> forms = new LinkedHashMap<>(); if (script == null) { return forms; } String replaced = script; Matcher match = VAR_PTN.matcher(replaced); while (match.find()) { Input form = getInputForm(match); forms.put(form.name, form); } forms.remove("pql"); return forms; } Input(String name, Object defaultValue, String type);  Input(String name, Object defaultValue, String type, ParamOption[] options);  Input(String name, String displayName, String type, String argument, Object defaultValue,
      ParamOption[] options, boolean hidden); @Override boolean equals(Object o); String getName(); void setName(String name); String getDisplayName(); void setDisplayName(String displayName); String getType(); void setType(String type); Object getDefaultValue(); void setDefaultValue(Object defaultValue); ParamOption[] getOptions(); void setOptions(ParamOption[] options); boolean isHidden(); static LinkedHashMap<String, Input> extractSimpleQueryForm(String script); static String getSimpleQuery(Map<String, Object> params, String script); static String[] split(String str); static String[] splitPipe(String str); static String[] split(String str, char split); static String[] split(String str, String[] splitters, boolean includeSplitter); static String[] split(String str, String escapeSeq, char escapeChar, String[] blockStart,
      String[] blockEnd, String[] splitters, boolean includeSplitter); }
Input implements Serializable { public static LinkedHashMap<String, Input> extractSimpleQueryForm(String script) { LinkedHashMap<String, Input> forms = new LinkedHashMap<>(); if (script == null) { return forms; } String replaced = script; Matcher match = VAR_PTN.matcher(replaced); while (match.find()) { Input form = getInputForm(match); forms.put(form.name, form); } forms.remove("pql"); return forms; } Input(String name, Object defaultValue, String type);  Input(String name, Object defaultValue, String type, ParamOption[] options);  Input(String name, String displayName, String type, String argument, Object defaultValue,
      ParamOption[] options, boolean hidden); @Override boolean equals(Object o); String getName(); void setName(String name); String getDisplayName(); void setDisplayName(String displayName); String getType(); void setType(String type); Object getDefaultValue(); void setDefaultValue(Object defaultValue); ParamOption[] getOptions(); void setOptions(ParamOption[] options); boolean isHidden(); static LinkedHashMap<String, Input> extractSimpleQueryForm(String script); static String getSimpleQuery(Map<String, Object> params, String script); static String[] split(String str); static String[] splitPipe(String str); static String[] split(String str, char split); static String[] split(String str, String[] splitters, boolean includeSplitter); static String[] split(String str, String escapeSeq, char escapeChar, String[] blockStart,
      String[] blockEnd, String[] splitters, boolean includeSplitter);  }