本文整理汇总了Java中com.brownfield.pss.search.entity.Flight类的典型用法代码示例。如果您正苦于以下问题:Java Flight类的具体用法?Java Flight怎么用?Java Flight使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Flight类属于com.brownfield.pss.search.entity包,在下文中一共展示了Flight类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
@Override
public void run(String... strings) throws Exception {
List<Flight> flights = new ArrayList<>();
flights.add(new Flight("BF100", "SEA","SFO","22-JAN-18",new Fares("100", "USD"),new Inventory(100)));
flights.add(new Flight("BF101", "NYC","SFO","22-JAN-18",new Fares("101", "USD"),new Inventory(100)));
flights.add(new Flight("BF105", "NYC","SFO","22-JAN-18",new Fares("105", "USD"),new Inventory(100)));
flights.add(new Flight("BF106", "NYC","SFO","22-JAN-18",new Fares("106", "USD"),new Inventory(100)));
flights.add(new Flight("BF102", "CHI","SFO","22-JAN-18",new Fares("102", "USD"),new Inventory(100)));
flights.add(new Flight("BF103", "HOU","SFO","22-JAN-18",new Fares("103", "USD"),new Inventory(100)));
flights.add(new Flight("BF104", "LAX","SFO","22-JAN-18",new Fares("104", "USD"),new Inventory(100)));
flightRepository.save(flights);
logger.info("Looking to load flights...");
for (Flight flight : flightRepository.findByOriginAndDestinationAndFlightDate("NYC", "SFO", "22-JAN-18")) {
logger.info(flight.toString());
}
}
示例2: run
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
@Override
public void run(String... strings) throws Exception {
List<Flight> flights = new ArrayList<>();
flights.add(new Flight("BF100", "SEA","SFO","22-JAN-16",new Fares("100", "USD"),new Inventory(100)));
flights.add(new Flight("BF101", "NYC","SFO","22-JAN-16",new Fares("101", "USD"),new Inventory(100)));
flights.add(new Flight("BF105", "NYC","SFO","22-JAN-16",new Fares("105", "USD"),new Inventory(100)));
flights.add(new Flight("BF106", "NYC","SFO","22-JAN-16",new Fares("106", "USD"),new Inventory(100)));
flights.add(new Flight("BF102", "CHI","SFO","22-JAN-16",new Fares("102", "USD"),new Inventory(100)));
flights.add(new Flight("BF103", "HOU","SFO","22-JAN-16",new Fares("103", "USD"),new Inventory(100)));
flights.add(new Flight("BF104", "LAX","SFO","22-JAN-16",new Fares("104", "USD"),new Inventory(100)));
flightRepository.save(flights);
logger.info("Looking to load flights...");
for (Flight flight : flightRepository.findByOriginAndDestinationAndFlightDate("NYC", "SFO", "22-JAN-16")) {
logger.info(flight.toString());
}
}
示例3: search
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
@HystrixCommand(fallbackMethod = "searchFallback")
public List<Flight> search(SearchQuery query){
List<Flight> flights= flightRepository.findByOriginAndDestinationAndFlightDate(query.getOrigin(),
query.getDestination(),
query.getFlightDate());
List<Flight> searchResult = new ArrayList<Flight>();
searchResult.addAll(flights);
flights.forEach(flight -> {
flight.getFares();
int inv = flight.getInventory().getCount();
if(inv < 0) {
searchResult.remove(flight);
}
});
return searchResult;
}
开发者ID:PacktPublishing,项目名称:Microservices-Building-Scalable-Software,代码行数:17,代码来源:SearchComponent.java
示例4: search
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
@RequestMapping(value="/get", method = RequestMethod.POST)
List<Flight> search(@RequestBody SearchQuery query){
logger.info("Input : "+ query);
if(Arrays.asList(originAirportShutdownList.split(",")).contains(query.getOrigin())){
logger.info("The origin airport is in shutdown state");
return new ArrayList<Flight>();
}
tpm.increment();
gaugeService.submit("tpm", tpm.count.intValue());
return searchComponent.search(query);
}
示例5: search
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
public List<Flight> search(SearchQuery query){
List<Flight> flights= flightRepository.findByOriginAndDestinationAndFlightDate(query.getOrigin(),
query.getDestination(),
query.getFlightDate());
List<Flight> searchResult = new ArrayList<Flight>();
searchResult.addAll(flights);
flights.forEach(flight -> {
flight.getFares();
int inv = flight.getInventory().getCount();
if(inv < 0) {
searchResult.remove(flight);
}
});
return searchResult;
}
示例6: updateInventory
import com.brownfield.pss.search.entity.Flight; //导入依赖的package包/类
public void updateInventory(String flightNumber, String flightDate, int inventory) {
logger.info("Updating inventory for flight "+ flightNumber + " innventory "+ inventory);
Flight flight = flightRepository.findByFlightNumberAndFlightDate(flightNumber,flightDate);
Inventory inv = flight.getInventory();
inv.setCount(inventory);
flightRepository.save(flight);
}