1 package de.spring.webservices.rest.business;
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.client.CarClientService;
13 @Service("businessService")
14 public class BusinessService {
15 private static final Logger LOGGER = LoggerFactory.getLogger(BusinessService.class);
17 private final CarClientService carClientService;
20 public BusinessService(CarClientService carClientService) {
21 this.carClientService = carClientService;
25 public void doSomethingWithCars() {
26 List<Car> cars = carClientService.doGetCars();
27 LOGGER.info("Retrieved cars");
28 for (Car car : cars) {
29 LOGGER.info("car: " + car.getId());
30 LOGGER.info(car.getContent());
34 public void doSomethingWithCar(long id) {
35 Car car = carClientService.doGetCar(id);
36 LOGGER.info("Retrieved car");
37 LOGGER.info("car: " + car.getId());
38 LOGGER.info(car.getContent());
41 public void createsNewCar() {
42 Car newCar = new Car(666L, "just_a_test");
44 Car car = carClientService.doNewCar(newCar);
45 LOGGER.info("New car");
46 LOGGER.info("car: " + car.getId());
47 LOGGER.info(car.getContent());