Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
15   122   15   1.15
2   62   1   13
13     1.15  
1    
 
 
  CustomFieldValueForm       Line # 39 15 15 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.util.LoginUtilities;
32   
33    /**
34    * This is the LoginForm Struts Form. It is used by Login form.
35    *
36    * @author ready
37    *
38    */
 
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    // let's try to put String,String here:
51    private HashMap<String, String> translations = new HashMap<String, String>();
52   
53    // private Map<String, String> translations;
54   
 
55  0 toggle public String getAction() {
56  0 return action;
57    }
58   
 
59  0 toggle public void setAction(String action) {
60  0 this.action = action;
61    }
62   
 
63  0 toggle public Integer getId() {
64  0 return id;
65    }
66   
 
67  0 toggle public void setId(Integer id) {
68  0 this.id = id;
69    }
70   
71    // let's try to put String,String here:
 
72  0 toggle public HashMap<String, String> getTranslations() {
73  0 return translations;
74    }
75   
76    // let's try to put String,String here:
 
77  0 toggle public void setTranslations(HashMap<String, String> translations) {
78  0 this.translations = translations;
79    }
80   
81    /**
82    * get localization in base locale
83    * @return
84    */
 
85  0 toggle private String getBaseTranslation() {
86  0 return translations.get(ITrackerResources.BASE_LOCALE);
87    }
88   
 
89  0 toggle public String getValue() {
90  0 return value;
91    }
92   
 
93  0 toggle public void setValue(String value) {
94  0 this.value = value;
95    }
96   
 
97  0 toggle public void reset(ActionMapping mapping, HttpServletRequest request) {
98   
99    }
100   
 
101  0 toggle public void setSortOrder(Integer sortOrder) {
102  0 this.sortOrder = sortOrder;
103    }
104   
 
105  0 toggle public Integer getSortOrder() {
106  0 return sortOrder;
107    }
108   
 
109  0 toggle public ActionErrors validate(ActionMapping mapping,
110    HttpServletRequest request) {
111  0 ActionErrors errors = super.validate(mapping, request);
112   
113    // TODO: setup request env for validation output
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    }