001    /**
002     * Copyright (c) 2000-2013 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.kernel.dao.orm;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class ProjectionFactoryUtil {
023    
024            public static Projection alias(Projection projection, String alias) {
025                    return getProjectionFactory().alias(projection, alias);
026            }
027    
028            public static Projection avg(String propertyName) {
029                    return getProjectionFactory().avg(propertyName);
030            }
031    
032            public static Projection count(String propertyName) {
033                    return getProjectionFactory().count(propertyName);
034            }
035    
036            public static Projection countDistinct(String propertyName) {
037                    return getProjectionFactory().countDistinct(propertyName);
038            }
039    
040            public static Projection distinct(Projection projection) {
041                    return getProjectionFactory().distinct(projection);
042            }
043    
044            public static ProjectionFactory getProjectionFactory() {
045                    PortalRuntimePermission.checkGetBeanProperty(
046                            ProjectionFactoryUtil.class);
047    
048                    return _projectionFactory;
049            }
050    
051            public static Projection groupProperty(String propertyName) {
052                    return getProjectionFactory().groupProperty(propertyName);
053            }
054    
055            public static Projection max(String propertyName) {
056                    return getProjectionFactory().max(propertyName);
057            }
058    
059            public static Projection min(String propertyName) {
060                    return getProjectionFactory().min(propertyName);
061            }
062    
063            public static ProjectionList projectionList() {
064                    return getProjectionFactory().projectionList();
065            }
066    
067            public static Projection property(String propertyName) {
068                    return getProjectionFactory().property(propertyName);
069            }
070    
071            public static Projection rowCount() {
072                    return getProjectionFactory().rowCount();
073            }
074    
075            public static Projection sqlProjection(
076                    String sql, String[] columnAliases, Type[] types) {
077    
078                    return getProjectionFactory().sqlProjection(sql, columnAliases, types);
079            }
080    
081            public static Projection sum(String propertyName) {
082                    return getProjectionFactory().sum(propertyName);
083            }
084    
085            public void setProjectionFactory(ProjectionFactory projectionFactory) {
086                    PortalRuntimePermission.checkSetBeanProperty(getClass());
087    
088                    _projectionFactory = projectionFactory;
089            }
090    
091            private static ProjectionFactory _projectionFactory;
092    
093    }