Skip to content

Commit

Permalink
added ERXExistsQualifier-support in ERXQualifierTraversal
Browse files Browse the repository at this point in the history
  • Loading branch information
nur-sgaertner committed Sep 21, 2015
1 parent 4d92aa1 commit 332ca7e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.webobjects.foundation.NSRange;

import er.extensions.eof.ERXKey;
import er.extensions.eof.qualifiers.ERXExistsQualifier;

/**
* Takes a qualifier, traverses every subqualifier, and prepends every keypath
Expand Down Expand Up @@ -110,6 +111,13 @@ protected boolean traverseTrueQualifier(ERXTrueQualifier q) {
return true;
}

@Override
protected boolean traverseExistsQualifier(ERXExistsQualifier q) {
String newBaseKeyPath = q.baseKeyPath() != null ? _prefix + q.baseKeyPath() : _prefix.substring(0, _prefix.length() - 1);
_qualifiers.add(new ERXExistsQualifier(q.subqualifier(), newBaseKeyPath, q.usesInQualInstead()));
return true;
}

@Override
public synchronized void traverse(EOQualifierEvaluation q, boolean postOrder) {
if (!postOrder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.webobjects.eocontrol.EOOrQualifier;
import com.webobjects.eocontrol.EOQualifierEvaluation;

import er.extensions.eof.qualifiers.ERXExistsQualifier;

/**
* Traverse a network of qualifiers until a traversal method returns false.
* Subclass and implement the methods you need.
Expand Down Expand Up @@ -125,6 +127,17 @@ protected boolean traverseFalseQualifier(ERXFalseQualifier q) {
return true;
}

/**
* Should traverse exists qualifier?
*
* @param q
* the qualifier to process
* @return should traverse exists qualifier
*/
protected boolean traverseExistsQualifier(ERXExistsQualifier q) {
return true;
}

/**
* Traverses the supplied qualifier
*
Expand Down Expand Up @@ -199,6 +212,9 @@ else if (q instanceof ERXTrueQualifier) {
else if (q instanceof ERXFalseQualifier) {
result = traverseFalseQualifier((ERXFalseQualifier) q) ? Boolean.TRUE : Boolean.FALSE;
}
else if (q instanceof ERXExistsQualifier) {
result = traverseExistsQualifier((ERXExistsQualifier) q) ? Boolean.TRUE : Boolean.FALSE;
}
else {
result = traverseUnknownQualifier(q) ? Boolean.TRUE : Boolean.FALSE;
}
Expand Down

0 comments on commit 332ca7e

Please sign in to comment.