org.itracker.model
Class Version

java.lang.Object
  extended by org.itracker.model.AbstractEntity
      extended by org.itracker.model.Version
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Entity>, Entity

public class Version
extends AbstractEntity
implements Comparable<Entity>

A Project version.

A Version can only belong to 1 Project (composition).

Author:
ready
See Also:
Serialized Form

Nested Class Summary
static class Version.VersionComparator
          Compares 2 Versions by major and minor number.
 
Nested classes/interfaces inherited from class org.itracker.model.AbstractEntity
AbstractEntity.CreateDateComparator, AbstractEntity.IdComparator, AbstractEntity.LastModifiedDateComparator
 
Field Summary
static Comparator<Version> VERSION_COMPARATOR
           
 
Fields inherited from class org.itracker.model.AbstractEntity
CREATE_DATE_COMPARATOR, ID_COMPARATOR, LAST_MODIFIED_DATE_COMPARATOR
 
Constructor Summary
Version()
          Default constructor (required by Hibernate).
Version(Project project, String number)
          Creates a new active Version for the given Project.
 
Method Summary
 String getDescription()
           
 int getMajor()
           
 int getMinor()
           
 String getNumber()
           
 Project getProject()
           
 Status getStatus()
          Returns this version's status.
 void setDescription(String getDescription)
           
 void setMajor(int getMajor)
           
 void setMinor(int getMinor)
           
 void setNumber(String getNumber)
           
 void setProject(Project project)
           
 void setStatus(Status status)
          Sets this version's status.
 void setVersionInfo(String versionInfo)
          Convience method to set the number, major and minor fields with a single call.
 String toString()
           
 
Methods inherited from class org.itracker.model.AbstractEntity
clone, compareTo, equals, getCreateDate, getId, getLastModifiedDate, hashCode, isNew, setCreateDate, setId, setLastModifiedDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

VERSION_COMPARATOR

public static final Comparator<Version> VERSION_COMPARATOR
Constructor Detail

Version

public Version()
Default constructor (required by Hibernate).

PENDING: should be private so that it can only be used by Hibernate, to ensure that project and number, which form an instance's identity, are never null.


Version

public Version(Project project,
               String number)
Creates a new active Version for the given Project.

Parameters:
project - project to which this version belongs
number - unique within the project
Method Detail

getMajor

public int getMajor()

setMajor

public void setMajor(int getMajor)

getMinor

public int getMinor()

setMinor

public void setMinor(int getMinor)

getNumber

public String getNumber()

setNumber

public void setNumber(String getNumber)

getDescription

public String getDescription()

setDescription

public void setDescription(String getDescription)

getProject

public Project getProject()

setProject

public void setProject(Project project)

getStatus

public Status getStatus()
Returns this version's status.

Returns:
enum constant

setStatus

public void setStatus(Status status)
Sets this version's status.

Parameters:
status - enum constant
Throws:
IllegalArgumentException - status is null

setVersionInfo

public void setVersionInfo(String versionInfo)
Convience method to set the number, major and minor fields with a single call. It will first set the number to the provided data, and then attempt to parse the info if in the form major.minor into parts to set the other information.

Parameters:
versionInfo - the version number string to use

toString

public String toString()
Overrides:
toString in class Object
Returns:
Version [id=, project=, number=]


Copyright © 2002-2012 itracker. All Rights Reserved.