@Override public String showWithMask( KObject ko, String mask, String sepFirst, String sepLast, HttpServletRequest request) { try { ArrayList<String> fieldNames = ko.getFieldNames(); for (String fName : fieldNames) { try { String value = ko.getAttribute(fName) + ""; mask = mask.replaceAll("(?i)" + "\\" + sepFirst + fName + "\\" + sepLast, value); } catch (Exception e2) { } } mask = mask.replace(sepFirst + "id" + sepLast, ko.getId() + ""); Pattern p = Pattern.compile("\\" + sepFirst + "(.+?)" + "\\" + sepLast, Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(mask); while (m.find()) if (m.groupCount() > 0) { Object ret = new String(""); String mName = m.group(1); ret = ko.invoke(mName, ko.getClass()); mask = mask.replace(sepFirst + mName + sepLast, ret + ""); } } catch (Exception e1) { e1.printStackTrace(); } return mask; }
public boolean isValid(KObject ko) { boolean result = true; KObjectController koCtrl = getObjectController(ko.getClass().getSimpleName()); if (koCtrl != null) result = koCtrl.isValid(ko); return result; }
public Map<String, ArrayList<String>> messages(KObject ko) { Map<String, ArrayList<String>> result = new HashMap<String, ArrayList<String>>(); KObjectController koCtrl = getObjectController(ko.getClass().getSimpleName()); if (koCtrl != null) result = koCtrl.messages(ko); return result; }