View Javadoc
1   /**
2    * Copyright 2011-2013 The Kuali Foundation Licensed under the Educational
3    * Community License, Version 2.0 (the "License"); you may not use this file
4    * except in compliance with the License. You may obtain a copy of the License
5    * at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12   * License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package org.kuali.mobility.academics.util;
16  
17  import org.apache.commons.collections.Predicate;
18  import org.kuali.mobility.academics.entity.Subject;
19  
20  /**
21   *
22   * @author Joe Swanson <joseswan@umich.edu>
23   */
24  public class SubjectPredicate implements Predicate {
25  	private String subjectId;
26  	public SubjectPredicate( String subjectId) {
27  		super();
28  		this.subjectId = subjectId;
29  	}
30  	@Override
31  	public boolean evaluate( Object obj ) {
32  		boolean match = false;
33  		if( obj instanceof Subject ) {
34  			if( subjectId != null && (subjectId.equalsIgnoreCase("ALL") || subjectId.equalsIgnoreCase( ((Subject)obj).getId()))) {
35  				match = true;
36  			}
37  		}
38  		return match;
39  	}
40  }