Coverage Report - org.kuali.student.common.dto.HasAttributesInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
HasAttributesInfo
0%
0/13
0%
0/2
1.143
HasAttributesInfo$Builder
0%
0/8
N/A
1.143
 
 1  
 /*
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may
 3  
  * not use this file except in compliance with the License. You may obtain a copy of the License at
 4  
  * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed
 5  
  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 6  
  * implied. See the License for the specific language governing permissions and limitations under the License.
 7  
  */
 8  
 
 9  
 package org.kuali.student.common.dto;
 10  
 
 11  
 import java.io.Serializable;
 12  
 import java.util.ArrayList;
 13  
 import java.util.List;
 14  
 
 15  
 import javax.xml.bind.annotation.XmlElement;
 16  
 import javax.xml.bind.annotation.XmlTransient;
 17  
 
 18  
 import org.kuali.student.common.infc.Attribute;
 19  
 import org.kuali.student.common.infc.HasAttributes;
 20  
 
 21  
 @SuppressWarnings("serial")
 22  
 @XmlTransient
 23  
 public abstract class HasAttributesInfo implements HasAttributes, Serializable {
 24  
 
 25  
     @XmlElement
 26  
     protected final List<AttributeInfo> attributes;
 27  
 
 28  0
     protected HasAttributesInfo() {
 29  0
         attributes = null;
 30  0
     }
 31  
 
 32  0
     protected HasAttributesInfo(HasAttributes builder) {
 33  0
         attributes = new ArrayList<AttributeInfo>();
 34  
 
 35  0
         AttributeInfo.Builder attBuilder = new AttributeInfo.Builder();
 36  0
         for (Attribute att : builder.getAttributes()) {
 37  0
             attBuilder.setKey(att.getKey());
 38  0
             attBuilder.setValue(att.getValue());
 39  0
             attBuilder.setId(att.getId());
 40  0
             attributes.add(attBuilder.build());
 41  
         }
 42  0
     }
 43  
 
 44  
     /**
 45  
      * @return the attributes
 46  
      */
 47  
     @Override
 48  
     public List<AttributeInfo> getAttributes() {
 49  0
         return attributes;
 50  
     }
 51  
 
 52  
     public static class Builder implements HasAttributes {
 53  0
         private List<? extends Attribute> attributes = new ArrayList<AttributeInfo>();
 54  
 
 55  0
         public Builder() {}
 56  
 
 57  0
         public Builder(HasAttributes hasAtts) {
 58  0
             this.attributes = hasAtts.getAttributes();
 59  0
         }
 60  
 
 61  
         @Override
 62  
         public List<? extends Attribute> getAttributes() {
 63  0
             return attributes;
 64  
         }
 65  
 
 66  
         public void setAttributes(List<? extends Attribute> attributes) {
 67  0
             this.attributes = attributes;
 68  0
         }
 69  
     }
 70  
 }