Ejemplo n.º 1
0
 private static CharSequence createElementSQLJoin(
     final Map<Class, String> joinTabalis, final EntityInfo info, final FilterJoinNode node) {
   if (node.joinClass == null) return null;
   StringBuilder sb = new StringBuilder();
   String[] joinColumns = node.joinColumns;
   sb.append(" INNER JOIN ")
       .append(node.joinEntity.getTable())
       .append(" ")
       .append(joinTabalis.get(node.joinClass))
       .append(" ON ")
       .append(info.getSQLColumn("a", joinColumns[0]))
       .append(" = ")
       .append(node.joinEntity.getSQLColumn(joinTabalis.get(node.joinClass), joinColumns[0]));
   for (int i = 1; i < joinColumns.length; i++) {
     sb.append(" AND ")
         .append(info.getSQLColumn("a", joinColumns[i]))
         .append(" = ")
         .append(node.joinEntity.getSQLColumn(joinTabalis.get(node.joinClass), joinColumns[i]));
   }
   return sb;
 }
Ejemplo n.º 2
0
  public boolean matches(Criteria criteria) {
    score = 0;

    boolean kill = false;
    boolean anyMatches = false;
    for (Criterion criterion : criteria) {
      Answer answer = answers.get(criterion.getAnswer().getQuestionText());
      boolean match =
          criterion.getWeight() == Weight.DontCare || answer.match(criterion.getAnswer());
      if (!match && criterion.getWeight() == Weight.MustMatch) {
        kill = true;
      }
      if (match) {
        score += criterion.getWeight().getValue();
      }
      anyMatches |= match;
      // ...
    }
    if (kill) return false;
    return anyMatches;
  }