Esempio n. 1
0
  /**
   * @param args - not used
   * @throws Exception - if anything goes awry
   */
  public static void main(String[] args) throws Exception {
    // Create lists to be populated by factory

    // remember to consider final qualifier for local vars
    List<ClientAccount> accounts = new ArrayList<ClientAccount>();
    List<Consultant> consultants = new ArrayList<Consultant>();
    List<TimeCard> timeCards = new ArrayList<TimeCard>();
    ListFactory.populateLists(accounts, consultants, timeCards);

    DbServer db = new DbServer("jdbc:mysql://localhost/scgDB", "student", "student");
    for (ClientAccount account : accounts) {
      db.addClient(account);
    }

    for (Consultant consultant : consultants) {
      db.addConsultant(consultant);
    }

    for (TimeCard tc : timeCards) {
      db.addTimeCard(tc);
    }
  }