Clover Coverage Report - Atlassian Mail
Coverage timestamp: Mon Sep 29 2008 21:26:36 CDT
28   167   16   2
4   125   0.57   14
14     1.14  
1    
 
 
  AbstractMailServer       Line # 21 28 16 100% 1.0
 
  (44)
 
1    /*
2    * Created by IntelliJ IDEA.
3    * User: owen
4    * Date: Nov 22, 2002
5    * Time: 3:33:27 PM
6    * CVS Revision: $Revision: 1.6 $
7    * Last CVS Commit: $Date: 2006/09/29 02:48:01 $
8    * Author of last CVS Commit: $Author: cowen $
9    * To change this template use Options | File Templates.
10    */
11    package com.atlassian.mail.server;
12   
13    import com.opensymphony.util.TextUtils;
14    import org.apache.commons.lang.builder.ToStringBuilder;
15    import org.apache.log4j.Category;
16   
17    import java.io.Serializable;
18    import java.io.ObjectInputStream;
19    import java.io.IOException;
20   
 
21    public abstract class AbstractMailServer implements MailServer, Serializable
22    {
23    protected transient Category LOG = Category.getInstance(this.getClass());
24   
25    private Long id;
26    private String name;
27    private String description;
28    private String hostname;
29    private String username = null;
30    private String password = null;
31   
 
32  13 toggle public AbstractMailServer()
33    {
34    }
35   
 
36  72 toggle public AbstractMailServer(Long id, String name, String description, String hostName, String username, String password)
37    {
38  72 setId(id);
39  72 setName(name);
40  72 setDescription(description);
41  72 setHostname(hostName);
42  72 setUsername(username);
43  72 setPassword(password);
44    }
45   
 
46  12 toggle public Long getId()
47    {
48  12 return id;
49    }
50   
 
51  88 toggle public void setId(Long id)
52    {
53  88 this.id = id;
54  88 propertyChanged();
55    }
56   
 
57  28 toggle public String getName()
58    {
59  28 return name;
60    }
61   
 
62  88 toggle public void setName(String name)
63    {
64  88 this.name = name;
65  88 propertyChanged();
66    }
67   
 
68  24 toggle public String getDescription()
69    {
70  24 return description;
71    }
72   
 
73  79 toggle public void setDescription(String description)
74    {
75  79 this.description = description;
76  79 propertyChanged();
77    }
78   
 
79  43 toggle public String getHostname()
80    {
81  43 return hostname;
82    }
83   
 
84  94 toggle public void setHostname(String serverName)
85    {
86  94 this.hostname = serverName;
87  94 propertyChanged();
88    }
89   
 
90  31 toggle public String getUsername()
91    {
92  31 return username;
93    }
94   
 
95  83 toggle public void setUsername(String username)
96    {
97  83 if (TextUtils.stringSet(username))
98  59 this.username = username;
99    else
100  24 this.username = null;
101  83 propertyChanged();
102    }
103   
 
104  30 toggle public String getPassword()
105    {
106  30 return password;
107    }
108   
 
109  83 toggle public void setPassword(String password)
110    {
111  83 if (TextUtils.stringSet(password))
112  59 this.password = password;
113    else
114  24 this.password = null;
115  83 propertyChanged();
116    }
117   
118    ///CLOVER:OFF
 
119    toggle public boolean equals(Object o)
120    {
121    if (this == o) return true;
122    if (!(o instanceof AbstractMailServer)) return false;
123   
124    final AbstractMailServer abstractMailServer = (AbstractMailServer) o;
125   
126    if (description != null ? !description.equals(abstractMailServer.description) : abstractMailServer.description != null) return false;
127    if (id != null ? !id.equals(abstractMailServer.id) : abstractMailServer.id != null) return false;
128    if (name != null ? !name.equals(abstractMailServer.name) : abstractMailServer.name != null) return false;
129    if (password != null ? !password.equals(abstractMailServer.password) : abstractMailServer.password != null) return false;
130    if (hostname != null ? !hostname.equals(abstractMailServer.hostname) : abstractMailServer.hostname != null) return false;
131    if (username != null ? !username.equals(abstractMailServer.username) : abstractMailServer.username != null) return false;
132   
133    return true;
134    }
135   
 
136    toggle public int hashCode()
137    {
138    int result;
139    result = (id != null ? id.hashCode() : 0);
140    result = 29 * result + (name != null ? name.hashCode() : 0);
141    result = 29 * result + (description != null ? description.hashCode() : 0);
142    result = 29 * result + (hostname != null ? hostname.hashCode() : 0);
143    result = 29 * result + (username != null ? username.hashCode() : 0);
144    result = 29 * result + (password != null ? password.hashCode() : 0);
145    return result;
146    }
147   
 
148    toggle public String toString()
149    {
150    return new ToStringBuilder(this).append("id", id).append("name", name).append("description", description).append("server name", hostname).append("username", username).append("password", password).toString();
151    }
152   
153    /**
154    * Call this method whenever a property of the server changes.
155    * Subclasses should override it to clear any cached information.
156    */
 
157    toggle protected void propertyChanged()
158    {
159   
160    }
161   
 
162    toggle private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
163    {
164    ois.defaultReadObject();
165    LOG = Category.getInstance(this.getClass());
166    }
167    }