Exemple #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;
 }
Exemple #2
0
 private List<KForeignKey> getForeignKeys(KObject instance, String tableName) {
   List<KForeignKey> foreignKeys = new ArrayList<>();
   for (KConstraint constraint : instance.getConstraints()) {
     if (constraint.getForeignKey() != null) {
       KForeignKey fk = constraint.getForeignKey();
       fk.setTableName(tableName);
       foreignKeys.add(fk);
     }
   }
   return foreignKeys;
 }
Exemple #3
0
 public boolean isValid(KObject ko) {
   boolean result = true;
   KObjectController koCtrl = getObjectController(ko.getClass().getSimpleName());
   if (koCtrl != null) result = koCtrl.isValid(ko);
   return result;
 }
Exemple #4
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;
 }