/** * {@inheritDoc} */ public Class<?> getType() { return qope.getSelect().get(fieldNumber).getType(); }
/** * {@inheritDoc} */ public Class<?> getType() { return qope.getSelect().get(fieldNumber).getType(); }
private static void copySelectList(Queryable q, List<QuerySelectable> select) { // Copy select list into query: QueryClass defaultClass = null; if (q instanceof QueryObjectPathExpression) { defaultClass = ((QueryObjectPathExpression) q).getDefaultClass(); } if ((select.size() == 1) && select.get(0).equals(defaultClass)) { // Don't add anything to the SELECT list - default is fine } else { for (QuerySelectable qs : select) { if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; if (qope.getSelect().size() > 1) { for (int i = 0; i < qope.getSelect().size(); i++) { q.addToSelect(new PathExpressionField(qope, i)); } } else { q.addToSelect(qope); } } else { q.addToSelect(qs); } } } }
while (qs instanceof PathExpressionField) { QueryObjectPathExpression qope = ((PathExpressionField) qs).getQope(); qs = qope.getSelect().get(((PathExpressionField) qs).getFieldNumber()); if (qs.equals(qope.getDefaultClass())) { qs = qope;
while (qs instanceof PathExpressionField) { QueryObjectPathExpression qope = ((PathExpressionField) qs).getQope(); qs = qope.getSelect().get(((PathExpressionField) qs).getFieldNumber()); if (qs.equals(qope.getDefaultClass())) { qs = qope;
private static void copySelectList(Queryable q, List<QuerySelectable> select) { // Copy select list into query: QueryClass defaultClass = null; if (q instanceof QueryObjectPathExpression) { defaultClass = ((QueryObjectPathExpression) q).getDefaultClass(); } if ((select.size() == 1) && select.get(0).equals(defaultClass)) { // Don't add anything to the SELECT list - default is fine } else { for (QuerySelectable qs : select) { if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; if (qope.getSelect().size() > 1) { for (int i = 0; i < qope.getSelect().size(); i++) { q.addToSelect(new PathExpressionField(qope, i)); } } else { q.addToSelect(qope); } } else { q.addToSelect(qs); } } } }
if ((!ref.getSelect().isEmpty()) || (ref.getConstraint() != null)) { Set<Integer> empty = Collections.emptySet(); Query subQ = ref.getQuery(empty, true); Set<QueryObjectPathExpression> subPathList = new HashSet<QueryObjectPathExpression>(); if (!ref.getSelect().isEmpty()) { retval.append("SELECT "); boolean needComma = false; for (QuerySelectable selectable : ref.getSelect()) { if (needComma) { retval.append(", ");
if ((!ref.getSelect().isEmpty()) || (ref.getConstraint() != null)) { Set<Integer> empty = Collections.emptySet(); Query subQ = ref.getQuery(empty, true); Set<QueryObjectPathExpression> subPathList = new HashSet<QueryObjectPathExpression>(); if (!ref.getSelect().isEmpty()) { retval.append("SELECT "); boolean needComma = false; for (QuerySelectable selectable : ref.getSelect()) { if (needComma) { retval.append(", ");
if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; List<QuerySelectable> subSelect = qope.getSelect(); if (!subSelect.isEmpty()) { qs = subSelect.get(0); qs = pef.getQope().getSelect().get(pef.getFieldNumber()); } else { notFinished = false;
if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; List<QuerySelectable> subSelect = qope.getSelect(); if (!subSelect.isEmpty()) { qs = subSelect.get(0); qs = pef.getQope().getSelect().get(pef.getFieldNumber()); } else { notFinished = false;
if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; List<QuerySelectable> subSelect = qope.getSelect(); if (!subSelect.isEmpty()) { qs = subSelect.get(0); PathExpressionField pef = (PathExpressionField) qs; QueryObjectPathExpression qope = pef.getQope(); qs = qope.getSelect().get(pef.getFieldNumber()); if (qs.equals(qope.getDefaultClass())) { qs = qope;
private static void addFlatSelect(List<QuerySelectable> toAdd, List<QuerySelectable> select, QuerySelectable defaultClass, QuerySelectable substitute) { if (select.isEmpty() && substitute != null) { toAdd.add(substitute); } else { for (QuerySelectable s : select) { while (s instanceof PathExpressionField) { PathExpressionField pef = (PathExpressionField) s; s = pef.getQope().getSelect().get(pef.getFieldNumber()); if (s == pef.getQope().getDefaultClass()) { s = pef.getQope(); } } if (s == defaultClass) { toAdd.add(substitute); } else if (s instanceof QueryCollectionPathExpression) { addFlatSelect(toAdd, ((QueryCollectionPathExpression) s).getSelect(), ((QueryCollectionPathExpression) s).getDefaultClass(), s); } else { toAdd.add(s); } } } } }
if (qs instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) qs; List<QuerySelectable> subSelect = qope.getSelect(); if (!subSelect.isEmpty()) { qs = subSelect.get(0); PathExpressionField pef = (PathExpressionField) qs; QueryObjectPathExpression qope = pef.getQope(); qs = qope.getSelect().get(pef.getFieldNumber()); if (qs.equals(qope.getDefaultClass())) { qs = qope;
private static void addFlatSelect(List<QuerySelectable> toAdd, List<QuerySelectable> select, QuerySelectable defaultClass, QuerySelectable substitute) { if (select.isEmpty() && substitute != null) { toAdd.add(substitute); } else { for (QuerySelectable s : select) { while (s instanceof PathExpressionField) { PathExpressionField pef = (PathExpressionField) s; s = pef.getQope().getSelect().get(pef.getFieldNumber()); if (s == pef.getQope().getDefaultClass()) { s = pef.getQope(); } } if (s == defaultClass) { toAdd.add(substitute); } else if (s instanceof QueryCollectionPathExpression) { addFlatSelect(toAdd, ((QueryCollectionPathExpression) s).getSelect(), ((QueryCollectionPathExpression) s).getDefaultClass(), s); } else { toAdd.add(s); } } } } }
if (parentNode instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) parentNode; if (qope.getSelect().isEmpty()) { qope.addToSelect(qope.getDefaultClass());
if (parentNode instanceof QueryObjectPathExpression) { QueryObjectPathExpression qope = (QueryObjectPathExpression) parentNode; if (qope.getSelect().isEmpty()) { qope.addToSelect(qope.getDefaultClass());
new HashSet<QuerySelectable>(qope.getSelect()), pathToQueryNode, occurancesOnly); } else if (qs instanceof QueryCollectionPathExpression) {
new HashSet<QuerySelectable>(qope.getSelect()), pathToQueryNode, occurancesOnly); } else if (qs instanceof QueryCollectionPathExpression) {
checkQueryNodes(msg + ": QueryClasses of QueryObjectPathExpressions don't match", pe1.getQueryClass(), pe2.getQueryClass(), q1, q2); Assert.assertEquals(msg + ": QueryObjectPathExpression fieldnames are not equal", pe1.getFieldName(), pe2.getFieldName()); checkQueryClassLists(msg + ": QueryObjectPathExpression SELECT lists are not equal", pe1.getSelect(), pe2.getSelect(), q1, q2); checkConstraints(msg + ": QueryObjectPathExpression constraints are not equal", pe1.getConstraint(), pe2.getConstraint(), q1, q2); } else {
new HashMap<FromElement, FromElement>(); subFromElementMap.put(origC.getDefaultClass(), retval.getDefaultClass()); for (QuerySelectable selectable : origC.getSelect()) { retval.addToSelect((QuerySelectable) cloneThing(selectable, subFromElementMap, qopeMap));