Coverage Report - org.kuali.mobility.admin.entity.HomeTool
 
Classes in this File Line Coverage Branch Coverage Complexity
HomeTool
0%
0/35
0%
0/6
1.294
 
 1  
 /**
 2  
  * Copyright 2011 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  
 package org.kuali.mobility.admin.entity;
 16  
 
 17  
 import java.io.Serializable;
 18  
 
 19  
 import javax.persistence.Column;
 20  
 import javax.persistence.Entity;
 21  
 import javax.persistence.FetchType;
 22  
 import javax.persistence.GeneratedValue;
 23  
 import javax.persistence.GenerationType;
 24  
 import javax.persistence.Id;
 25  
 import javax.persistence.JoinColumn;
 26  
 import javax.persistence.ManyToOne;
 27  
 import javax.persistence.Table;
 28  
 import javax.persistence.Version;
 29  
 
 30  
 /**
 31  
  * Defines an object to link HomeScreen objects with Tool objects
 32  
  * @author Kuali Mobility Team (moblitiy.collab@kuali.org)
 33  
  */
 34  0
 @Entity
 35  
 @Table(name="KME_HM_TL_T")
 36  
 public class HomeTool implements Serializable, Comparable<HomeTool> {
 37  
         
 38  
         private static final long serialVersionUID = -8942674782383943102L;
 39  
 
 40  
         @Id
 41  
         @GeneratedValue(strategy = GenerationType.TABLE)
 42  
     @Column(name="ID")
 43  
     private Long homeToolId;
 44  
         
 45  
     @Column(name="HM_SCRN_ID", insertable=false, updatable=false)
 46  
     private Long homeScreenId;
 47  
         
 48  
     @Column(name="TL_ID", insertable=false, updatable=false)
 49  
     private Long toolId;
 50  
         
 51  
         @Column(name="ORDR")
 52  
         private int order;
 53  
                 
 54  
         @ManyToOne
 55  
         @JoinColumn(name="HM_SCRN_ID")
 56  
         private HomeScreen homeScreen;
 57  
         
 58  
         @ManyToOne(fetch = FetchType.EAGER)
 59  
         @JoinColumn(name="TL_ID")
 60  
         private Tool tool;
 61  
         
 62  
         @Version
 63  
     @Column(name="VER_NBR")
 64  
     private Long versionNumber;
 65  
 
 66  0
         public HomeTool() {}
 67  
         
 68  0
         public HomeTool(HomeScreen homeScreen, Tool tool, int order) {
 69  0
                 this.homeScreen = homeScreen;
 70  0
                 this.homeScreenId = homeScreen.getHomeScreenId();
 71  0
                 this.tool = tool;
 72  0
                 this.toolId = tool.getToolId();
 73  0
                 this.order = order;
 74  0
         }
 75  
 
 76  
         public Long getHomeScreenId() {
 77  0
                 return homeScreenId;
 78  
         }
 79  
 
 80  
         public void setHomeScreenId(Long homeScreenId) {
 81  0
                 this.homeScreenId = homeScreenId;
 82  0
         }
 83  
 
 84  
         public Long getToolId() {
 85  0
                 return toolId;
 86  
         }
 87  
 
 88  
         public void setToolId(Long toolId) {
 89  0
                 this.toolId = toolId;
 90  0
         }
 91  
 
 92  
         /**
 93  
          * @return the display order of the Tool for the associated HomeScreen
 94  
          */
 95  
         public int getOrder() {
 96  0
                 return order;
 97  
         }
 98  
 
 99  
         /**
 100  
          * set the display order of the Tool for the associated HomeScreen
 101  
          * @param order
 102  
          */
 103  
         public void setOrder(int order) {
 104  0
                 this.order = order;
 105  0
         }
 106  
 
 107  
         public Long getVersionNumber() {
 108  0
                 return versionNumber;
 109  
         }
 110  
 
 111  
         public void setVersionNumber(Long versionNumber) {
 112  0
                 this.versionNumber = versionNumber;
 113  0
         }
 114  
 
 115  
         public Long getHomeToolId() {
 116  0
                 return homeToolId;
 117  
         }
 118  
 
 119  
         public void setHomeToolId(Long homeToolId) {
 120  0
                 this.homeToolId = homeToolId;
 121  0
         }
 122  
 
 123  
         /**
 124  
          * @return the HomeScreen associated with the Tool
 125  
          */
 126  
         public HomeScreen getHomeScreen() {
 127  0
                 return homeScreen;
 128  
         }
 129  
 
 130  
         /**
 131  
          * set the HomeScreen to associate with the Tool
 132  
          * @param homeScreen
 133  
          */
 134  
         public void setHomeScreen(HomeScreen homeScreen) {
 135  0
                 this.homeScreen = homeScreen;
 136  0
         }
 137  
 
 138  
         /**
 139  
          * @return the Tool associated with the HomeScreen
 140  
          */
 141  
         public Tool getTool() {
 142  0
                 return tool;
 143  
         }
 144  
 
 145  
         /**
 146  
          * set the Tool to associate with the HomeScreen
 147  
          * @param tool
 148  
          */
 149  
         public void setTool(Tool tool) {
 150  0
                 this.tool = tool;
 151  0
         }
 152  
 
 153  
         @Override
 154  
         public int compareTo(HomeTool that) {
 155  0
                 if (that == null) {
 156  0
                         return -1;
 157  
                 }
 158  0
                 if (this.order == that.order) {
 159  0
                         return 0;
 160  
                 }
 161  0
                 return this.order < that.order ? -1 : 1;
 162  
         }        
 163  
         
 164  
 }