Hi all,
I hope this is a simple question to answe!
When I process a WorkItem that I obtained from running an "im viewissue" command, I'm given the options to pull primitive data types such as String, Boolean etc.
I'm trying to get some of the HTML formatting that is available within the Integrity Client, including bold font and tables. Is there a method for doing this using the Java API?
Many thanks,
Rich
Solved! Go to Solution.
Hi Rich,
Calling the im viewissue command with the --showRichContent option in the CLI will pull the raw HTML in the appropriate fields.
To use this in the API, you would use something like the below code:
Command aCommand = new Command(Command.IM, "viewissue");
Response aResponse;
WorkItem aWI;
String fieldValue;
aCommand.addOption(new Option("showRichContent"));
aCommand.addOption(new Option("fields","field1,field2,field3,...fieldN"));
aCommand.addSelection("<item ID>");
try{
aResponse = cmdRunner.execute(aCommand);
/*cmdRunner is coming from a global function that handles all the try/catch and null checks for doing
IntegrationPointFactory
.getInstance()
.createIntegrationPoint(host, port, apiMajorVersion, apiMinorVersion)
.createSession(user, password)
.createCmdRunner();
*/
for (WorkItemIterator itr = aResponse.getWorkItems(); itr.hasNext();) {
aWI = itr.next();
//handle your workitem
fieldValue = aWI.getField("field1").getString();
}
} catch (APIException e){
//handle exception
}
Hi Rich,
Calling the im viewissue command with the --showRichContent option in the CLI will pull the raw HTML in the appropriate fields.
To use this in the API, you would use something like the below code:
Command aCommand = new Command(Command.IM, "viewissue");
Response aResponse;
WorkItem aWI;
String fieldValue;
aCommand.addOption(new Option("showRichContent"));
aCommand.addOption(new Option("fields","field1,field2,field3,...fieldN"));
aCommand.addSelection("<item ID>");
try{
aResponse = cmdRunner.execute(aCommand);
/*cmdRunner is coming from a global function that handles all the try/catch and null checks for doing
IntegrationPointFactory
.getInstance()
.createIntegrationPoint(host, port, apiMajorVersion, apiMinorVersion)
.createSession(user, password)
.createCmdRunner();
*/
for (WorkItemIterator itr = aResponse.getWorkItems(); itr.hasNext();) {
aWI = itr.next();
//handle your workitem
fieldValue = aWI.getField("field1").getString();
}
} catch (APIException e){
//handle exception
}
Thanks for the comprehensive answer, this is exactly what I was looking for!
Many thanks,
Rich