Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
23   152   21   1.21
2   88   0.91   19
19     1.11  
1    
 
 
  CustomFieldForm       Line # 41 23 21 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.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    * This is the Struts Form. It is used by action.
36    *
37    * @author ready
38    *
39    */
40    @SuppressWarnings("serial")
 
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    // private String base_locale;
50    HashMap<String, String> translations = new HashMap<String, String>();
51   
52   
53    /*
54    * public void reset(ActionMapping mapping, HttpServletRequest request) {
55    * action = null; id = null; fieldType = null; required= null; dateFormat=
56    * null; sortOptionsByName= null; value= null; translations = null;
57    * }
58    */
 
59  0 toggle @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   
 
74  0 toggle @Override
75    public void reset(ActionMapping mapping, HttpServletRequest request) {
76  0 super.reset(mapping, request);
77    }
78   
 
79  0 toggle public String getAction() {
80  0 return action;
81    }
82   
 
83  0 toggle public void setAction(String action) {
84  0 this.action = action;
85    }
86   
 
87  0 toggle public String getDateFormat() {
88  0 return dateFormat;
89    }
90   
 
91  0 toggle public void setDateFormat(String dateFormat) {
92  0 this.dateFormat = dateFormat;
93    }
94   
 
95  0 toggle public Integer getFieldType() {
96  0 return fieldType;
97    }
98   
 
99  0 toggle public void setFieldType(Integer fieldType) {
100  0 this.fieldType = fieldType;
101    }
102   
 
103  0 toggle public Integer getId() {
104  0 return id;
105    }
106   
 
107  0 toggle public void setId(Integer id) {
108  0 this.id = id;
109    }
110   
 
111  0 toggle public String getRequired() {
112  0 return required;
113    }
114   
 
115  0 toggle public void setRequired(String required) {
116  0 this.required = required;
117    }
118   
 
119  0 toggle public String getSortOptionsByName() {
120  0 return sortOptionsByName;
121    }
122   
 
123  0 toggle public void setSortOptionsByName(String sortOptionsByName) {
124  0 this.sortOptionsByName = sortOptionsByName;
125    }
126   
 
127  0 toggle public HashMap<String, String> getTranslations() {
128  0 return translations;
129    }
130   
 
131  0 toggle public void setTranslations(HashMap<String, String> translations) {
132  0 this.translations = translations;
133    }
134   
 
135  0 toggle public String getValue() {
136  0 return value;
137    }
138   
 
139  0 toggle public void setValue(String value) {
140  0 this.value = value;
141    }
142   
143    /**
144    * get localization in base locale
145    * @return
146    */
 
147  0 toggle private String getBaseTranslation() {
148  0 return translations.get(ITrackerResources.BASE_LOCALE);
149    }
150   
151   
152    }