NIHVIVO-2158 Add generic info to some of the structures in EditProcessObject. Use interfaces in method signatures instead of concrete implementations.
This commit is contained in:
parent
f246cfe0cc
commit
4d413bc451
4 changed files with 24 additions and 21 deletions
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
||||
import edu.cornell.mannlib.vedit.validator.Validator;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import java.lang.reflect.Method;
|
||||
import java.io.Serializable;
|
||||
|
@ -24,10 +25,10 @@ public class EditProcessObject implements Serializable {
|
|||
private Object beanMask = null;
|
||||
private List simpleMask = new LinkedList();
|
||||
|
||||
private HashMap validatorMap = new HashMap();
|
||||
private HashMap errMsgMap = new HashMap();
|
||||
private Map<String, List<Validator>> validatorMap = new HashMap<String, List<Validator>>();
|
||||
private Map<String, String> errMsgMap = new HashMap<String, String>();
|
||||
|
||||
private HashMap defaultValueMap = new HashMap();
|
||||
private Map<String, String> defaultValueMap = new HashMap<String, String>();
|
||||
|
||||
private List preProcessorList = new LinkedList();
|
||||
private List changeListenerList = new LinkedList();
|
||||
|
@ -58,9 +59,9 @@ public class EditProcessObject implements Serializable {
|
|||
|
||||
private Map requestParameterMap = null;
|
||||
|
||||
private HashMap badValueMap = new HashMap();
|
||||
private Map<String, String> badValueMap = new HashMap<String, String>();
|
||||
|
||||
private HashMap<String,Object> attributeMap = new HashMap<String,Object>();
|
||||
private Map<String,Object> attributeMap = new HashMap<String, Object>();
|
||||
|
||||
private Method getMethod = null;
|
||||
//assumed to take an integer primary key argument, at least for now
|
||||
|
@ -272,39 +273,39 @@ public class EditProcessObject implements Serializable {
|
|||
this.getMethod = getMethod;
|
||||
}
|
||||
|
||||
public HashMap getDefaultValueMap() {
|
||||
public Map<String, String> getDefaultValueMap() {
|
||||
return defaultValueMap;
|
||||
}
|
||||
|
||||
public void setDefaultValueMap(HashMap dvh) {
|
||||
public void setDefaultValueMap(Map<String, String> dvh) {
|
||||
this.defaultValueMap = dvh;
|
||||
}
|
||||
|
||||
public HashMap getValidatorMap(){
|
||||
public Map<String, List<Validator>> getValidatorMap(){
|
||||
return validatorMap;
|
||||
}
|
||||
|
||||
public void setValidatorMap(HashMap validatorMap){
|
||||
public void setValidatorMap(Map<String, List<Validator>> validatorMap){
|
||||
this.validatorMap = validatorMap;
|
||||
}
|
||||
|
||||
public HashMap getErrMsgMap() {
|
||||
public Map<String, String> getErrMsgMap() {
|
||||
return errMsgMap;
|
||||
}
|
||||
|
||||
public void setErrMsgMap(HashMap emh){
|
||||
public void setErrMsgMap(Map<String, String> emh){
|
||||
errMsgMap = emh;
|
||||
}
|
||||
|
||||
public HashMap getBadValueMap() {
|
||||
public Map<String, String> getBadValueMap() {
|
||||
return badValueMap;
|
||||
}
|
||||
|
||||
public void setBadValueMap(HashMap bvh){
|
||||
public void setBadValueMap(Map<String, String> bvh){
|
||||
badValueMap = bvh;
|
||||
}
|
||||
|
||||
public Map getAttributeMap() {
|
||||
public Map<String, Object> getAttributeMap() {
|
||||
return this.attributeMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,14 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FormObject implements Serializable {
|
||||
|
||||
private HashMap<String, String> values = new HashMap<String, String>();
|
||||
private HashMap<String, List<Option>> optionLists = new HashMap<String, List<Option>>();
|
||||
private HashMap<String, List<Checkbox>> checkboxLists = new HashMap<String, List<Checkbox>>();
|
||||
private HashMap<String, String> errorMap = new HashMap<String, String>();
|
||||
private Map<String, String> errorMap = new HashMap<String, String>();
|
||||
private List<DynamicField> dynamicFields = new ArrayList<DynamicField>();
|
||||
|
||||
public HashMap<String, String> getValues(){
|
||||
|
@ -43,11 +44,11 @@ public class FormObject implements Serializable {
|
|||
return checkboxLists;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getErrorMap(){
|
||||
public Map<String, String> getErrorMap(){
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public void setErrorMap(HashMap<String, String> errorMap){
|
||||
public void setErrorMap(Map<String, String> errorMap){
|
||||
this.errorMap = errorMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Enumeration;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -278,9 +279,9 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
if (fieldValid){
|
||||
if (currValue.length()==0) {
|
||||
HashMap defaultHash = epo.getDefaultValueMap();
|
||||
Map<String, String> defaultHash = epo.getDefaultValueMap();
|
||||
try {
|
||||
String defaultValue = (String)defaultHash.get(currParam);
|
||||
String defaultValue = defaultHash.get(currParam);
|
||||
if (defaultValue != null)
|
||||
currValue=defaultValue;
|
||||
} catch (Exception e) {}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class FormUtils {
|
|||
return htmlFormFromBean(bean,action,null,foo,new HashMap());
|
||||
}
|
||||
|
||||
public static String htmlFormFromBean (Object bean, String action, FormObject foo, HashMap badValuesHash) {
|
||||
public static String htmlFormFromBean (Object bean, String action, FormObject foo, Map<String, String> badValuesHash) {
|
||||
return htmlFormFromBean(bean,action,null,foo,badValuesHash);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class FormUtils {
|
|||
* @return XHTML markup of an editing form for the specified class
|
||||
* @author bjl23
|
||||
*/
|
||||
public static String htmlFormFromBean (Object bean, String action, EditProcessObject epo, FormObject foo, HashMap BadValuesHash) {
|
||||
public static String htmlFormFromBean (Object bean, String action, EditProcessObject epo, FormObject foo, Map<String, String> BadValuesHash) {
|
||||
|
||||
String formMarkup = "";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue