/** * Given a <code>List<ESockEntry></code> creates and populates <code>Set<NavStep></code> * * @param <code>List<ESockEntry></code> navLogs * @throws Exception */ private void createNavSteps(List<ESockEntry> navLogs) throws Exception { for (ESockEntry entry : navLogs) { String activityType = this.activityType(entry.getValue()); if (activityType.equals("project_open")) { this.openOffset = entry.getMillisecondsOffset(); NavStep navStep = new NavStep(); navStep.setOpen(entry.getMillisecondsOffset() - openOffset); navStep.setPodId(null); this.navSteps.add(navStep); } else if (activityType.equals("step_open")) { NavStep navStep = new NavStep(); navStep.setOpen(entry.getMillisecondsOffset() - openOffset); EStep currentStep = this.getStepByPodUUID(this.podUUID(entry.getValue()), runId); navStep.setPodId(currentStep.getPodUUID().toString()); navStep.setActivityNum(((EActivity) currentStep.eContainer()).getNumber()); navStep.setStepNum(currentStep.getNumber()); this.navSteps.add(navStep); } else if (activityType.equals("step_close")) { String entryUUID = this.podUUID(entry.getValue()); if (entryUUID.equals("null")) { for (NavStep step : this.navSteps) { if (step.getPodId() == null) { this.navSteps.remove(step); } } } else { for (NavStep step : this.navSteps) { if (step.getPodId() == null) { step.setClose(entry.getMillisecondsOffset() - openOffset); EStep currentStep = this.getStepByPodUUID(entryUUID, runId); step.setPodId(currentStep.getPodUUID().toString()); step.setActivityNum(((EActivity) currentStep.eContainer()).getNumber()); step.setStepNum(currentStep.getNumber()); break; } else if (step.getPodId().equals(entryUUID)) { if (!step.isClosed()) { step.setClose(entry.getMillisecondsOffset() - openOffset); break; } } } } } else if (activityType.equals("project_close")) { for (NavStep step : this.navSteps) { if (!step.isClosed()) { step.setClose(entry.getMillisecondsOffset() - openOffset); } } } else { // error } } }
/** * Given a <code>String</code> id (podUUID) and a <code>long</code> runId, returns the step that * is associated with that run and that podUUID * * @param <code>String</code> id * @param <code>long</code> runId * @return <code>EStep</code> * @throws <code>ObjectNotFoundException</code> when no run is found with specified runId */ public EStep getStepByPodUUID(String id, long runId) throws Exception { for (EStep step : this.allSteps) { if (step.getPodUUID().toString().equals(id)) { return step; } } return null; }