public static boolean extractQueries(QueryCommand queryCommand, List<Query> result) { if (queryCommand instanceof SetQuery) { SetQuery sq = (SetQuery)queryCommand; if (sq.isAll() && sq.getOperation() == Operation.UNION && sq.getOrderBy() == null && sq.getLimit() == null && sq.getWith() == null) { if (!extractQueries(sq.getLeftQuery(), result)) { return false; } if (!extractQueries(sq.getRightQuery(), result)) { return false; } return true; } return false; } result.add((Query)queryCommand); return true; }
public static boolean extractQueries(QueryCommand queryCommand, List<Query> result) { if (queryCommand instanceof SetQuery) { SetQuery sq = (SetQuery)queryCommand; if (sq.isAll() && sq.getOperation() == Operation.UNION && sq.getOrderBy() == null && sq.getLimit() == null && sq.getWith() == null) { if (!extractQueries(sq.getLeftQuery(), result)) { return false; } if (!extractQueries(sq.getRightQuery(), result)) { return false; } return true; } return false; } result.add((Query)queryCommand); return true; }
public static boolean extractQueries(QueryCommand queryCommand, List<Query> result) { if (queryCommand instanceof SetQuery) { SetQuery sq = (SetQuery)queryCommand; if (sq.isAll() && sq.getOperation() == Operation.UNION && sq.getOrderBy() == null && sq.getLimit() == null && sq.getWith() == null) { if (!extractQueries(sq.getLeftQuery(), result)) { return false; } if (!extractQueries(sq.getRightQuery(), result)) { return false; } return true; } return false; } result.add((Query)queryCommand); return true; }
/** * Compare two queries for equality. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(!(obj instanceof SetQuery)) { return false; } SetQuery other = (SetQuery) obj; return getOperation() == other.getOperation() && EquivalenceUtil.areEqual(this.isAll(), other.isAll()) && EquivalenceUtil.areEqual(this.leftQuery, other.leftQuery) && EquivalenceUtil.areEqual(this.rightQuery, other.rightQuery) && EquivalenceUtil.areEqual(getOrderBy(), other.getOrderBy()) && EquivalenceUtil.areEqual(getLimit(), other.getLimit()) && EquivalenceUtil.areEqual(getWith(), other.getWith()) && sameOptionAndHint(other); }
public void visit(SetQuery obj) { preVisitVisitor(obj); visitNodes(obj.getWith()); visitNodes(obj.getQueryCommands()); visitNode(obj.getOrderBy()); visitNode(obj.getLimit()); visitNode(obj.getOption()); postVisitVisitor(obj); }
public void visit(SetQuery obj) { preVisitVisitor(obj); visitNodes(obj.getWith()); visitNodes(obj.getQueryCommands()); visitNode(obj.getOrderBy()); visitNode(obj.getLimit()); visitNode(obj.getOption()); postVisitVisitor(obj); }
/** * Compare two queries for equality. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(!(obj instanceof SetQuery)) { return false; } SetQuery other = (SetQuery) obj; return getOperation() == other.getOperation() && EquivalenceUtil.areEqual(this.isAll(), other.isAll()) && EquivalenceUtil.areEqual(this.leftQuery, other.leftQuery) && EquivalenceUtil.areEqual(this.rightQuery, other.rightQuery) && EquivalenceUtil.areEqual(getOrderBy(), other.getOrderBy()) && EquivalenceUtil.areEqual(getLimit(), other.getLimit()) && EquivalenceUtil.areEqual(getWith(), other.getWith()) && sameOptionAndHint(other); }
/** * Compare two queries for equality. * @param obj Other object * @return True if equal */ public boolean equals(Object obj) { // Quick same object test if(this == obj) { return true; } // Quick fail tests if(!(obj instanceof SetQuery)) { return false; } SetQuery other = (SetQuery) obj; return getOperation() == other.getOperation() && EquivalenceUtil.areEqual(this.isAll(), other.isAll()) && EquivalenceUtil.areEqual(this.leftQuery, other.leftQuery) && EquivalenceUtil.areEqual(this.rightQuery, other.rightQuery) && EquivalenceUtil.areEqual(getOrderBy(), other.getOrderBy()) && EquivalenceUtil.areEqual(getLimit(), other.getLimit()) && EquivalenceUtil.areEqual(getWith(), other.getWith()) && sameOptionAndHint(other); }
public void visit(SetQuery obj) { preVisitVisitor(obj); visitNodes(obj.getWith()); visitNodes(obj.getQueryCommands()); visitNode(obj.getOrderBy()); visitNode(obj.getLimit()); visitNode(obj.getOption()); postVisitVisitor(obj); }
/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
org.teiid.language.SetQuery translate(SetQuery union) { org.teiid.language.SetQuery result = new org.teiid.language.SetQuery(); result.setWith(translate(union.getWith())); result.setAll(union.isAll()); switch (union.getOperation()) { case UNION: result.setOperation(org.teiid.language.SetQuery.Operation.UNION); break; case INTERSECT: result.setOperation(org.teiid.language.SetQuery.Operation.INTERSECT); break; case EXCEPT: result.setOperation(org.teiid.language.SetQuery.Operation.EXCEPT); break; } result.setLeftQuery(translate(union.getLeftQuery())); result.setRightQuery(translate(union.getRightQuery())); result.setOrderBy(translate(union.getOrderBy(), true)); result.setLimit(translate(union.getLimit())); return result; }
org.teiid.language.SetQuery translate(SetQuery union) { org.teiid.language.SetQuery result = new org.teiid.language.SetQuery(); result.setWith(translate(union.getWith())); result.setAll(union.isAll()); switch (union.getOperation()) { case UNION: result.setOperation(org.teiid.language.SetQuery.Operation.UNION); break; case INTERSECT: result.setOperation(org.teiid.language.SetQuery.Operation.INTERSECT); break; case EXCEPT: result.setOperation(org.teiid.language.SetQuery.Operation.EXCEPT); break; } result.setLeftQuery(translate(union.getLeftQuery())); result.setRightQuery(translate(union.getRightQuery())); result.setOrderBy(translate(union.getOrderBy(), true)); result.setLimit(translate(union.getLimit())); return result; }
org.teiid.language.SetQuery translate(SetQuery union) { org.teiid.language.SetQuery result = new org.teiid.language.SetQuery(); result.setWith(translate(union.getWith())); result.setAll(union.isAll()); switch (union.getOperation()) { case UNION: result.setOperation(org.teiid.language.SetQuery.Operation.UNION); break; case INTERSECT: result.setOperation(org.teiid.language.SetQuery.Operation.INTERSECT); break; case EXCEPT: result.setOperation(org.teiid.language.SetQuery.Operation.EXCEPT); break; } result.setLeftQuery(translate(union.getLeftQuery())); result.setRightQuery(translate(union.getRightQuery())); result.setOrderBy(translate(union.getOrderBy(), true)); result.setLimit(translate(union.getLimit())); return result; }