18 package org.turro.dossier.entity;
20 import java.util.Date;
21 import java.util.List;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.ManyToOne;
28 import javax.persistence.Temporal;
29 import javax.persistence.TemporalType;
30 import org.turro.string.Strings;
31 import org.turro.dossier.db.DossierPU;
32 import org.turro.elephant.util.DateFormats;
33 import org.turro.jpa.entity.IDaoEntity;
34 import org.turro.util.Chars;
35 import org.turro.version.Version;
45 @GeneratedValue(strategy= GenerationType.IDENTITY)
46 @Column(name=
"IDENTIFIER")
49 private String versionId;
54 @Temporal(TemporalType.DATE)
55 private Date releaseDate;
57 private boolean active;
72 this.dossier = dossier;
88 this.releaseDate = releaseDate;
96 this.versionId = versionId;
108 return Strings.isBlank(versionId) ||
115 return "[" + versionId + Chars.forward().spaced().toString() +
DateFormats.
format(releaseDate,
true) +
"]";
118 private transient Long issueCount;
122 if(issueCount ==
null) {
124 "select count(issue) from Issue issue " +
125 "where issue.version = ?",
126 new Object[] {
this }
133 if(currentStatus ==
null) {
135 "select count(issue) from Issue issue " +
136 "where issue.version = ? " +
137 "and issue.status <> ? " +
138 "and issue.priority = ?",
145 "select count(issue) from Issue issue " +
146 "where issue.version = ? " +
147 "and issue.status <> ? " +
148 "and issue.priority = ?",
151 if(problematic > 0) {
155 "select count(issue) from Issue issue " +
156 "where issue.version = ? " +
157 "and issue.status <> ?",
168 return currentStatus;
174 "select concat('/issue/', id) from Issue issue " +
175 "where issue.version = ? " +
176 "and issue.status <> ? " +
177 "and issue.priority = ?",
182 "select concat('/issue/', id) from Issue issue " +
183 "where issue.version = ? " +
184 "and issue.status <> ? " +
185 "and issue.priority = ?",
194 return new Version(versionId).compareTo(
new Version(o !=
null ? o.versionId :
null));
String getVersionString()
void setActive(boolean active)
void setVersionId(String versionId)
List< String > getByStatus(DossierVersionStatus status)
DossierVersionStatus getStatus()
void setReleaseDate(Date releaseDate)
int compareTo(DossierVersion o)
void setDossier(Dossier dossier)
Object getSingleResult(WhereClause wc)
PRIORITY_WORKAROUND_IMPRACTICAL