GLS ShipIT
GLS ShipIT - SOAP services
ConverterUtils.java
Go to the documentation of this file.
1 package eu.glsgroup.fpcs.soap.util;
2 
22 import eu.glsgroup.fpcs.dto.ConsigneeCategory;
23 
24 import java.util.List;
25 import java.util.Optional;
26 import java.util.stream.Collectors;
27 import java.util.stream.Stream;
28 
29 public final class ConverterUtils {
30 
31  //Suppress default constructor for non-instantiability
32  private ConverterUtils() {
33 
34  throw new AssertionError("ConverterUtils cannot be instantiated.");
35  }
36 
37  public static ConsigneeCategory convertCategoryType(CategoryType categoryType) {
38 
39  if (categoryType == null) {
40  return null;
41  }
42  switch (categoryType) {
43  case PRIVATE:
44  return ConsigneeCategory.PRIVATE;
45  case BUSINESS:
46  return ConsigneeCategory.BUSINESS;
47  default:
48  throw new IllegalArgumentException("Unexpected categoryType '" + categoryType + "'");
49  }
50  }
51 
52  public static List<String> convertUnitService(UnitService unitService) {
53 
54  return Stream.of(Optional.ofNullable(unitService.getCash())
56  Optional.ofNullable(unitService.getAddonLiability())
58  Optional.ofNullable(unitService.getHazardousGoods())
60  Optional.ofNullable(unitService.getExWorks())
62  Optional.ofNullable(unitService.getLimitedQuantities())
64  .filter(Optional::isPresent)
65  .map(Optional::get)
66  .collect(Collectors.toList());
67  }
68 
69  public static List<String> convertShipmentService(ShipmentService shipmentService) {
70 
71  return Stream.of(Optional.ofNullable(shipmentService.getService())
73  Optional.ofNullable(shipmentService.getShopDelivery())
75  Optional.ofNullable(shipmentService.getShopReturn())
77  Optional.ofNullable(shipmentService.getIntercompany())
79  Optional.ofNullable(shipmentService.getExchange())
81  Optional.ofNullable(shipmentService.getDeliveryAtWork())
83  Optional.ofNullable(shipmentService.getDeposit())
85  Optional.ofNullable(shipmentService.getIdentPin())
87  Optional.ofNullable(shipmentService.getIdent())
89  Optional.ofNullable(shipmentService.getPickAndShip())
91  Optional.ofNullable(shipmentService.getPickAndReturn())
93  .filter(Optional::isPresent)
94  .map(Optional::get)
95  .collect(Collectors.toList());
96  }
97 }
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService
Definition: ShipmentService.java:58
eu.glsgroup.fpcs.datatypes.soap.v1.common.IdentPINService.getServiceName
String getServiceName()
Definition: IdentPINService.java:64
eu.glsgroup.fpcs
eu.glsgroup.fpcs.datatypes.soap.v1.common.CashService.getServiceName
String getServiceName()
Definition: CashService.java:65
eu.glsgroup.fpcs.datatypes.soap.v1.common.IdentPINService
Definition: IdentPINService.java:45
eu.glsgroup.fpcs.datatypes
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getShopReturn
ShopReturnService getShopReturn()
Definition: ShipmentService.java:139
eu.glsgroup.fpcs.datatypes.soap.v1.common.CategoryType
Definition: CategoryType.java:25
eu.glsgroup.fpcs.datatypes.soap.v1.common.HazardousGoodsService.getServiceName
String getServiceName()
Definition: HazardousGoodsService.java:56
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService.getHazardousGoods
HazardousGoodsService getHazardousGoods()
Definition: UnitService.java:115
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getService
Service getService()
Definition: ShipmentService.java:91
eu.glsgroup.fpcs.datatypes.soap.v1.common.PickAndReturnService
Definition: PickAndReturnService.java:49
eu.glsgroup.fpcs.datatypes.soap.v1.common.DepositService.getServiceName
String getServiceName()
Definition: DepositService.java:54
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService.getAddonLiability
AddOnLiabilityService getAddonLiability()
Definition: UnitService.java:91
eu.glsgroup.fpcs.datatypes.soap.v1.common.PickAndShipService.getServiceName
String getServiceName()
Definition: PickAndShipService.java:72
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getIdentPin
IdentPINService getIdentPin()
Definition: ShipmentService.java:259
eu.glsgroup.fpcs.soap.util.ConverterUtils.convertCategoryType
static ConsigneeCategory convertCategoryType(CategoryType categoryType)
Definition: ConverterUtils.java:37
eu.glsgroup.fpcs.datatypes.soap.v1.common.IdentService.getServiceName
String getServiceName()
Definition: IdentService.java:71
eu.glsgroup.fpcs.datatypes.soap.v1.common.LimitedQuantitiesService.getServiceName
String getServiceName()
Definition: LimitedQuantitiesService.java:58
eu.glsgroup.fpcs.datatypes.soap.v1.common.PickAndShipService
Definition: PickAndShipService.java:49
eu.glsgroup.fpcs.datatypes.soap.v1.common.AddOnLiabilityService.getServiceName
String getServiceName()
Definition: AddOnLiabilityService.java:66
eu.glsgroup.fpcs.datatypes.soap
eu.glsgroup.fpcs.soap.util.ConverterUtils
Definition: ConverterUtils.java:29
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService.getLimitedQuantities
LimitedQuantitiesService getLimitedQuantities()
Definition: UnitService.java:163
eu.glsgroup.fpcs.datatypes.soap.v1.common.IntercompanyService.getServiceName
String getServiceName()
Definition: IntercompanyService.java:66
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getIntercompany
IntercompanyService getIntercompany()
Definition: ShipmentService.java:163
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getPickAndShip
PickAndShipService getPickAndShip()
Definition: ShipmentService.java:307
eu.glsgroup.fpcs.soap.util.ConverterUtils.convertShipmentService
static List< String > convertShipmentService(ShipmentService shipmentService)
Definition: ConverterUtils.java:69
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getShopDelivery
ShopDeliveryService getShopDelivery()
Definition: ShipmentService.java:115
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService.getExWorks
ExWorksService getExWorks()
Definition: UnitService.java:139
eu.glsgroup.fpcs.soap.util.ConverterUtils.convertUnitService
static List< String > convertUnitService(UnitService unitService)
Definition: ConverterUtils.java:52
eu.glsgroup.fpcs.datatypes.soap.v1.common.IdentService
Definition: IdentService.java:48
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShopReturnService
Definition: ShopReturnService.java:39
eu.glsgroup.fpcs.datatypes.soap.v1.common.ExchangeService
Definition: ExchangeService.java:44
eu.glsgroup.fpcs.datatypes.soap.v1.common.ExWorksService
Definition: ExWorksService.java:37
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShopDeliveryService.getServiceName
String getServiceName()
Definition: ShopDeliveryService.java:54
eu.glsgroup.fpcs.datatypes.soap.v1.common.Service
Definition: Service.java:37
eu.glsgroup.fpcs.datatypes.soap.v1.common.DepositService
Definition: DepositService.java:39
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getPickAndReturn
PickAndReturnService getPickAndReturn()
Definition: ShipmentService.java:331
eu.glsgroup.fpcs.datatypes.soap.v1.common.PickAndReturnService.getServiceName
String getServiceName()
Definition: PickAndReturnService.java:72
eu.glsgroup.fpcs.datatypes.soap.v1.common
Definition: AddOnLiabilityService.java:2
eu.glsgroup.fpcs.datatypes.soap.v1.common.HazardousGoodsService
Definition: HazardousGoodsService.java:41
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getDeposit
DepositService getDeposit()
Definition: ShipmentService.java:235
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getExchange
ExchangeService getExchange()
Definition: ShipmentService.java:187
eu.glsgroup.fpcs.datatypes.soap.v1.common.DeliveryAtWorkService.getServiceName
String getServiceName()
Definition: DeliveryAtWorkService.java:74
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService.getCash
CashService getCash()
Definition: UnitService.java:67
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getIdent
IdentService getIdent()
Definition: ShipmentService.java:283
eu.glsgroup.fpcs.datatypes.soap.v1.common.DeliveryAtWorkService
Definition: DeliveryAtWorkService.java:49
eu.glsgroup
eu.glsgroup.fpcs.datatypes.soap.v1.common.UnitService
Definition: UnitService.java:46
eu
eu.glsgroup.fpcs.datatypes.soap.v1.common.Service.getServiceName
String getServiceName()
Definition: Service.java:50
eu.glsgroup.fpcs.datatypes.soap.v1.common.IntercompanyService
Definition: IntercompanyService.java:46
eu.glsgroup.fpcs.datatypes.soap.v1.common.ExWorksService.getServiceName
String getServiceName()
Definition: ExWorksService.java:50
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShopDeliveryService
Definition: ShopDeliveryService.java:39
eu.glsgroup.fpcs.datatypes.soap.v1.common.LimitedQuantitiesService
Definition: LimitedQuantitiesService.java:42
eu.glsgroup.fpcs.datatypes.soap.v1.common.AddOnLiabilityService
Definition: AddOnLiabilityService.java:46
eu.glsgroup.fpcs.datatypes.soap.v1.common.ExchangeService.getServiceName
String getServiceName()
Definition: ExchangeService.java:62
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShipmentService.getDeliveryAtWork
DeliveryAtWorkService getDeliveryAtWork()
Definition: ShipmentService.java:211
eu.glsgroup.fpcs.datatypes.soap.v1
eu.glsgroup.fpcs.datatypes.soap.v1.common.CashService
Definition: CashService.java:45
eu.glsgroup.fpcs.datatypes.soap.v1.common.ShopReturnService.getServiceName
String getServiceName()
Definition: ShopReturnService.java:54