Package com.piketec.tpt.api
Interface Requirement
-
- All Superinterfaces:
IdentifiableRemote
,java.rmi.Remote
,TptRemote
public interface Requirement extends IdentifiableRemote
TPT API representation of a requirement. This interface allows more manipulation than the user can do from the UI. The UI only allows globally removing an attribute and editing the comment.
Note: Changing the requirement via API - in contrast to changing it by importing requirements - will not lead to a "modified" state of the requirement. Only UI actions that lead to a "modified" state will do so via API as well, e.g. setting status to "deleted". Otherwise usemarkAsModified()
to set the status to modified explicitly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Requirement.RequirementStatus
There are three types of status for requirements.static class
Requirement.RequirementType
There are three types of requirements.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Attachment
createAttributeAttachment(java.lang.String attributeName, java.lang.String fileName, byte[] content)
Adds a new attachment to the list of attachments every requirement attribute can have.FormalRequirementStep
createFormalRequirmentsStep(int index, java.lang.String type)
Creates a formal requirement step of a given type at the given position.Attachment
createRequirementAttachment(java.lang.String fileName, byte[] content)
Adds a new attachment to the list of attachments every requirement can have directly.Requirement
createSubRequirement(java.lang.String id)
Adds a new sub-requirement to this requirementRemoteList<Attachment>
getAttributeAttachments(java.lang.String attributeName)
Delivers the list of attachments every requirement attribute can have.java.util.Map<java.lang.String,java.lang.String>
getAttributes()
Returns the attributes and the associated values of the requirement.java.lang.String
getComment()
Get the comment of the requirement.java.lang.String
getDocument()
A requirement normally belongs to a document.java.lang.String
getDocumentVersion()
Get the document version of the requirement.RemoteList<FormalRequirementStep>
getFormalRequirmentsSteps()
Returns all formal requirement steps of the requirement.java.lang.String
getID()
Every requirement has a unique ID.int
getIndentLevel()
Get the indent level of the requirement.RemoteCollection<Assessment>
getLinkedAssessments()
Get all assesslets linked to this requirement.RemoteCollection<Scenario>
getLinkedScenarios()
Get all test cases and variants linked to this requirement.java.util.Set<Scenario>
getLinkedTestCases()
Returns all (explicit and implicit) to thisRequirement
linkedtest cases
.java.lang.String
getModule()
Deprecated.UsegetDocument()
instead.Requirement
getParentRequirement()
Returns a parentRequirement
if this is a sub-requirement, otherwisenull
RemoteList<Attachment>
getRequirementAttachments()
Delivers the list of attachments the requirement directly has.Requirement.RequirementStatus
getStatus()
Returns the current requirement status.java.util.List<Requirement>
getSubRequirements()
Returns all sub-requirements of thisRequirement
java.lang.String
getText()
Get the describing text a requirement normally has.Requirement.RequirementType
getType()
Get the type of the requirement.java.net.URI
getURI()
Get the URI of the requirement.boolean
isModified()
Returnstrue
if the requirement is marked as modified, otherwisefalse
.boolean
isSubRequirement()
Returnstrue
if the requirement is a sub-requirement, otherwisefalse
.void
linkAssessment(AssessmentOrGroup aog)
Creates a link between this requirement and the givenAssessment
.void
linkScenario(ScenarioOrGroup sog)
Creates a link between this requirement and the givenScenario
.void
markAsModified()
Marks this requirement as modified.void
markAsReviewed()
Marks this requirement as reviewed.void
removeAllAttributeAttachments(java.lang.String attributeName)
Removes all attachments of the requirement attribute with the given name.void
removeAttributeAttachment(java.lang.String attributeName, Attachment attachment)
Removes the attachment of the requirement attribute with the given name.void
setAttribute(java.lang.String attributeName, java.lang.String value)
Set the attribute value of the requirement.void
setComment(java.lang.String comment)
Set the comment of the requirement.void
setStatus(Requirement.RequirementStatus status)
Sets the requirement status.void
setText(java.lang.String text)
Set the describing text a requirement normally has.void
setType(Requirement.RequirementType type)
Set the type of the requirement.void
setURI(java.net.URI uri)
Set the URI of the requirement.-
Methods inherited from interface com.piketec.tpt.api.IdentifiableRemote
getIdentifier
-
-
-
-
Method Detail
-
getType
Requirement.RequirementType getType() throws java.rmi.RemoteException
Get the type of the requirement.- Returns:
- The type of the requirement.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setType
void setType(Requirement.RequirementType type) throws java.rmi.RemoteException
Set the type of the requirement.- Parameters:
type
- The new type of the Requirement- Throws:
java.rmi.RemoteException
- remote communication problem
-
getID
java.lang.String getID() throws java.rmi.RemoteException
Every requirement has a unique ID.- Returns:
- The unique ID.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getDocument
java.lang.String getDocument() throws java.rmi.RemoteException
A requirement normally belongs to a document. The default docmuent is an empty string.- Returns:
- The name of the document the requirement belongs to.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getDocumentVersion
java.lang.String getDocumentVersion() throws java.rmi.RemoteException
Get the document version of the requirement.- Returns:
- The requirement's document version.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getModule
@Deprecated java.lang.String getModule() throws java.rmi.RemoteException
Deprecated.UsegetDocument()
instead. Removed in TPT-19. ThrowsDeprecatedAndRemovedException
.A requirement normally belongs to a module. The default module is an empty string.- Returns:
- The name of the module the requirement belongs to.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getText
java.lang.String getText() throws java.rmi.RemoteException
Get the describing text a requirement normally has.- Returns:
- The describing text of the requirement.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setText
void setText(java.lang.String text) throws java.rmi.RemoteException
Set the describing text a requirement normally has.- Parameters:
text
- The new describing text.Null
will be reduced to an empty string.- Throws:
java.rmi.RemoteException
- remote communication problem
-
getComment
java.lang.String getComment() throws java.rmi.RemoteException
Get the comment of the requirement. This comment is also editable from the UI.- Returns:
- The comment of the requirement.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setComment
void setComment(java.lang.String comment) throws java.rmi.RemoteException
Set the comment of the requirement. This comment is also editable from the UI.- Parameters:
comment
- The new comment of the requirement.Null
will be reduced to an empty string.- Throws:
java.rmi.RemoteException
- remote communication problem
-
getURI
java.net.URI getURI() throws java.rmi.RemoteException
Get the URI of the requirement. If a requirement has a URI a clickable link symbol will be displayed in the UI.- Returns:
- The URI of the requirement or
null
. - Throws:
java.rmi.RemoteException
- remote communication problem
-
getIndentLevel
int getIndentLevel() throws java.rmi.RemoteException
Get the indent level of the requirement. This is the indentation of the requirement in the requirement table. There may be another user attribute indent level or object level. This method returns the internal attribute, that is used to layout the requirements in the UI.- Returns:
- The indent level of the requirement.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setURI
void setURI(java.net.URI uri) throws java.rmi.RemoteException
Set the URI of the requirement. If a requirement has a URI a clickable link symbol will be displayed in the UI.- Parameters:
uri
- The new URI ornull
to remove the link.- Throws:
java.rmi.RemoteException
- remote communication problem
-
getAttributes
java.util.Map<java.lang.String,java.lang.String> getAttributes() throws java.rmi.RemoteException
Returns the attributes and the associated values of the requirement. A requirement can have additional attributes. Each attribute has a value associated for the requirement.- Returns:
- A map from attribute name to value.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setAttribute
void setAttribute(java.lang.String attributeName, java.lang.String value) throws java.rmi.RemoteException
Set the attribute value of the requirement. A requirement can have additional attributes. Each attribute has a value associated for the requirement. If the attribute does not exist yet it will be created.- Parameters:
attributeName
- The name of the attribute.value
- The new value of the attribute.- Throws:
java.rmi.RemoteException
- remote communication problem
-
getRequirementAttachments
RemoteList<Attachment> getRequirementAttachments() throws java.rmi.RemoteException
Delivers the list of attachments the requirement directly has. This list is shown in the UI as attachments to the attribute "Text". For attachments of other attributes seegetAttributeAttachments(String)
.- Returns:
- The List of attachments of the requirement.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
createRequirementAttachment
Attachment createRequirementAttachment(java.lang.String fileName, byte[] content) throws java.rmi.RemoteException
Adds a new attachment to the list of attachments every requirement can have directly. This list is shown in the UI as attachments to the attribute "Text". For attachments of other attributes seecreateAttributeAttachment(String, String, byte[])
.- Parameters:
fileName
- The file name of the attachment. The file name is used to create temporary files when viewing the attachment and will be shown in the UI as tooltip in TPT.content
- The content of the attachment.- Returns:
- The newly created attachment
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getAttributeAttachments
RemoteList<Attachment> getAttributeAttachments(java.lang.String attributeName) throws java.rmi.RemoteException
Delivers the list of attachments every requirement attribute can have. The default attributes "ID", "Text", "URI", and "Comment" cannot have attachments but attachments of the requirement (seegetRequirementAttachments()
) will be shown in the UI as attachments of "Text".- Parameters:
attributeName
- The name of the attribute.- Returns:
- The List of attachments of the given attribute. Returns
null
if the attribute is not defined for the requirement. - Throws:
java.rmi.RemoteException
- remote communication problem
-
removeAttributeAttachment
void removeAttributeAttachment(java.lang.String attributeName, Attachment attachment) throws java.rmi.RemoteException
Removes the attachment of the requirement attribute with the given name.- Parameters:
attributeName
- The name of the attribute.attachment
- The attachment to remove- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if the attachment and the requirement from different projects or if the name of the attribute is empty ornull
-
removeAllAttributeAttachments
void removeAllAttributeAttachments(java.lang.String attributeName) throws java.rmi.RemoteException
Removes all attachments of the requirement attribute with the given name.- Parameters:
attributeName
- The name of the attribute.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if the name of the attribute is empty ornull
-
createAttributeAttachment
Attachment createAttributeAttachment(java.lang.String attributeName, java.lang.String fileName, byte[] content) throws java.rmi.RemoteException
Adds a new attachment to the list of attachments every requirement attribute can have. If no attribute with the given attribute name exists for the requirement the attribute will be created and an empty value associated. The default attributes "ID", "Text", "URI", and "Comment" cannot have attachments but attachments created withcreateRequirementAttachment(String, byte[])
will be shown as attachments of "Text".- Parameters:
attributeName
- The name of the attribute.fileName
- The file name of the attachment. The file name is used to create temporary files when viewing the attachment and will be shown as tooltip in TPT.content
- The content of the attachment.- Returns:
- The newly created attachment
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getLinkedAssessments
RemoteCollection<Assessment> getLinkedAssessments() throws java.rmi.RemoteException
Get all assesslets linked to this requirement.- Returns:
- The list of linked assessments.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
linkAssessment
void linkAssessment(AssessmentOrGroup aog) throws ApiException, java.rmi.RemoteException
Creates a link between this requirement and the givenAssessment
. If the argument is aAssessmentGroup
all assessments of the group will be added recursively. You can remove a link by removing theAssessment
fromgetLinkedAssessments()
.- Parameters:
aog
- TheAssessment
orAssessmentGroup
to create links to this requirement.- Throws:
ApiException
- If thetype
of the requirement is not linkable or if aog is not of the same project as the requirement.java.rmi.RemoteException
- remote communication problem
-
getLinkedScenarios
RemoteCollection<Scenario> getLinkedScenarios() throws java.rmi.RemoteException
Get all test cases and variants linked to this requirement.- Returns:
- The list of linked test cases and variants.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
linkScenario
void linkScenario(ScenarioOrGroup sog) throws ApiException, java.rmi.RemoteException
Creates a link between this requirement and the givenScenario
. If the argument is aScenarioGroup
all scenarios of the group will be added recursively. You can remove a link by removing theScenario
fromgetLinkedScenarios()
.- Parameters:
sog
- TheScenario
orScenarioOrGroup
to create links to this requirement.- Throws:
ApiException
- If thetype
of the requirement is not linkable or if sog is not of the same project as the requirement.java.rmi.RemoteException
- remote communication problem
-
setStatus
void setStatus(Requirement.RequirementStatus status) throws ApiException, java.rmi.RemoteException
Sets the requirement status.- Parameters:
status
- to be set.- Throws:
ApiException
- If the the given status is not allowed ornull
.java.rmi.RemoteException
- remote communication problem
-
getStatus
Requirement.RequirementStatus getStatus() throws java.rmi.RemoteException
Returns the current requirement status.- Returns:
- the current requirement status.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
markAsModified
void markAsModified() throws java.rmi.RemoteException
Marks this requirement as modified.- Throws:
java.rmi.RemoteException
- remote communication problem- See Also:
markAsReviewed()
-
markAsReviewed
void markAsReviewed() throws java.rmi.RemoteException
Marks this requirement as reviewed.- Throws:
java.rmi.RemoteException
- remote communication problem- See Also:
markAsModified()
-
isModified
boolean isModified() throws java.rmi.RemoteException
Returnstrue
if the requirement is marked as modified, otherwisefalse
.- Returns:
true
if requirement is marked as modified, otherwisefalse
- Throws:
java.rmi.RemoteException
- remote communication problem
-
isSubRequirement
boolean isSubRequirement() throws java.rmi.RemoteException
Returnstrue
if the requirement is a sub-requirement, otherwisefalse
.- Returns:
true
if requirement is a sub-requirement, otherwisefalse
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getParentRequirement
Requirement getParentRequirement() throws java.rmi.RemoteException
Returns a parentRequirement
if this is a sub-requirement, otherwisenull
- Returns:
- the parent requirement or
null
if this is not a sub-requirement - Throws:
java.rmi.RemoteException
- remote communication problem
-
createSubRequirement
Requirement createSubRequirement(java.lang.String id) throws ApiException, java.rmi.RemoteException
Adds a new sub-requirement to this requirement- Parameters:
id
- The unique ID of the requirement- Returns:
- The newly created requirement.
- Throws:
ApiException
- If a requirement with the same id already exists.java.rmi.RemoteException
- remote communication problem
-
getSubRequirements
java.util.List<Requirement> getSubRequirements() throws java.rmi.RemoteException
Returns all sub-requirements of thisRequirement
- Returns:
- all sub-requirements of this
Requirement
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getLinkedTestCases
java.util.Set<Scenario> getLinkedTestCases() throws java.rmi.RemoteException
Returns all (explicit and implicit) to thisRequirement
linkedtest cases
.- Returns:
- all (explicit and implicit) to this
Requirement
linkedtest cases
. - Throws:
java.rmi.RemoteException
- remote communication problem
-
createFormalRequirmentsStep
FormalRequirementStep createFormalRequirmentsStep(int index, java.lang.String type) throws ApiException, java.rmi.RemoteException
Creates a formal requirement step of a given type at the given position. The indices of the formal requirement steps start at 0.Formal requirements are a TPT feature that facilitates requirement-driven development. A clear, requirements pattern helps to be concise, unambiguous, and testable. The formal requirements are created and managed in
FormalRequirementsStepList
via and belong to a requirement.- Parameters:
index
- indicates the position where the new step shall be inserted in the step listtype
- the type of the newly created step as String, possible types are : When, While, Until, Shall, From, Between, Documentation- Returns:
- the newly created Step.
- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if the giventype
does not exist.
-
getFormalRequirmentsSteps
RemoteList<FormalRequirementStep> getFormalRequirmentsSteps() throws java.rmi.RemoteException
Returns all formal requirement steps of the requirement.- Returns:
- the list of
Steps
in their given order. - Throws:
java.rmi.RemoteException
- remote communication problem
-
-