| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.web.forms; |
| 20 |
|
|
| 21 |
|
import java.util.HashMap; |
| 22 |
|
|
| 23 |
|
import javax.servlet.http.HttpServletRequest; |
| 24 |
|
|
| 25 |
|
import org.apache.struts.action.ActionErrors; |
| 26 |
|
import org.apache.struts.action.ActionMapping; |
| 27 |
|
import org.apache.struts.action.ActionMessage; |
| 28 |
|
import org.apache.struts.action.ActionMessages; |
| 29 |
|
import org.apache.struts.validator.ValidatorForm; |
| 30 |
|
import org.itracker.core.resources.ITrackerResources; |
| 31 |
|
import org.itracker.web.util.LoginUtilities; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@author |
| 37 |
|
|
| 38 |
|
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 15 |
Complexity Density: 1 |
|
| 39 |
|
public class CustomFieldValueForm extends ValidatorForm { |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
private static final long serialVersionUID = 1L; |
| 44 |
|
private String action; |
| 45 |
|
|
| 46 |
|
private Integer id; |
| 47 |
|
|
| 48 |
|
private String value; |
| 49 |
|
private Integer sortOrder; |
| 50 |
|
|
| 51 |
|
private HashMap<String, String> translations = new HashMap<String, String>(); |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 55 |
0
|
public String getAction() {... |
| 56 |
0
|
return action; |
| 57 |
|
} |
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 59 |
0
|
public void setAction(String action) {... |
| 60 |
0
|
this.action = action; |
| 61 |
|
} |
| 62 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 63 |
0
|
public Integer getId() {... |
| 64 |
0
|
return id; |
| 65 |
|
} |
| 66 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 67 |
0
|
public void setId(Integer id) {... |
| 68 |
0
|
this.id = id; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 72 |
0
|
public HashMap<String, String> getTranslations() {... |
| 73 |
0
|
return translations; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 77 |
0
|
public void setTranslations(HashMap<String, String> translations) {... |
| 78 |
0
|
this.translations = translations; |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
@return |
| 84 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 85 |
0
|
private String getBaseTranslation() {... |
| 86 |
0
|
return translations.get(ITrackerResources.BASE_LOCALE); |
| 87 |
|
} |
| 88 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 89 |
0
|
public String getValue() {... |
| 90 |
0
|
return value; |
| 91 |
|
} |
| 92 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 93 |
0
|
public void setValue(String value) {... |
| 94 |
0
|
this.value = value; |
| 95 |
|
} |
| 96 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 97 |
0
|
public void reset(ActionMapping mapping, HttpServletRequest request) {... |
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 101 |
0
|
public void setSortOrder(Integer sortOrder) {... |
| 102 |
0
|
this.sortOrder = sortOrder; |
| 103 |
|
} |
| 104 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 105 |
0
|
public Integer getSortOrder() {... |
| 106 |
0
|
return sortOrder; |
| 107 |
|
} |
| 108 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 109 |
0
|
public ActionErrors validate(ActionMapping mapping,... |
| 110 |
|
HttpServletRequest request) { |
| 111 |
0
|
ActionErrors errors = super.validate(mapping, request); |
| 112 |
|
|
| 113 |
|
|
| 114 |
0
|
if (null == getBaseTranslation() || "".equals(getBaseTranslation().trim())) { |
| 115 |
0
|
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.validate.required", |
| 116 |
|
ITrackerResources.getString("itracker.web.attr.baselocale", LoginUtilities.getCurrentLocale(request)))); |
| 117 |
|
} |
| 118 |
0
|
return errors; |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
} |