1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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 =
29          "custom.field.boolean.array";
30  
31      public static final String BOOLEAN_LABEL = "custom.field.boolean";
32  
33      public static final int DATE = 3;
34  
35      public static final int DATE_ARRAY = 4;
36  
37      public static final String DATE_ARRAY_LABEL =
38          "custom.field.java.util.Date.array";
39  
40      public static final String DATE_LABEL = "custom.field.java.util.Date";
41  
42      public static final int DOUBLE = 5;
43  
44      public static final int DOUBLE_ARRAY = 6;
45  
46      public static final String DOUBLE_ARRAY_LABEL = "custom.field.double.array";
47  
48      public static final String DOUBLE_LABEL = "custom.field.double";
49  
50      public static final int FLOAT = 7;
51  
52      public static final int FLOAT_ARRAY = 8;
53  
54      public static final String FLOAT_ARRAY_LABEL = "custom.field.float.array";
55  
56      public static final String FLOAT_LABEL = "custom.field.float";
57  
58      public static final int INTEGER = 9;
59  
60      public static final int INTEGER_ARRAY = 10;
61  
62      public static final String INTEGER_ARRAY_LABEL = "custom.field.int.array";
63  
64      public static final String INTEGER_LABEL = "custom.field.int";
65  
66      public static final int LONG = 11;
67  
68      public static final int LONG_ARRAY = 12;
69  
70      public static final String LONG_ARRAY_LABEL = "custom.field.long.array";
71  
72      public static final String LONG_LABEL = "custom.field.long";
73  
74      public static final String PROPERTY_HEIGHT = "height";
75  
76      public static final String PROPERTY_HIDDEN = "hidden";
77  
78      public static final String PROPERTY_SECRET = "secret";
79  
80      public static final String PROPERTY_SELECTION = "selection";
81  
82      public static final String PROPERTY_VISIBLE_WITH_UPDATE_PERMISSION =
83          "visible-with-update-permission";
84  
85      public static final String PROPERTY_WIDTH = "width";
86  
87      public static final int SHORT = 13;
88  
89      public static final int SHORT_ARRAY = 14;
90  
91      public static final String SHORT_ARRAY_LABEL = "custom.field.short.array";
92  
93      public static final String SHORT_LABEL = "custom.field.short";
94  
95      public static final int STRING = 15;
96  
97      public static final int STRING_ARRAY = 16;
98  
99      public static final String STRING_ARRAY_LABEL =
100         "custom.field.java.lang.String.array";
101 
102     public static final String STRING_LABEL = "custom.field.java.lang.String";
103 
104     public static final int[] TYPES = new int[] {
105         BOOLEAN, BOOLEAN_ARRAY, DATE, DATE_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT,
106         FLOAT_ARRAY, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT,
107         SHORT_ARRAY, STRING, STRING_ARRAY
108     };
109 
110     public static final String UNKNOWN_LABEL = "Unknown";
111 
112     public static final String getTypeLabel(int type) {
113         if (type == BOOLEAN) {
114             return BOOLEAN_LABEL;
115         }
116         else if (type == BOOLEAN_ARRAY) {
117             return BOOLEAN_ARRAY_LABEL;
118         }
119         else if (type == DATE) {
120             return DATE_LABEL;
121         }
122         else if (type == DATE_ARRAY) {
123             return DATE_ARRAY_LABEL;
124         }
125         else if (type == DOUBLE) {
126             return DOUBLE_LABEL;
127         }
128         else if (type == DOUBLE_ARRAY) {
129             return DOUBLE_ARRAY_LABEL;
130         }
131         else if (type == FLOAT) {
132             return FLOAT_LABEL;
133         }
134         else if (type == FLOAT_ARRAY) {
135             return FLOAT_ARRAY_LABEL;
136         }
137         else if (type == INTEGER) {
138             return INTEGER_LABEL;
139         }
140         else if (type == INTEGER_ARRAY) {
141             return INTEGER_ARRAY_LABEL;
142         }
143         else if (type == LONG) {
144             return LONG_LABEL;
145         }
146         else if (type == LONG_ARRAY) {
147             return LONG_ARRAY_LABEL;
148         }
149         else if (type == SHORT) {
150             return SHORT_LABEL;
151         }
152         else if (type == SHORT_ARRAY) {
153             return SHORT_ARRAY_LABEL;
154         }
155         else if (type == STRING) {
156             return STRING_LABEL;
157         }
158         else if (type == STRING_ARRAY) {
159             return STRING_ARRAY_LABEL;
160         }
161 
162         return UNKNOWN_LABEL;
163     }
164 
165 }