Search in sources :

Example 1 with NetworkType

use of org.citrusframework.schema.samples.networkservice.v1.NetworkType in project citrus-samples by christophd.

the class IncidentManagerService method openIncident.

@Override
public OpenIncidentResponse openIncident(@WebParam(partName = "parameters", name = "OpenIncident", targetNamespace = "http://www.citrusframework.org/schema/samples/IncidentManager/v1") OpenIncident in) throws IncidentFault_Exception {
    log.info(String.format("Received new incident request '%s'", in.getIncident().getTicketId()));
    AnalyseIncident analyseRequest = new AnalyseIncident();
    analyseRequest.setIncident(new IncidentType());
    analyseRequest.getIncident().setTicketId(in.getIncident().getTicketId());
    analyseRequest.getIncident().setDescription(in.getIncident().getDescription());
    analyseRequest.setNetwork(new NetworkType());
    analyseRequest.getNetwork().setLineId(UUID.randomUUID().toString());
    analyseRequest.getNetwork().setConnection(UUID.randomUUID().toString());
    analyseRequest.getNetwork().setType(NetworkComponentType.fromValue(in.getIncident().getComponent().name()));
    AnalyseIncidentResponse analyseIncidentResponse = networkService.analyse(analyseRequest);
    if (analyseIncidentResponse.getResult().isFieldForceRequired()) {
        OrderRequest ffOrder = new OrderRequest();
        ffOrder.setIncident(new org.citrusframework.schema.samples.fieldforceservice.v1.IncidentType());
        ffOrder.getIncident().setTicketId(in.getIncident().getTicketId());
        ffOrder.getIncident().setDescription(in.getIncident().getDescription());
        ffOrder.setCustomer(new CustomerType());
        ffOrder.getCustomer().setId(in.getCustomer().getId());
        ffOrder.getCustomer().setFirstname(in.getCustomer().getFirstname());
        ffOrder.getCustomer().setLastname(in.getCustomer().getLastname());
        ffOrder.getCustomer().setAddress(in.getCustomer().getAddress());
        ffOrder.setNetwork(new org.citrusframework.schema.samples.fieldforceservice.v1.NetworkType());
        ffOrder.getNetwork().setLineId(analyseRequest.getNetwork().getLineId());
        fieldForceService.placeOrder(ffOrder);
    }
    OpenIncidentResponse incidentResponse = new OpenIncidentResponse();
    incidentResponse.setTicketId(in.getIncident().getTicketId());
    incidentResponse.setScheduled(getScheduledTime());
    log.info(String.format("Successfully processed new incident request '%s'", in.getIncident().getTicketId()));
    return incidentResponse;
}
Also used : IncidentType(org.citrusframework.schema.samples.networkservice.v1.IncidentType) NetworkType(org.citrusframework.schema.samples.networkservice.v1.NetworkType) org.citrusframework.schema.samples.fieldforceservice.v1(org.citrusframework.schema.samples.fieldforceservice.v1) org.citrusframework.schema.samples.networkservice.v1(org.citrusframework.schema.samples.networkservice.v1) org.citrusframework.schema.samples.incidentmanager.v1(org.citrusframework.schema.samples.incidentmanager.v1) CustomerType(org.citrusframework.schema.samples.fieldforceservice.v1.CustomerType)

Aggregations

org.citrusframework.schema.samples.fieldforceservice.v1 (org.citrusframework.schema.samples.fieldforceservice.v1)1 CustomerType (org.citrusframework.schema.samples.fieldforceservice.v1.CustomerType)1 org.citrusframework.schema.samples.incidentmanager.v1 (org.citrusframework.schema.samples.incidentmanager.v1)1 org.citrusframework.schema.samples.networkservice.v1 (org.citrusframework.schema.samples.networkservice.v1)1 IncidentType (org.citrusframework.schema.samples.networkservice.v1.IncidentType)1 NetworkType (org.citrusframework.schema.samples.networkservice.v1.NetworkType)1