public class ItemSample extends LoginSample implements java.lang.Runnable
This class serves as a little example how to work with the Track+ client library (TCL). It demonstrates how to create an item, retrieve an item by its identifier, and change various aspects of an item. It also demonstrates how to access all item information.
The class uses the LoginSample
class to perform
the login. You need to set the URL and the user name and password in that
class before compiling and running this class here.
This example is a Java console application. You can run it directly by
calling its main()
method.
connector, pField, uName, url
Constructor and Description |
---|
ItemSample()
The constructor.
|
ItemSample(TCLFacade connector)
Constructor with existing connection.
|
Modifier and Type | Method and Description |
---|---|
void |
addComment(java.lang.String itemID)
This method demonstrates how to add a comment to an item.
|
void |
archiveItem(java.lang.String itemID)
This method shows how to archive an item.
|
void |
changeStatus(java.lang.String itemID)
This method demonstrates how to change the item status.
|
java.lang.String |
createItem()
Create an item, setting all required parameters.
|
java.lang.String |
createItem(java.lang.String title)
Create an item, setting all required parameters.
|
java.lang.String |
createItem(java.lang.String title,
int parentId) |
void |
createItems(int numberOfItems,
java.lang.String projectID) |
void |
deleteComments(java.lang.String itemID) |
void |
deleteItem(java.lang.String itemID)
This method demonstrates how to mark an item as deleted.
|
void |
editComment(java.lang.String itemID) |
WSField[] |
getCustomFields() |
WSDisplayItemBean |
getDisplayItem(java.lang.String itemID)
Retrieve an item by its identifier.
|
WSEditItemContextBean |
getEditItemContext(java.lang.String itemID)
The item context contains all objects the item proper references.
|
void |
getHistory(java.lang.String itemID)
This method obtains the complete item history.
|
WSItemBean |
getItem(java.lang.String itemID)
Retrieve an item by its identifier.
|
WSItemContextBean |
getItemContext(java.lang.String itemID)
The item context contains all objects the item proper references.
|
WSItemContextBean[] |
getItemContexts(java.lang.String[] itemIDs) |
static void |
main(java.lang.String[] args) |
void |
modifyItem(java.lang.String itemID)
This method demonstrates how to change some aspects of an item.
|
void |
printBaseFields(WSItemBean item) |
void |
printDisplayItem(WSDisplayItemBean displayItem) |
void |
printEditItemContext(WSEditItemContextBean editCtx,
WSField[] customFields) |
void |
printItem(WSItemBean item) |
void |
printItemSimple(WSItemBean item) |
void |
run() |
void |
unarchiveItem(java.lang.String itemID)
This method shows how to restore an archived item.
|
void |
undeleteItem(java.lang.String itemID)
This method shows how to restore an item that has been marked
as deleted previously.
|
checkVersion, handleTCLFacadeException, login, login, startTime, stopTime
public ItemSample()
public ItemSample(TCLFacade connector)
connector
- public java.lang.String createItem()
public java.lang.String createItem(java.lang.String title)
public java.lang.String createItem(java.lang.String title, int parentId)
public void createItems(int numberOfItems, java.lang.String projectID)
public WSItemBean getItem(java.lang.String itemID)
itemID
- the object identifier of the item to retrieve.public WSDisplayItemBean getDisplayItem(java.lang.String itemID)
itemID
- public WSItemContextBean getItemContext(java.lang.String itemID)
The item context contains all objects the item proper references. For example, the context contains the persons that are the (possible) manager and responsible of that item, with all their related information, or the possible statuses, priorities, severities, and so on.
The context is helpful when constructing the selection boxes at the user interface.
itemID
- public WSItemContextBean[] getItemContexts(java.lang.String[] itemIDs)
public WSEditItemContextBean getEditItemContext(java.lang.String itemID)
The item context contains all objects the item proper references. For example, the context contains the persons that are the (possible) manager and responsible of that item, with all their related information, or the possible statuses, priorities, severities, and so on.
The context is helpful when constructing the selection boxes at the user interface.
itemID
- public void modifyItem(java.lang.String itemID)
itemID
- public void addComment(java.lang.String itemID)
itemID
- public void editComment(java.lang.String itemID)
public void deleteComments(java.lang.String itemID)
public void changeStatus(java.lang.String itemID)
itemID
- public void getHistory(java.lang.String itemID)
itemID
- public void deleteItem(java.lang.String itemID)
itemID
- public void undeleteItem(java.lang.String itemID)
itemID
- public void archiveItem(java.lang.String itemID)
itemID
- public void unarchiveItem(java.lang.String itemID)
itemID
- public WSField[] getCustomFields()
public void printItemSimple(WSItemBean item)
public void printItem(WSItemBean item)
public void printBaseFields(WSItemBean item)
public void printDisplayItem(WSDisplayItemBean displayItem)
public void printEditItemContext(WSEditItemContextBean editCtx, WSField[] customFields)
public static void main(java.lang.String[] args)
public void run()
run
in interface java.lang.Runnable
run
in class LoginSample