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