org.squashtest.tm.domain.requirement
Class Requirement

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

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

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(NodeContainerVisitor visitor)
           
 void accept(NodeVisitor visitor)
           
 void accept(RequirementLibraryNodeVisitor visitor)
          Implementors should ask the visitor to visit this object.
 void addContent(Requirement child)
          Adds new content to this container.
 TreeMap<RequirementVersion,RequirementVersion> addPreviousVersionsCopiesToCopy(Requirement copy)
          Will create copies for all non obsolete versions older than the current version, and add it to the copy.
 Requirement createCopy()
          Creates a copy usable in a copy / paste operation.
 RequirementVersion findLastNonObsoleteVersion()
           
 RequirementVersion findRequirementVersion(int versionNumber)
           
 RequirementCategory getCategory()
           
 Set<Requirement> getContent()
           
 List<String> getContentNames()
           
 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()
           
 Collection<Requirement> getOrderedContent()
          Will return the ordered (if order there is) content nodes.
 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 hasContent()
           
 boolean hasNonObsoleteVersion()
           
 void increaseVersion()
           
 void increaseVersion(RequirementVersion newVersion)
           
 boolean isContentNameAvailable(String name)
           
 boolean isLinkable()
           
 boolean isModifiable()
          Tells if this requirement's "intrinsic" properties can be modified.
 void removeContent(Requirement exChild)
           
 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.tm.domain.requirement.RequirementLibraryNode
getAttachmentList, getId, getLibrary, getProject, notifyAssociatedWithProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.squashtest.tm.domain.library.NodeContainer
getProject
 
Methods inherited from interface org.squashtest.tm.domain.Identified
getId
 

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 Copiable
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>

accept

public void accept(NodeVisitor visitor)
Specified by:
accept in interface TreeNode

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


createCopy

public Requirement createCopy()
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:
createCopy in interface Copiable

addPreviousVersionsCopiesToCopy

public TreeMap<RequirementVersion,RequirementVersion> addPreviousVersionsCopiesToCopy(Requirement copy)
Will create copies for all non obsolete versions older than the current version, and add it to the copy.

Parameters:
copy - : The requirement copy
Returns:
a TreeMap of RequirementVersion copy by source ordered younger to older.

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 Copiable
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)

addContent

public void addContent(@NotNull
                       Requirement child)
                throws DuplicateNameException,
                       org.apache.commons.lang.NullArgumentException
Description copied from interface: NodeContainer
Adds new content to this container. Should refuse to add null content, should refuse to add content with duplicate name.

Specified by:
addContent in interface NodeContainer<Requirement>
Throws:
DuplicateNameException
org.apache.commons.lang.NullArgumentException

isContentNameAvailable

public boolean isContentNameAvailable(String name)
Specified by:
isContentNameAvailable in interface NodeContainer<Requirement>

getContent

public Set<Requirement> getContent()
Specified by:
getContent in interface NodeContainer<Requirement>

getOrderedContent

public Collection<Requirement> getOrderedContent()
Description copied from interface: NodeContainer
Will return the ordered (if order there is) content nodes.

Specified by:
getOrderedContent in interface NodeContainer<Requirement>
Returns:

hasContent

public boolean hasContent()
Specified by:
hasContent in interface NodeContainer<Requirement>

removeContent

public void removeContent(Requirement exChild)
                   throws org.apache.commons.lang.NullArgumentException
Specified by:
removeContent in interface NodeContainer<Requirement>
Throws:
org.apache.commons.lang.NullArgumentException

getContentNames

public List<String> getContentNames()
Specified by:
getContentNames in interface NodeContainer<Requirement>

accept

public void accept(NodeContainerVisitor visitor)
Specified by:
accept in interface NodeContainer<Requirement>


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