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.portlet.asset;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    import com.liferay.portlet.asset.model.AssetRendererFactory;
019    
020    import java.util.List;
021    
022    /**
023     * @author Bruno Farache
024     * @author Marcellus Tavares
025     */
026    public class AssetRendererFactoryRegistryUtil {
027    
028            /**
029             * @deprecated As of 6.2.0, replaced by {@link #getAssetRendererFactories(
030             *             long)}
031             */
032            public static List<AssetRendererFactory> getAssetRendererFactories() {
033                    return getAssetRendererFactoryRegistry().getAssetRendererFactories();
034            }
035    
036            public static List<AssetRendererFactory> getAssetRendererFactories(
037                    long companyId) {
038    
039                    return getAssetRendererFactoryRegistry().getAssetRendererFactories(
040                            companyId);
041            }
042    
043            public static AssetRendererFactory getAssetRendererFactoryByClassName(
044                    String className) {
045    
046                    return getAssetRendererFactoryRegistry().
047                            getAssetRendererFactoryByClassName(className);
048            }
049    
050            public static AssetRendererFactory getAssetRendererFactoryByType(
051                    String type) {
052    
053                    return getAssetRendererFactoryRegistry().getAssetRendererFactoryByType(
054                            type);
055            }
056    
057            public static AssetRendererFactoryRegistry
058                    getAssetRendererFactoryRegistry() {
059    
060                    PortalRuntimePermission.checkGetBeanProperty(
061                            AssetRendererFactoryRegistryUtil.class);
062    
063                    return _assetRendererFactoryRegistry;
064            }
065    
066            /**
067             * @deprecated As of 6.2.0, replaced by {@link #getClassNameIds( long)}
068             */
069            public static long[] getClassNameIds() {
070                    return getAssetRendererFactoryRegistry().getClassNameIds();
071            }
072    
073            public static long[] getClassNameIds(long companyId) {
074                    return getAssetRendererFactoryRegistry().getClassNameIds(companyId);
075            }
076    
077            public static void register(AssetRendererFactory assetRendererFactory) {
078                    getAssetRendererFactoryRegistry().register(assetRendererFactory);
079            }
080    
081            public static void register(
082                    List<AssetRendererFactory> assetRendererFactories) {
083    
084                    for (AssetRendererFactory assetRendererFactory :
085                                    assetRendererFactories) {
086    
087                            register(assetRendererFactory);
088                    }
089            }
090    
091            public static void unregister(AssetRendererFactory assetRendererFactory) {
092                    getAssetRendererFactoryRegistry().unregister(assetRendererFactory);
093            }
094    
095            public static void unregister(
096                    List<AssetRendererFactory> assetRendererFactories) {
097    
098                    for (AssetRendererFactory assetRendererFactory :
099                                    assetRendererFactories) {
100    
101                            unregister(assetRendererFactory);
102                    }
103            }
104    
105            public void setAssetRendererFactoryRegistry(
106                    AssetRendererFactoryRegistry assetRendererFactoryRegistry) {
107    
108                    PortalRuntimePermission.checkSetBeanProperty(getClass());
109    
110                    _assetRendererFactoryRegistry = assetRendererFactoryRegistry;
111            }
112    
113            private static AssetRendererFactoryRegistry _assetRendererFactoryRegistry;
114    
115    }