Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
18   145   15   1.38
4   59   0.83   13
13     1.15  
1    
 
 
  IssueActivity       Line # 36 18 15 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   
23    /**
24    * An issue activity.
25    *
26    * <p>
27    * An IssueActivity can only belong to 1 Issue (composition).
28    * </p>
29    *
30    * <p>
31    * The natural key of an IssueActivity is issue + user + type + createDate.
32    * </p>
33    *
34    * @author ready
35    */
 
36    public class IssueActivity extends AbstractEntity {
37   
38    /**
39    *
40    */
41    private static final long serialVersionUID = 1L;
42   
43    /** Issue to which this activity is related. */
44    private Issue issue;
45   
46    /** The User who generated this activity. */
47    private User user;
48   
49    /** Optional activity description. */
50    private String description = "";
51   
52    /**
53    * Whether a notification has been sent for this activity.
54    */
55    private boolean notificationSent = false;
56   
57    private IssueActivityType activityType = IssueActivityType.ISSUE_CREATED;
58   
59    /**
60    * Default constructor (required by Hibernate).
61    *
62    * <p>
63    * PENDING: should be <code>private</code> so that it can only be used by
64    * Hibernate, to ensure that <code>issue</code>, <code>user</code> and
65    * <code>type</code>, which form an instance's identity, are always
66    * initialized.
67    * </p>
68    */
 
69  0 toggle public IssueActivity() {
70   
71    }
72   
73    /**
74    * Creates a new instance with a <code>notificationSent</code> flag set to
75    * <tt>false</tt> and a creation and last modified time stamp set to the
76    * current time.
77    *
78    * @param issue
79    * @param user
80    * @param type
81    * @param description
82    */
 
83  0 toggle public IssueActivity(Issue issue, User user, IssueActivityType type) {
84  0 setIssue(issue);
85  0 setUser(user);
86  0 setActivityType(type);
87    }
88   
 
89  0 toggle public Issue getIssue() {
90  0 return issue;
91    }
92   
 
93  0 toggle public void setIssue(Issue issue) {
94  0 if (issue == null) {
95  0 throw new IllegalArgumentException("null issue");
96    }
97  0 this.issue = issue;
98    }
99   
 
100  0 toggle public User getUser() {
101  0 return user;
102    }
103   
 
104  0 toggle public void setUser(User user) {
105  0 if (user == null) {
106  0 throw new IllegalArgumentException("null user");
107    }
108  0 this.user = user;
109    }
110   
 
111  0 toggle public void setActivityType(IssueActivityType type) {
112   
113    // this.type = type.code;
114  0 this.activityType = type;
115    }
116   
 
117  0 toggle public IssueActivityType getActivityType() {
118  0 return this.activityType;
119    }
120   
 
121  0 toggle public String getDescription() {
122  0 return description;
123    }
124   
 
125  0 toggle public void setDescription(String description) {
126  0 this.description = description;
127    }
128   
 
129  0 toggle public boolean getNotificationSent() {
130  0 return notificationSent;
131    }
132   
 
133  0 toggle public void setNotificationSent(boolean sent) {
134  0 this.notificationSent = sent;
135    }
136   
 
137  0 toggle public String toString() {
138  0 return new ToStringBuilder(this).append("id", getId())
139    .append("issue", getIssue()).append("user", getUser()).append("type",
140    getActivityType()).append("createDate", getCreateDate())
141    .toString();
142   
143    }
144   
145    }