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   */
31  public class ExpandoColumnConstants {
32  
33      public static final int BOOLEAN = 1;
34  
35      public static final int BOOLEAN_ARRAY = 2;
36  
37      public static final String BOOLEAN_ARRAY_LABEL = "boolean[]";
38  
39      public static final String BOOLEAN_LABEL = "boolean";
40  
41      public static final int DATE = 3;
42  
43      public static final int DATE_ARRAY = 4;
44  
45      public static final String DATE_ARRAY_LABEL = "java.util.Date[]";
46  
47      public static final String DATE_LABEL = "java.util.Date";
48  
49      public static final int DOUBLE = 5;
50  
51      public static final int DOUBLE_ARRAY = 6;
52  
53      public static final String DOUBLE_ARRAY_LABEL = "double[]";
54  
55      public static final String DOUBLE_LABEL = "double";
56  
57      public static final int FLOAT = 7;
58  
59      public static final int FLOAT_ARRAY = 8;
60  
61      public static final String FLOAT_ARRAY_LABEL = "float[]";
62  
63      public static final String FLOAT_LABEL = "float";
64  
65      public static final int INTEGER = 9;
66  
67      public static final int INTEGER_ARRAY = 10;
68  
69      public static final String INTEGER_ARRAY_LABEL = "int[]";
70  
71      public static final String INTEGER_LABEL = "int";
72  
73      public static final int LONG = 11;
74  
75      public static final int LONG_ARRAY = 12;
76  
77      public static final String LONG_ARRAY_LABEL = "long[]";
78  
79      public static final String LONG_LABEL = "long";
80  
81      public static final String PROPERTY_HEIGHT = "height";
82  
83      public static final String PROPERTY_HIDDEN = "hidden";
84  
85      public static final String PROPERTY_SECRET = "secret";
86  
87      public static final String PROPERTY_SELECTION = "selection";
88  
89      public static final String PROPERTY_WIDTH = "width";
90  
91      public static final int SHORT = 13;
92  
93      public static final int SHORT_ARRAY = 14;
94  
95      public static final String SHORT_ARRAY_LABEL = "short[]";
96  
97      public static final String SHORT_LABEL = "short";
98  
99      public static final int STRING = 15;
100 
101     public static final int STRING_ARRAY = 16;
102 
103     public static final String STRING_ARRAY_LABEL = "java.lang.String[]";
104 
105     public static final String STRING_LABEL = "java.lang.String";
106 
107     public static final int[] TYPES = new int[] {
108         BOOLEAN, BOOLEAN_ARRAY, DATE, DATE_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT,
109         FLOAT_ARRAY, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT,
110         SHORT_ARRAY, STRING, STRING_ARRAY
111     };
112 
113     public static final String UNKNOWN_LABEL = "Unknown";
114 
115     public static final String getTypeLabel(int type) {
116         if (type == BOOLEAN) {
117             return BOOLEAN_LABEL;
118         }
119         else if (type == BOOLEAN_ARRAY) {
120             return BOOLEAN_ARRAY_LABEL;
121         }
122         else if (type == DATE) {
123             return DATE_LABEL;
124         }
125         else if (type == DATE_ARRAY) {
126             return DATE_ARRAY_LABEL;
127         }
128         else if (type == DOUBLE) {
129             return DOUBLE_LABEL;
130         }
131         else if (type == DOUBLE_ARRAY) {
132             return DOUBLE_ARRAY_LABEL;
133         }
134         else if (type == FLOAT) {
135             return FLOAT_LABEL;
136         }
137         else if (type == FLOAT_ARRAY) {
138             return FLOAT_ARRAY_LABEL;
139         }
140         else if (type == INTEGER) {
141             return INTEGER_LABEL;
142         }
143         else if (type == INTEGER_ARRAY) {
144             return INTEGER_ARRAY_LABEL;
145         }
146         else if (type == LONG) {
147             return LONG_LABEL;
148         }
149         else if (type == LONG_ARRAY) {
150             return LONG_ARRAY_LABEL;
151         }
152         else if (type == SHORT) {
153             return SHORT_LABEL;
154         }
155         else if (type == SHORT_ARRAY) {
156             return SHORT_ARRAY_LABEL;
157         }
158         else if (type == STRING) {
159             return STRING_LABEL;
160         }
161         else if (type == STRING_ARRAY) {
162             return STRING_ARRAY_LABEL;
163         }
164 
165         return UNKNOWN_LABEL;
166     }
167 
168 }