org.squashtest.csp.tm.domain.requirement
Class Requirement

java.lang.Object
  extended by org.squashtest.csp.tm.domain.requirement.RequirementLibraryNode<RequirementVersion>
      extended by org.squashtest.csp.tm.domain.requirement.Requirement
All Implemented Interfaces:
org.squashtest.csp.core.domain.Identified, AttachmentHolder, LibraryNode, ProjectResource

@Entity
public class Requirement
extends RequirementLibraryNode<RequirementVersion>
implements AttachmentHolder

Entity requirement Note that much of its setters will throw an IllegalRequirementModificationException if a modification is attempted while the status does not allow it.

Author:
bsiri

Constructor Summary
protected Requirement()
           
  Requirement(RequirementVersion version)
          Creates a new requirement which "latest version" is the given RequirementVersion
 
Method Summary
 void accept(RequirementLibraryNodeVisitor visitor)
          Implementors should ask the visitor to visit this object.
 Requirement createPastableCopy()
          Creates a copy usable in a copy / paste operation.
 RequirementVersion findLastNonObsoleteVersion()
           
 RequirementVersion findRequirementVersion(int versionNumber)
           
 AttachmentList getAttachmentList()
          Should return the container for this object's attachments.
 RequirementCategory getCategory()
           
 RequirementCriticality getCriticality()
           
 RequirementVersion getCurrentVersion()
           
 RequirementVersion getDefaultVerifiableVersion()
          returns this requirement's version which should be linked to a test case by default.
 String getDescription()
           
 String getName()
           
 String getReference()
           
 List<RequirementVersion> getRequirementVersions()
          Get the all the requirement versions numbers and status by the version Id
 RequirementVersion getResource()
           
 RequirementStatus getStatus()
           
 List<RequirementVersion> getUnmodifiableVersions()
           
 boolean hasNonObsoleteVersion()
           
 void increaseVersion()
           
 void increaseVersion(RequirementVersion newVersion)
           
 boolean isLinkable()
           
 boolean isModifiable()
          Tells if this requirement's "intrinsic" properties can be modified.
 void setCategory(RequirementCategory category)
          Set the requirement category
 void setCriticality(RequirementCriticality criticality)
          Set the requirement criticality
 void setDescription(String description)
           
 void setName(String name)
           
 void setReference(String reference)
          Set the requirement reference
 void setStatus(RequirementStatus status)
           
 
Methods inherited from class org.squashtest.csp.tm.domain.requirement.RequirementLibraryNode
getId, getLibrary, getProject, notifyAssociatedWithProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Requirement

protected Requirement()

Requirement

public Requirement(@NotNull
                   RequirementVersion version)
Creates a new requirement which "latest version" is the given RequirementVersion

Parameters:
version -
Method Detail

setName

public void setName(String name)
Specified by:
setName in interface LibraryNode
Parameters:
name - The name of this node. Should not be blank or null.

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface LibraryNode
Parameters:
description - the new node description

accept

public void accept(RequirementLibraryNodeVisitor visitor)
Description copied from class: RequirementLibraryNode
Implementors should ask the visitor to visit this object.

Specified by:
accept in class RequirementLibraryNode<RequirementVersion>

getAttachmentList

public AttachmentList getAttachmentList()
Description copied from interface: AttachmentHolder
Should return the container for this object's attachments. Should never return null.

Specified by:
getAttachmentList in interface AttachmentHolder
Returns:
the AttachmentList of this object.

getReference

public String getReference()
Returns:
the reference of the requirement

setReference

public void setReference(String reference)
Set the requirement reference

Parameters:
reference -

getRequirementVersions

public List<RequirementVersion> getRequirementVersions()
Get the all the requirement versions numbers and status by the version Id


createPastableCopy

public Requirement createPastableCopy()
Creates a copy usable in a copy / paste operation. The copy is associated to no version, it should be done by the caller (the latest version might not be eligible for copy / paste).

Specified by:
createPastableCopy in interface LibraryNode
Specified by:
createPastableCopy in class RequirementLibraryNode<RequirementVersion>

getCriticality

public RequirementCriticality getCriticality()
Returns:
the requirement criticality

setCriticality

public void setCriticality(RequirementCriticality criticality)
Set the requirement criticality

Parameters:
criticality -

getCategory

public RequirementCategory getCategory()
Returns:
the requirement category

setCategory

public void setCategory(RequirementCategory category)
Set the requirement category

Parameters:
category -

setStatus

public void setStatus(RequirementStatus status)

getStatus

public RequirementStatus getStatus()

isLinkable

public boolean isLinkable()
Returns:
true if this requirement can be (un)linked by new verifying testcases

isModifiable

public boolean isModifiable()
Tells if this requirement's "intrinsic" properties can be modified. The following are not considered as "intrinsic" properties" : #verifyingTestCases are governed by the isLinkable() state, #status is governed by itself.

Returns:
true if this requirement's properties can be modified.

getName

public String getName()
Specified by:
getName in interface LibraryNode
Returns:
Name of this node.

getDescription

public String getDescription()
Specified by:
getDescription in interface LibraryNode

getCurrentVersion

public RequirementVersion getCurrentVersion()

getResource

public RequirementVersion getResource()
Specified by:
getResource in class RequirementLibraryNode<RequirementVersion>

increaseVersion

public void increaseVersion()

increaseVersion

public void increaseVersion(RequirementVersion newVersion)

getDefaultVerifiableVersion

public RequirementVersion getDefaultVerifiableVersion()
returns this requirement's version which should be linked to a test case by default.

Returns:

getUnmodifiableVersions

public List<RequirementVersion> getUnmodifiableVersions()
Returns:
an unmodifiable view of this requirement's versions

hasNonObsoleteVersion

public boolean hasNonObsoleteVersion()
Returns:
false if all requirement versions are obsolete

findLastNonObsoleteVersion

public RequirementVersion findLastNonObsoleteVersion()
Returns:
the last non obsolete requirement version
or null if all versions are obsolete

findRequirementVersion

public RequirementVersion findRequirementVersion(int versionNumber)


Copyright © 2010-2012 Henix, henix.fr. All Rights Reserved.