View Javadoc

1   /*
2    * Copyright (c) 2005 Your Corporation. All Rights Reserved.
3    */
4   package org.bejug.javacareers.jobs.model;
5   
6   import org.apache.commons.lang.builder.CompareToBuilder;
7   import org.apache.commons.lang.builder.EqualsBuilder;
8   import org.apache.commons.lang.builder.HashCodeBuilder;
9   import org.apache.commons.lang.builder.ToStringBuilder;
10  
11  
12  
13  
14  /***
15   * Models an organisation.
16   * An organisation can be an educational institution, the government or a
17   * private company.  The distinction is made through the member
18   * OrganisationType.
19   *
20   * @author Bart Meyers (last modified by $Author: shally $ )
21   * @version $Revision: 1.3 $ - $Date: 2005/12/20 15:36:45 $
22   *
23   */
24  public class Organisation extends AbstractPersistableObject {
25      
26      //members
27  
28      /***
29       * The organisation address.
30       */
31      private Address address = null;
32  
33      /***
34       * Type of organisation.
35       */
36      private OrganisationType organisationType = null;
37      
38      /***
39       * The name of the organisation.
40       */
41      private String name = null;
42     
43      /***
44       * the description of the organisation.
45       */
46      private String description = null;
47  
48      /***
49       * default constructor
50       */
51      public Organisation() {
52          super();
53      }
54      
55      /***
56       * constructor.
57       * @param name the name of the organisation.
58       * @param description the description of the organisation.
59       */
60      public Organisation(String name, String description) {
61          super();
62          this.name = name;
63          this.description = description;
64      }
65      
66      /***
67       * Retrieves the organisation address.
68       * @return The organisation address.
69       */
70      public Address getAddress() {
71          return address;
72      }
73  
74      /***
75       * Sets the address of the organisation.
76       * @param address The organisation address.
77       */
78      public void setAddress(Address address) {
79          this.address = address;
80      }
81  
82  
83      /***
84       * Returns the type of the organisation.
85       * @return The organisation type.
86       */
87      public OrganisationType getOrganisationType() {
88          return organisationType;
89      }
90  
91      /***
92       * Sets the organsation type.
93       * @param organisationType The organisation type.
94       */
95      public void setOrganisationType(OrganisationType organisationType) {
96          this.organisationType = organisationType;
97      }
98      
99      /***
100      * @return the wanted description.
101      */
102     public String getDescription() {
103         return description;
104     }
105     
106     /***
107      * sets the description.
108      * @param description the description.
109      */
110     public void setDescription(String description) {
111         this.description = description;
112     }
113     
114     /***
115      * @return the wanted name.
116      */
117     public String getName() {
118         return name;
119     }
120     
121     /***
122      * sets the name of the organisation.
123      * @param name the name.
124      */
125     public void setName(String name) {
126         this.name = name;
127     }
128     
129     
130     /***
131 	 * {@inheritDoc}
132 	 */
133 	public int compareTo(Object o) {
134 	     Organisation organisation = (Organisation) o;
135 	     return new CompareToBuilder()
136 	       .appendSuper(super.compareTo(o))
137 	       .append(this.address, organisation.getAddress())
138 	       .append(this.organisationType, organisation.getOrganisationType())
139 	       .append(this.description, organisation.getDescription())
140 	       .append(this.name, organisation.getName())
141 	       .toComparison();
142 	}
143 	
144 	/***
145      * {@inheritDoc}
146      */
147     public boolean equals(Object o) {
148     	if (!(o instanceof Organisation)) {
149     	     return false;
150     	   }
151     	   if (this == o) {
152     	     return true;
153     	   }
154     	   Organisation organisation = (Organisation) o;
155     	   return new EqualsBuilder()
156     	   		.appendSuper(super.equals(o))
157     	   		.append(this.address, organisation.getAddress())
158     	   		.append(this.organisationType, organisation.getOrganisationType())
159     	   		.append(this.description, organisation.getDescription())
160     	   		.append(this.name, organisation.getName())
161     	        .isEquals();
162     }
163     
164     
165     /***
166      * {@inheritDoc}
167      */
168     public int hashCode() {
169         return new HashCodeBuilder(719, 71)
170         	.append(this.address)
171         	.append(this.description)
172         	.append(this.name)
173         	.append(this.organisationType)
174         	.toHashCode();
175     }
176     
177     
178     /***
179      * {@inheritDoc}
180      */
181     public String toString() {
182     	return new ToStringBuilder(this)
183     		.appendSuper(super.toString())
184     		.append("name", this.name)
185     		.append("description", this.description)
186     		.append("organisationType", this.organisationType)
187     		.append("address", this.address)
188     		.toString();
189     }
190 }
191 /***
192  * $Log: Organisation.java,v $
193  * Revision 1.3  2005/12/20 15:36:45  shally
194  * CheckStyle and PMD changes.
195  *
196  * Revision 1.2  2005/08/31 12:15:09  bme_jcs
197  * refactoring and introduction of apache builders
198  *
199  * Revision 1.1  2005/08/26 07:58:26  ge0ffrey
200  * split up the sources in service, serviceimpl and webclient
201  *
202  * Revision 1.2  2005/06/09 08:18:52  bejug_cc
203  * Fix initial import
204  *
205  * Revision 1.6  2005/05/10 13:55:52  bme
206  * bug resolved: this is not a parameter
207  *
208  * Revision 1.5  2005/05/09 13:42:10  ssc
209  * checkstyle
210  *
211  * Revision 1.4  2005/04/29 12:21:05  bme
212  * updated for parameter-functionality
213  *
214  * Revision 1.2  2005/04/25 13:25:57  ssc
215  * Add ParameterizedObject
216  *
217  * Revision 1.1  2005/04/19 11:51:22  PSONG09
218  * First release
219  *
220  * Revision 1.2  2005/04/18 18:54:14  sja
221  * Added CVS class header tags and javadoc.
222  *
223  */