Created
June 6, 2018 13:10
-
-
Save shankybnl/060120bd2b72ada9c2d670f5a222ae94 to your computer and use it in GitHub Desktop.
PilotSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@And("^Get all active \"([^\"]*)\" of pilots$") | |
public void getAllActiveOfPilots(String activityOrDuty) throws Throwable { | |
session = CrudOperations.createHibernateConnection(); | |
if (activityOrDuty.equalsIgnoreCase("duties")) { | |
activePilotDutiesMap = new HashMap<>(); | |
List<PilotDuty> pilotDuty = session.createQuery("from PilotDuty where isActive=true order by id desc").list(); | |
for (int i = 0; i < pilotDuty.size(); i++) { | |
List<Long> duties = null; | |
if (activePilotDutiesMap.containsKey(pilotDuty.get(i).getPilotId())) { | |
duties = activePilotDutiesMap.get(pilotDuty.get(i).getPilotId()); | |
duties.add(pilotDuty.get(i).getId()); | |
activePilotDutiesMap.put(pilotDuty.get(i).getPilotId(), duties); | |
} else { | |
int pilot = pilotDuty.get(i).getPilotId().intValue(); | |
duties = activePilotDutiesMap.get(pilot); | |
if (duties == null) { | |
duties = new ArrayList<Long>(); | |
Long dutyId = pilotDuty.get(i).getId(); | |
activePilotDutiesMap.put(pilotDuty.get(i).getPilotId(), duties); | |
duties.add(pilotDuty.get(i).getId()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment