private Map<String, Object> getPropertyMap(Destination domainObject) { Map<String, Object> map = new HashMap<>(); map.put(AIRPORT_ID, domainObject.getAirport()); map.put(FLIGHT_ID, domainObject.getFlightNumber()); map.put(ARRIVAL_DELAY, domainObject.getArrivalDelay()); map.put(TAXI_IN, domainObject.getTaxiIn()); return map; }
@Override public void store(Destination domainObject) { try (Transaction tx = graphDatabaseService.beginTx()) { Node airport = indexRepository.get(domainObject.getAirport(), NodeType.AIRPORT); Node flight = indexRepository.get(domainObject.getFlightNumber(), NodeType.FLIGHT); if (airport == null || flight == null) { logger.warn( "Relationship cannot be established between " + NodeType.FLIGHT.getClassName() + " : " + domainObject.getFlightNumber() + " and " + NodeType.AIRPORT.getClassName() + " : " + domainObject.getAirport()); return; } createSingleRelationship( flight, airport, NodeType.FLIGHT, NodeType.AIRPORT, NodeRelationshipType.DESTINATION, getPropertyMap(domainObject)); tx.success(); logger.info( "Relation created of type : " + NodeRelationshipType.DESTINATION.name() + " from flight : " + domainObject.getFlightNumber() + " to airport : " + domainObject.getAirport()); } }