Package com.mks.tm.api
Interface IItem
- All Known Subinterfaces:
ITestCase
,ITestSession
public interface IItem
Test cases and test sessions are represented by PTC RV&S items.
This interface provides read access to the underlying item.
-
Method Summary
Modifier and TypeMethodDescriptionCreate an item delta that can be used to modify this item.void
extractAttachment
(String fieldName, String attachmentName, File outputFile, boolean overwriteExisting) Extract the contents of an attachment on the test item to a local file.getAsOf()
The date and time that the item is being viewed.Get the names of the fields where the values are available for this item.getFieldValue
(String fieldName) The value of the field on the test item.getFieldValueAsString
(String fieldName) Get the field value on the test item in the form of a string appropriate for display to a user.int
getID()
The ID of the item.Get the test server where this item was fetched from.
-
Method Details
-
getTestServer
ITestServer getTestServer()Get the test server where this item was fetched from.- Returns:
- The test server where this item was fetched from.
-
getID
int getID()The ID of the item.- Returns:
- The ID of the item.
-
getFieldNames
Get the names of the fields where the values are available for this item.- Returns:
- The names of the fields where the values are available.
-
getAsOf
Date getAsOf()The date and time that the item is being viewed.- Returns:
- The date and time the item is being viewed. This may be
null
if a historic view of the item is not being performed.
-
getFieldValue
The value of the field on the test item. The type of Object returned depends on the underlying field type on the item.- Integer - java.lang.Integer
- Pick - java.lang.String
- multi-valued Pick - java.util.List of java.lang.String elements
- Float - java.lang.Double
- Logical - java.lang.Boolean
- Date - java.util.Date
- Date with time - java.util.Date
- Short text - java.lang.String
- Long text - java.lang.String
- User - java.lang.String
- multi-valued User - java.util.List of java.lang.String elements
- Group - java.lang.String
- multi-valued Group - java.util.List of java.lang.String elements
- Relationship - java.lang.Integer
- multi-valued Relationship - java.util.List of java.lang.Integer elements
- Source Code Management Project - java.lang.String
- Range - java.lang.String
- Phase - java.lang.String
- Query backed relationship - java.lang.Integer
- multi-valued Query backed relationship - java.util.List of java.lang.Integer elements
- Item backed pick list - java.lang.Integer
- multi-valued Item backed pick list - java.util.List of java.lang.Integer elements
- Attachment - java.util.List of java.lang.String elements
- State - java.lang.String
- Workflow and Documents Project - java.lang.String
- Type - java.lang.String
- Parameters:
fieldName
- The name of the field.- Returns:
- The field value. The type of Object returned depends on the underlying type for the field.
- Throws:
TMAPIException
- If the requesting the value for a field that is not available (seeIItem.getFieldNames()
).
-
getFieldValueAsString
Get the field value on the test item in the form of a string appropriate for display to a user.- Parameters:
fieldName
- The name of the field.- Returns:
- The field value in the form of a string.
- Throws:
TMAPIException
- If the requesting the value for a field that is not available (seeIItem.getFieldNames()
).
-
extractAttachment
void extractAttachment(String fieldName, String attachmentName, File outputFile, boolean overwriteExisting) throws TMAPIException Extract the contents of an attachment on the test item to a local file.- Parameters:
fieldName
- Then name of the attachment field.attachmentName
- The name of the attachment to fetch.outputFile
- The local file to store the attachment content in.overwriteExisting
- Iftrue
then extraction of the attachment is permitted to overwrite an existing file, otherwise it will be considered an error to extract an attachment over an existing file.- Throws:
TMAPIException
- If the attachment can't be found on the item, or there was an error in fetching the attachment content from the server or streaming the content to disk.
-
createItemDelta
IItemDelta createItemDelta()Create an item delta that can be used to modify this item.- Returns:
- The template item delta to modify this item.
-