1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.events.util;
16
17 import org.apache.commons.collections.Predicate;
18 import org.kuali.mobility.events.entity.Category;
19
20 public final class CategoryPredicate implements Predicate {
21
22 private String campus;
23 private String category;
24
25 public CategoryPredicate( final String campus, final String category )
26 {
27 this.setCampus( campus );
28 this.setCategory( category );
29 }
30
31 @Override
32 public boolean evaluate(Object obj) {
33 boolean campusMatch = false;
34 boolean categoryMatch = false;
35
36 if( obj instanceof Category )
37 {
38 if( getCampus() == null )
39 {
40 campusMatch = true;
41 }
42 if( getCampus() != null && getCampus().equalsIgnoreCase( ((Category)obj).getCampus() ))
43 {
44 campusMatch = true;
45 }
46 if( getCategory() == null )
47 {
48 categoryMatch = true;
49 }
50 if( getCategory() != null && getCategory().equalsIgnoreCase( ((Category)obj).getCategoryId() ) )
51 {
52 categoryMatch = true;
53 }
54 }
55
56 return campusMatch && categoryMatch;
57 }
58
59
60
61
62 public String getCategory() {
63 return category;
64 }
65
66
67
68
69 public void setCategory(String category) {
70 this.category = category;
71 }
72
73
74
75
76 public String getCampus() {
77 return campus;
78 }
79
80
81
82
83 public void setCampus(String campus) {
84 this.campus = campus;
85 }
86
87 }