1 package de.spring.webservices.rest.business.service.impl;
3 import javax.inject.Inject;
5 import org.springframework.data.domain.Page;
6 import org.springframework.data.domain.Pageable;
7 import org.springframework.stereotype.Service;
9 import de.spring.webservices.domain.Car;
10 import de.spring.webservices.rest.business.service.AwesomeBusinessLogic;
11 import de.spring.webservices.rest.business.service.RxJavaBusinessLogic;
17 * TODO: WHAT ABOUT EXCEPTIONS FROM awesomeBusinessLogic? RuntimeExceptions for example
18 * I guess they will be caught by my adapter in controller layer but I must try it.
23 @Service("rxJavaBusinessLogic")
24 public class RxJavaBusinessLogicImpl implements RxJavaBusinessLogic {
25 private final AwesomeBusinessLogic awesomeBusinessLogic;
28 public RxJavaBusinessLogicImpl(AwesomeBusinessLogic awesomeBusinessLogic) {
29 this.awesomeBusinessLogic = awesomeBusinessLogic;
33 public Observable<Page<Car>> findAll(Pageable pageRequest) {
34 return Observable.create(observer -> observer.onNext( awesomeBusinessLogic.findAll(pageRequest)));
39 public Observable<Car> findById(long id) {
40 return Observable.create(observer -> observer.onNext( awesomeBusinessLogic.findById(id)));
44 public Observable<Car> create(Car car) {
45 return Observable.create(observer -> observer.onNext(awesomeBusinessLogic.create(car)));