1 package de.spring.webservices.rest.business.service.impl;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Service;
10 import de.spring.webservices.domain.Car;
11 import de.spring.webservices.rest.business.service.BusinessService;
12 import de.spring.webservices.rest.client.service.CarClientService;
14 @Service("businessService")
15 public class BusinessServiceImpl implements BusinessService {
16 private static final Logger LOGGER = LoggerFactory.getLogger(BusinessServiceImpl.class);
18 private final CarClientService carClientService;
21 public BusinessServiceImpl(CarClientService carClientService) {
22 this.carClientService = carClientService;
27 public void doSomethingWithCars() {
28 List<Car> cars = carClientService.doGetCars();
29 LOGGER.info("Retrieved cars");
30 for (Car car : cars) {
31 LOGGER.info("car: " + car.getId());
32 LOGGER.info(car.getContent());
37 public void doSomethingWithCar(long id) {
38 Car car = carClientService.doGetCar(id);
39 LOGGER.info("Retrieved car");
40 LOGGER.info("car: " + car.getId());
41 LOGGER.info(car.getContent());
45 public void createsNewCar() {
46 Car newCar = new Car(666L, "just_a_test");
48 Car car = carClientService.doNewCar(newCar);
49 LOGGER.info("New car");
50 LOGGER.info("car: " + car.getId());
51 LOGGER.info(car.getContent());