001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.dao.orm.hibernate;
016    
017    import com.liferay.portal.kernel.dao.orm.Type;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class TypeTranslator {
023    
024            public static org.hibernate.type.Type translate(Type type) {
025                    if (type == Type.BIG_DECIMAL) {
026                            return org.hibernate.Hibernate.BIG_DECIMAL;
027                    }
028                    else if (type == Type.BIG_INTEGER) {
029                            return org.hibernate.Hibernate.BIG_INTEGER;
030                    }
031                    else if (type == Type.BINARY) {
032                            return org.hibernate.Hibernate.BINARY;
033                    }
034                    else if (type == Type.BLOB) {
035                            return org.hibernate.Hibernate.BLOB;
036                    }
037                    else if (type == Type.BOOLEAN) {
038                            return org.hibernate.Hibernate.BOOLEAN;
039                    }
040                    else if (type == Type.BYTE) {
041                            return org.hibernate.Hibernate.BYTE;
042                    }
043                    else if (type == Type.CALENDAR) {
044                            return org.hibernate.Hibernate.CALENDAR;
045                    }
046                    else if (type == Type.CALENDAR_DATE) {
047                            return org.hibernate.Hibernate.CALENDAR_DATE;
048                    }
049                    else if (type == Type.CHAR_ARRAY) {
050                            return org.hibernate.Hibernate.CHAR_ARRAY;
051                    }
052                    else if (type == Type.CHARACTER) {
053                            return org.hibernate.Hibernate.CHARACTER;
054                    }
055                    else if (type == Type.CHARACTER_ARRAY) {
056                            return org.hibernate.Hibernate.CHARACTER_ARRAY;
057                    }
058                    else if (type == Type.CLASS) {
059                            return org.hibernate.Hibernate.CLASS;
060                    }
061                    else if (type == Type.CLOB) {
062                            return org.hibernate.Hibernate.CLOB;
063                    }
064                    else if (type == Type.CURRENCY) {
065                            return org.hibernate.Hibernate.CURRENCY;
066                    }
067                    else if (type == Type.DATE) {
068                            return org.hibernate.Hibernate.DATE;
069                    }
070                    else if (type == Type.DOUBLE) {
071                            return org.hibernate.Hibernate.DOUBLE;
072                    }
073                    else if (type == Type.FLOAT) {
074                            return org.hibernate.Hibernate.FLOAT;
075                    }
076                    else if (type == Type.INTEGER) {
077                            return org.hibernate.Hibernate.INTEGER;
078                    }
079                    else if (type == Type.LOCALE) {
080                            return org.hibernate.Hibernate.LOCALE;
081                    }
082                    else if (type == Type.LONG) {
083                            return org.hibernate.Hibernate.LONG;
084                    }
085                    else if (type == Type.OBJECT) {
086                            return org.hibernate.Hibernate.OBJECT;
087                    }
088                    else if (type == Type.SERIALIZABLE) {
089                            return org.hibernate.Hibernate.SERIALIZABLE;
090                    }
091                    else if (type == Type.SHORT) {
092                            return org.hibernate.Hibernate.SHORT;
093                    }
094                    else if (type == Type.STRING) {
095                            return org.hibernate.Hibernate.STRING;
096                    }
097                    else if (type == Type.TEXT) {
098                            return org.hibernate.Hibernate.TEXT;
099                    }
100                    else if (type == Type.TIMESTAMP) {
101                            return org.hibernate.Hibernate.TIMESTAMP;
102                    }
103                    else if (type == Type.TIMEZONE) {
104                            return org.hibernate.Hibernate.TIMEZONE;
105                    }
106                    else if (type == Type.TRUE_FALSE) {
107                            return org.hibernate.Hibernate.TRUE_FALSE;
108                    }
109                    else if (type == Type.WRAPPER_BINARY) {
110                            return org.hibernate.Hibernate.WRAPPER_BINARY;
111                    }
112                    else if (type == Type.YES_NO) {
113                            return org.hibernate.Hibernate.YES_NO;
114                    }
115                    else {
116                            return null;
117                    }
118            }
119    
120    }