Coverage Report - org.directdemocracyportal.democracy.model.world.Region
 
Classes in this File Line Coverage Branch Coverage Complexity
Region
25%
3/12
N/A
1
 
 1  
 /*
 2  
 Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
 3  
         $Id
 4  
 */
 5  
 package org.directdemocracyportal.democracy.model.world;
 6  
 
 7  
 import java.util.HashSet;
 8  
 import java.util.Set;
 9  
 
 10  
 import javax.persistence.CascadeType;
 11  
 import javax.persistence.Entity;
 12  
 import javax.persistence.FetchType;
 13  
 import javax.persistence.JoinColumn;
 14  
 import javax.persistence.ManyToOne;
 15  
 import javax.persistence.OneToMany;
 16  
 
 17  
 import org.directdemocracyportal.democracy.model.core.Environment;
 18  
 import org.hibernate.annotations.Cache;
 19  
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 20  
 
 21  
 /**
 22  
  * The Class Region.
 23  
  */
 24  
 @Entity
 25  
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
 26  
 public class Region extends Environment
 27  
 {
 28  
 
 29  
     /** The Constant serialVersionUID. */
 30  
     private static final long serialVersionUID = 614889376820015758L;
 31  
 
 32  
     /** The parent. */
 33  
     private Region parent;
 34  
 
 35  
     /** The region type. */
 36  
     private RegionType regionType;
 37  
 
 38  
     /** The parts. */
 39  2
     private Set<Region> parts = new HashSet<Region>();
 40  
 
 41  
     /**
 42  
      * Instantiates a new region.
 43  
      */
 44  2
     public Region() {
 45  2
     }
 46  
 
 47  
     /**
 48  
      * Gets the parent.
 49  
      *
 50  
      * @return the parent
 51  
      */
 52  
     @ManyToOne
 53  
     @JoinColumn
 54  
     public Region getParent() {
 55  0
         return parent;
 56  
     }
 57  
 
 58  
     /**
 59  
      * Sets the parent.
 60  
      *
 61  
      * @param parent the new parent
 62  
      */
 63  
     public void setParent(Region parent) {
 64  0
         this.parent = parent;
 65  0
     }
 66  
 
 67  
     /**
 68  
      * Gets the parts.
 69  
      *
 70  
      * @return the parts
 71  
      */
 72  
     @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
 73  
     public Set<Region> getParts() {
 74  0
         return parts;
 75  
     }
 76  
 
 77  
     /**
 78  
      * Sets the parts.
 79  
      *
 80  
      * @param parts the new parts
 81  
      */
 82  
     public void setParts(Set<Region> parts) {
 83  0
         this.parts = parts;
 84  0
     }
 85  
 
 86  
     /**
 87  
      * Gets the region type.
 88  
      *
 89  
      * @return the region type
 90  
      */
 91  
     public RegionType getRegionType() {
 92  0
         return regionType;
 93  
     }
 94  
 
 95  
     /**
 96  
      * Sets the region type.
 97  
      *
 98  
      * @param regionType the new region type
 99  
      */
 100  
     public void setRegionType(RegionType regionType) {
 101  0
         this.regionType = regionType;
 102  0
     }
 103  
 }