Coverage Report - org.kuali.student.r2.common.criteria.transform.RenameTransform
 
Classes in this File Line Coverage Branch Coverage Complexity
RenameTransform
0%
0/10
0%
0/4
2
 
 1  
 package org.kuali.student.r2.common.criteria.transform;
 2  
 
 3  
 import java.util.Map;
 4  
 
 5  
 import org.kuali.rice.core.api.criteria.Predicate;
 6  
 import org.kuali.rice.core.api.criteria.PropertyPathPredicate;
 7  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria;
 8  
 
 9  
 public class RenameTransform extends BaseTransform {
 10  
     
 11  
     private Map<String, String> renameAttributes;
 12  
 
 13  0
     private RenameTransform(Map<String, String> renameAttributes) {
 14  0
         this.renameAttributes = renameAttributes;
 15  0
     }
 16  
 
 17  
     @Override
 18  
     public Predicate apply(final Predicate input, Criteria criteria) {
 19  0
         if (input instanceof PropertyPathPredicate) {
 20  0
             String pp = ((PropertyPathPredicate) input).getPropertyPath();
 21  0
             String property = this.getRenameProperty(pp);
 22  0
             if (property != null) {
 23  0
                 return this.createPredicate(input, property);
 24  
             }
 25  
         }
 26  
 
 27  0
         return input;
 28  
     }
 29  
 
 30  
     private String getRenameProperty(String key) {
 31  0
         return renameAttributes.get(key);
 32  
     }
 33  
 }