Coverage Report - net.sf.webphotos.model.CategoryVO
 
Classes in this File Line Coverage Branch Coverage Complexity
CategoryVO
0%
0/35
0%
0/12
1,533
 
 1  
 /**
 2  
  * Copyright 2008 WebPhotos
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 /*
 17  
  * To change this template, choose Tools | Templates
 18  
  * and open the template in the editor.
 19  
  */
 20  
 package net.sf.webphotos.model;
 21  
 
 22  
 import java.io.Serializable;
 23  
 import javax.persistence.*;
 24  
 import net.sf.webphotos.entity.HasID;
 25  
 
 26  
 /**
 27  
  *
 28  
  * @author Guilhe
 29  
  */
 30  0
 @Entity
 31  
 @Table(name = "CATEGORIAS")
 32  
 @NamedQueries({
 33  
     @NamedQuery(name = "CategoryVO.findByCategoriaID", query = "SELECT c FROM CategoryVO c WHERE c.categoriaID = :categoriaID"),
 34  
     @NamedQuery(name = "CategoryVO.findByNmcategoria", query = "SELECT c FROM CategoryVO c WHERE c.nmcategoria = :nmcategoria")})
 35  
 public class CategoryVO implements Serializable, HasID<Integer> {
 36  
 
 37  
     private static final long serialVersionUID = 1L;
 38  
     
 39  
     @Id
 40  
     @Column(name = "CATEGORIAID", nullable = false)
 41  
     @GeneratedValue(strategy=GenerationType.IDENTITY)
 42  
     private Integer categoriaID;
 43  
     
 44  
     @Column(name = "NMCATEGORIA", nullable = false)
 45  
     private String nmcategoria;
 46  
     
 47  
     @ManyToOne(optional = true)
 48  
     @JoinColumn(name = "CATEGORIAPAI")
 49  
     private CategoryVO categoriaPai;
 50  
 
 51  
     @Deprecated
 52  0
     public CategoryVO() {
 53  0
     }
 54  
 
 55  
     @Deprecated
 56  0
     public CategoryVO(Integer categoriaID) {
 57  0
         this.categoriaID = categoriaID;
 58  0
     }
 59  
 
 60  
     @Deprecated
 61  
     public CategoryVO(Integer categoriaID, String nmcategoria) {
 62  0
         this(categoriaID);
 63  0
         this.nmcategoria = nmcategoria;
 64  0
     }
 65  
 
 66  0
     public CategoryVO(String nmcategoria) {
 67  0
         this.nmcategoria = nmcategoria;
 68  0
     }
 69  
 
 70  
     public CategoryVO(String nmcategoria, CategoryVO categoriaPai) {
 71  0
         this(nmcategoria);
 72  0
         this.categoriaPai = categoriaPai;
 73  0
     }
 74  
     
 75  
     public Integer getCategoriaID() {
 76  0
         return categoriaID;
 77  
     }
 78  
 
 79  
     public void setCategoriaID(Integer categoriaid) {
 80  0
         this.categoriaID = categoriaid;
 81  0
     }
 82  
 
 83  
     public String getNmcategoria() {
 84  0
         return nmcategoria;
 85  
     }
 86  
 
 87  
     public void setNmcategoria(String nmcategoria) {
 88  0
         this.nmcategoria = nmcategoria;
 89  0
     }
 90  
 
 91  
     /**
 92  
      * @return the categoriaPai
 93  
      */
 94  
     public CategoryVO getCategoriaPai() {
 95  0
         return categoriaPai;
 96  
     }
 97  
 
 98  
     /**
 99  
      * @param categoriaPai the categoriaPai to set
 100  
      */
 101  
     public void setCategoriaPai(CategoryVO categoriaPai) {
 102  0
         this.categoriaPai = categoriaPai;
 103  0
     }
 104  
 
 105  
     @Override
 106  
     public int hashCode() {
 107  0
         int hash = 0;
 108  0
         hash += (categoriaID != null ? categoriaID.hashCode() : 0);
 109  0
         return hash;
 110  
     }
 111  
 
 112  
     @Override
 113  
     public boolean equals(Object object) {
 114  
         // TODO: Warning - this method won't work in the case the id fields are not set
 115  0
         if (!(object instanceof CategoryVO)) {
 116  0
             return false;
 117  
         }
 118  0
         CategoryVO other = (CategoryVO) object;
 119  0
         if ((this.categoriaID == null && other.categoriaID != null) || (this.categoriaID != null && !this.categoriaID.equals(other.categoriaID))) {
 120  0
             return false;
 121  
         }
 122  0
         return true;
 123  
     }
 124  
 
 125  
     @Override
 126  
     public String toString() {
 127  0
         return this.getClass().getCanonicalName() + "[categoriaid=" + categoriaID + "]";
 128  
     }
 129  
 
 130  
     @Override
 131  
     public Integer getId() {
 132  0
         return categoriaID;
 133  
     }
 134  
 }