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