@Override public void saveOrUpdate(Ticket ticketToUpdateOrCreate) throws PluginException { Objects.requireNonNull(ticketToUpdateOrCreate, "The provided ticket must not be null"); if (ticketToUpdateOrCreate.getId() == null) { create(ticketToUpdateOrCreate); } else { update(ticketToUpdateOrCreate); } }
/** * Convenience method for updating the Ticket Status in RT * * @param ticket the ticket details */ private void updateRtStatus(final Ticket ticket) throws PluginException { try { m_requestTracker.updateTicket(Long.valueOf(ticket.getId()), "Status: " + openNMSToRTState(ticket.getState())); } catch (final Exception e) { LOG.warn("Error updating ticket {} to state {}", ticket.getId(), ticket.getState(), e); } }
/** * Convenience method for updating the Ticket Status in RT * * @param ticket the ticket details */ private void updateRtStatus(final Ticket ticket) throws PluginException { try { m_requestTracker.updateTicket(Long.valueOf(ticket.getId()), "Status: " + openNMSToRTState(ticket.getState())); } catch (final Exception e) { LOG.warn("Error updating ticket {} to state {}", ticket.getId(), ticket.getState(), e); } }
/** {@inheritDoc} */ @Override public void saveOrUpdate(Ticket newTicket) throws PluginException { if ((newTicket.getId() == null) ) { save(newTicket); } else { update(newTicket); } }
private void updateOTRSState(Ticket ticket, TicketServicePort_PortType port, Credentials creds) throws RemoteException { Integer otrsStateId = openNMSToOTRSState(ticket.getState()); TicketStateUpdate stateUpdate = new TicketStateUpdate(); stateUpdate.setStateID(otrsStateId); stateUpdate.setTicketNumber(Long.parseLong(ticket.getId())); stateUpdate.setUser(m_configDao.getDefaultUser()); LOG.debug("Updating ticket with new state"); LOG.debug("Ticket ID: {}", ticket.getId()); LOG.debug("OpenNMS State: {}", ticket.getState().toString()); LOG.debug("OTRS state: {}", otrsStateId.toString()); port.ticketStateUpdate(stateUpdate, creds); }
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; LOG.info("update: Remedy: Ticket Cancelled. Not updating ticket with incindent_number: {}", ticket.getId()); return; LOG.info("update: Remedy: Ticket Closed. Not updating ticket with incindent_number: {}", ticket.getId()); return; 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());
private RTTicket rtTicketFromTicket(final Ticket ticket) { final RTTicket rtt = new RTTicket(); final String id = ticket.getId(); if (id != null && id.length() > 0) { rtt.setId(Long.valueOf(id)); } rtt.setQueue(m_queue); rtt.setRequestor(m_requestor); if (ticket.getSummary() != null) rtt.setSubject(ticket.getSummary()); // Remove any HTML tags in the ticket details. if (ticket.getDetails() != null) rtt.setText(m_tagPattern.matcher(ticket.getDetails()).replaceAll("")); rtt.setStatus(openNMSToRTState(ticket.getState())); return rtt; }
private RTTicket rtTicketFromTicket(final Ticket ticket) { final RTTicket rtt = new RTTicket(); final String id = ticket.getId(); if (id != null && id.length() > 0) { rtt.setId(Long.valueOf(id)); } rtt.setQueue(m_queue); rtt.setRequestor(m_requestor); if (ticket.getSummary() != null) rtt.setSubject(ticket.getSummary()); // Remove any HTML tags in the ticket details. if (ticket.getDetails() != null) rtt.setText(m_tagPattern.matcher(ticket.getDetails()).replaceAll("")); rtt.setStatus(openNMSToRTState(ticket.getState())); return rtt; }
/** {@inheritDoc} */ @Override public void createTicketForAlarm(int alarmId, Map<String,String> attributes) { OnmsAlarm alarm = m_alarmDao.get(alarmId); if (alarm == null) { LOG.error("No alarm with id {} was found. No ticket will be created.", alarmId); return; } if (SKIP_CREATE_WHEN_CLEARED) { final OnmsSeverity currentSeverity = alarm.getSeverity(); if (currentSeverity != null && currentSeverity.equals(OnmsSeverity.CLEARED)) { LOG.info("Alarm with id {} is currently cleared. No ticket will be created.", alarmId); return; } } Ticket ticket = createTicketFromAlarm(alarm, attributes); try { m_ticketerPlugin.saveOrUpdate(ticket); alarm.setTTicketId(ticket.getId()); alarm.setTTicketState(TroubleTicketState.OPEN); } catch (PluginException e) { alarm.setTTicketState(TroubleTicketState.CREATE_FAILED); LOG.error("Unable to create ticket for alarm: {}", e.getMessage(), e); m_eventIpcManager.sendNow(createEvent(e.getMessage())); } m_alarmDao.saveOrUpdate(alarm); }
private void saveOrUpdateInternal(Ticket ticket, JiraRestClient jira) throws PluginException { Config config = getConfig(); if (ticket.getId() == null || ticket.getId().equals("")) { LOG.info("Received ticket: {}", ticket.getId()); issue = jira.getIssueClient().getIssue(ticket.getId()).get(); } catch (InterruptedException | ExecutionException e) { throw new PluginException("Failed to get issue with id:" + ticket.getId(), e); for (Transition transition : transitions) { if (config.getResolveTransitionName().equals(transition.getName())) { LOG.info("Resolving ticket {}", ticket.getId()); LOG.warn("Could not resolve ticket {}, no '{}' operation available.", ticket.getId(), getConfig().getResolveTransitionName()); } else if (Ticket.State.OPEN.equals(ticket.getState())) { Comment comment = Comment.valueOf("Issue reopened by OpenNMS."); for (Transition transition : transitions) { if (getConfig().getReopentransitionName().equals(transition.getName())) { LOG.info("Reopening ticket {}", ticket.getId()); LOG.warn("Could not reopen ticket {}, no '{}' operation available.", ticket.getId(), getConfig().getReopentransitionName());
private void saveOrUpdateInternal(Ticket ticket, JiraRestClient jira) throws PluginException { Config config = getConfig(); if (ticket.getId() == null || ticket.getId().equals("")) { LOG.info("Received ticket: {}", ticket.getId()); issue = jira.getIssueClient().getIssue(ticket.getId()).get(); } catch (InterruptedException | ExecutionException e) { throw new PluginException("Failed to get issue with id:" + ticket.getId(), e); for (Transition transition : transitions) { if (config.getResolveTransitionName().equals(transition.getName())) { LOG.info("Resolving ticket {}", ticket.getId()); LOG.warn("Could not resolve ticket {}, no '{}' operation available.", ticket.getId(), getConfig().getResolveTransitionName()); } else if (Ticket.State.OPEN.equals(ticket.getState())) { Comment comment = Comment.valueOf("Issue reopened by OpenNMS."); for (Transition transition : transitions) { if (getConfig().getReopentransitionName().equals(transition.getName())) { LOG.info("Reopening ticket {}", ticket.getId()); LOG.warn("Could not reopen ticket {}, no '{}' operation available.", ticket.getId(), getConfig().getReopentransitionName());
alarm.setTTicketId(ticket.getId()); alarm.setTTicketState(TroubleTicketState.OPEN); } catch (PluginException e) {
private void update(Ticket ticketToUpdate) throws PluginException { Ticket currentTicket = get(ticketToUpdate.getId()); LOG.debug("updating existing ticket : {}", currentTicket.getId()); update.setUserLogin(m_configDao.getUserName()); update.setPassword(m_configDao.getPassword()); update.setTicketID(new BigInteger(currentTicket.getId())); update.setTicket(ticketUpdate); update.setArticle(articleUpdate);
@Override public void saveOrUpdate(Ticket ticket) throws PluginException { LOG.debug("saveOrUpdate called with ticket: {}", ticket); String ticketId = ticket.getId();
@Override public void saveOrUpdate(Ticket ticket) throws PluginException { LOG.debug("saveOrUpdate called with ticket: {}", ticket); String ticketId = ticket.getId();
VIPType.No, Work_Info_View_AccessType.Public, ticket.getId(), output.getStatus_Reason(), output.getServiceCI(),
if (StringUtils.isEmpty(ticket.getId())) { MXStringType reportedBy = new MXStringType(); reportedBy.setValue(ticket.getUser());