Esempio n. 1
0
 @Override
 @WebMethod
 public ResponseDTO findCauseOfDepartureDelaysAtEachAirport() {
   Map<String, Map<String, Integer>> airportDelayCauseMap = Maps.newHashMap();
   try (Transaction tx = graphDatabaseService.beginTx()) {
     ResourceIterator<Node> resourceIterator = indexRepository.getNodes(NodeType.AIRPORT);
     if (resourceIterator != null) {
       while (resourceIterator.hasNext()) {
         Node node = resourceIterator.next();
         airportDelayCauseMap.put(
             node.getProperty(NodeType.AIRPORT.getIdType()).toString(),
             airportTraversal.findCauseOfDepartureDelaysAtEachAirport(node));
       }
     }
     tx.success();
     tx.close();
   }
   return new ResponseDTO(new Assembler().toCauseDtos(airportDelayCauseMap));
 }
Esempio n. 2
0
 @Override
 @WebMethod
 public ResponseDTO findDelayedFlights(Integer delayTime) {
   Map<String, List<DelayDTO>> delayDtoMap = Maps.newHashMap();
   try (Transaction tx = graphDatabaseService.beginTx()) {
     ResourceIterator<Node> resourceIterator = indexRepository.getNodes(NodeType.AIRPORT);
     if (resourceIterator != null) {
       while (resourceIterator.hasNext()) {
         Node node = resourceIterator.next();
         delayDtoMap.put(
             node.getProperty(NodeType.AIRPORT.getIdType()).toString(),
             airportTraversal.findDelayedFlights(node, delayTime));
       }
     }
     tx.success();
     tx.close();
   }
   return new ResponseDTO(new Assembler().toDelayDtos(delayDtoMap));
 }