Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
21   140   15   1.62
4   69   0.71   6.5
13     1.15  
2    
 
 
  IssueHistory       Line # 37 20 14 25% 0.25
  IssueHistory.Status       Line # 125 1 1 0% 0.0
 
No Tests
 
1    /*
2    * This software was designed and created by Jason Carroll.
3    * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4    * The author can be reached at jcarroll@cowsultants.com
5    * ITracker website: http://www.cowsultants.com
6    * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7    *
8    * This program is free software; you can redistribute it and/or modify
9    * it only under the terms of the GNU General Public License as published by
10    * the Free Software Foundation; either version 2 of the License, or
11    * (at your option) any later version.
12    *
13    * This program is distributed in the hope that it will be useful,
14    * but WITHOUT ANY WARRANTY; without even the implied warranty of
15    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16    * GNU General Public License for more details.
17    */
18   
19    package org.itracker.model;
20   
21    import org.apache.commons.lang.builder.ToStringBuilder;
22    import org.itracker.services.util.IssueUtilities;
23   
24    /**
25    * An issue history entry.
26    *
27    * <p>
28    * An IssueHistory can only belong to 1 Issue (composition).
29    * </p>
30    *
31    * <p>
32    * PENDING : what's the difference with an IssueActivity ?
33    * </p>
34    *
35    * @author ready
36    */
 
37    public class IssueHistory extends AbstractEntity {
38   
39    /**
40    *
41    */
42    private static final long serialVersionUID = 1L;
43   
44    private Issue issue;
45   
46    private String description;
47   
48    private int status;
49   
50    /** The User who generated this history entry. */
51    private User creator;
52   
53    /**
54    * Default constructor (required by Hibernate).
55    *
56    * <p>
57    * PENDING: should be <code>private</code> so that it can only be used by
58    * Hibernate, to ensure that the fields which form an instance's identity
59    * are always initialized/never <tt>null</tt>.
60    * </p>
61    */
 
62  1 toggle public IssueHistory() {
63    }
64   
 
65  0 toggle public IssueHistory(Issue issue, User creator) {
66  0 setIssue(issue);
67  0 setUser(creator);
68  0 setStatus(IssueUtilities.HISTORY_STATUS_AVAILABLE);
69    }
70   
 
71  0 toggle public IssueHistory(Issue issue, User creator, String description,
72    int status) {
73  0 setIssue(issue);
74  0 setUser(creator);
75  0 setDescription(description);
76  0 setStatus(status);
77    }
78   
 
79  0 toggle public Issue getIssue() {
80  0 return issue;
81    }
82   
 
83  0 toggle public void setIssue(Issue issue) {
84  0 if (issue == null) {
85  0 throw new IllegalArgumentException("null issue");
86    }
87  0 this.issue = issue;
88    }
89   
 
90  0 toggle public User getUser() {
91  0 return creator;
92    }
93   
 
94  1 toggle public void setUser(User creator) {
95  1 if (creator == null) {
96  0 throw new IllegalArgumentException("null creator");
97    }
98  1 this.creator = creator;
99    }
100   
 
101  0 toggle public int getStatus() {
102  0 return status;
103    }
104   
 
105  1 toggle public void setStatus(int status) {
106  1 this.status = status;
107    }
108   
 
109  0 toggle public String getDescription() {
110  0 return description;
111    }
112   
 
113  1 toggle public void setDescription(String description) {
114  1 this.description = description;
115    }
116   
117   
 
118  0 toggle @Override
119    public String toString() {
120  0 return new ToStringBuilder(this).append("id", getId())
121    .append("issue", issue).append("creator", getUser()).append(
122    "createDate", getCreateDate()).toString();
123    }
124   
 
125    public static enum Status {
126   
127    STATUS_REMOVED(-1),
128   
129    STATUS_AVAILABLE(1);
130   
131    @SuppressWarnings("unused")
132    private final int code;
133   
 
134  0 toggle private Status(int code) {
135  0 this.code = code;
136    }
137   
138    }
139   
140    }