Coverage Report - org.directdemocracyportal.democracy.model.world.Resolution
 
Classes in this File Line Coverage Branch Coverage Complexity
Resolution
15%
3/20
0%
0/4
1.333
Resolution$ResolutionState
0%
0/7
N/A
1.333
 
 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.ArrayList;
 8  
 import java.util.Date;
 9  
 import java.util.List;
 10  
 
 11  
 import javax.persistence.CascadeType;
 12  
 import javax.persistence.Entity;
 13  
 import javax.persistence.EnumType;
 14  
 import javax.persistence.Enumerated;
 15  
 import javax.persistence.FetchType;
 16  
 import javax.persistence.OneToMany;
 17  
 import javax.persistence.Temporal;
 18  
 import javax.persistence.TemporalType;
 19  
 import javax.persistence.Transient;
 20  
 
 21  
 import org.hibernate.annotations.Cache;
 22  
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 23  
 
 24  
 /**
 25  
  * The Class Resolution.
 26  
  */
 27  
 @Entity
 28  
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
 29  1
 public class Resolution extends Document
 30  
 {
 31  
 
 32  
     /** The Constant serialVersionUID. */
 33  
     private static final long serialVersionUID = 5477103732940234132L;
 34  
 
 35  
     /** The href. */
 36  
     private String href;
 37  
 
 38  
     /** The resolution state. */
 39  
     private ResolutionState resolutionState;
 40  
 
 41  
     /** The decided date. */
 42  
     private Date decidedDate;
 43  
 
 44  
     /** The issues. */
 45  1
     private List<Issue> issues = new ArrayList<Issue>();
 46  
 
 47  
     /**
 48  
      * Gets the href.
 49  
      *
 50  
      * @return the href
 51  
      */
 52  
     public String getHref() {
 53  0
         return href;
 54  
     }
 55  
 
 56  
     /**
 57  
      * Sets the href.
 58  
      *
 59  
      * @param href the new href
 60  
      */
 61  
     public void setHref(String href) {
 62  0
         this.href = href;
 63  0
     }
 64  
 
 65  
     /**
 66  
      * Gets the resolution state.
 67  
      *
 68  
      * @return the resolution state
 69  
      */
 70  
     @Enumerated(EnumType.STRING)
 71  
     public ResolutionState getResolutionState() {
 72  0
         return resolutionState;
 73  
     }
 74  
 
 75  
     /**
 76  
      * Sets the resolution state.
 77  
      *
 78  
      * @param resolutionState the new resolution state
 79  
      */
 80  
     public void setResolutionState(ResolutionState resolutionState) {
 81  0
         this.resolutionState = resolutionState;
 82  0
     }
 83  
 
 84  
     /**
 85  
      * Gets the decided date.
 86  
      *
 87  
      * @return the decided date
 88  
      */
 89  
     @Temporal(TemporalType.DATE)
 90  
     public Date getDecidedDate() {
 91  0
         return decidedDate;
 92  
     }
 93  
 
 94  
     /**
 95  
      * Sets the decided date.
 96  
      *
 97  
      * @param decidedDate the new decided date
 98  
      */
 99  
     public void setDecidedDate(Date decidedDate) {
 100  0
         this.decidedDate = decidedDate;
 101  0
     }
 102  
 
 103  
 
 104  
     /**
 105  
      * Gets the issues.
 106  
      *
 107  
      * @return the issues
 108  
      */
 109  
     @OneToMany(mappedBy = "resolution", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
 110  
     public List<Issue> getIssues() {
 111  0
         return issues;
 112  
     }
 113  
 
 114  
     /**
 115  
      * Sets the issues.
 116  
      *
 117  
      * @param issues the new issues
 118  
      */
 119  
     public void setIssues(List<Issue> issues) {
 120  0
         this.issues = issues;
 121  0
     }
 122  
 
 123  
 
 124  
     /**
 125  
      * The Enum ResolutionState.
 126  
      */
 127  1
     public enum ResolutionState {
 128  
 
 129  
         /** The Created. */
 130  0
         Created,
 131  
 
 132  
         /** The Preparation. */
 133  0
         Preparation,
 134  
 
 135  
         /** The Public. */
 136  0
         Public,
 137  
 
 138  
         /** The Stayed. */
 139  0
         Stayed,
 140  
 
 141  
         /** The Decided. */
 142  0
         Decided,
 143  
 
 144  
         /** The Proccessed. */
 145  0
         Proccessed;
 146  
 
 147  
     }
 148  
 
 149  
     /**
 150  
      * Contains issue.
 151  
      *
 152  
      * @param name the name
 153  
      * @return true, if successful
 154  
      */
 155  
     @Transient
 156  
     public boolean containsIssue(String name) {
 157  0
         for (Issue issue : issues) {
 158  0
             if (name.equals(issue.getName())) {
 159  0
                 return true;
 160  
             }
 161  0
         }
 162  0
         return false;
 163  
     }
 164  
 
 165  
 }