| 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.actions.admin.configuration.EditCustomFieldActionUtil; |
| 32 |
|
import org.itracker.web.util.LoginUtilities; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
@author |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
@SuppressWarnings("serial") |
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 21 |
Complexity Density: 0.91 |
|
| 41 |
|
public class CustomFieldForm extends ValidatorForm { |
| 42 |
|
String action = null; |
| 43 |
|
Integer id = null; |
| 44 |
|
Integer fieldType = null; |
| 45 |
|
String required = null; |
| 46 |
|
String dateFormat = null; |
| 47 |
|
String sortOptionsByName = null; |
| 48 |
|
String value = null; |
| 49 |
|
|
| 50 |
|
HashMap<String, String> translations = new HashMap<String, String>(); |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 59 |
0
|
@Override... |
| 60 |
|
public ActionErrors validate(ActionMapping mapping, |
| 61 |
|
HttpServletRequest request) { |
| 62 |
0
|
ActionErrors errors = super.validate(mapping, request); |
| 63 |
|
|
| 64 |
0
|
if (null == getBaseTranslation() || "".equals(getBaseTranslation().trim())) { |
| 65 |
0
|
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.validate.required", |
| 66 |
|
ITrackerResources.getString("itracker.web.attr.baselocale", LoginUtilities.getCurrentLocale(request)))); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
0
|
EditCustomFieldActionUtil.setRequestEnv(request, this); |
| 70 |
0
|
return errors; |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 74 |
0
|
@Override... |
| 75 |
|
public void reset(ActionMapping mapping, HttpServletRequest request) { |
| 76 |
0
|
super.reset(mapping, request); |
| 77 |
|
} |
| 78 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 79 |
0
|
public String getAction() {... |
| 80 |
0
|
return action; |
| 81 |
|
} |
| 82 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 83 |
0
|
public void setAction(String action) {... |
| 84 |
0
|
this.action = action; |
| 85 |
|
} |
| 86 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 87 |
0
|
public String getDateFormat() {... |
| 88 |
0
|
return dateFormat; |
| 89 |
|
} |
| 90 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 91 |
0
|
public void setDateFormat(String dateFormat) {... |
| 92 |
0
|
this.dateFormat = dateFormat; |
| 93 |
|
} |
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 95 |
0
|
public Integer getFieldType() {... |
| 96 |
0
|
return fieldType; |
| 97 |
|
} |
| 98 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
0
|
public void setFieldType(Integer fieldType) {... |
| 100 |
0
|
this.fieldType = fieldType; |
| 101 |
|
} |
| 102 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 103 |
0
|
public Integer getId() {... |
| 104 |
0
|
return id; |
| 105 |
|
} |
| 106 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 107 |
0
|
public void setId(Integer id) {... |
| 108 |
0
|
this.id = id; |
| 109 |
|
} |
| 110 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
0
|
public String getRequired() {... |
| 112 |
0
|
return required; |
| 113 |
|
} |
| 114 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 115 |
0
|
public void setRequired(String required) {... |
| 116 |
0
|
this.required = required; |
| 117 |
|
} |
| 118 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 119 |
0
|
public String getSortOptionsByName() {... |
| 120 |
0
|
return sortOptionsByName; |
| 121 |
|
} |
| 122 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0
|
public void setSortOptionsByName(String sortOptionsByName) {... |
| 124 |
0
|
this.sortOptionsByName = sortOptionsByName; |
| 125 |
|
} |
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0
|
public HashMap<String, String> getTranslations() {... |
| 128 |
0
|
return translations; |
| 129 |
|
} |
| 130 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
0
|
public void setTranslations(HashMap<String, String> translations) {... |
| 132 |
0
|
this.translations = translations; |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0
|
public String getValue() {... |
| 136 |
0
|
return value; |
| 137 |
|
} |
| 138 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
0
|
public void setValue(String value) {... |
| 140 |
0
|
this.value = value; |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
@return |
| 146 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 147 |
0
|
private String getBaseTranslation() {... |
| 148 |
0
|
return translations.get(ITrackerResources.BASE_LOCALE); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
|
| 152 |
|
} |