View Javadoc

1   /*
2   * Copyright 2005 Arnaud Prost
3   * 
4   * Arnaud.prost@gmail.com
5   * 
6   * This software is a computer program whose purpose is to ease the 
7   * management of software project.
8   * 
9   * This software is governed by the CeCILL  license under French law and
10  * abiding by the rules of distribution of free software.  You can  use, 
11  * modify and/ or redistribute the software under the terms of the CeCILL
12  * license as circulated by CEA, CNRS and INRIA at the following URL
13  * "http://www.cecill.info". 
14  * 
15  * As a counterpart to the access to the source code and  rights to copy,
16  * modify and redistribute granted by the license, users are provided only
17  * with a limited warranty  and the software's author,  the holder of the
18  * economic rights,  and the successive licensors  have only  limited
19  * liability. 
20  * 
21  * In this respect, the user's attention is drawn to the risks associated
22  * with loading,  using,  modifying and/or developing or reproducing the
23  * software by the user in light of its specific status of free software,
24  * that may mean  that it is complicated to manipulate,  and  that  also
25  * therefore means  that it is reserved for developers  and  experienced
26  * professionals having in-depth computer knowledge. Users are therefore
27  * encouraged to load and test the software's suitability as regards their
28  * requirements in conditions enabling the security of their systems and/or 
29  * data to be ensured and,  more generally, to use and operate it in the 
30  * same conditions as regards security. 
31  * 
32  * The fact that you are presently reading this means that you have had
33  * knowledge of the CeCILL license and that you accept its terms.
34  */
35  
36  
37  package net.sf.pmr.core.domain.user.company;
38  
39  import net.sf.pmr.keopsframework.domain.object.AbstractDomainObject;
40  
41  import org.apache.commons.lang.builder.EqualsBuilder;
42  import org.apache.commons.lang.builder.HashCodeBuilder;
43  
44  /***
45   * @author Arnaud Prost (arnaud.prost@gmail.com)
46   */
47  public class CompanyImpl extends AbstractDomainObject implements Company {
48  
49      private String name;
50  
51      private Address address;
52  
53      /*
54       * (non-Javadoc)
55       *
56       * @see net.sf.pmr.core.domain.user.Company#getCompanyName()
57       */
58      public String getName() {
59          return name;
60      }
61  
62      /*
63       * (non-Javadoc)
64       *
65       * @see net.sf.pmr.core.domain.user.Company#setCompanyName(java.lang.String)
66       */
67      public void setName(final String companyName) {
68          this.name = companyName;
69  
70      }
71  
72      /*
73       * (non-Javadoc)
74       *
75       * @see net.sf.pmr.core.domain.user.Company#GetAddress()
76       */
77      public Address getAddress() {
78          return address;
79      }
80  
81      /*
82       * (non-Javadoc)
83       *
84       * @see net.sf.pmr.core.domain.user.Company#SetAddress(net.sf.pmr.core.domain.user.Address)
85       */
86      public void setAddress(final Address address) {
87          this.address = address;
88      }
89  
90      /***
91       * @see java.lang.Object#equals(Object)
92       */
93      public boolean equals(final Object object) {
94          if (!(object instanceof CompanyImpl)) {
95              return false;
96          }
97          CompanyImpl rhs = (CompanyImpl) object;
98          return new EqualsBuilder().append(this.name, rhs.name)
99                  .append(this.getPersistanceId(), rhs.getPersistanceId()).isEquals();
100     }
101 
102     /***
103      * @see java.lang.Object#hashCode()
104      */
105     public int hashCode() {
106         return new HashCodeBuilder(-1896230795, 128359325).append(
107                 this.name).append(this.getPersistanceId()).toHashCode();
108     }
109 }