1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.expando.model;
16  
17  /**
18   * <a href="ExpandoColumnConstants.java.html"><b><i>View Source</i></b></a>
19   *
20   * @author Raymond Augé
21   */
22  public class ExpandoColumnConstants {
23  
24      public static final int BOOLEAN = 1;
25  
26      public static final int BOOLEAN_ARRAY = 2;
27  
28      public static final String BOOLEAN_ARRAY_LABEL = "boolean[]";
29  
30      public static final String BOOLEAN_LABEL = "boolean";
31  
32      public static final int DATE = 3;
33  
34      public static final int DATE_ARRAY = 4;
35  
36      public static final String DATE_ARRAY_LABEL = "java.util.Date[]";
37  
38      public static final String DATE_LABEL = "java.util.Date";
39  
40      public static final int DOUBLE = 5;
41  
42      public static final int DOUBLE_ARRAY = 6;
43  
44      public static final String DOUBLE_ARRAY_LABEL = "double[]";
45  
46      public static final String DOUBLE_LABEL = "double";
47  
48      public static final int FLOAT = 7;
49  
50      public static final int FLOAT_ARRAY = 8;
51  
52      public static final String FLOAT_ARRAY_LABEL = "float[]";
53  
54      public static final String FLOAT_LABEL = "float";
55  
56      public static final int INTEGER = 9;
57  
58      public static final int INTEGER_ARRAY = 10;
59  
60      public static final String INTEGER_ARRAY_LABEL = "int[]";
61  
62      public static final String INTEGER_LABEL = "int";
63  
64      public static final int LONG = 11;
65  
66      public static final int LONG_ARRAY = 12;
67  
68      public static final String LONG_ARRAY_LABEL = "long[]";
69  
70      public static final String LONG_LABEL = "long";
71  
72      public static final String PROPERTY_HEIGHT = "height";
73  
74      public static final String PROPERTY_HIDDEN = "hidden";
75  
76      public static final String PROPERTY_SECRET = "secret";
77  
78      public static final String PROPERTY_SELECTION = "selection";
79  
80      public static final String PROPERTY_WIDTH = "width";
81  
82      public static final int SHORT = 13;
83  
84      public static final int SHORT_ARRAY = 14;
85  
86      public static final String SHORT_ARRAY_LABEL = "short[]";
87  
88      public static final String SHORT_LABEL = "short";
89  
90      public static final int STRING = 15;
91  
92      public static final int STRING_ARRAY = 16;
93  
94      public static final String STRING_ARRAY_LABEL = "java.lang.String[]";
95  
96      public static final String STRING_LABEL = "java.lang.String";
97  
98      public static final int[] TYPES = new int[] {
99          BOOLEAN, BOOLEAN_ARRAY, DATE, DATE_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT,
100         FLOAT_ARRAY, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT,
101         SHORT_ARRAY, STRING, STRING_ARRAY
102     };
103 
104     public static final String UNKNOWN_LABEL = "Unknown";
105 
106     public static final String getTypeLabel(int type) {
107         if (type == BOOLEAN) {
108             return BOOLEAN_LABEL;
109         }
110         else if (type == BOOLEAN_ARRAY) {
111             return BOOLEAN_ARRAY_LABEL;
112         }
113         else if (type == DATE) {
114             return DATE_LABEL;
115         }
116         else if (type == DATE_ARRAY) {
117             return DATE_ARRAY_LABEL;
118         }
119         else if (type == DOUBLE) {
120             return DOUBLE_LABEL;
121         }
122         else if (type == DOUBLE_ARRAY) {
123             return DOUBLE_ARRAY_LABEL;
124         }
125         else if (type == FLOAT) {
126             return FLOAT_LABEL;
127         }
128         else if (type == FLOAT_ARRAY) {
129             return FLOAT_ARRAY_LABEL;
130         }
131         else if (type == INTEGER) {
132             return INTEGER_LABEL;
133         }
134         else if (type == INTEGER_ARRAY) {
135             return INTEGER_ARRAY_LABEL;
136         }
137         else if (type == LONG) {
138             return LONG_LABEL;
139         }
140         else if (type == LONG_ARRAY) {
141             return LONG_ARRAY_LABEL;
142         }
143         else if (type == SHORT) {
144             return SHORT_LABEL;
145         }
146         else if (type == SHORT_ARRAY) {
147             return SHORT_ARRAY_LABEL;
148         }
149         else if (type == STRING) {
150             return STRING_LABEL;
151         }
152         else if (type == STRING_ARRAY) {
153             return STRING_ARRAY_LABEL;
154         }
155 
156         return UNKNOWN_LABEL;
157     }
158 
159 }