Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import er.extensions.eof.ERXKey;
import er.extensions.foundation.ERXArrayUtilities;
import er.extensions.foundation.ERXStringUtilities;
import er.extensions.qualifiers.ERXPrefixQualifierTraversal;

/**
* A qualifier that qualifies using an EXISTS clause.
Expand All @@ -68,7 +67,7 @@ public class ERXExistsQualifier extends EOQualifier implements Cloneable, NSCodi
*/
static final Logger log = LoggerFactory.getLogger(ERXExistsQualifier.class);

private static final Pattern PATTERN = Pattern.compile("([ '\"\\(]|^)(t)([0-9])([ ,\\.'\"\\(]|$)");
static final Pattern PATTERN = Pattern.compile("([ '\"\\(]|^)(t)([0-9])([ ,\\.'\"\\(]|$)");

public static final String EXISTS_ALIAS = "exists";
public static final boolean UseSQLInClause = true;
Expand All @@ -95,6 +94,7 @@ public class ERXExistsQualifier extends EOQualifier implements Cloneable, NSCodi
* Public single argument constructor. Use this constructor for sub-qualification on the same table.
* @param subqualifier sub-qualifier
*/
@SuppressWarnings("hiding")
public ERXExistsQualifier(EOQualifier subqualifier) {
this(subqualifier, null);
}
Expand All @@ -106,6 +106,7 @@ public ERXExistsQualifier(EOQualifier subqualifier) {
* @param baseKeyPath to the entity to which the subqualifier will be applied. Note that this should end in a
* relationship rather than an attribute, e.g., the key path from an Employee might be <code>department.division</code>.
*/
@SuppressWarnings("hiding")
public ERXExistsQualifier(EOQualifier subqualifier, String baseKeyPath) {
super();
/*
Expand Down Expand Up @@ -136,7 +137,8 @@ public ERXExistsQualifier(EOQualifier subqualifier, String baseKeyPath) {
* relationship rather than an attribute, e.g., the key path from an Employee might be <code>department.division</code>.
* @param usesInQualInstead when true will convert the EXISTS clause into an IN clause - to be used if it makes the query plan faster.
*/
public ERXExistsQualifier(EOQualifier subqualifier, String baseKeyPath, boolean usesInQualInstead) {
@SuppressWarnings("hiding")
public ERXExistsQualifier(EOQualifier subqualifier, String baseKeyPath, boolean usesInQualInstead) {
this(subqualifier, baseKeyPath);
setUsesInQualInstead(usesInQualInstead);
}
Expand Down Expand Up @@ -470,12 +472,13 @@ public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchive
@Override
public boolean evaluateWithObject(Object object) {
boolean match = false;
NSKeyValueCodingAdditions obj = (NSKeyValueCodingAdditions) object;
if (obj != null && subqualifier != null) {
NSKeyValueCodingAdditions finalObj = baseKeyPath != null ? (NSKeyValueCodingAdditions) obj.valueForKeyPath(baseKeyPath) : obj;
if (finalObj != null) {
if (finalObj instanceof NSArray) {
NSArray<NSKeyValueCoding> objArray = (NSArray<NSKeyValueCoding>) finalObj;
if (object != null && subqualifier != null) {
if (baseKeyPath != null) {
object = NSKeyValueCodingAdditions.Utility.valueForKeyPath(object, baseKeyPath);
}
if (object != null) {
if (object instanceof NSArray) {
NSArray<NSKeyValueCoding> objArray = (NSArray<NSKeyValueCoding>) object;
objArray = ERXArrayUtilities.removeNullValues(objArray);
if (objArray != null && objArray.count() > 0) {
for (NSKeyValueCoding objInArray : objArray) {
Expand All @@ -491,7 +494,7 @@ public boolean evaluateWithObject(Object object) {
}
}
} else {
match = subqualifier.evaluateWithObject(finalObj);
match = subqualifier.evaluateWithObject(object);
}
}
}
Expand All @@ -502,8 +505,8 @@ public boolean usesInQualInstead() {
return usesInQualInstead;
}

@SuppressWarnings("hiding")
public void setUsesInQualInstead(boolean usesInQualInstead) {
this.usesInQualInstead = usesInQualInstead;
}

}