/** * Retrieves the plugin that is currently registered. * * If no plugin is currently registered, this full will throw a {@link PluginException} * instead of returning null. * * @return the currently registered plugin * @throws PluginException when no plugin is currently registered */ public Plugin getTicketerPlugin() throws PluginException { if (m_ticketerPlugin == null) { throw new PluginException("No ticketing plugin is currently registered."); } return m_ticketerPlugin; } }
/** * Retrieves the plugin that is currently registered. * * If no plugin is currently registered, this full will throw a {@link PluginException} * instead of returning null. * * @return the currently registered plugin * @throws PluginException when no plugin is currently registered */ public Plugin getTicketerPlugin() throws PluginException { if (m_ticketerPlugin == null) { throw new PluginException("No ticketing plugin is currently registered."); } return m_ticketerPlugin; } }
@Override public void saveOrUpdate(Ticket ticket) throws PluginException { try (JiraRestClient client = getConnection()) { saveOrUpdateInternal(ticket, client); } catch (IOException e) { throw new PluginException(e); } }
@Override public void saveOrUpdate(Ticket ticket) throws PluginException { try (JiraRestClient client = getConnection()) { saveOrUpdateInternal(ticket, client); } catch (IOException e) { throw new PluginException(e); } }
/** * Implementation of TicketerPlugin API call to retrieve a Jira trouble ticket. * * @return an OpenNMS * @throws PluginException */ @Override public Ticket get(String ticketId) throws PluginException { try (JiraRestClient client = getConnection()) { return getInternal(ticketId, client); } catch (IOException e) { throw new PluginException(e); } }
/** * Implementation of TicketerPlugin API call to retrieve a Jira trouble ticket. * * @return an OpenNMS * @throws PluginException */ @Override public Ticket get(String ticketId) throws PluginException { try (JiraRestClient client = getConnection()) { return getInternal(ticketId, client); } catch (IOException e) { throw new PluginException(e); } }
public static JiraRestClient createConnection(String url, String username, String password) throws PluginException { try { final URI jiraUri = new URL(url).toURI(); if (Strings.isNullOrEmpty(username)) { return new AsynchronousJiraRestClientFactory().create(jiraUri, new AnonymousAuthenticationHandler()); } return new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraUri, username, password); } catch (MalformedURLException | URISyntaxException e) { throw new PluginException("Failed to parse URL: " + url); } } }
/** * Convenience method for initializing the ticketServicePort and correctly setting the endpoint. * * @return TicketServicePort to connect to the remote service. */ private HPD_IncidentInterface_WSPortTypePortType getTicketServicePort(String portname, String endpoint) throws PluginException { HPD_IncidentInterface_WSServiceLocator service = new HPD_IncidentInterface_WSServiceLocator(); HPD_IncidentInterface_WSPortTypePortType port = null; try { service.setEndpointAddress(portname, endpoint); port = service.getHPD_IncidentInterface_WSPortTypeSoap(); } catch (ServiceException e) { LOG.error("Failed initialzing Remedy TicketServicePort", e); throw new PluginException("Failed initialzing Remedy TicketServicePort", e); } return port; }
public static JiraRestClient createConnection(String url, String username, String password) throws PluginException { try { final URI jiraUri = new URL(url).toURI(); if (Strings.isNullOrEmpty(username)) { return new AsynchronousJiraRestClientFactory().create(jiraUri, new AnonymousAuthenticationHandler()); } return new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraUri, username, password); } catch (MalformedURLException | URISyntaxException e) { throw new PluginException("Failed to parse URL: " + url); } } }
/** * Convenience method for initialising the ticketServicePort and correctly setting the endpoint. * * @return TicketServicePort to connect to the remote service. */ private HPD_IncidentInterface_Create_WSPortTypePortType getCreateTicketServicePort(String portname, String endpoint) throws PluginException { HPD_IncidentInterface_Create_WSServiceLocator service = new HPD_IncidentInterface_Create_WSServiceLocator(); HPD_IncidentInterface_Create_WSPortTypePortType port = null; try { service.setEndpointAddress(portname, endpoint); port = service.getHPD_IncidentInterface_Create_WSPortTypeSoap(); } catch (ServiceException e) { LOG.error("Failed initialzing Remedy TicketServicePort", e); throw new PluginException("Failed initialzing Remedy TicketServicePort", e); } return port; } }
/** * Convenience method for initialising the ticketServicePort and correctly setting the endpoint. * * @return TicketServicePort to connect to the remote service. */ private TicketServicePort_PortType getTicketServicePort(String endpoint) throws PluginException { TicketServiceLocator service = new TicketServiceLocator(); service.setTicketServicePortEndpointAddress(endpoint); TicketServicePort_PortType port = null; try { port = service.getTicketServicePort(); } catch (ServiceException e) { LOG.error("Failed initialzing OTRS TicketServicePort", e); throw new PluginException("Failed initialzing OTRS TicketServicePort"); } return port; }
private void save(Ticket newTicket) throws PluginException { HPD_IncidentInterface_Create_WSPortTypePortType port = getCreateTicketServicePort(m_createportname,m_createendpoint); try { String incident_number = port.helpDesk_Submit_Service(getRemedyAuthenticationHeader(), getRemedyCreateInputMap(newTicket)).getIncident_Number(); LOG.debug("created new remedy ticket with reported incident number: {}", incident_number); newTicket.setId(incident_number); } catch (RemoteException e) { e.printStackTrace(); throw new PluginException("Problem saving ticket", e); } }
rtTicketNumber = m_requestTracker.createTicket(ticket); } catch (final Exception e) { throw new PluginException(e); throw new PluginException("Received no ticket number from RT");
/** * {@inheritDoc} * * Gets ticket details from the RT trouble ticket system */ @Override public Ticket get(final String ticketId) throws PluginException { Ticket ticket = null; RTTicket rtt = null; try { rtt = m_requestTracker.getTicket(Long.valueOf(ticketId), false); } catch (final RequestTrackerException e) { throw new PluginException(e); } if (rtt != null) { ticket = new Ticket(); ticket.setState(rtToOpenNMSState(rtt.getStatus())); ticket.setId(rtt.getId().toString()); ticket.setUser(StringUtils.join(rtt.getRequestors(), ", ")); ticket.setSummary(rtt.getSubject()); ticket.setDetails(rtt.getText()); } else { throw new PluginException("could not find ticket in RT for Ticket: " + ticketId); } return ticket; }
/** * {@inheritDoc} * * Gets ticket details from the RT trouble ticket system */ @Override public Ticket get(final String ticketId) throws PluginException { Ticket ticket = null; RTTicket rtt = null; try { rtt = m_requestTracker.getTicket(Long.valueOf(ticketId), false); } catch (final RequestTrackerException e) { throw new PluginException(e); } if (rtt != null) { ticket = new Ticket(); ticket.setState(rtToOpenNMSState(rtt.getStatus())); ticket.setId(rtt.getId().toString()); ticket.setUser(StringUtils.join(rtt.getRequestors(), ", ")); ticket.setSummary(rtt.getSubject()); ticket.setDetails(rtt.getText()); } else { throw new PluginException("could not find ticket in RT for Ticket: " + ticketId); } return ticket; }
throw new PluginException("No Remedy ticketID available in OpenNMS Ticket"); } catch (RemoteException e) { e.printStackTrace(); throw new PluginException("Problem getting ticket", e);
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; } }
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; } }
} catch (RemoteException e) { e.printStackTrace(); throw new PluginException("Problem creating ticket", e);
throw new PluginException("Failed to create or update OTRS ticket");