Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
27   110   15   2.7
8   70   0.56   10
10     1.5  
1    
 
 
  FormatIssueOwnerTag       Line # 33 27 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.web.taglib;
20   
21    import java.util.Locale;
22   
23    import javax.servlet.http.HttpSession;
24    import javax.servlet.jsp.JspException;
25    import javax.servlet.jsp.tagext.TagSupport;
26   
27    import org.apache.struts.taglib.TagUtils;
28    import org.itracker.core.resources.ITrackerResources;
29    import org.itracker.model.Issue;
30    import org.itracker.web.util.Constants;
31   
32   
 
33    public class FormatIssueOwnerTag extends TagSupport {
34    /**
35    *
36    */
37    private static final long serialVersionUID = 1L;
38    private String emptyKey = "itracker.web.generic.unassigned";
39    private String format;
40    private Issue issue;
41   
 
42  0 toggle public String getFormat() {
43  0 return format;
44    }
45   
 
46  0 toggle public void setFormat(String value) {
47  0 format = value;
48    }
49   
 
50  0 toggle public Issue getIssue() {
51  0 return issue;
52    }
53   
 
54  0 toggle public void setIssue(Issue value) {
55  0 issue = value;
56    }
57   
 
58  0 toggle public String getEmptyKey() {
59  0 return emptyKey;
60    }
61   
 
62  0 toggle public void setEmptyKey(String value) {
63  0 emptyKey = value;
64    }
65   
 
66  0 toggle public int doStartTag() throws JspException {
67  0 return SKIP_BODY;
68    }
69   
 
70  0 toggle public int doEndTag() throws JspException {
71  0 String value = "";
72  0 Locale locale = null;
73   
74  0 HttpSession session = pageContext.getSession();
75  0 if(session != null) {
76  0 locale = (Locale) session.getAttribute(Constants.LOCALE_KEY);
77    }
78   
79  0 if(issue == null || issue.getOwner() == null) {
80  0 value = ITrackerResources.getString(emptyKey, locale);
81    } else {
82  0 try {
83  0 if("short".equalsIgnoreCase(format)) {
84  0 value = (issue.getOwner().getFirstName().length() > 0 ? issue.getOwner().getFirstName().substring(0,1).toUpperCase() + "." : "") +
85    " " + issue.getOwner().getLastName();
86    } else {
87  0 value = issue.getOwner().getFirstName() + " " + issue.getOwner().getLastName();
88    }
89    } catch(Exception e) {
90  0 value = ITrackerResources.getString(emptyKey, locale);
91    }
92    }
93   
94    // ResponseUtils.write(pageContext, value);
95  0 TagUtils.getInstance().write(pageContext, value);
96  0 clearState();
97  0 return EVAL_PAGE;
98    }
99   
 
100  0 toggle public void release() {
101  0 super.release();
102  0 clearState();
103    }
104   
 
105  0 toggle private void clearState() {
106  0 emptyKey = "itracker.web.generic.unassigned";
107  0 format = null;
108  0 issue = null;
109    }
110    }