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