Beispiel #1
0
  private void saveMarathonData(final MarathonData data) {
    storage.callInTransaction(
        new Callable<Void>() {

          @Override
          public Void call() throws Exception {
            storage.saveMaraton(data);
            return null;
          }
        });
  }
Beispiel #2
0
  private MarathonData loadMarathonData(final String name) {
    return storage.callInTransaction(
        new Callable<MarathonData>() {

          @Override
          public MarathonData call() throws Exception {
            final MarathonData marathon = storage.getMarathon(name, ReadPolicy.READ_OR_CREATE);
            if (marathon.getCompetitionPhases().isEmpty()) {
              final PhaseDataCompetition phaseA = new PhaseDataCompetition();
              phaseA.setPhaseName("Phase A");
              marathon.getCompetitionPhases().put(Phase.A, phaseA);
              final PhaseDataCompetition phaseD = new PhaseDataCompetition();
              phaseD.setPhaseName("Phase D");
              marathon.getCompetitionPhases().put(Phase.D, phaseD);
              final PhaseDataCompetition phaseE = new PhaseDataCompetition();
              phaseE.setPhaseName("Phase E");
              marathon.getCompetitionPhases().put(Phase.E, phaseE);
            }
            return marathon;
          }
        });
  }