use of org.opennms.integration.remedy.ticketservice.GetOutputMap 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);
}
}
}
use of org.opennms.integration.remedy.ticketservice.GetOutputMap in project opennms by OpenNMS.
the class RemedyTicketerPlugin method get.
/** {@inheritDoc} */
@Override
public Ticket get(String ticketId) throws PluginException {
Ticket opennmsTicket = new Ticket();
if (ticketId == null) {
LOG.error("No Remedy ticketID available in OpenNMS Ticket");
throw new PluginException("No Remedy ticketID available in OpenNMS Ticket");
} else {
LOG.debug("get: search ticket with id: {}", ticketId);
HPD_IncidentInterface_WSPortTypePortType port = getTicketServicePort(m_portname, m_endpoint);
if (port != null) {
try {
GetOutputMap outputmap = port.helpDesk_Query_Service(getRemedyInputMap(ticketId), getRemedyAuthenticationHeader());
LOG.info("get: found ticket: {} status: {}", ticketId, outputmap.getStatus().getValue());
LOG.info("get: found ticket: {} urgency: {}", ticketId, outputmap.getUrgency().getValue());
opennmsTicket.setId(ticketId);
opennmsTicket.setSummary(outputmap.getSummary());
opennmsTicket.setDetails(outputmap.getNotes());
opennmsTicket.setState(remedyToOpenNMSState(outputmap.getStatus()));
opennmsTicket.setUser(outputmap.getAssigned_Group());
} catch (RemoteException e) {
e.printStackTrace();
throw new PluginException("Problem getting ticket", e);
}
}
}
// add ticket basics from the Remedy ticket
return opennmsTicket;
}
Aggregations