1 23 24 package org.infoglue.deliver.applications.databeans; 25 26 import java.net.URLEncoder ; 27 import java.util.ArrayList ; 28 import java.util.List ; 29 30 import org.apache.log4j.Logger; 31 import org.exolab.castor.jdo.Database; 32 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController; 33 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO; 34 import org.infoglue.deliver.util.CacheController; 35 36 39 40 public class ComponentProperty 41 { 42 public final static Logger logger = Logger.getLogger(ComponentProperty.class.getName()); 43 44 public static final String BINDING = "binding"; 45 public static final String TEXTFIELD = "textfield"; 46 public static final String TEXTAREA = "textarea"; 47 public static final String SELECTFIELD = "select"; 48 49 private Integer id; 50 private String name; 51 private String description; 52 private String type; 53 private String [] allowedContentTypeNamesArray = null; 54 private Integer componentId; 55 private String entityClass; 56 private Integer entityId; 57 private String value; 58 private boolean isMultipleBinding = false; 59 private String visualizingAction = null; 60 private String createAction = null; 61 62 private List options = new ArrayList (); 63 64 private List contentBindings = new ArrayList (); 65 private List siteNodeBindings = new ArrayList (); 66 67 68 public Integer getComponentId() 69 { 70 return componentId; 71 } 72 73 public List getContentBindings() 74 { 75 return contentBindings; 76 } 77 78 public String getEntityClass() 79 { 80 return entityClass; 81 } 82 83 public Integer getEntityId() 84 { 85 return entityId; 86 } 87 88 public Integer getId() 89 { 90 return id; 91 } 92 93 public String getName() 94 { 95 return name; 96 } 97 98 public List getSiteNodeBindings() 99 { 100 return siteNodeBindings; 101 } 102 103 public String getValue() 104 { 105 return value; 106 } 107 108 public void setComponentId(Integer integer) 109 { 110 componentId = integer; 111 } 112 113 public void setContentBindings(List list) 114 { 115 contentBindings = list; 116 } 117 118 public void setEntityClass(String string) 119 { 120 entityClass = string; 121 } 122 123 public void setEntityId(Integer integer) 124 { 125 entityId = integer; 126 } 127 128 public void setId(Integer integer) 129 { 130 id = integer; 131 } 132 133 public void setName(String string) 134 { 135 name = string; 136 } 137 138 public String getDescription() 139 { 140 return description; 141 } 142 143 public void setDescription(String description) 144 { 145 this.description = description; 146 } 147 148 public void setSiteNodeBindings(List list) 149 { 150 siteNodeBindings = list; 151 } 152 153 public void setValue(String string) 154 { 155 value = string; 156 } 157 158 public String getType() 159 { 160 return type; 161 } 162 163 public void setType(String string) 164 { 165 type = string; 166 } 167 168 public boolean getIsMultipleBinding() 169 { 170 return this.isMultipleBinding; 171 } 172 173 public void setIsMultipleBinding(boolean isMultipleBinding) 174 { 175 this.isMultipleBinding = isMultipleBinding; 176 } 177 178 public String getVisualizingAction() 179 { 180 return visualizingAction; 181 } 182 183 public void setVisualizingAction(String visualizingAction) 184 { 185 this.visualizingAction = visualizingAction; 186 } 187 188 public String getCreateAction() 189 { 190 return this.createAction; 191 } 192 193 public void setCreateAction(String createAction) 194 { 195 this.createAction = createAction; 196 } 197 198 public String [] getAllowedContentTypeNamesArray() 199 { 200 return allowedContentTypeNamesArray; 201 } 202 203 public void setAllowedContentTypeNamesArray(String [] allowedContentTypeNamesArray) 204 { 205 this.allowedContentTypeNamesArray = allowedContentTypeNamesArray; 206 } 207 208 public String getAllowedContentTypeNamesAsUrlEncodedString() throws Exception 209 { 210 StringBuffer sb = new StringBuffer (); 211 for (int i = 0; i < allowedContentTypeNamesArray.length; i++) 212 { 213 if (i > 0) 214 { 215 sb.append("&"); 216 } 217 218 sb.append("allowedContentTypeNames=" + URLEncoder.encode(allowedContentTypeNamesArray[i], "UTF-8")); 219 } 220 221 return sb.toString(); 222 } 223 224 public String getAllowedContentTypeIdAsUrlEncodedString(Database db) throws Exception 225 { 226 StringBuffer sb = new StringBuffer (); 227 String allowedContentTypeName = null; 228 for (int i = 0; i < allowedContentTypeNamesArray.length; i++) 229 { 230 if (i > 0) 231 { 232 sb.append("&"); 233 } 234 235 allowedContentTypeName = allowedContentTypeNamesArray[i]; 236 ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController() 237 .getContentTypeDefinitionVOWithName(allowedContentTypeName, db); 238 if ( contentTypeDefinitionVO != null ) 239 { 240 sb.append("allowedContentTypeIds=" + contentTypeDefinitionVO.getId()); 241 } 242 else 243 { 244 logger.error("Cant find the ContentTypeDefinition for: " + allowedContentTypeName ); 245 } 246 } 247 return sb.toString(); 248 } 249 250 public List getOptions() 251 { 252 return options; 253 } 254 255 public String toString() 256 { 257 StringBuffer sb = new StringBuffer (); 258 sb.append("id=").append(id) 259 .append(" name=").append(name) 260 .append(" type=").append(type) 261 .append(" componentId=").append(componentId) 262 .append(" entityClass=").append(entityClass) 263 .append(" entityId=").append(entityId) 264 .append(" value=").append(value) 265 .append(" isMultipleBinding=").append(isMultipleBinding) 266 .append(" visualizingAction=").append(visualizingAction) 267 .append(" createAction=").append(createAction) 268 .append(" allowedContentTypeNames=").append(allowedContentTypeNamesArray) 269 .append(" contentBindings.size=").append(contentBindings.size()) 270 .append(" siteNodeBindings.size=").append(siteNodeBindings.size()) 271 .append(" categoryBindings.size=").append("not implemented"); 272 return sb.toString(); 273 } 274 275 } | Popular Tags |