KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > applications > databeans > ComponentProperty


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23
24 package org.infoglue.deliver.applications.databeans;
25
26 import java.net.URLEncoder JavaDoc;
27 import java.util.ArrayList JavaDoc;
28 import java.util.List JavaDoc;
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 /**
37  *
38  */

39
40 public class ComponentProperty
41 {
42     public final static Logger logger = Logger.getLogger(ComponentProperty.class.getName());
43     
44     public static final String JavaDoc BINDING = "binding";
45     public static final String JavaDoc TEXTFIELD = "textfield";
46     public static final String JavaDoc TEXTAREA = "textarea";
47     public static final String JavaDoc SELECTFIELD = "select";
48     
49     private Integer JavaDoc id;
50     private String JavaDoc name;
51     private String JavaDoc description;
52     private String JavaDoc type;
53     private String JavaDoc[] allowedContentTypeNamesArray = null;
54     private Integer JavaDoc componentId;
55     private String JavaDoc entityClass;
56     private Integer JavaDoc entityId;
57     private String JavaDoc value;
58     private boolean isMultipleBinding = false;
59     private String JavaDoc visualizingAction = null;
60     private String JavaDoc createAction = null;
61
62     private List JavaDoc options = new ArrayList JavaDoc();
63     
64     private List JavaDoc contentBindings = new ArrayList JavaDoc();
65     private List JavaDoc siteNodeBindings = new ArrayList JavaDoc();
66         
67         
68     public Integer JavaDoc getComponentId()
69     {
70         return componentId;
71     }
72
73     public List JavaDoc getContentBindings()
74     {
75         return contentBindings;
76     }
77
78     public String JavaDoc getEntityClass()
79     {
80         return entityClass;
81     }
82
83     public Integer JavaDoc getEntityId()
84     {
85         return entityId;
86     }
87
88     public Integer JavaDoc getId()
89     {
90         return id;
91     }
92
93     public String JavaDoc getName()
94     {
95         return name;
96     }
97
98     public List JavaDoc getSiteNodeBindings()
99     {
100         return siteNodeBindings;
101     }
102
103     public String JavaDoc getValue()
104     {
105         return value;
106     }
107
108     public void setComponentId(Integer JavaDoc integer)
109     {
110         componentId = integer;
111     }
112
113     public void setContentBindings(List JavaDoc list)
114     {
115         contentBindings = list;
116     }
117
118     public void setEntityClass(String JavaDoc string)
119     {
120         entityClass = string;
121     }
122
123     public void setEntityId(Integer JavaDoc integer)
124     {
125         entityId = integer;
126     }
127
128     public void setId(Integer JavaDoc integer)
129     {
130         id = integer;
131     }
132
133     public void setName(String JavaDoc string)
134     {
135         name = string;
136     }
137
138     public String JavaDoc getDescription()
139     {
140         return description;
141     }
142     
143     public void setDescription(String JavaDoc description)
144     {
145         this.description = description;
146     }
147
148     public void setSiteNodeBindings(List JavaDoc list)
149     {
150         siteNodeBindings = list;
151     }
152
153     public void setValue(String JavaDoc string)
154     {
155         value = string;
156     }
157
158     public String JavaDoc getType()
159     {
160         return type;
161     }
162
163     public void setType(String JavaDoc 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 JavaDoc getVisualizingAction()
179     {
180         return visualizingAction;
181     }
182
183     public void setVisualizingAction(String JavaDoc visualizingAction)
184     {
185         this.visualizingAction = visualizingAction;
186     }
187
188     public String JavaDoc getCreateAction()
189     {
190         return this.createAction;
191     }
192
193     public void setCreateAction(String JavaDoc createAction)
194     {
195         this.createAction = createAction;
196     }
197
198     public String JavaDoc[] getAllowedContentTypeNamesArray()
199     {
200         return allowedContentTypeNamesArray;
201     }
202     
203     public void setAllowedContentTypeNamesArray(String JavaDoc[] allowedContentTypeNamesArray)
204     {
205         this.allowedContentTypeNamesArray = allowedContentTypeNamesArray;
206     }
207
208     public String JavaDoc getAllowedContentTypeNamesAsUrlEncodedString() throws Exception JavaDoc
209     {
210         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
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 JavaDoc getAllowedContentTypeIdAsUrlEncodedString(Database db) throws Exception JavaDoc
225     {
226         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
227         String JavaDoc 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 JavaDoc getOptions()
251     {
252         return options;
253     }
254
255     public String JavaDoc toString()
256     {
257         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
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