| 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.net.MalformedURLException; |
| 22 |
|
import java.util.Locale; |
| 23 |
|
|
| 24 |
|
import javax.servlet.http.HttpSession; |
| 25 |
|
import javax.servlet.jsp.JspException; |
| 26 |
|
import javax.servlet.jsp.tagext.BodyTagSupport; |
| 27 |
|
|
| 28 |
|
import org.apache.struts.taglib.TagUtils; |
| 29 |
|
import org.itracker.core.resources.ITrackerResources; |
| 30 |
|
import org.itracker.services.util.HTMLUtilities; |
| 31 |
|
import org.itracker.web.util.Constants; |
| 32 |
|
|
| 33 |
|
|
|
|
|
| 0% |
Uncovered Elements: 136 (136) |
Complexity: 39 |
Complexity Density: 0.51 |
|
| 34 |
|
public final class FormatLinkTag extends BodyTagSupport { |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
private static final long serialVersionUID = 1L; |
| 39 |
|
|
| 40 |
|
private String text = null; |
| 41 |
|
|
| 42 |
|
private String action = null; |
| 43 |
|
private String forward = null; |
| 44 |
|
private String paramName = null; |
| 45 |
|
private String paramValue = null; |
| 46 |
|
private String titleKey = null; |
| 47 |
|
private String arg0 = null; |
| 48 |
|
private String caller = null; |
| 49 |
|
private String targetAction = null; |
| 50 |
|
private String target = null; |
| 51 |
|
private String styleClass = null; |
| 52 |
|
private String queryString = null; |
| 53 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 54 |
0
|
public String getAction() {... |
| 55 |
0
|
return action; |
| 56 |
|
} |
| 57 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 58 |
0
|
public void setAction(String value) {... |
| 59 |
0
|
action = value; |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
0
|
public String getForward() {... |
| 63 |
0
|
return forward; |
| 64 |
|
} |
| 65 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
0
|
public void setForward(String value) {... |
| 67 |
0
|
forward = value; |
| 68 |
|
} |
| 69 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 70 |
0
|
public String getParamName() {... |
| 71 |
0
|
return paramName; |
| 72 |
|
} |
| 73 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 74 |
0
|
public void setParamName(String value) {... |
| 75 |
0
|
paramName = value; |
| 76 |
|
} |
| 77 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
0
|
public Object getParamValue() {... |
| 79 |
0
|
return paramValue; |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 82 |
0
|
public void setParamValue(Object value) {... |
| 83 |
0
|
paramValue = (value != null ? value.toString() : null); |
| 84 |
|
} |
| 85 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
0
|
public String getQueryString() {... |
| 87 |
0
|
return queryString; |
| 88 |
|
} |
| 89 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 90 |
0
|
public void setQueryString(String value) {... |
| 91 |
0
|
queryString = value; |
| 92 |
|
} |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0
|
public String getTitleKey() {... |
| 95 |
0
|
return titleKey; |
| 96 |
|
} |
| 97 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 98 |
0
|
public void setTitleKey(String value) {... |
| 99 |
0
|
titleKey = value; |
| 100 |
|
} |
| 101 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 102 |
0
|
public Object getArg0() {... |
| 103 |
0
|
return arg0; |
| 104 |
|
} |
| 105 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 106 |
0
|
public void setArg0(Object value) {... |
| 107 |
0
|
arg0 = (value != null ? value.toString() : null); |
| 108 |
|
} |
| 109 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 110 |
0
|
public String getCaller() {... |
| 111 |
0
|
return caller; |
| 112 |
|
} |
| 113 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 114 |
0
|
public void setCaller(String value) {... |
| 115 |
0
|
caller = value; |
| 116 |
|
} |
| 117 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 118 |
0
|
public String getTargetAction() {... |
| 119 |
0
|
return targetAction; |
| 120 |
|
} |
| 121 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 122 |
0
|
public void setTargetAction(String value) {... |
| 123 |
0
|
targetAction = value; |
| 124 |
|
} |
| 125 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 126 |
0
|
public String getTarget() {... |
| 127 |
0
|
return target; |
| 128 |
|
} |
| 129 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 130 |
0
|
public void setTarget(String value) {... |
| 131 |
0
|
target = value; |
| 132 |
|
} |
| 133 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 134 |
0
|
public String getStyleClass() {... |
| 135 |
0
|
return styleClass; |
| 136 |
|
} |
| 137 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 138 |
0
|
public void setStyleClass(String value) {... |
| 139 |
0
|
styleClass = value; |
| 140 |
|
} |
| 141 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 142 |
0
|
public int doStartTag() throws JspException {... |
| 143 |
0
|
text = null; |
| 144 |
0
|
return EVAL_BODY_BUFFERED; |
| 145 |
|
} |
| 146 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 147 |
0
|
public int doAfterBody() throws JspException {... |
| 148 |
0
|
if(bodyContent != null) { |
| 149 |
0
|
String value = bodyContent.getString().trim(); |
| 150 |
0
|
if(value.length() > 0) { |
| 151 |
0
|
text = value; |
| 152 |
|
} |
| 153 |
|
} |
| 154 |
0
|
return SKIP_BODY; |
| 155 |
|
} |
| 156 |
|
|
|
|
|
| 0% |
Uncovered Elements: 58 (58) |
Complexity: 11 |
Complexity Density: 0.32 |
|
| 157 |
0
|
public int doEndTag() throws JspException {... |
| 158 |
0
|
boolean hasParams = false; |
| 159 |
0
|
Locale locale = null; |
| 160 |
|
|
| 161 |
0
|
HttpSession session = pageContext.getSession(); |
| 162 |
0
|
if(session != null) { |
| 163 |
0
|
locale = (Locale) session.getAttribute(Constants.LOCALE_KEY); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
0
|
StringBuffer buf = new StringBuffer("<a href=\""); |
| 167 |
0
|
try { |
| 168 |
0
|
buf.append(TagUtils.getInstance().computeURL(pageContext, forward, null, null, action, null, null, null, false)); |
| 169 |
|
} catch(MalformedURLException murle) { |
| 170 |
0
|
buf.append(HTMLUtilities.escapeTags(forward)); |
| 171 |
|
} |
| 172 |
0
|
if(queryString != null) { |
| 173 |
0
|
buf.append("?" + HTMLUtilities.escapeTags(queryString)); |
| 174 |
0
|
hasParams = true; |
| 175 |
|
} |
| 176 |
0
|
if(paramName != null && paramValue != null) { |
| 177 |
0
|
buf.append((hasParams ? "&" : "?") + paramName + "=" + paramValue); |
| 178 |
0
|
hasParams = true; |
| 179 |
|
} |
| 180 |
0
|
if(caller != null) { |
| 181 |
0
|
buf.append((hasParams ? "&" : "?") + "caller=" + HTMLUtilities.escapeTags(caller)); |
| 182 |
0
|
hasParams = true; |
| 183 |
|
} |
| 184 |
0
|
if(targetAction != null) { |
| 185 |
0
|
buf.append((hasParams ? "&" : "?") + "action=" + HTMLUtilities.escapeTags(targetAction)); |
| 186 |
0
|
hasParams = true; |
| 187 |
|
} |
| 188 |
0
|
buf.append("\""); |
| 189 |
0
|
if(target != null) { |
| 190 |
0
|
buf.append(" target=\"" + HTMLUtilities.escapeTags(target) + "\""); |
| 191 |
|
} |
| 192 |
0
|
if(titleKey != null) { |
| 193 |
0
|
buf.append(" title=\"" + HTMLUtilities.escapeTags(ITrackerResources.getString(titleKey, locale, (arg0 == null ? "" : arg0))) + "\""); |
| 194 |
|
} |
| 195 |
0
|
if(styleClass != null) { |
| 196 |
0
|
buf.append(" class=\"" + HTMLUtilities.escapeTags(styleClass) + "\""); |
| 197 |
|
} |
| 198 |
0
|
buf.append(">"); |
| 199 |
0
|
buf.append(HTMLUtilities.escapeTags(text)); |
| 200 |
0
|
buf.append("</a>"); |
| 201 |
|
|
| 202 |
0
|
TagUtils.getInstance().write(pageContext, buf.toString()); |
| 203 |
0
|
clearState(); |
| 204 |
0
|
return (EVAL_PAGE); |
| 205 |
|
} |
| 206 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 207 |
0
|
public void release() {... |
| 208 |
0
|
super.release(); |
| 209 |
0
|
clearState(); |
| 210 |
|
} |
| 211 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
| 212 |
0
|
private void clearState() {... |
| 213 |
0
|
text = null; |
| 214 |
0
|
action = null; |
| 215 |
0
|
forward = null; |
| 216 |
0
|
paramName = null; |
| 217 |
0
|
paramValue = null; |
| 218 |
0
|
titleKey = null; |
| 219 |
0
|
arg0 = null; |
| 220 |
0
|
caller = null; |
| 221 |
0
|
target = null; |
| 222 |
0
|
targetAction = null; |
| 223 |
0
|
styleClass = null; |
| 224 |
0
|
queryString = null; |
| 225 |
|
} |
| 226 |
|
} |