use of org.opennms.api.integration.ticketing.Ticket.State in project opennms by OpenNMS.
the class RemedyTicketerPlugin method update.
private void update(Ticket ticket) throws PluginException {
HPD_IncidentInterface_WSPortTypePortType port = getTicketServicePort(m_portname, m_endpoint);
if (port != null) {
try {
GetOutputMap remedy = port.helpDesk_Query_Service(getRemedyInputMap(ticket.getId()), getRemedyAuthenticationHeader());
if (remedy == null) {
LOG.info("update: Remedy: Cannot find incident with incindent_number: {}", ticket.getId());
return;
}
if (remedy.getStatus().getValue().equals(StatusType._value7)) {
LOG.info("update: Remedy: Ticket Cancelled. Not updating ticket with incindent_number: {}", ticket.getId());
return;
}
if (remedy.getStatus().getValue().equals(StatusType._value6)) {
LOG.info("update: Remedy: Ticket Closed. Not updating ticket with incindent_number: {}", ticket.getId());
return;
}
SetInputMap output = getRemedySetInputMap(ticket, remedy);
// The only things to update are urgency and state
LOG.debug("update: Remedy: found urgency: {} - for ticket with incindent_number: {}", output.getUrgency().getValue(), ticket.getId());
output.setUrgency(getUrgency(ticket));
LOG.debug("update: opennms status: {} - for ticket with incindent_number: {}", ticket.getState(), ticket.getId());
LOG.debug("update: Remedy: found status: {} - for ticket with incindent_number: {}", output.getStatus().getValue(), ticket.getId());
State outputState = remedyToOpenNMSState(output.getStatus());
LOG.debug("update: Remedy: found opennms status: {} - for ticket with incindent_number: {}", outputState, ticket.getId());
if (!(ticket.getState() == outputState))
output = opennmsToRemedyState(output, ticket.getState());
port.helpDesk_Modify_Service(output, getRemedyAuthenticationHeader());
} catch (RemoteException e) {
e.printStackTrace();
throw new PluginException("Problem creating ticket", e);
}
}
}
Aggregations