1 21 package oracle.toplink.essentials.queryframework; 23 24 25 38 public class InMemoryQueryIndirectionPolicy implements java.io.Serializable { 39 public static final int SHOULD_THROW_INDIRECTION_EXCEPTION = 0; 40 public static final int SHOULD_TRIGGER_INDIRECTION = 1; 41 public static final int SHOULD_IGNORE_EXCEPTION_RETURN_CONFORMED = 2; 42 public static final int SHOULD_IGNORE_EXCEPTION_RETURN_NOT_CONFORMED = 3; 43 protected int policy; 44 45 public InMemoryQueryIndirectionPolicy() { 46 this.policy = SHOULD_THROW_INDIRECTION_EXCEPTION; 47 } 48 49 public InMemoryQueryIndirectionPolicy(int policyValue) { 50 this.policy = policyValue; 51 } 52 53 public boolean shouldTriggerIndirection() { 54 return this.policy == SHOULD_TRIGGER_INDIRECTION; 55 } 56 57 public boolean shouldThrowIndirectionException() { 58 return this.policy == SHOULD_THROW_INDIRECTION_EXCEPTION; 59 } 60 61 public boolean shouldIgnoreIndirectionExceptionReturnConformed() { 62 return this.policy == SHOULD_IGNORE_EXCEPTION_RETURN_CONFORMED; 63 } 64 65 public boolean shouldIgnoreIndirectionExceptionReturnNotConformed() { 66 return this.policy == SHOULD_IGNORE_EXCEPTION_RETURN_NOT_CONFORMED; 67 } 68 69 public void ignoreIndirectionExceptionReturnNotConformed() { 70 this.policy = SHOULD_IGNORE_EXCEPTION_RETURN_NOT_CONFORMED; 71 } 72 73 public void ignoreIndirectionExceptionReturnConformed() { 74 this.policy = SHOULD_IGNORE_EXCEPTION_RETURN_CONFORMED; 75 } 76 77 public void triggerIndirection() { 78 this.policy = SHOULD_TRIGGER_INDIRECTION; 79 } 80 81 public void throwIndirectionException() { 82 this.policy = SHOULD_THROW_INDIRECTION_EXCEPTION; 83 } 84 85 public int getPolicy() { 87 return this.policy; 88 } 89 90 public void setPolicy(int policy) { 91 this.policy = policy; 92 } 93 } 94 | Popular Tags |