1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.expando.model;
24  
25  /**
26   * <a href="ExpandoColumnConstants.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Raymond Augé
29   */
30  public class ExpandoColumnConstants {
31  
32      public static final int BOOLEAN = 1;
33  
34      public static final int BOOLEAN_ARRAY = 2;
35  
36      public static final String BOOLEAN_ARRAY_LABEL = "boolean[]";
37  
38      public static final String BOOLEAN_LABEL = "boolean";
39  
40      public static final int DATE = 3;
41  
42      public static final int DATE_ARRAY = 4;
43  
44      public static final String DATE_ARRAY_LABEL = "java.util.Date[]";
45  
46      public static final String DATE_LABEL = "java.util.Date";
47  
48      public static final int DOUBLE = 5;
49  
50      public static final int DOUBLE_ARRAY = 6;
51  
52      public static final String DOUBLE_ARRAY_LABEL = "double[]";
53  
54      public static final String DOUBLE_LABEL = "double";
55  
56      public static final int FLOAT = 7;
57  
58      public static final int FLOAT_ARRAY = 8;
59  
60      public static final String FLOAT_ARRAY_LABEL = "float[]";
61  
62      public static final String FLOAT_LABEL = "float";
63  
64      public static final int INTEGER = 9;
65  
66      public static final int INTEGER_ARRAY = 10;
67  
68      public static final String INTEGER_ARRAY_LABEL = "int[]";
69  
70      public static final String INTEGER_LABEL = "int";
71  
72      public static final int LONG = 11;
73  
74      public static final int LONG_ARRAY = 12;
75  
76      public static final String LONG_ARRAY_LABEL = "long[]";
77  
78      public static final String LONG_LABEL = "long";
79  
80      public static final String PROPERTY_HEIGHT = "height";
81  
82      public static final String PROPERTY_HIDDEN = "hidden";
83  
84      public static final String PROPERTY_SECRET = "secret";
85  
86      public static final String PROPERTY_SELECTION = "selection";
87  
88      public static final String PROPERTY_WIDTH = "width";
89  
90      public static final int SHORT = 13;
91  
92      public static final int SHORT_ARRAY = 14;
93  
94      public static final String SHORT_ARRAY_LABEL = "short[]";
95  
96      public static final String SHORT_LABEL = "short";
97  
98      public static final int STRING = 15;
99  
100     public static final int STRING_ARRAY = 16;
101 
102     public static final String STRING_ARRAY_LABEL = "java.lang.String[]";
103 
104     public static final String STRING_LABEL = "java.lang.String";
105 
106     public static final int[] TYPES = new int[] {
107         BOOLEAN, BOOLEAN_ARRAY, DATE, DATE_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT,
108         FLOAT_ARRAY, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT,
109         SHORT_ARRAY, STRING, STRING_ARRAY
110     };
111 
112     public static final String UNKNOWN_LABEL = "Unknown";
113 
114     public static final String getTypeLabel(int type) {
115         if (type == BOOLEAN) {
116             return BOOLEAN_LABEL;
117         }
118         else if (type == BOOLEAN_ARRAY) {
119             return BOOLEAN_ARRAY_LABEL;
120         }
121         else if (type == DATE) {
122             return DATE_LABEL;
123         }
124         else if (type == DATE_ARRAY) {
125             return DATE_ARRAY_LABEL;
126         }
127         else if (type == DOUBLE) {
128             return DOUBLE_LABEL;
129         }
130         else if (type == DOUBLE_ARRAY) {
131             return DOUBLE_ARRAY_LABEL;
132         }
133         else if (type == FLOAT) {
134             return FLOAT_LABEL;
135         }
136         else if (type == FLOAT_ARRAY) {
137             return FLOAT_ARRAY_LABEL;
138         }
139         else if (type == INTEGER) {
140             return INTEGER_LABEL;
141         }
142         else if (type == INTEGER_ARRAY) {
143             return INTEGER_ARRAY_LABEL;
144         }
145         else if (type == LONG) {
146             return LONG_LABEL;
147         }
148         else if (type == LONG_ARRAY) {
149             return LONG_ARRAY_LABEL;
150         }
151         else if (type == SHORT) {
152             return SHORT_LABEL;
153         }
154         else if (type == SHORT_ARRAY) {
155             return SHORT_ARRAY_LABEL;
156         }
157         else if (type == STRING) {
158             return STRING_LABEL;
159         }
160         else if (type == STRING_ARRAY) {
161             return STRING_ARRAY_LABEL;
162         }
163 
164         return UNKNOWN_LABEL;
165     }
166 
167 }