001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.commons.dsi.dml;
020:
021: import java.util.Vector;
022:
023: import org.openharmonise.commons.dsi.*;
024:
025: /**
026: * WhereCondition which includes a SQL function manipulation on the value of the DB
027: * column before comparison.
028: *
029: * <emph>Note: the default comparison operator is '='.</emph>
030: *
031: * @author Michael Bell
032: * @version $Revision: 1.1 $
033: *
034: */
035: public class FunctionedWhereCondition extends WhereCondition {
036:
037: /**
038: * Function to be used in where condition.
039: */
040: private Function m_func = null;
041:
042: /**
043: * Constructs a where condition which can have a function applied.
044: *
045: * @param colref condition column reference
046: * @param val value for comparison
047: * @throws DataStoreException if condition is invalid
048: */
049: public FunctionedWhereCondition(ColumnRef colref, int val)
050: throws DataStoreException {
051: super (colref, val);
052: }
053:
054: /**
055: * Constructs a where condtion which can have a function applied.
056: *
057: * @param colref condition column reference
058: * @param sOp condition comparison operator
059: * @param val value for comparison
060: * @throws DataStoreException if condition is invalid
061: */
062: public FunctionedWhereCondition(ColumnRef colref, String sOp,
063: int val) throws DataStoreException {
064: super (colref, sOp, val);
065: }
066:
067: /**
068: * Constructs a where condtion which can have a function applied.
069: *
070: * @param colref condition column reference
071: * @param val value for comparison
072: * @throws DataStoreException if condition is invalid
073: */
074: public FunctionedWhereCondition(ColumnRef colref, Object val)
075: throws DataStoreException {
076: super (colref, val);
077: }
078:
079: /**
080: * Constructs a where condtion which can have a function applied.
081: *
082: * @param colref condition column reference
083: * @param sOp condition comparison operator
084: * @param val value for comparison
085: * @throws DataStoreException if condition is invalid
086: */
087: public FunctionedWhereCondition(ColumnRef colref, String sOp,
088: Object val) throws DataStoreException {
089: super (colref, sOp, val);
090: }
091:
092: /**
093: * Constructs a where condtion which can have a function applied.
094: *
095: * @param colref condition column reference
096: * @param val list of values for comparison
097: * @throws DataStoreException if condition is invalid
098: */
099: public FunctionedWhereCondition(ColumnRef colref, Vector val)
100: throws DataStoreException {
101: super (colref, val);
102: }
103:
104: /**
105: * Constructs a where condtion which can have a function applied.
106: *
107: * @param colref condition column reference
108: * @param sOp condition comparison operator
109: * @param val list of values for comparison
110: * @throws DataStoreException if condition is invalid
111: */
112: public FunctionedWhereCondition(ColumnRef colref, String sOp,
113: Vector val) throws DataStoreException {
114: super (colref, sOp, val);
115: }
116:
117: /**
118: * Sets function for this functioned condition.
119: *
120: * @param func Function to be used in this condition
121: */
122: public void setFunction(Function func) {
123: m_func = func;
124: }
125:
126: /**
127: * Returns the function to be applied to this condition.
128: *
129: * @return the function to be applied to this condition
130: */
131: public Function getFunction() {
132: return m_func;
133: }
134:
135: }
|