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 use markAsModified() to set the status to modified explicitly.
    • 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.
        Use getDocument() instead. Removed in TPT-19. Throws DeprecatedAndRemovedException.
        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 or null 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 see getAttributeAttachments(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 see createAttributeAttachment(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 (see getRequirementAttachments()) 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 problem
        ApiException - if the attachment and the requirement from different projects or if the name of the attribute is empty or null
      • 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 problem
        ApiException - if the name of the attribute is empty or null
      • 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 with createRequirementAttachment(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 given Assessment. If the argument is a AssessmentGroup all assessments of the group will be added recursively. You can remove a link by removing the Assessment from getLinkedAssessments().
        Parameters:
        aog - The Assessment or AssessmentGroup to create links to this requirement.
        Throws:
        ApiException - If the type 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 given Scenario. If the argument is a ScenarioGroup all scenarios of the group will be added recursively. You can remove a link by removing the Scenario from getLinkedScenarios().
        Parameters:
        sog - The Scenario or ScenarioOrGroup to create links to this requirement.
        Throws:
        ApiException - If the type 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 or null.
        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
        Returns true if the requirement is marked as modified, otherwise false.
        Returns:
        true if requirement is marked as modified, otherwise false
        Throws:
        java.rmi.RemoteException - remote communication problem
      • isSubRequirement

        boolean isSubRequirement()
                          throws java.rmi.RemoteException
        Returns true if the requirement is a sub-requirement, otherwise false.
        Returns:
        true if requirement is a sub-requirement, otherwise false
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getParentRequirement

        Requirement getParentRequirement()
                                  throws java.rmi.RemoteException
        Returns a parent Requirement if this is a sub-requirement, otherwise null
        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 this Requirement
        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 this Requirement linked test cases.
        Returns:
        all (explicit and implicit) to this Requirement linked test 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 list
        type - 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 problem
        ApiException - if the given type 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