1 /* 2 * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.] 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package edu.internet2.middleware.shibboleth.common.attribute.filtering.provider; 18 19 import java.util.ArrayList; 20 import java.util.List; 21 22 /** 23 * A policy describing if a set of attribute value filters is applicable. 24 */ 25 public class AttributeFilterPolicy { 26 27 /** Unique identifier for this policy. */ 28 private String policyId; 29 30 /** Requirement that must be met for this policy to apply. */ 31 private MatchFunctor policyRequirementRule; 32 33 /** Filters to be used on attribute values. */ 34 private List<AttributeRule> attributeRules; 35 36 /** 37 * Constructor. 38 * 39 * @param id unique ID for the policy 40 */ 41 public AttributeFilterPolicy(String id) { 42 policyId = id; 43 attributeRules = new ArrayList<AttributeRule>(); 44 } 45 46 /** 47 * Gets the unique ID for this policy. 48 * 49 * @return unique ID for this policy 50 */ 51 public String getPolicyId(){ 52 return policyId; 53 } 54 55 /** 56 * Gets the requirement for this policy. 57 * 58 * @return requirement for this policy 59 */ 60 public MatchFunctor getPolicyRequirementRule() { 61 return policyRequirementRule; 62 } 63 64 /** 65 * Sets the requirement for this policy. 66 * 67 * @param requirement requirement for this policy 68 */ 69 public void setPolicyRequirementRule(MatchFunctor requirement) { 70 policyRequirementRule = requirement; 71 } 72 73 /** 74 * Gets the attribute rules that are in effect if this policy is in effect. 75 * 76 * @return attribute rules that are in effect if this policy is in effect, never null 77 */ 78 public List<AttributeRule> getAttributeRules(){ 79 return attributeRules; 80 } 81 }