BrightSide Workbench Full Report + Source Code
elephant-dossier/src/main/java/org/turro/dossier/entity/Project.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2016 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.dossier.entity;
20 
21 import java.util.Date;
22 import java.util.List;
23 import javax.persistence.Column;
24 import javax.persistence.Embedded;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.OneToOne;
30 import javax.persistence.Temporal;
31 import org.turro.string.Strings;
32 import org.turro.dossier.project.ProjectPhaseWrapper;
33 import org.turro.entities.IElephantEntity;
34 import org.turro.phase.PhaseDefinition;
35 import org.turro.phase.PhaseDefinitions;
36 
41 @Entity
42 public class Project implements java.io.Serializable {
43 
44  @Id
45  @GeneratedValue(strategy=GenerationType.IDENTITY)
46  @Column(name="IDENTIFIER")
47  private Long id;
48 
49  private String projectCode, projectTitle, goal;
50 
51  private int phase;
52 
53  private double estimatedBudget, assignedBudget;
54 
55  @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
56  private java.util.Date startDate, approvedDate, oppositingEndDate, endDate, changePhase;
57 
58  @Embedded
59  private GrantMatchCriteria matchCriteria = new GrantMatchCriteria();
60 
61  @OneToOne
62  private Dossier dossier;
63 
64  public Long getId() {
65  return id;
66  }
67 
68  public void setId(Long id) {
69  this.id = id;
70  }
71 
72  public String getProjectCode() {
73  return projectCode;
74  }
75 
76  public void setProjectCode(String projectCode) {
77  this.projectCode = projectCode;
78  }
79 
80  public String getProjectTitle() {
81  return projectTitle;
82  }
83 
84  public void setProjectTitle(String projectTitle) {
85  this.projectTitle = projectTitle;
86  }
87 
88  public String getGoal() {
89  return goal;
90  }
91 
92  public void setGoal(String goal) {
93  this.goal = goal;
94  }
95 
96  public int getPhase() {
97  return phase;
98  }
99 
100  public void setPhase(int phase) {
101  this.phase = phase;
102  }
103 
104  public double getEstimatedBudget() {
105  return estimatedBudget;
106  }
107 
108  public void setEstimatedBudget(double estimatedBudget) {
109  this.estimatedBudget = estimatedBudget;
110  }
111 
112  public double getAssignedBudget() {
113  return assignedBudget;
114  }
115 
116  public void setAssignedBudget(double assignedBudget) {
117  this.assignedBudget = assignedBudget;
118  }
119 
120  public Date getStartDate() {
121  return startDate;
122  }
123 
124  public void setStartDate(Date startDate) {
125  this.startDate = startDate;
126  }
127 
128  public Date getApprovedDate() {
129  return approvedDate;
130  }
131 
132  public void setApprovedDate(Date approvedDate) {
133  this.approvedDate = approvedDate;
134  }
135 
136  public Date getOppositingEndDate() {
137  return oppositingEndDate;
138  }
139 
140  public void setOppositingEndDate(Date oppositingEndDate) {
141  this.oppositingEndDate = oppositingEndDate;
142  }
143 
144  public Date getEndDate() {
145  return endDate;
146  }
147 
148  public void setEndDate(Date endDate) {
149  this.endDate = endDate;
150  }
151 
152  public Date getChangePhase() {
153  return changePhase;
154  }
155 
156  public void setChangePhase(Date changePhase) {
157  this.changePhase = changePhase;
158  }
159 
161  return matchCriteria;
162  }
163 
164  public void setMatchCriteria(GrantMatchCriteria matchCriteria) {
165  this.matchCriteria = matchCriteria;
166  }
167 
168  public Dossier getDossier() {
169  return dossier;
170  }
171 
172  public void setDossier(Dossier dossier) {
173  this.dossier = dossier;
174  }
175 
176  /* Helpers */
177 
178  public boolean isEmpty() {
179  return Strings.isBlank(projectTitle);
180  }
181 
183  return PhaseDefinitions.instance().get(phase);
184  }
185 
186  public void setPhaseDefinition(PhaseDefinition phase) {
187  this.phase = phase.getIndex();
188  }
189 
191  return new ProjectPhaseWrapper(this);
192  }
193 
194  public List<IElephantEntity> getGrantMatches() {
195  return matchCriteria != null ? matchCriteria.getMatchingsForDossier(dossier.getId()) : null;
196  }
197 
198 }
static PhaseDefinitions instance()
PhaseDefinition get(int index)