Coverage Report - org.kuali.student.enrollment.class1.lui.model.LuiRevenueEntity
 
Classes in this File Line Coverage Branch Coverage Complexity
LuiRevenueEntity
0%
0/31
0%
0/6
1.333
 
 1  
 package org.kuali.student.enrollment.class1.lui.model;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.List;
 5  
 
 6  
 import javax.persistence.CascadeType;
 7  
 import javax.persistence.Column;
 8  
 import javax.persistence.Entity;
 9  
 import javax.persistence.JoinColumn;
 10  
 import javax.persistence.ManyToOne;
 11  
 import javax.persistence.OneToMany;
 12  
 import javax.persistence.Table;
 13  
 
 14  
 import org.kuali.student.r2.common.dto.AttributeInfo;
 15  
 import org.kuali.student.r2.common.entity.AttributeOwner;
 16  
 import org.kuali.student.r2.common.entity.MetaEntity;
 17  
 import org.kuali.student.r2.common.infc.Attribute;
 18  
 import org.kuali.student.r2.lum.clu.dto.RevenueInfo;
 19  
 import org.kuali.student.r2.lum.clu.infc.Revenue;
 20  
 
 21  
 @Entity
 22  
 @Table(name = "KSEN_LUI_REVENUE")
 23  
 public class LuiRevenueEntity extends MetaEntity implements AttributeOwner<LuiRevenueAttributeEntity> {
 24  
 
 25  
     @Column(name = "FEE_TYPE")
 26  
     private String feeType;
 27  
 
 28  
     @ManyToOne
 29  
     @JoinColumn(name = "LUI_ID")
 30  
     private LuiEntity lui;
 31  
 
 32  
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
 33  
     private List<LuiRevenueAttributeEntity> attributes;
 34  
 
 35  0
     public LuiRevenueEntity() {}
 36  
 
 37  
     public LuiRevenueEntity(Revenue revenue) {
 38  0
         super(revenue);
 39  0
         this.setId(revenue.getId());
 40  0
         this.setFeeType(revenue.getFeeType());
 41  
 
 42  
         // Attributes
 43  0
         this.setAttributes(new ArrayList<LuiRevenueAttributeEntity>());
 44  0
         if (null != revenue.getAttributes()) {
 45  0
             for (Attribute att : revenue.getAttributes()) {
 46  0
                 LuiRevenueAttributeEntity attEntity = new LuiRevenueAttributeEntity(att);
 47  0
                 this.getAttributes().add(attEntity);
 48  0
             }
 49  
         }
 50  0
     }
 51  
 
 52  
     public RevenueInfo toDto() {
 53  0
         RevenueInfo obj = new RevenueInfo();
 54  0
         obj.setId(this.getId());
 55  0
         obj.setFeeType(this.getFeeType());
 56  
 
 57  
         // Attributes
 58  0
         List<AttributeInfo> atts = new ArrayList<AttributeInfo>();
 59  0
         for (LuiRevenueAttributeEntity att : getAttributes()) {
 60  0
             AttributeInfo attInfo = att.toDto();
 61  0
             atts.add(attInfo);
 62  0
         }
 63  0
         obj.setAttributes(atts);
 64  
         
 65  0
         obj.setMeta(super.toDTO());
 66  
 
 67  0
         return obj;
 68  
 
 69  
     }
 70  
 
 71  
     public String getFeeType() {
 72  0
         return feeType;
 73  
     }
 74  
 
 75  
     public void setFeeType(String feeType) {
 76  0
         this.feeType = feeType;
 77  0
     }
 78  
 
 79  
     public LuiEntity getLui() {
 80  0
         return lui;
 81  
     }
 82  
 
 83  
     public void setLui(LuiEntity lui) {
 84  0
         this.lui = lui;
 85  0
     }
 86  
 
 87  
     @Override
 88  
     public void setAttributes(List<LuiRevenueAttributeEntity> attributes) {
 89  0
         this.attributes = attributes;
 90  0
     }
 91  
 
 92  
     @Override
 93  
     public List<LuiRevenueAttributeEntity> getAttributes() {
 94  0
         return attributes;
 95  
     }
 96  
 
 97  
 }