| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 15 |
Complexity Density: 0.56 |
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0
|
public String getFormat() {... |
| 43 |
0
|
return format; |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public void setFormat(String value) {... |
| 47 |
0
|
format = value; |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 50 |
0
|
public Issue getIssue() {... |
| 51 |
0
|
return issue; |
| 52 |
|
} |
| 53 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 54 |
0
|
public void setIssue(Issue value) {... |
| 55 |
0
|
issue = value; |
| 56 |
|
} |
| 57 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 58 |
0
|
public String getEmptyKey() {... |
| 59 |
0
|
return emptyKey; |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
0
|
public void setEmptyKey(String value) {... |
| 63 |
0
|
emptyKey = value; |
| 64 |
|
} |
| 65 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
0
|
public int doStartTag() throws JspException {... |
| 67 |
0
|
return SKIP_BODY; |
| 68 |
|
} |
| 69 |
|
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.4 |
|
| 70 |
0
|
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 |
|
|
| 95 |
0
|
TagUtils.getInstance().write(pageContext, value); |
| 96 |
0
|
clearState(); |
| 97 |
0
|
return EVAL_PAGE; |
| 98 |
|
} |
| 99 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 100 |
0
|
public void release() {... |
| 101 |
0
|
super.release(); |
| 102 |
0
|
clearState(); |
| 103 |
|
} |
| 104 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 105 |
0
|
private void clearState() {... |
| 106 |
0
|
emptyKey = "itracker.web.generic.unassigned"; |
| 107 |
0
|
format = null; |
| 108 |
0
|
issue = null; |
| 109 |
|
} |
| 110 |
|
} |