예제 #1
0
  public JahiaEquiJoinMerger(
      Join join,
      Map<String, PropertyValue> columns,
      OperandEvaluator evaluator,
      QueryObjectModelFactory factory,
      EquiJoinCondition condition)
      throws RepositoryException {
    super(join, columns, evaluator, factory, condition);

    PropertyValue property1 =
        factory.propertyValue(condition.getSelector1Name(), condition.getProperty1Name());
    PropertyValue property2 =
        factory.propertyValue(condition.getSelector2Name(), condition.getProperty2Name());

    if (leftSelectors.contains(property1.getSelectorName())
        && rightSelectors.contains(property2.getSelectorName())) {
      leftProperty = property1;
      rightProperty = property2;
    } else if (leftSelectors.contains(property2.getSelectorName())
        && rightSelectors.contains(property1.getSelectorName())) {
      leftProperty = property2;
      rightProperty = property1;
    } else {
      throw new RepositoryException("Invalid equi-join");
    }
  }
예제 #2
0
  public List<Constraint> getRightJoinConstraintsWithTranslation(List<Row> leftRows)
      throws RepositoryException {
    Map<String, Literal> literals = new HashMap<String, Literal>();
    for (Row leftRow : leftRows) {
      for (Value value : evaluator.getValues(leftProperty, leftRow)) {
        literals.put(value.getString(), factory.literal(value));
      }
    }

    List<Constraint> constraints = new ArrayList<Constraint>(literals.size());
    for (Literal literal : literals.values()) {
      constraints.add(factory.comparison(rightProperty, JCR_OPERATOR_EQUAL_TO, literal));
      constraints.add(
          factory.comparison(
              factory.propertyValue(rightProperty.getSelectorName(), "_PARENT"),
              JCR_OPERATOR_EQUAL_TO,
              literal));
    }
    return constraints;
  }