001/**
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.auth.webac;
017
018import java.net.URI;
019import java.util.Collection;
020import java.util.HashSet;
021import java.util.Set;
022
023/**
024 * @author whikloj
025 * @author acoburn
026 * @since 2015-08-25
027 */
028public class WebACAuthorization {
029
030    private final Set<String> agents = new HashSet<>();
031
032    private final Set<String> agentClasses = new HashSet<>();
033
034    private final Set<URI> modes = new HashSet<>();
035
036    private final Set<String> accessTo = new HashSet<>();
037
038    private final Set<String> accessToClass = new HashSet<>();
039
040    /**
041     * Constructor
042     *
043     * @param agents The acl:agent values
044     * @param agentClasses the acl:agentClass values
045     * @param modes the acl:mode values
046     * @param accessTo the acl:accessTo values
047     * @param accessToClass the acl:accessToClass values
048     */
049    public WebACAuthorization(final Collection<String> agents, final Collection<String> agentClasses,
050            final Collection<URI> modes, final Collection<String> accessTo, final Collection<String> accessToClass) {
051        this.agents.addAll(agents);
052        this.agentClasses.addAll(agentClasses);
053        this.modes.addAll(modes);
054        this.accessTo.addAll(accessTo);
055        this.accessToClass.addAll(accessToClass);
056    }
057
058    /**
059     * Get the set of acl:agents, empty set if none.
060     *
061     * @return set of acl:agents
062     */
063    public Set<String> getAgents() {
064        return agents;
065    }
066
067    /**
068     * Get the set of acl:agentClasses, empty set if none.
069     * 
070     * @return set of acl:agentClasses
071     */
072    public Set<String> getAgentClasses() {
073        return agentClasses;
074    }
075
076    /**
077     * Get the set of acl:modes, empty set if none.
078     *
079     * @return set of acl:modes
080     */
081    public Set<URI> getModes() {
082        return modes;
083    }
084
085    /**
086     * Get the set of strings directly linked from this ACL, empty set if none.
087     *
088     * @return set of String
089     */
090    public Set<String> getAccessToURIs() {
091        return accessTo;
092    }
093
094    /**
095     * Get the set of strings describing the rdf:types for this ACL, empty set if none.
096     *
097     * @return set of Strings
098     */
099    public Set<String> getAccessToClassURIs() {
100        return accessToClass;
101    }
102}