View Javadoc

1   package org.kuali.student.r2.common.criteria.transform;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import org.kuali.rice.core.api.criteria.LookupCustomizer;
6   import org.kuali.rice.core.api.criteria.LookupCustomizer.Transform;
7   import org.kuali.rice.core.api.criteria.Predicate;
8   
9   /**
10   * A transform that simply applies a set of other transforms sequentially to a predicate
11   * @author nwright
12   */
13  public class MultiplePredicateTransform implements LookupCustomizer.Transform<Predicate,Predicate>{
14      
15  
16      private List<LookupCustomizer.Transform<Predicate,Predicate>> transforms = 
17              new ArrayList<LookupCustomizer.Transform<Predicate,Predicate>> ();
18  
19      public MultiplePredicateTransform() {
20      }
21  
22      /** 
23       * Convenience constructor
24       * @param transforms 
25       */
26      public MultiplePredicateTransform(List<LookupCustomizer.Transform<Predicate,Predicate>> transforms) {
27          this.transforms = transforms;
28      }
29  
30      public List<Transform<Predicate, Predicate>> getTransforms() {
31          return transforms;
32      }
33  
34      public void setTransforms(List<Transform<Predicate, Predicate>> transforms) {
35          this.transforms = transforms;
36      }
37  
38      @Override
39      public Predicate apply(Predicate p) {
40          for (Transform<Predicate,Predicate> transform : transforms) {
41             p = transform.apply(p); 
42          }
43          return p;
44      }
45      
46  
47  
48  
49  
50      
51  }