Merge remote-tracking branch 'local12x/1.2.x'
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
|
||||
interface CityRepository extends Repository<City, Long> {
|
||||
|
||||
Page<City> findAll(Pageable pageable);
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.HotelSummary;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface CityService {
|
||||
|
||||
Page<City> findCities(CitySearchCriteria criteria, Pageable pageable);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.HotelSummary;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -24,9 +27,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.HotelSummary;
|
||||
|
||||
@Component("cityService")
|
||||
@Transactional
|
||||
class CityServiceImpl implements CityService {
|
||||
|
||||
@@ -18,16 +18,16 @@ package sample.data.jpa.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.HotelSummary;
|
||||
import sample.data.jpa.domain.RatingCount;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
interface HotelRepository extends Repository<Hotel, Long> {
|
||||
|
||||
Hotel findByCityAndName(City city, String name);
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.Review;
|
||||
import sample.data.jpa.domain.ReviewDetails;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface HotelService {
|
||||
|
||||
Hotel getHotel(City city, String name);
|
||||
|
||||
@@ -20,13 +20,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.Rating;
|
||||
@@ -34,6 +27,13 @@ import sample.data.jpa.domain.RatingCount;
|
||||
import sample.data.jpa.domain.Review;
|
||||
import sample.data.jpa.domain.ReviewDetails;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@Component("hotelService")
|
||||
@Transactional
|
||||
class HotelServiceImpl implements HotelService {
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package sample.data.jpa.service;
|
||||
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.Review;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
import sample.data.jpa.domain.Review;
|
||||
|
||||
interface ReviewRepository extends Repository<Review, Long> {
|
||||
|
||||
Page<Review> findByHotel(Hotel hotel, Pageable pageable);
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package sample.data.jpa.web;
|
||||
|
||||
import sample.data.jpa.service.CityService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import sample.data.jpa.service.CityService;
|
||||
|
||||
@Controller
|
||||
public class SampleController {
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.management.ObjectName;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@@ -17,15 +17,15 @@ package sample.data.jpa.service;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import sample.data.jpa.SampleDataJpaApplication;
|
||||
import sample.data.jpa.domain.City;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import sample.data.jpa.SampleDataJpaApplication;
|
||||
import sample.data.jpa.domain.City;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@@ -19,13 +19,6 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import sample.data.jpa.SampleDataJpaApplication;
|
||||
import sample.data.jpa.domain.City;
|
||||
import sample.data.jpa.domain.Hotel;
|
||||
@@ -33,6 +26,13 @@ import sample.data.jpa.domain.HotelSummary;
|
||||
import sample.data.jpa.domain.Rating;
|
||||
import sample.data.jpa.domain.RatingCount;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
Reference in New Issue
Block a user