001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.trash;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.util.List;
020    
021    /**
022     * @author Alexander Chow
023     */
024    public class TrashHandlerRegistryUtil {
025    
026            public static TrashHandler getTrashHandler(String className) {
027                    return getTrashHandlerRegistry().getTrashHandler(className);
028            }
029    
030            public static TrashHandlerRegistry getTrashHandlerRegistry() {
031                    PortalRuntimePermission.checkGetBeanProperty(
032                            TrashHandlerRegistryUtil.class);
033    
034                    return _trashHandlerRegistry;
035            }
036    
037            public static List<TrashHandler> getTrashHandlers() {
038                    return getTrashHandlerRegistry().getTrashHandlers();
039            }
040    
041            public static void register(List<TrashHandler> trashHandlers) {
042                    for (TrashHandler trashHandler : trashHandlers) {
043                            register(trashHandler);
044                    }
045            }
046    
047            public static void register(TrashHandler trashHandler) {
048                    getTrashHandlerRegistry().register(trashHandler);
049            }
050    
051            public static void unregister(List<TrashHandler> trashHandlers) {
052                    for (TrashHandler trashHandler : trashHandlers) {
053                            unregister(trashHandler);
054                    }
055            }
056    
057            public static void unregister(TrashHandler trashHandler) {
058                    getTrashHandlerRegistry().unregister(trashHandler);
059            }
060    
061            public void setTrashHandlerRegistry(
062                    TrashHandlerRegistry trashHandlerRegistry) {
063    
064                    PortalRuntimePermission.checkSetBeanProperty(getClass());
065    
066                    _trashHandlerRegistry = trashHandlerRegistry;
067            }
068    
069            private static TrashHandlerRegistry _trashHandlerRegistry;
070    
071    }