KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > entities > management > ContentTypeAttributeParameter


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.cms.entities.management;
25
26 import java.util.LinkedHashMap JavaDoc;
27
28 /**
29  * This is a pure javabean carrying the information about one content type attribute parameter.
30  * The parameters are used to carry information about a certain extra parameter belonging to an
31  * attribute. For example - a simple attribute might have attributes steering which default value it
32  * should have or which label the attribute should have visible to the user. To support for example
33  * lists of values in a parameter the lists are allways used.
34  */

35
36
37 public class ContentTypeAttributeParameter
38 {
39     public static final int SINGLE_VALUE_TYPE = 0;
40     public static final int MULTI_VALUE_TYPE = 1;
41     
42     private String JavaDoc id = "";
43     private int type = SINGLE_VALUE_TYPE;
44     private LinkedHashMap JavaDoc contentTypeAttributeParameterValues = new LinkedHashMap JavaDoc();
45     
46     public ContentTypeAttributeParameter()
47     {
48     }
49     
50     public String JavaDoc getId()
51     {
52         return this.id;
53     }
54
55     public void setId(String JavaDoc id)
56     {
57         this.id = id;
58     }
59
60     public int getType()
61     {
62         return this.type;
63     }
64     
65     public void setType(int type)
66     {
67         this.type = type;
68     }
69
70     public void addContentTypeAttributeParameterValue(String JavaDoc key, ContentTypeAttributeParameterValue contentTypeAttributeParameterValue)
71     {
72         this.contentTypeAttributeParameterValues.put(key, contentTypeAttributeParameterValue);
73         if(this.contentTypeAttributeParameterValues.size() > 1)
74             this.type = MULTI_VALUE_TYPE;
75     }
76
77     public ContentTypeAttributeParameterValue getContentTypeAttributeParameterValue()
78     {
79         if(this.contentTypeAttributeParameterValues.values() != null && this.contentTypeAttributeParameterValues.values().toArray().length > 0)
80             return (ContentTypeAttributeParameterValue)this.contentTypeAttributeParameterValues.values().toArray()[0];
81         else
82             return null;
83     }
84
85     public ContentTypeAttributeParameterValue getContentTypeAttributeParameterValue(String JavaDoc key)
86     {
87         if(this.contentTypeAttributeParameterValues.size() > 0)
88             return (ContentTypeAttributeParameterValue)this.contentTypeAttributeParameterValues.get(key);
89         else
90             return null;
91     }
92     
93     public LinkedHashMap JavaDoc getContentTypeAttributeParameterValues()
94     {
95         return this.contentTypeAttributeParameterValues;
96     }
97     
98     
99
100 }
Popular Tags