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