1 17 package org.alfresco.repo.action; 18 19 import java.io.Serializable ; 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 import org.alfresco.service.cmr.action.ParameterizedItem; 24 25 30 public abstract class ParameterizedItemImpl implements ParameterizedItem, Serializable 31 { 32 35 private String id; 36 37 40 private Map <String , Serializable > parameterValues = new HashMap <String , Serializable >(); 41 42 47 public ParameterizedItemImpl(String id) 48 { 49 this(id, null); 50 } 51 52 58 public ParameterizedItemImpl(String id, Map <String , Serializable > parameterValues) 59 { 60 this.id = id; 62 63 if (parameterValues != null) 64 { 65 this.parameterValues = parameterValues; 68 } 69 } 70 71 74 public String getId() 75 { 76 return this.id; 77 } 78 79 82 public Map <String , Serializable > getParameterValues() 83 { 84 Map <String , Serializable > result = this.parameterValues; 85 if (result == null) 86 { 87 result = new HashMap <String , Serializable >(); 88 } 89 return result; 90 } 91 92 95 public Serializable getParameterValue(String name) 96 { 97 return this.parameterValues.get(name); 98 } 99 100 103 public void setParameterValues(Map <String , Serializable > parameterValues) 104 { 105 if (parameterValues != null) 106 { 107 this.parameterValues = parameterValues; 110 } 111 } 112 113 116 public void setParameterValue(String name, Serializable value) 117 { 118 this.parameterValues.put(name, value); 119 } 120 121 124 @Override 125 public int hashCode() 126 { 127 return this.id.hashCode(); 128 } 129 130 133 @Override 134 public boolean equals(Object obj) 135 { 136 if (this == obj) 137 { 138 return true; 139 } 140 if (obj instanceof ParameterizedItemImpl) 141 { 142 ParameterizedItemImpl that = (ParameterizedItemImpl) obj; 143 return (this.id.equals(that.id)); 144 } 145 else 146 { 147 return false; 148 } 149 } 150 } 151 | Popular Tags |