KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rentacar > persistance > bo > CentralOfficeVO


1 package org.objectweb.rentacar.persistance.bo;
2
3 import java.util.HashSet JavaDoc;
4 import java.util.Set JavaDoc;
5
6 import org.apache.commons.lang.builder.EqualsBuilder;
7 import org.apache.commons.lang.builder.HashCodeBuilder;
8 import org.apache.commons.lang.builder.ToStringBuilder;
9
10 /**
11  *
12  * @author ofabre
13  *
14  */

15 public class CentralOfficeVO {
16     
17     private String JavaDoc centralOfficeId;
18     
19     private String JavaDoc host;
20     
21     private String JavaDoc port;
22     
23     private Set JavaDoc<String JavaDoc> agencies;
24
25     public CentralOfficeVO() {
26         super();
27         // TODO Auto-generated constructor stub
28
}
29
30     public CentralOfficeVO(Set JavaDoc<String JavaDoc> agencies) {
31         super();
32         this.agencies = agencies;
33     }
34     
35     public CentralOfficeVO(String JavaDoc centralOfficeId, Set JavaDoc<String JavaDoc> agencies) {
36         super();
37         // TODO Auto-generated constructor stub
38
this.centralOfficeId = centralOfficeId;
39         this.agencies = agencies;
40     }
41
42     public CentralOfficeVO(CentralOffice centralOffice) {
43         super();
44         this.centralOfficeId = centralOffice.getCentralOfficeId();
45         Set JavaDoc<String JavaDoc> agencies = new HashSet JavaDoc<String JavaDoc>();
46         for (Agency agency : centralOffice.getAgencies()) {
47             agencies.add(agency.getAgencyId());
48         }
49         this.agencies = agencies;
50         this.host = centralOffice.getHost();
51         this.port = centralOffice.getPort();
52     }
53     
54     public Set JavaDoc<String JavaDoc> getAgencies() {
55         return agencies;
56     }
57
58     public void setAgencies(Set JavaDoc<String JavaDoc> agencies) {
59         this.agencies = agencies;
60     }
61
62     public String JavaDoc getCentralOfficeId() {
63         return centralOfficeId;
64     }
65
66     public void setCentralOfficeId(String JavaDoc centralOfficeId) {
67         this.centralOfficeId = centralOfficeId;
68     }
69
70     public String JavaDoc getHost() {
71         return host;
72     }
73
74     public void setHost(String JavaDoc host) {
75         this.host = host;
76     }
77
78     public String JavaDoc getPort() {
79         return port;
80     }
81
82     public void setPort(String JavaDoc port) {
83         this.port = port;
84     }
85
86     /**
87      * @see java.lang.Object#equals(Object)
88      */

89     public boolean equals(Object JavaDoc object) {
90         if (!(object instanceof CentralOfficeVO)) {
91             return false;
92         }
93         CentralOfficeVO rhs = (CentralOfficeVO) object;
94         return new EqualsBuilder().append(this.centralOfficeId,
95                 rhs.centralOfficeId).append(this.host, rhs.host).append(
96                 this.agencies, rhs.agencies).append(this.port, rhs.port)
97                 .isEquals();
98     }
99
100     /**
101      * @see java.lang.Object#hashCode()
102      */

103     public int hashCode() {
104         return new HashCodeBuilder(-1002924675, -292380135).append(
105                 this.centralOfficeId).append(this.host).append(this.agencies)
106                 .append(this.port).toHashCode();
107     }
108
109     /**
110      * @see java.lang.Object#toString()
111      */

112     public String JavaDoc toString() {
113         return new ToStringBuilder(this).append("centralOfficeId",
114                 this.centralOfficeId).append("agencies", this.agencies).append(
115                 "host", this.host).append("port", this.port).toString();
116     }
117     
118     
119
120 }
121
Popular Tags