Coverage Report - org.kuali.student.core.comment.entity.Comment
 
Classes in this File Line Coverage Branch Coverage Complexity
Comment
95%
21/22
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.core.comment.entity;
 17  
 
 18  
 import java.util.Date;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.persistence.CascadeType;
 22  
 import javax.persistence.Column;
 23  
 import javax.persistence.Entity;
 24  
 import javax.persistence.JoinColumn;
 25  
 import javax.persistence.ManyToOne;
 26  
 import javax.persistence.NamedQueries;
 27  
 import javax.persistence.NamedQuery;
 28  
 import javax.persistence.OneToMany;
 29  
 import javax.persistence.Table;
 30  
 import javax.persistence.Temporal;
 31  
 import javax.persistence.TemporalType;
 32  
 
 33  
 import org.kuali.student.core.entity.AttributeOwner;
 34  
 import org.kuali.student.core.entity.MetaEntity;
 35  
 
 36  
 /**
 37  
  * This is a description of what this class does - lindholm don't forget to fill this in.
 38  
  *
 39  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 40  
  *
 41  
  */
 42  
 @Entity
 43  
 @Table(name = "KSCO_COMMENT")
 44  
 @NamedQueries( {
 45  
         @NamedQuery(name = "Comment.getComments", query = "SELECT  comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId ORDER BY comment.meta.updateTime DESC"),
 46  
         @NamedQuery(name = "Comment.getComment", query = "SELECT  comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId"),
 47  
         @NamedQuery(name = "Comment.getCommentsByType", query = "SELECT  comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId AND comment.type.id =:commentTypeId"),
 48  
         @NamedQuery(name = "Comment.getCommentsByRefId", query="SELECT comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId")})
 49  14
 public class Comment extends MetaEntity implements AttributeOwner<CommentAttribute> {
 50  
     private static final long serialVersionUID = 1L;
 51  
 
 52  
     @ManyToOne(cascade = CascadeType.ALL)
 53  
     @JoinColumn(name = "RT_DESCR_ID")
 54  
     private CommentRichText commentText;
 55  
 
 56  
     @ManyToOne
 57  
     @JoinColumn(name = "REFERENCE")
 58  
     private Reference reference;
 59  
 
 60  
     @Temporal(TemporalType.TIMESTAMP)
 61  
     @Column(name = "EFF_DT")
 62  
     private Date effectiveDate;
 63  
 
 64  
     @Temporal(TemporalType.TIMESTAMP)
 65  
     @Column(name = "EXPIR_DT")
 66  
     private Date expirationDate;
 67  
 
 68  
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
 69  
     private List<CommentAttribute> attributes;
 70  
 
 71  
     @ManyToOne
 72  
     @JoinColumn(name = "TYPE")
 73  
     private CommentType type;
 74  
 
 75  
     @Column(name = "STATE")
 76  
     private String state;
 77  
 
 78  
     /**
 79  
      * @return the commentText
 80  
      */
 81  
     public CommentRichText getCommentText() {
 82  11
         return commentText;
 83  
     }
 84  
 
 85  
     /**
 86  
      * @param commentText the commentText to set
 87  
      */
 88  
     public void setCommentText(CommentRichText commentText) {
 89  5
         this.commentText = commentText;
 90  5
     }
 91  
 
 92  
     /**
 93  
          * @param reference the reference to set
 94  
          */
 95  
         public void setReference(Reference reference) {
 96  5
                 this.reference = reference;
 97  5
         }
 98  
 
 99  
         /**
 100  
          * @return the reference
 101  
          */
 102  
         public Reference getReference() {
 103  0
                 return reference;
 104  
         }
 105  
 
 106  
         /**
 107  
      * @return the effectiveDate
 108  
      */
 109  
     public Date getEffectiveDate() {
 110  11
         return effectiveDate;
 111  
     }
 112  
 
 113  
     /**
 114  
      * @param effectiveDate the effectiveDate to set
 115  
      */
 116  
     public void setEffectiveDate(Date effectiveDate) {
 117  5
         this.effectiveDate = effectiveDate;
 118  5
     }
 119  
 
 120  
     /**
 121  
      * @return the expirationDate
 122  
      */
 123  
     public Date getExpirationDate() {
 124  11
         return expirationDate;
 125  
     }
 126  
 
 127  
     /**
 128  
      * @param expirationDate the expirationDate to set
 129  
      */
 130  
     public void setExpirationDate(Date expirationDate) {
 131  5
         this.expirationDate = expirationDate;
 132  5
     }
 133  
 
 134  
 
 135  
     @Override
 136  
     public List<CommentAttribute> getAttributes() {
 137  38
         return attributes;
 138  
     }
 139  
 
 140  
     @Override
 141  
     public void setAttributes(List<CommentAttribute> attributes) {
 142  13
         this.attributes = attributes;
 143  13
     }
 144  
 
 145  
     /**
 146  
      * @return the type
 147  
      */
 148  
     public CommentType getType() {
 149  11
         return type;
 150  
     }
 151  
 
 152  
     /**
 153  
      * @param type the type to set
 154  
      */
 155  
     public void setType(CommentType type) {
 156  5
         this.type = type;
 157  5
     }
 158  
 
 159  
     /**
 160  
      * @return the state
 161  
      */
 162  
     public String getState() {
 163  11
         return state;
 164  
     }
 165  
 
 166  
     /**
 167  
      * @param state the state to set
 168  
      */
 169  
     public void setState(String state) {
 170  5
         this.state = state;
 171  5
     }
 172  
 
 173  
 }