当前位置: 首页>>代码示例>>Java>>正文


Java Flight类代码示例

本文整理汇总了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());
    }
}
 
开发者ID:rajeshrv,项目名称:SpringMicroservice,代码行数:19,代码来源:Application.java

示例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());
    }
}
 
开发者ID:rajeshrv,项目名称:SpringMicroservice,代码行数:19,代码来源:Application.java

示例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);
}
 
开发者ID:rajeshrv,项目名称:SpringMicroservice,代码行数:13,代码来源:SearchRestController.java

示例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; 
}
 
开发者ID:rajeshrv,项目名称:SpringMicroservice,代码行数:16,代码来源:SearchComponent.java

示例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); 
}
 
开发者ID:rajeshrv,项目名称:SpringMicroservice,代码行数:8,代码来源:SearchComponent.java


注:本文中的com.brownfield.pss.search.entity.Flight类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。