return retailerService.saveOrUpdateRetailer(retailer);
}
public Warehouse createOrUpdateWarehouse(final RequestData requestData, Warehouse warehouse, final WarehouseForm warehouseForm) {
if (warehouse == null) {
warehouse = new Warehouse();
Set<WarehouseMarketAreaRel> warehouseMarketAreas = new HashSet<WarehouseMarketAreaRel>();
WarehouseMarketAreaRel warehouseMarketArea = new WarehouseMarketAreaRel();
warehouseMarketArea.setMarketArea(requestData.getMarketArea());
warehouseMarketAreas.add(warehouseMarketArea);
warehouse.setWarehouseMarketAreaRels(warehouseMarketAreas);
}
if (StringUtils.isNotEmpty(warehouseForm.getCode())) {
warehouse.setCode(warehouseForm.getCode());
}
if (StringUtils.isNotEmpty(warehouseForm.getName())) {
warehouse.setName(warehouseForm.getName());
}
warehouse.setDescription(warehouseForm.getDescription());
warehouse.setAddress1(warehouseForm.getAddress1());
warehouse.setAddress2(warehouseForm.getAddress2());
warehouse.setAddressAdditionalInformation(warehouseForm.getAddressAdditionalInformation());
warehouse.setPostalCode(warehouseForm.getPostalCode());
warehouse.setCity(warehouseForm.getCity());
warehouse.setStateCode(warehouseForm.getStateCode());
warehouse.setCountryCode(warehouseForm.getCountryCode());
warehouse.setLatitude(warehouseForm.getLatitude());
warehouse.setLongitude(warehouseForm.getLongitude());
Warehouse savedWarehouse = warehouseService.saveOrUpdateWarehouse(warehouse);
return savedWarehouse;
}