use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.
the class CentricTicketerPlugin method get.
/**
* Implementation of TicketerPlugin API call to retrieve a CentricCRM trouble ticket.
* @return an OpenNMS
*/
public Ticket get(String ticketId) {
CentricConnection crm = createConnection();
ArrayList<String> returnFields = new ArrayList<String>();
returnFields.add("id");
returnFields.add("modified");
returnFields.add("problem");
returnFields.add("comment");
returnFields.add("stateId");
crm.setTransactionMeta(returnFields);
DataRecord query = new DataRecord();
query.setName("ticketList");
query.setAction(DataRecord.SELECT);
query.addField("id", ticketId);
boolean success = crm.load(query);
if (!success) {
throw new DataRetrievalFailureException(crm.getLastResponse());
}
Ticket ticket = new Ticket();
ticket.setId(crm.getResponseValue("id"));
ticket.setModificationTimestamp(crm.getResponseValue("modified"));
ticket.setSummary(crm.getResponseValue("problem"));
ticket.setDetails(crm.getResponseValue("comment"));
ticket.setState(getStateFromId(crm.getResponseValue("stateId")));
return ticket;
}
use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.
the class JiraTicketerPlugin method getInternal.
private Ticket getInternal(String ticketId, JiraRestClient jira) throws PluginException {
// w00t
Issue issue;
try {
issue = jira.getIssueClient().getIssue(ticketId).get();
} catch (InterruptedException | ExecutionException e) {
throw new PluginException("Failed to get issue with id: " + ticketId, e);
}
if (issue != null) {
Ticket ticket = new Ticket();
ticket.setId(issue.getKey());
ticket.setModificationTimestamp(String.valueOf(issue.getUpdateDate().toDate().getTime()));
ticket.setSummary(issue.getSummary());
ticket.setDetails(issue.getDescription());
ticket.setState(getStateFromStatusName(issue.getStatus().getName()));
return ticket;
} else {
return null;
}
}
use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.
the class Otrs31TicketerPluginTest method testCreate.
@Test
public void testCreate() throws PluginException {
otrsPlugin.saveOrUpdate(s_ticket);
Ticket otrsTicket = otrsPlugin.get(s_ticket.getId());
assertTicketEquals(s_ticket, otrsTicket);
}
use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.
the class JiraTicketerPluginTest method get.
private void get(String ticketId) throws PluginException {
Ticket newTicket = m_ticketer.get(ticketId);
assertNotNull(newTicket);
assertEquals(ticketId, newTicket.getId());
assertEquals(Ticket.State.OPEN, newTicket.getState());
assertTrue("Unexpected summary: " + newTicket.getSummary(), newTicket.getSummary().contains("This is the summary"));
assertTrue("Unexpected description: " + newTicket.getDetails(), newTicket.getDetails().contains("details"));
}
use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.
the class JiraTicketerPluginTest method verifyTooManyFiles.
@Test
@Ignore
public void verifyTooManyFiles() throws PluginException {
JiraTicketerPlugin plugin = new JiraTicketerPlugin();
for (int i = 0; i < 500; i++) {
System.out.print(i + ": ");
Ticket ticket = plugin.get("NMS-8947");
System.out.print(ticket.getSummary() + "\n");
}
}
Aggregations