Package net.geco.model

Examples of net.geco.model.Runner


  }

  @Override
  public String requestMergeUnknownRunner(RunnerRaceData data, String ecard) {
    Course course = detectCourse(data);
    Runner r = detectArchiveRunner(data, ecard, course);
    if( r!=null ){
      // TODO: rethink this part with SIReaderHandler. We return null because detectArchiveRunner
      // already handled the case and announced CardRead (autoprinting).
      // Returning the e-card would led SIReaderHandler to announce an unknown card.
      return null;
View Full Code Here


    return bestResult.course;
  }

  private Runner detectArchiveRunner(RunnerRaceData data, String ecard, Course course) {
    ArchiveManager archive = geco().getService(ArchiveManager.class);
    Runner newRunner = archive.findAndCreateRunner(ecard, course);
    if( newRunner==null ){
      return null;
    } else {
      runnerControl().registerRunner(newRunner, data);
      geco().announcer().announceCardRead(newRunner.getEcard());
      geco().log("Insertion " + data.infoString()); //$NON-NLS-1$
      return newRunner;
    }
  }
View Full Code Here

 
  private String processData(RunnerRaceData runnerData, String ecard, Course course, Status status) {
    String uniqueEcard = runnerControl().deriveUniqueEcard(ecard);
    try {
      // Create from scratch a brand new runner
      Runner newRunner = runnerControl().buildAnonymousRunner(uniqueEcard, course);
//      newRunner.setFirstname("Loisir");
//      newRunner.setLastname(uniqueEcard);
      runnerData.getResult().setStatus(status); // set custom (unresolved) status
      runnerControl().registerRunner(newRunner, runnerData);
      geco().log("Creation " + runnerData.infoString()); //$NON-NLS-1$
View Full Code Here

    String firstName = trimQuotes(record[4]);
    if( ecard.equals("") ){ //$NON-NLS-1$
      geco().log(Messages.getString("StartlistImporter.NoEcardWarning") + firstName + " " + lastName); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    Runner runner = runnerControl().buildBasicRunner(ecard); // ensure unique ecard
    if( ! record[0].equals("") ){ //$NON-NLS-1$
      runner.setStartId(Integer.valueOf(record[0])); // TODO: ensure unique start number here
    }
    if( ! record[2].equals("") ){
      runner.setArchiveId(new Integer(record[2]));     
    }
    runner.setLastname(lastName);
    runner.setFirstname(firstName);
    runner.setNC(record[8].equals("X")); //$NON-NLS-1$
   
    Date relativeTime = TimeManager.safeParse(record[9]); // ! Time since zero hour
    runner.setRegisteredStarttime( TimeManager.absoluteTime(relativeTime, stage().getZeroHour()) );

    Club club = ensureClubInRegistry(record[15], record[14]);
    Category cat = ensureCategoryInRegistry(record[18], record[19]);
    runner.setClub(club);
    runner.setCategory(cat);
    runner.setCourse(registry().getDefaultCourseOrAnyFor(cat));
   
    runnerControl().registerNewRunner(runner);
  }
View Full Code Here

    return getRunnerData(rowIndex).getRunner();
  }
 
 
  public Object getValueAt(int rowIndex, int columnIndex) {
    Runner runner = getRunner(rowIndex);
    switch (columnIndex) {
    case 0: return runner.getStartId();
    case 1: return runner.getEcard();
    case 2: return runner.getFirstname();
    case 3: return runner.getLastname();
    case 4: return runner.getCategory().getShortname();
    case 5: return runner.getCourse().getName();
    case 6: return runner.getClub().getName();
    case 7: return TimeManager.time(getRunnerData(rowIndex).realRaceTime());
    case 8: return getRunnerData(rowIndex).getResult().getNbMPs();
    case 9: return getRunnerData(rowIndex).getResult().formatTimePenalty();
    case 10: return getRunnerData(rowIndex).getResult().formatRacetime();
    case 11: return getRunnerData(rowIndex).getResult().getStatus();
View Full Code Here

    return processData(input.split(",")); //$NON-NLS-1$
  }
 
  private String processData(String[] data) {
    // chip, start, last, first, cat, club, course, status, racetime, mps, penalties, trace...
    Runner runner = registry().findRunnerByEcard(data[0]);
    if( runner==null || ! Integer.valueOf(data[1]).equals(runner.getStartId()) ) {
      System.err.println("creation " + data[0]); //$NON-NLS-1$
      try {
        runner = runnerControl.createAnonymousRunner(registry().findCourse(data[6]));
        runnerControl.validateEcard(runner, data[0]);
        runnerControl.validateStartId(runner, data[1]);
        runnerControl.validateLastname(runner, data[2]);
        runnerControl.validateFirstname(runner, data[3]);
        runnerControl.validateCategory(runner, data[4]);
        runnerControl.validateClub(runner, data[5]);
        serverMulti.announceNewData();
      } catch (RunnerCreationException e) {
        e.printStackTrace();
      }
    } else { // check that course is consistent
      if( !runner.getCourse().getName().equals(data[6]) ) {
        System.err.println("inconsistent course " + data[6]); //$NON-NLS-1$
        runnerControl.validateCourse(registry().findRunnerData(runner), data[6]);
      }
    }
   
View Full Code Here

    default: break;
    }
  }

  private void setCategory(RunnerRaceData runnerData, String newCategory) {
    Runner runner = runnerData.getRunner();
    control().validateCategory(runner, newCategory);
    // check course even if no change in category
    if( useDefaultCourseForCategory ){
      Course catCourse = runner.getCategory().getCourse();
      if( catCourse!=null ){
        control().validateCourse(runnerData, catCourse.getName());
      }
    }
  }
View Full Code Here

  @Override
  protected void writeCsvResult(String id, RunnerRaceData runnerData,
            String rankOrStatus, String timeOrStatus, boolean showPenalties, CsvWriter writer)
      throws IOException {
    Runner runner = runnerData.getRunner();
    if( showPenalties ){
      writer.writeRecord(
        id,
        rankOrStatus,
        runner.getFirstname(),
        runner.getLastname(),
        runner.getClub().getName(),
        timeOrStatus,
        TimeManager.time(runnerData.realRaceTime()),
        Integer.toString(runnerData.getResult().getNbMPs()));
    } else {
      writer.writeRecord(
        id,
        rankOrStatus,
        runner.getFirstname(),
        runner.getLastname(),
        runner.getClub().getName(),
        timeOrStatus);       
    }
  }
View Full Code Here

  public RunnerRaceData importTData(String[] record) {
    /*
     * Start id,read time,clear time,check time,start time,finish time,
     * control, time, ...
     */
    Runner runner;
    if( version12 ){
      runner = this.registry.findRunnerById(Integer.valueOf(record[0]));
    } else {
      runner = this.registry.findRunnerByEcard(record[0]);
    }
View Full Code Here

  private Announcer announcer() {
    return geco().announcer();
  }

  public Runner buildMockRunner() {
    Runner runner = factory().createRunner();
    runner.setCourse(registry().anyCourse());
    return runner;   
  }
View Full Code Here

TOP

Related Classes of net.geco.model.Runner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.