1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
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.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.businessobjects.commons;
16
17 import org.figure8.join.core.SortableEntityObject;
18
19 import java.util.Date;
20 /**
21 * This is an entity representing a release of the software project
22 * that is using Join for its integration phases management.
23 * <br/>
24 * A release is defined using a name (that should be unique), a major
25 * and a minor release number (ex: "2.0"); it should also have a
26 * shipping date.
27 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
28 * @version $Revision: 1.3 $
29 *
30 * @hibernate.class table="join_releases" lazy="true"
31 * @hibernate.cache usage="read-write"
32 *
33 * @hibernate.query name="join.release_findByName"
34 * query="from Release rel where rel.name = :releaseName"
35 * @hibernate.query name="join.release_findByNumbers"
36 * query="from Release rel where rel.major = :majorNb and rel.minor = :minorNb"
37 */
38 public class Release extends SortableEntityObject{
39
40
41
42 /** The release name */
43 private String name;
44 /** The release major version */
45 private int major;
46 /** The release minor version */
47 private int minor;
48 /** The release ship date */
49 private Date shippingDate;
50
51
52
53
54 /** Creates a new instance of Release */
55 public Release(){
56 }
57
58 /**
59 * Creates a new instance of Release with mandatory fields.
60 * @param name This release name (must be unique)
61 * @param major Major version number
62 * @param minor Minor version number
63 * @param shippingDate Release shipping date
64 */
65 public Release(String name, int major, int minor, Date shippingDate){
66 this.name = name;
67 this.major = major;
68 this.minor = minor;
69 this.shippingDate = shippingDate;
70 }
71
72
73
74
75 /**
76 * @hibernate.property column="s_name"
77 * not-null="true" unique="true"
78 * length="40"
79 * @return This release name
80 */
81 public String getName(){
82 return name;
83 }
84 /** @param name This release name */
85 public void setName(String name){
86 this.name = name;
87 }
88
89 /**
90 * @hibernate.property column="n_major"
91 * not-null="true"
92 * @return This release major number
93 */
94 public int getMajor(){
95 return major;
96 }
97 /** @param major This release major number */
98 public void setMajor(int major){
99 this.major = major;
100 }
101
102 /**
103 * @hibernate.property column="n_minor"
104 * not-null="true"
105 * @return This release minor number
106 */
107 public int getMinor(){
108 return minor;
109 }
110 /** @param minor This release minor number */
111 public void setMinor(int minor){
112 this.minor = minor;
113 }
114
115 /**
116 * @hibernate.property column="d_ship"
117 * not-null="true"
118 * @return This release shipping date
119 */
120 public Date getShippingDate(){
121 return shippingDate;
122 }
123 /** @param ship This release shipping date */
124 public void setShippingDate(Date ship){
125 this.shippingDate = ship;
126 }
127
128
129
130
131 /**
132 * Get the comparision criterion as a string. Major + minor numbers here.
133 * @return The string representation of comparison and sort cirterion
134 */
135 public String getStringForComparison(){
136 String comp = (getMajor() < 10) ? "0" + String.valueOf(getMajor()) : String.valueOf(getMajor());
137 return (comp + getMinor());
138 }
139 }