1    package com.instantbank.component.job.model;
2    
3    import java.io.Serializable;
4    import org.w3c.dom.Element;
5    import org.w3c.dom.Document;
6    //import com.instantbank.component.job.util.*;
7    
8    /**
9     * Value Object that represents a WHERE element of a Job
10    * (innmutable)
11    */
12   public class JobWHEREelement
13       implements Serializable {
14   
15     /**
16      * sequence
17      */
18     private int sequence;
19     /**
20      * clause
21      */
22     private int clause;
23     /**
24      * field Identifier
25      */
26     private long fieldId;
27   
28     /**
29      * rule operator:  =, <, >, >=, <=, <>, BETWEEN, IN
30      */
31     private String ruleOperator;
32   
33     /**
34      * value
35      */
36     private String value;
37   
38     /**
39      * connector: LetterTemplateGlobals.OR_CONNECTOR, AND_CONNECTOR,
40      *ORTHE_CONNECTOR, EMPTY_CONNECTOR
41      */
42     private String connector;
43   
44   
45     /**
46      * Default Constructor
47      *
48      * @param sequence Description of the Parameter
49      * @param clause Description of the Parameter
50      * @param fieldId Description of the Parameter
51      * @param ruleOperator Description of the Parameter
52      * @param value Description of the Parameter
53      * @param connector Description of the Parameter
54      */
55     public JobWHEREelement(int sequence, int clause, long fieldId,
56                            String ruleOperator, String value, String connector) {
57       this.sequence = sequence;
58       this.clause = clause;
59       this.fieldId = fieldId;
60       this.ruleOperator = ruleOperator;
61       this.value = value;
62       this.connector = connector;
63     }
64   
65   
66     /**
67      *  Getter method for sequence
68      *
69      * @return sequence value
70      */
71     public int getSequence() {
72       return sequence;
73     }
74   
75   
76     /**
77      *  Getter method for clause
78      *
79      * @return clause value
80      */
81     public int getClause() {
82       return clause;
83     }
84   
85   
86     /**
87      *  Getter method for fieldId
88      *
89      * @return fieldId value
90      */
91     public long getFieldId() {
92       return fieldId;
93     }
94   
95   
96     /**
97      *  Getter method for ruleOperator
98      *
99      * @return ruleOperator value
100     */
101    public String getRuleOperator() {
102      return ruleOperator;
103    }
104  
105  
106    /**
107     *  Getter method for value
108     *
109     * @return value value
110     */
111    public String getValue() {
112      return value;
113    }
114  
115  
116    /**
117     *  Getter method for connector
118     *
119     * @return connector value
120     */
121    public String getConnector() {
122      return connector;
123    }
124  
125  
126    /**
127     *  Textual representation of JobWHEREelement
128     *
129     * @return associated text
130     */
131    public String toString() {
132      return "[sequence=" + sequence
133        + ", clause=" + clause
134        + ", fieldId=" + fieldId
135        + ", ruleOperator=" + ruleOperator
136        + ", value=" + value
137        + "]";
138    }
139  
140  
141    /**
142     *  XML representation of JobWHEREelement
143     *
144     * @param doc Description of the Parameter
145     * @return associated XML text
146     */
147    public Element toXml(Document doc) {
148      Element root = doc.createElement("JobWHEREelement");
149      root.setAttribute("Id", String.valueOf(sequence));
150  
151      Element node = null;
152  
153      node = doc.createElement("Clause");
154      node.appendChild(doc.createTextNode(String.valueOf(clause)));
155      root.appendChild(node);
156  
157      node = doc.createElement("FieldId");
158      node.appendChild(doc.createTextNode(String.valueOf(fieldId)));
159      root.appendChild(node);
160  
161      node = doc.createElement("RuleOperator");
162      node.appendChild(doc.createTextNode(ruleOperator));
163      root.appendChild(node);
164  
165      node = doc.createElement("Value");
166      node.appendChild(doc.createTextNode(value));
167      root.appendChild(node);
168  
169      node = doc.createElement("Connector");
170      node.appendChild(doc.createTextNode(connector));
171      root.appendChild(node);
172  
173      return root;
174    }
175  }
176