if (project == null) {
LOG.warn("Product was not found. Unable to create defect.");
return null;
}
WorkItem item = client.newWorkItem(project
.getVisibleWorkItemTypes()[0]);
if (item == null) {
LOG.warn("Unable to create item in TFS.");
return null;
}
item.setTitle(metadata.getDescription());
item.getFields().getField("Description").setValue(description);
item.getFields().getField("Priority").setValue(metadata.getPriority());
String itemId = null;
if (checkItemValues(item)) {
item.save();
itemId = String.valueOf(item.getID());
} else {
LOG.error("Failed to create issue because one or more fields were invalid. " +
"Check the above logs for more details.");
}