1 21 package oracle.toplink.essentials.internal.expressions; 23 24 import oracle.toplink.essentials.exceptions.*; 25 import oracle.toplink.essentials.queryframework.*; 26 import oracle.toplink.essentials.expressions.*; 27 import oracle.toplink.essentials.internal.sessions.AbstractRecord; 28 import oracle.toplink.essentials.internal.sessions.AbstractSession; 29 import oracle.toplink.essentials.descriptors.ClassDescriptor; 30 31 34 public class LogicalExpression extends CompoundExpression { 35 36 39 public LogicalExpression() { 40 super(); 41 } 42 43 47 public String descriptionOfNodeType() { 48 return "Logical"; 49 } 50 51 57 public boolean doesConform(Object object, AbstractSession session, AbstractRecord translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean objectIsUnregistered) { 58 if (getOperator().getSelector() == ExpressionOperator.And) { 60 return getFirstChild().doesConform(object, session, translationRow, valueHolderPolicy, objectIsUnregistered) && getSecondChild().doesConform(object, session, translationRow, valueHolderPolicy, objectIsUnregistered); 61 } else if (getOperator().getSelector() == ExpressionOperator.Or) { 62 return getFirstChild().doesConform(object, session, translationRow, valueHolderPolicy, objectIsUnregistered) || getSecondChild().doesConform(object, session, translationRow, valueHolderPolicy, objectIsUnregistered); 63 } 64 65 throw QueryException.cannotConformExpression(); 66 67 } 68 69 75 public boolean extractPrimaryKeyValues(boolean requireExactMatch, ClassDescriptor descriptor, AbstractRecord primaryKeyRow, AbstractRecord translationRow) { 76 if (getOperator().getSelector() != ExpressionOperator.And) { 78 if (requireExactMatch || (getOperator().getSelector() != ExpressionOperator.Or)) { 81 return false; 82 } 83 } 84 boolean validExpression = getFirstChild().extractPrimaryKeyValues(requireExactMatch, descriptor, primaryKeyRow, translationRow); 85 if (requireExactMatch && (!validExpression)) { 86 return false; 87 } 88 return getSecondChild().extractPrimaryKeyValues(requireExactMatch, descriptor, primaryKeyRow, translationRow); 89 } 90 91 94 public boolean isLogicalExpression() { 95 return true; 96 } 97 } 98 | Popular Tags |