Search in sources :

Example 1 with SetInputMap

use of org.opennms.integration.remedy.ticketservice.SetInputMap 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);
        }
    }
}
Also used : GetOutputMap(org.opennms.integration.remedy.ticketservice.GetOutputMap) State(org.opennms.api.integration.ticketing.Ticket.State) HPD_IncidentInterface_WSPortTypePortType(org.opennms.integration.remedy.ticketservice.HPD_IncidentInterface_WSPortTypePortType) RemoteException(java.rmi.RemoteException) SetInputMap(org.opennms.integration.remedy.ticketservice.SetInputMap)

Example 2 with SetInputMap

use of org.opennms.integration.remedy.ticketservice.SetInputMap in project opennms by OpenNMS.

the class RemedyTicketerPlugin method getRemedySetInputMap.

private SetInputMap getRemedySetInputMap(Ticket ticket, GetOutputMap output) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    return new SetInputMap(output.getCategorization_Tier_1(), output.getCategorization_Tier_2(), output.getCategorization_Tier_3(), output.getClosure_Manufacturer(), output.getClosure_Product_Category_Tier1(), output.getClosure_Product_Category_Tier2(), output.getClosure_Product_Category_Tier3(), output.getClosure_Product_Model_Version(), output.getClosure_Product_Name(), output.getCompany(), output.getSummary(), output.getNotes(), output.getImpact(), output.getManufacturer(), output.getProduct_Categorization_Tier_1(), output.getProduct_Categorization_Tier_2(), output.getProduct_Categorization_Tier_3(), output.getProduct_Model_Version(), output.getProduct_Name(), output.getReported_Source(), output.getResolution(), output.getResolution_Category(), output.getResolution_Category_Tier_2(), output.getResolution_Category_Tier_3(), "", output.getService_Type(), output.getStatus(), output.getUrgency(), ACTION_MODIFY, "", "", Work_Info_TypeType.value10, cal, Work_Info_SourceType.value1, VIPType.No, Work_Info_View_AccessType.Public, ticket.getId(), output.getStatus_Reason(), output.getServiceCI(), output.getServiceCI_ReconID(), output.getHPD_CI(), output.getHPD_CI_ReconID(), output.getHPD_CI_FormName(), output.getZ1D_CI_FormName(), "", new byte[0], 0);
}
Also used : Calendar(java.util.Calendar) Date(java.util.Date) SetInputMap(org.opennms.integration.remedy.ticketservice.SetInputMap)

Aggregations

SetInputMap (org.opennms.integration.remedy.ticketservice.SetInputMap)2 RemoteException (java.rmi.RemoteException)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 State (org.opennms.api.integration.ticketing.Ticket.State)1 GetOutputMap (org.opennms.integration.remedy.ticketservice.GetOutputMap)1 HPD_IncidentInterface_WSPortTypePortType (org.opennms.integration.remedy.ticketservice.HPD_IncidentInterface_WSPortTypePortType)1