Exemplo n.º 1
0
 @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;
 }
Exemplo n.º 2
0
 public boolean isValid(KObject ko) {
   boolean result = true;
   KObjectController koCtrl = getObjectController(ko.getClass().getSimpleName());
   if (koCtrl != null) result = koCtrl.isValid(ko);
   return result;
 }
Exemplo n.º 3
0
 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;
 }