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 ORDER element of a Job
10    * (innmutable)
11    */
12   public class JobORDERelement
13       implements Serializable {
14   
15     /**
16      * sequence
17      */
18     private int sequence;
19     /**
20      * field Identifier
21      */
22     private long fieldId;
23   
24     /**
25      * direction: LetterTemplateGlobals.ASCENDING_DIRECTION
26      *or LetterTemplateGlobals.DESCENDING_DIRECTION
27      */
28     private String direction;
29   
30     /**
31      * unicity member: "yes"  or "no"
32      */
33     private String unicityMember;
34   
35   
36     /**
37      * Default Constructor
38      *
39      * @param sequence Description of the Parameter
40      * @param fieldId Description of the Parameter
41      * @param direction Description of the Parameter
42      * @param unicityMember Description of the Parameter
43      */
44     public JobORDERelement(int sequence, long fieldId,
45                            String direction, String unicityMember) {
46       this.sequence = sequence;
47       this.fieldId = fieldId;
48       this.direction = direction;
49       this.unicityMember = unicityMember;
50     }
51   
52   
53     /**
54      *  Getter method for sequence
55      *
56      * @return sequence value
57      */
58     public int getSequence() {
59       return sequence;
60     }
61   
62   
63     /**
64      *  Getter method for fieldId
65      *
66      * @return fieldId value
67      */
68     public long getFieldId() {
69       return fieldId;
70     }
71   
72   
73     /**
74      *  Getter method for direction
75      *
76      * @return direction value
77      */
78     public String getDirection() {
79       return direction;
80     }
81   
82   
83     /**
84      *  Getter method for unicityMember
85      *
86      * @return unicityMember value
87      */
88     public String getUnicityMember() {
89       return unicityMember;
90     }
91   
92   
93     /**
94      *  Textual representation of JobWHEREelement
95      *
96      * @return associated text
97      */
98     public String toString() {
99       return "[sequence=" + sequence
100        + ", fieldId=" + fieldId
101        + ", direction=" + direction
102        + ", unicityMember=" + unicityMember
103        + "]";
104    }
105  
106  
107    /**
108     *  XML representation of JobORDERelement
109     *
110     * @param doc Description of the Parameter
111     * @return associated XML text
112     */
113    public Element toXml(Document doc) {
114      Element root = doc.createElement("JobORDERelement");
115      root.setAttribute("Id", String.valueOf(sequence));
116  
117      Element node = null;
118  
119      node = doc.createElement("FieldId");
120      node.appendChild(doc.createTextNode(String.valueOf(fieldId)));
121      root.appendChild(node);
122  
123      node = doc.createElement("Direction");
124      node.appendChild(doc.createTextNode(direction));
125      root.appendChild(node);
126  
127      node = doc.createElement("UnicityMember");
128      node.appendChild(doc.createTextNode(unicityMember));
129      root.appendChild(node);
130  
131      return root;
132    }
133  }
134