Ejemplo n.º 1
0
 /**
  * Generates portion of the query for attribute JOIN
  *
  * @param sql already existing portion of the SQL, presumed to have at least SELECT and FROM
  *     clauses.
  * @param attributes list of attribute constraints for the capability with #capabilityAlias
  * @param capabilityAlias alias of the capability to which these attribute constraints belong
  */
 private void processAttributesJoin(
     SQL sql, List<Attribute<?>> attributes, String capabilityAlias) {
   String attributeAlias;
   for (int j = 0; j < attributes.size(); j++) {
     attributeAlias = createAttributeAlias(capabilityAlias, j);
     sql.INNER_JOIN(
         "capability_attribute "
             + attributeAlias
             + " ON "
             + attributeAlias
             + ".capability_id = "
             + capabilityAlias
             + ".capability_id");
   }
 }
Ejemplo n.º 2
0
  /**
   * Generates portion of the query for subcapability JOIN
   *
   * @param sql already existing portion of the SQL, presumed to have at least SELECT and FROM
   *     clauses.
   * @param filter filter for the particular subcapability
   * @param parentCapabilityAlias alias of the subcapability's parent in the #sql query
   */
  private void processSubCapabilitiesJoin(
      SQL sql, CapabilityFilter filter, String parentCapabilityAlias) {
    String subAlias;
    CapabilityFilter subFilter;
    for (int k = 0; k < filter.getSubFilters().size(); k++) {
      subFilter = filter.getSubFilters().get(k);

      subAlias = parentCapabilityAlias + k;
      sql.INNER_JOIN(
          "capability "
              + subAlias
              + " ON "
              + parentCapabilityAlias
              + ".capability_id = "
              + subAlias
              + ".parent_capability_id");

      processAttributesJoin(sql, subFilter.getAttributes(), subAlias);

      processSubCapabilitiesJoin(sql, subFilter, subAlias);
    }
  }