/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.Readable#getString() */ public String getString() { return getSymbol(); }
@Override public void visit(DescendantNodeJoinCondition joinCondition) { symbols.add(joinCondition.getAncestorSelectorName()); symbols.add(joinCondition.getDescendantSelectorName()); }
/** * @see org.xcmis.search.Visitors.AbstractModelVisitor#visit(org.xcmis.search.model.source.join.EquiJoinCondition) */ @Override public void visit(EquiJoinCondition node) throws VisitException { checkTableAndColumnExistance(node.getSelector1Name(), node.getProperty1Name(), true); checkTableAndColumnExistance(node.getSelector2Name(), node.getProperty2Name(), true); if (node.getSelector1Name().equals(node.getSelector2Name())) { problems.addException(new InvalidQueryException(node.getSelector1Name() + " is the same as " + node.getSelector2Name())); } }
@Override public void visit(ChildNodeJoinCondition joinCondition) { symbols.add(joinCondition.getChildSelectorName()); symbols.add(joinCondition.getParentSelectorName()); }
/** * {@inheritDoc} * * @see QueryObjectModelVisitor#visit(SameNodeJoinCondition) */ public void visit(SameNodeJoinCondition condition) { append("ISSAMENODE(").append(condition.getSelector1Name()).append(',').append(condition.getSelector2Name()); if (condition.getSelector2Path() != null) { append(',').append(condition.getSelector2Path()); } append(')'); }
@Override public void visit(SameNodeJoinCondition joinCondition) { symbols.add(joinCondition.getSelector1Name()); symbols.add(joinCondition.getSelector2Name()); } }));
@Override public void visit(EquiJoinCondition joinCondition) { symbols.add(joinCondition.getSelector1Name()); symbols.add(joinCondition.getSelector2Name()); }
/** * Define the join as using an equi-join criteria by specifying the * expression equating two columns. Each column reference must be * qualified with the appropriate table name or alias. * * @param columnEqualExpression * the equality expression between the two tables; may not be * null * @return the query builder instance, for method chaining purposes * @throws IllegalArgumentException * if the supplied expression is not an equality expression */ public QueryBuilder on(String columnEqualExpression) { String[] parts = columnEqualExpression.split("="); if (parts.length != 2) { throw new IllegalArgumentException("Expected equality expression for columns, but found \"" + columnEqualExpression + "\""); } return createJoin(new EquiJoinCondition(column(parts[0]), column(parts[1]))); }
/** * {@inheritDoc} * @throws VisitException if exception occurs * * @see QueryObjectModelVisitor#visit(Join) */ public void visit(Join join) throws VisitException { join.getLeft().accept(this); // if (join.getType() != JoinType.INNER) { sb.append(' ').append(join.getType().getSymbol()); // } else { // sb.append(','); // } append(' '); join.getRight().accept(this); append(" ON "); join.getJoinCondition().accept(this); }
/** * Define the join criteria to require the two tables represent the same * node. The supplied tables must be a valid name or alias. * * @param table1 * the name or alias of the first table * @param table2 * the name or alias of the second table * @return the query builder instance, for method chaining purposes */ public QueryBuilder onSameNode(String table1, String table2) { return createJoin(new SameNodeJoinCondition(nameOf(table1), nameOf(table2))); }
/** * Define the join criteria to require the node in one table is a * descendant of the node in another table. The supplied tables must be a * valid name or alias. * * @param ancestorTable * the name or alias of the table containing the ancestor node * @param descendantTable * the name or alias of the table containing the descendant node * @return the query builder instance, for method chaining purposes */ public QueryBuilder onDescendant(String ancestorTable, String descendantTable) { return createJoin(new DescendantNodeJoinCondition(nameOf(ancestorTable), nameOf(descendantTable))); }
/** * Define the join criteria to require the node in one table is a child of * the node in another table. The supplied tables must be a valid name or * alias. * * @param parentTable * the name or alias of the table containing the parent node * @param childTable * the name or alias of the table containing the child node * @return the query builder instance, for method chaining purposes */ public QueryBuilder onChildNode(String parentTable, String childTable) { return createJoin(new ChildNodeJoinCondition(nameOf(parentTable), nameOf(childTable))); }
/** * {@inheritDoc} * * @see QueryObjectModelVisitor#visit(EquiJoinCondition) */ public void visit(EquiJoinCondition condition) { append(condition.getSelector1Name()).append('.').append(condition.getProperty1Name()); append(" = "); append(condition.getSelector2Name()).append('.').append(condition.getProperty2Name()); }
/** * @see org.xcmis.search.Visitors.AbstractModelVisitor#visit(org.xcmis.search.model.source.join.DescendantNodeJoinCondition) */ @Override public void visit(DescendantNodeJoinCondition node) throws VisitException { checkSelectorExistance(node.getAncestorSelectorName()); checkSelectorExistance(node.getDescendantSelectorName()); }
/** * @see org.xcmis.search.Visitors.AbstractModelVisitor#visit(org.xcmis.search.model.source.join.ChildNodeJoinCondition) */ @Override public void visit(ChildNodeJoinCondition node) throws VisitException { checkSelectorExistance(node.getChildSelectorName()); checkSelectorExistance(node.getParentSelectorName()); if (node.getChildSelectorName().equals(node.getParentSelectorName())) { problems.addException(new InvalidQueryException(node.getChildSelectorName() + " is the same as " + node.getParentSelectorName())); } }
/** * @see org.xcmis.search.Visitors.AbstractModelVisitor#visit(org.xcmis.search.model.source.join.SameNodeJoinCondition) */ @Override public void visit(SameNodeJoinCondition node) throws VisitException { checkSelectorExistance(node.getSelector1Name()); checkSelectorExistance(node.getSelector2Name()); if (node.getSelector1Name().equals(node.getSelector2Name())) { problems.addException(new InvalidQueryException(node.getSelector1Name() + " is the same as " + node.getSelector2Name())); } }
sn2 = getSelectorName(sn2); res = new EquiJoinCondition(sn1, p1, sn2, p2);
/** * {@inheritDoc} * * @see QueryObjectModelVisitor#visit(DescendantNodeJoinCondition) */ public void visit(DescendantNodeJoinCondition condition) { append("ISDESCENDANTNODE("); append(condition.getDescendantSelectorName()); append(','); append(condition.getAncestorSelectorName()); append(')'); }
/** * {@inheritDoc} * * @see QueryObjectModelVisitor#visit(ChildNodeJoinCondition) */ public void visit(ChildNodeJoinCondition condition) { append("ISCHILDNODE("); append(condition.getChildSelectorName()); append(','); append(condition.getParentSelectorName()); append(')'); }