001/** 002 * Copyright 2011-2013 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016package org.kuali.mobility.security.authz.expression; 017 018import org.kuali.mobility.security.user.api.User; 019 020public class OrExpression extends AbstractNonLeafExpression implements NonLeafExpression { 021 022 private static final long serialVersionUID = -375075043935425839L; 023 024 025 public OrExpression() { 026 super(); 027 } 028 029 public boolean evaluate(User user) { 030 for (Expression child : getChildren()) { 031 if (child.evaluate(user)) { 032 return true; 033 } 034 } 035 return false; 036 } 037 038 039 @Override 040 public boolean equals(Object obj) { 041 if (obj instanceof OrExpression) { 042 OrExpression other = (OrExpression)obj; 043 return getChildren().equals(other.getChildren()); 044 } 045 return false; 046 } 047 048}