Class LocalTriggerManager.ScriptTestResultDeltaBean

  • All Implemented Interfaces:
    mks.frame.triggers.ScriptExposableBean
    Enclosing class:
    LocalTriggerManager

    public static class LocalTriggerManager.ScriptTestResultDeltaBean
    extends LocalTriggerManager.ScriptTestResultBean

    A bean that encapsulates a single test result. All information on the test result is available regardless of what operation was invoked.

    Instances of this bean are available through the getTestResultBeans call of the ScriptTestResultsArgsBean during a create, or edit test result operation. All information on the test result is available to this bean. Test result metadata, if available, is exposed for update on this bean via the setFieldValue methods.

    This bean provides read-write access.

    • Constructor Detail

      • ScriptTestResultDeltaBean

        public ScriptTestResultDeltaBean​(mks.ci.server.engine.TestResult original,
                                         mks.ci.server.engine.TestResult delta,
                                         int userId,
                                         java.sql.Connection c,
                                         boolean readonly)
    • Method Detail

      • getExposedName

        public java.lang.String getExposedName()
        Description copied from class: ScriptBaseBean
        Returns the name of this bean that is exposed to the scripting language.
        Specified by:
        getExposedName in interface mks.frame.triggers.ScriptExposableBean
        Overrides:
        getExposedName in class LocalTriggerManager.ScriptTestResultBean
        Returns:
        the bean name: siMemberBean.
      • getOldVerdict

        public java.lang.String getOldVerdict()
        Returns the name of the original verdict for this test result, or null if no verdict has been set.
        Returns:
        A string representing the verdict, or null if no verdict has been set.
      • getNewVerdict

        public java.lang.String getNewVerdict()
        Returns the name of the verdict set for this test result, or null if no verdict has been set. If the value is unchanged, the old verdict name is retrieved.
        Returns:
        A string representing the verdict, or null if no verdict has been set.
      • getOldVerdictType

        public java.lang.String getOldVerdictType()
        Returns the name of the original verdict type for this test result (e.g. "Pass", "Fail", "Other") or null if no verdict has been set.
        Returns:
        A string representing the verdict type, or null if no verdict has been set.
      • getNewVerdictType

        public java.lang.String getNewVerdictType()
        Returns the name of the verdict type set for this test result (e.g. "Pass", "Fail", "Other") or null if no verdict has been set. If the value is unchanged, the old verdict type is retrieved.
        Returns:
        A string representing the verdict type, or null if no verdict has been set.
      • getOldAnnotation

        public java.lang.String getOldAnnotation()
        Gets the original annotation of this test result.
        Returns:
        The annotation of this test result.
      • getNewAnnotation

        public java.lang.String getNewAnnotation()
        Gets the new annotation of this test result. If the value is unchanged, the old annotation is retrieved.
        Returns:
        The annotation of this test result.
      • getRemoveStepResultBeans

        public LocalTriggerManager.ScriptTestStepResultBean[] getRemoveStepResultBeans()
                                                                                throws mks.frame.triggers.TriggerException
        Returns all test step results that have been removed from this test result.
        Returns:
        an array of beans representing test step results that have been removed from this test result.
        Throws:
        mks.frame.triggers.TriggerException
      • setVerdict

        public void setVerdict​(java.lang.String verdict)
                        throws mks.frame.triggers.TriggerException
        Sets the verdict of this test result.
        Parameters:
        verdict - The new verdict to set for this test result.
        Throws:
        mks.frame.triggers.TriggerException - if the verdict does not exist, or if the script is running in a POST trigger context.
      • setAnnotation

        public void setAnnotation​(java.lang.String annotation)
                           throws mks.frame.triggers.TriggerException
        Sets the annotation of this test result.
        Parameters:
        annotation - the new annotation to set for this test result.
        Throws:
        mks.frame.triggers.TriggerException - if the script is running in a POST trigger context.
      • hasAddRelatedItems

        public boolean hasAddRelatedItems()
        Return true if relationships are going to be added to this test result.
        Returns:
        true if relationships are going to be added to this test result, false otherwise.
      • isAddRelatedItem

        public boolean isAddRelatedItem​(int relatedItem)
        Return true if the given item is in the add related item list of this test result.
        Parameters:
        relatedItem - the item to check
        Returns:
        true if the given item is in the add related item list of this test result, false otherwise.
      • getAddRelatedItems

        public int[] getAddRelatedItems()
        Returns all items that are going to be related to this test result as an array of Windchill RV&S item ids.
        Returns:
        an array of Windchill RV&S item ids.
      • getAddRelatedItemBeans

        public LocalTriggerManager.ScriptIssueBean[] getAddRelatedItemBeans()
                                                                     throws mks.frame.triggers.TriggerException
        Returns all items that are going to be related to this test result as an array of ScriptIssueBeans.
        Returns:
        an array of beans representing Windchill RV&S items that are to be related to this test result.
        Throws:
        mks.frame.triggers.TriggerException
      • addToAddRelatedItems

        public void addToAddRelatedItems​(int relatedItem)
                                  throws mks.frame.triggers.TriggerException
        Add an item to the "add related item" list. Any item added to this list will be related to this test result.
        Parameters:
        relatedItem - The item to create a relationship with.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • The item to add is already in the list of add related items
        • The item to add is already related to this test result
        • The script is running in a POST trigger context
      • removeFromAddRelatedItems

        public void removeFromAddRelatedItems​(int relatedItem)
                                       throws mks.frame.triggers.TriggerException
        Remove an item from the "add related item" list. Any item removed from this list will not be related to this test result.
        Parameters:
        relatedItem - The item to remove from the "add related item" list.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • The item to remove from the add related items list does not exist in that list.
        • The script is running in a POST trigger context
      • hasRemoveRelatedItems

        public boolean hasRemoveRelatedItems()
        Return true if relationships are going to be removed from this test result.
        Returns:
        true if relationships are going to be removed from this test result, false otherwise.
      • isRemoveRelatedItem

        public boolean isRemoveRelatedItem​(int relatedItem)
        Return true if the given item is in the remove related item list of this test result.
        Parameters:
        relatedItem - the item to check
        Returns:
        true if the given item is in the remove related item list of this test result, false otherwise.
      • getRemoveRelatedItems

        public int[] getRemoveRelatedItems()
        Returns all items that are no longer going to be related to this test result as an array of Windchill RV&S item ids.
        Returns:
        an array of Windchill RV&S item ids.
      • getRemoveRelatedItemBeans

        public LocalTriggerManager.ScriptIssueBean[] getRemoveRelatedItemBeans()
                                                                        throws mks.frame.triggers.TriggerException
        Returns all items that are no longer going to be related to this test result as an array of ScriptIssueBeans.
        Returns:
        an array of beans representing Windchill RV&S items that will no longer be related to this test result.
        Throws:
        mks.frame.triggers.TriggerException
      • addToRemoveRelatedItems

        public void addToRemoveRelatedItems​(int relatedItem)
                                     throws mks.frame.triggers.TriggerException
        Add an item to the "remove related item" list. Any item added to this list will no longer be related to this test result.
        Parameters:
        relatedItem - the item to remove a relationship from.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • The item to add is already in the list of remove related items
        • The item to add is not related to this test result
        • The script is running in a POST trigger context
      • removeFromRemoveRelatedItems

        public void removeFromRemoveRelatedItems​(int relatedItem)
                                          throws mks.frame.triggers.TriggerException
        Remove an item from the "remove related item" list. Any item removed from this list will continue to be related to this test result.
        Parameters:
        relatedItem - The item to remove from the "add related item" list.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • The item to remove from the remove related items list does not exist in that list.
        • The script is running in a POST trigger context
      • hasAddAttachments

        public boolean hasAddAttachments()
        Return true if attachments will be added to this test result.
        Returns:
        true if attachments will be added to this test result, false otherwise.
      • isAddAttachment

        public boolean isAddAttachment​(java.lang.String attachment)
        Return true if the given attachment name represents an attachment that will be added to this test result.
        Parameters:
        attachment - The name of the attachment
        Returns:
        true if the given attachment name represents an attachment that will be added to this test result.
      • getAddAttachments

        public java.lang.String[] getAddAttachments()
        Return all names of attachments that are going to be added to this test result, as an array of Strings.
        Returns:
        an array of attachment names
      • getAddAttachmentBeans

        public LocalTriggerManager.ScriptAttachmentBean[] getAddAttachmentBeans()
        Return all attachments that are going to be added to this test result, as an array of ScriptAttachmentBeans.
        Returns:
        An array of beans representing test result attachments.
      • addToAddAttachments

        public void addToAddAttachments​(java.lang.String name,
                                        java.lang.String summary,
                                        java.lang.String file,
                                        java.lang.String contentType)
                                 throws mks.frame.triggers.TriggerException
        Add an attachment to this test result.
        Parameters:
        name - The name of the attachment
        summary - The summary of the attachment
        file - The path to the file on the server filesystem
        contentType - The content type (can be null)
        Throws:
        mks.frame.triggers.TriggerException - if:
        • an attachment by this name has already been added to this test result.
        • the script is running in a POST trigger context
      • removeFromAddAttachments

        public void removeFromAddAttachments​(java.lang.String name)
                                      throws mks.frame.triggers.TriggerException
        Remove an attachment from the "add attachments" list.
        Parameters:
        name - The attachment name to remove.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • the attachment is not in the add attachment list.
        • the script is running in a POST trigger context
      • hasRemoveAttachments

        public boolean hasRemoveAttachments()
        Return true if this test result has attachments that will be removed.
        Returns:
        true if this test result has attachments that will be removed, false otherwise.
      • isRemoveAttachment

        public boolean isRemoveAttachment​(java.lang.String attachment)
        Return true if the given attachment name represents an attachment that will be removed from this test result.
        Parameters:
        attachment - The name of the attachment
        Returns:
        true if the given attachment name represents an attachment that will be removed from this test result.
      • getRemoveAttachments

        public java.lang.String[] getRemoveAttachments()
        Return all names of attachments that are going to be removed from this test result, as an array of Strings.
        Returns:
        an array of attachment names.
      • getRemoveAttachmentBeans

        public LocalTriggerManager.ScriptAttachmentBean[] getRemoveAttachmentBeans()
        Return all attachments that are going to be added to this test result, as an array of ScriptAttachmentBeans.
        Returns:
        an array of beans representing test result attachments.
      • addToRemoveAttachments

        public void addToRemoveAttachments​(java.lang.String name)
                                    throws mks.frame.triggers.TriggerException
        Remove an attachment from this test result.
        Parameters:
        name - The name of the attachment to remove.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • the given attachment is already in the remove attachment list.
        • the script is running in a POST trigger context
      • removeFromRemoveAttachments

        public void removeFromRemoveAttachments​(java.lang.String name)
                                         throws mks.frame.triggers.TriggerException
        Remove an attachment from the list of attachments that are to be removed from this test result.
        Parameters:
        name - The name of the attachment to remove from the remove attachment list.
        Throws:
        mks.frame.triggers.TriggerException - if:
        • the attachment is not in the remove attachment list.
        • the script is running in a POST trigger context
      • setFieldValue

        public void setFieldValue​(java.lang.String fieldName,
                                  java.lang.String value)
                           throws mks.frame.triggers.TriggerException
        Change the value of a result field by name. The value must be representable by a string. e.g. for an integer field, the string must be parsable as an integer.
        • The value may be null. This unsets the field.
        • For a date/time field, the format is always "MM/dd/yyyy HH:mm:ss a z".
        • For a picklist, the string must be a valid pick string, or a pick number.
        Parameters:
        fieldName - the name of the result field whose value we want to set. Only fields exposed in the test result by a test result type can be used here.
        value - the value to set the field to (as a string)
        Throws:
        mks.frame.triggers.TriggerException - An appropriate error message is returned in a TriggerException in the following cases:
        • The field name isn't known
        • If the field is of pick type, the value isn't a valid pick value string, or if a number isn't a valid pick value.
      • setFieldValue

        public void setFieldValue​(java.lang.String fieldName,
                                  double value)
                           throws mks.frame.triggers.TriggerException
        Change the value of a result field by name. The field type must be of type float, integer, or date. In the case of a date, the value must be a numeric time value, such as that returned by new Date().valueOf() which returns the current time.
        Parameters:
        fieldName - the name of the result field whose value we want to set. Only fields exposed in the test result by a test result type can be used here.
        value - the value to set the field to (as a double)
        Throws:
        mks.frame.triggers.TriggerException - If the field is not a floating point, integer, or date field.
      • setFieldValue

        public void setFieldValue​(java.lang.String fieldName,
                                  java.util.Date value)
                           throws mks.frame.triggers.TriggerException
        Change the value of a result field by name. You should use this method to make an assignment to a date field, if you are using a java Date object. If you have a string formatted date or a time since the epoch, then you should use the setFieldValue that accepts a string value or double respectively.
        Parameters:
        fieldName - the name of the result field whose value we want to set. Only fields exposed in the test result by a test result type can be used here.
        value - the value to set the field to (as a java.util.Date)
        Throws:
        mks.frame.triggers.TriggerException - If the field doesn't exist or is not a date field.
      • getOldFieldDisplayString

        public java.lang.String getOldFieldDisplayString​(java.lang.String fieldName)
                                                  throws mks.frame.triggers.TriggerException
        Retrieve the original value of a result field as a printable string.
        Parameters:
        fieldName - the name of the result field whose value we return. Only fields exposed in the test result by a test result type can be used here.
        Returns:
        a string representing the display value of the result field
        Throws:
        mks.frame.triggers.TriggerException
      • getNewFieldDisplayString

        public java.lang.String getNewFieldDisplayString​(java.lang.String fieldName)
                                                  throws mks.frame.triggers.TriggerException
        Retrieve the new value of a result field as a printable string. If the value is unchanged, the old value is retrieved.
        Parameters:
        fieldName - the name of the result field whose value we return. Only fields exposed in the test result by a test result type can be used here.
        Returns:
        a string representing the display value of the result field
        Throws:
        mks.frame.triggers.TriggerException
      • getOldFieldValue

        public java.lang.Object getOldFieldValue​(java.lang.String fieldName)
                                          throws mks.frame.triggers.TriggerException
        Retrieve the old value of the test result field by name. The actual value returned is always a java object:
        • Integer: Java `Integer' object
        • Double: Java `Double' object
        • PickList: String name of the picked entry
        • Date: Java `Date' object
        • Text: String
        Note that in javascript, you can mostly use all these values without converting, javascript will for example extract the int value out of the Integer if you try to use it for arithmetic.
        Parameters:
        fieldName - the name of the result field whose value we return. Only fields exposed in the test result by a test result type can be used here.
        Returns:
        Various, if the field has not been set, the null value.
        Throws:
        mks.frame.triggers.TriggerException - if the field is not known or an error occurs retrieving the value.
      • getNewFieldValue

        public java.lang.Object getNewFieldValue​(java.lang.String fieldName)
                                          throws mks.frame.triggers.TriggerException
        Retrieve the new value of the test result field by name. If the value is unchanged, the old value is retrieved. The actual value returned is always a java object:
        • Integer: Java `Integer' object
        • Double: Java `Double' object
        • PickList: String name of the picked entry
        • Date: Java `Date' object
        • Text: String
        Note that in javascript, you can mostly use all these values without converting, javascript will for example extract the int value out of the Integer if you try to use it for arithmetic.
        Parameters:
        fieldName - the name of the result field whose value we return. Only fields exposed in the test result by a test result type can be used here.
        Returns:
        Various, if the field has not been set, the null value.
        Throws:
        mks.frame.triggers.TriggerException - if the field is not known or an error occurs retrieving the value.