1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.computerlabs.util;
16
17 import org.apache.commons.collections.Predicate;
18 import org.kuali.mobility.computerlabs.entity.Lab;
19
20
21
22
23
24 public class LabPredicate implements Predicate {
25
26 private String buildingCode;
27 private String labUID;
28 public LabPredicate(String buildingCode, String labUID) {
29 super();
30 this.buildingCode = buildingCode;
31 this.labUID = labUID;
32 }
33
34 @Override
35 public boolean evaluate( Object obj ) {
36 boolean match = false;
37 if( obj instanceof Lab ) {
38 if( buildingCode != null ) {
39 if( buildingCode.equalsIgnoreCase( ((Lab)obj).getBuildingCode() ) ) {
40 match = true;
41 }
42 } else if( labUID != null ) {
43 if( labUID.equalsIgnoreCase( ((Lab)obj).getLabUID() ) ) {
44 match = true;
45 }
46 }
47 }
48 return match;
49 }
50 }