Exemplo n.º 1
0
  private Hut createHut(
      String name,
      String phone,
      String coordinates,
      String buildDate,
      String mapId,
      String picUrl,
      String capacity,
      String price) {
    ExpeditionMap map = manager.getExpeditionMap(Integer.parseInt(mapId));
    Hut hut = null;
    try {
      hut =
          new Hut(
              name,
              phone,
              coordinates,
              new Date(new SimpleDateFormat("yyyy-MM-dd").parse(buildDate).getTime()),
              map,
              picUrl,
              Integer.parseInt(capacity),
              Double.parseDouble(price));
    } catch (ParseException e) {
      e.printStackTrace();
    }

    manager.addHut(hut);

    return hut;
  }
Exemplo n.º 2
0
  private Expedition createExpedition(
      String name, String description, String startVillage, String endVillage, String expMapId) {
    ExpeditionMap expMap = manager.getExpeditionMap(Integer.parseInt(expMapId));
    Expedition exp = new Expedition(name, description, startVillage, endVillage, expMap);

    manager.addExpedition(exp);

    return exp;
  }
Exemplo n.º 3
0
  private Registry createRegistry(
      String expId, String participantId, String startDate, String endDate) {
    Expedition exp = manager.getExpedition(Integer.parseInt(expId));
    Participant p = manager.getParticipant(Integer.parseInt(participantId));
    Registry reg = null;
    try {
      reg =
          new Registry(
              exp,
              p,
              new Date(new SimpleDateFormat("yyyy-MM-dd").parse(startDate).getTime()),
              new Date(new SimpleDateFormat("yyyy-MM-dd").parse(endDate).getTime()));
    } catch (ParseException e) {
      e.printStackTrace();
    }

    manager.addRegistry(reg);

    return reg;
  }
Exemplo n.º 4
0
  private ExpeditionMap createNewMap(String mountain, String date, String picPath) {
    ExpeditionMap map = null;
    try {
      Date issueDate = new Date(new SimpleDateFormat("yyyy-dd-MM").parse(date).getTime());
      map = new ExpeditionMap(mountain, issueDate, picPath);
    } catch (ParseException e) {
      e.printStackTrace();
    }

    manager.addExpeditionMap(map);

    return map;
  }
Exemplo n.º 5
0
  private Participant createParticipant(String name, String birthDate) {
    Participant participant = null;
    try {
      participant =
          new Participant(
              name, new Date(new SimpleDateFormat("yyyy-MM-dd").parse(birthDate).getTime()));
    } catch (ParseException e) {
      e.printStackTrace();
    }

    manager.addParticipant(participant);

    return participant;
  }