Пример #1
0
  private ServiceWrapper constructServiceWrapperFromService(Service xmlService) {
    ServiceWrapper service = new ServiceWrapper(xmlService.getId());

    service.setTtl(xmlService.getTtl());
    service.setConsumability(xmlService.getConsumability());
    service.setContractDescription(xmlService.getContractDescription());
    service.setDescription(xmlService.getDescription());
    service.setServiceContractID(xmlService.getContractID());
    service.setServiceName(xmlService.getServiceName());

    if (xmlService.getAccessPoints() != null) {
      for (ws.argo.wireline.response.xml.Services.Service.AccessPoints.AccessPoint ap :
          xmlService.getAccessPoints().getAccessPoint()) {
        service.addAccessPoint(
            ap.getLabel(),
            ap.getIpAddress(),
            ap.getPort(),
            ap.getUrl(),
            ap.getData().getType(),
            ap.getData().getValue());
      }
    }

    service.setResponseID(xmlService.getResponseID());
    service.setProbeID(xmlService.getProbeID());

    return service;
  }
Пример #2
0
  private Service composeServiceFromServiceWrapper(ServiceWrapper service) {
    ObjectFactory of = new ObjectFactory();
    Service xmlService = of.createServicesService();

    xmlService.setId(service.getId());
    xmlService.setServiceName(service.getServiceName());
    if (service.getTtl() != null) xmlService.setTtl(Integer.toString(service.getTtl().intValue()));
    else xmlService.setTtl("0");
    xmlService.setConsumability(service.getConsumability());
    xmlService.setContractDescription(service.getContractDescription());
    xmlService.setDescription(service.getDescription());
    xmlService.setContractID(service.getServiceContractID());

    for (AccessPoint ac : service.accessPoints) {
      ws.argo.wireline.response.xml.Services.Service.AccessPoints.AccessPoint ap =
          of.createServicesServiceAccessPointsAccessPoint();
      ap.setLabel(ac.label);
      ap.setIpAddress(ac.ipAddress);
      ap.setPort(ac.port);
      ap.setUrl(ac.url);
      Data xmlData = of.createServicesServiceAccessPointsAccessPointData();
      xmlData.setType(ac.dataType);
      xmlData.setValue(ac.data);
      ap.setData(xmlData);

      AccessPoints aps = xmlService.getAccessPoints();
      if (aps == null) {
        aps = of.createServicesServiceAccessPoints();
        xmlService.setAccessPoints(aps);
      }

      xmlService.getAccessPoints().getAccessPoint().add(ap);
    }

    xmlService.setResponseID(service.getResponseId());
    xmlService.setProbeID(service.getProbeId());

    return xmlService;
  }