001    /**
002     * Copyright (c) 2000-present 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.security.permission;
016    
017    import com.liferay.portal.kernel.security.permission.ResourceActionsBag;
018    
019    import java.util.HashSet;
020    import java.util.Set;
021    
022    /**
023     * @author László Csontos
024     */
025    public class ResourceActionsBagImpl implements Cloneable, ResourceActionsBag {
026    
027            public ResourceActionsBagImpl() {
028            }
029    
030            public ResourceActionsBagImpl(ResourceActionsBag resourceActionsBag) {
031                    _resourceActions.addAll(resourceActionsBag.getResourceActions());
032                    _resourceGroupDefaultActions.addAll(
033                            resourceActionsBag.getResourceGroupDefaultActions());
034                    _resourceGuestDefaultActions.addAll(
035                            resourceActionsBag.getResourceGuestDefaultActions());
036                    _resourceGuestUnsupportedActions.addAll(
037                            resourceActionsBag.getResourceGuestUnsupportedActions());
038                    _resources.addAll(resourceActionsBag.getResources());
039            }
040    
041            @Override
042            public ResourceActionsBag clone() {
043                    return new ResourceActionsBagImpl(this);
044            }
045    
046            @Override
047            public Set<String> getResourceActions() {
048                    return _resourceActions;
049            }
050    
051            @Override
052            public Set<String> getResourceGroupDefaultActions() {
053                    return _resourceGroupDefaultActions;
054            }
055    
056            @Override
057            public Set<String> getResourceGuestDefaultActions() {
058                    return _resourceGuestDefaultActions;
059            }
060    
061            @Override
062            public Set<String> getResourceGuestUnsupportedActions() {
063                    return _resourceGuestUnsupportedActions;
064            }
065    
066            @Override
067            public Set<String> getResources() {
068                    return _resources;
069            }
070    
071            private final Set<String> _resourceActions = new HashSet<>();
072            private final Set<String> _resourceGroupDefaultActions = new HashSet<>();
073            private final Set<String> _resourceGuestDefaultActions = new HashSet<>();
074            private final Set<String> _resourceGuestUnsupportedActions =
075                    new HashSet<>();
076            private final Set<String> _resources = new HashSet<>();
077    
078    }