Example #1
0
  private void addSeedData() {

    String[][] peopleArray = {
      {"1", "Garner", "Paul John", "M"},
      {"2", "Garner", "Frederick John", "M"},
      {"3", "Garner", "Frederick", "M"},
      {"4", "Garner", "Amos", "M"},
      {"5", "Garner", "William", "M"},
      {"6", "Garner", "William", "M"},
      {"7", "Garner", "John", "M"},
      {"8", "Odell", "Brenda Margaret", "F"},
      {"9", "Jennings", "Nicola", "F"}
    };

    for (String[] personArray : peopleArray) {
      Person person = new Person();

      person.setId(Integer.parseInt(personArray[0]));
      person.setSurname(personArray[1]);
      person.setForenames(personArray[2]);
      person.setGender(personArray[3]);

      people.add(person);
    }
  }
Example #2
0
  public static Result create() throws NoSuchAlgorithmException {
    models.Person person = personForm.bindFromRequest().get();

    if (personForm.hasErrors()) {
      return badRequest();
    }

    person.save();
    return ok("Got user " + person.toString());
  }
Example #3
0
  public List<Person> getBySurname(String surname) {

    List<Person> peopleWithSurname = new ArrayList<Person>();

    for (Person _person : people) {
      if (_person.getSurname().equalsIgnoreCase(surname)) {
        peopleWithSurname.add(_person);
      }
    }

    return peopleWithSurname;
  }
Example #4
0
  public Person getById(int id) {
    Person person = null;

    for (Person _person : people) {
      if (_person.getId() == id) {
        person = _person;
        break;
      }
    }

    return person;
  }
Example #5
0
  private void setSkillTextField() {
    String personCode = person.getPersonCode();
    try {
      this.list = skillQueries.getSkillsOfPerson(personCode);
    } catch (SQLException e) {
      e.printStackTrace();
    }

    StringBuilder sb = new StringBuilder();
    for (Skill skill : list) {
      sb.append(skill.getSkillName() + ", ");
    }
    taSkills.setText(sb.toString());
  }
  private void displayPersonTypes(Person person) {
    this.person = person;
    List<Address> list = null;

    try {
      list = addressQueries.getPersonAddresses(person.getPersonCode());
    } catch (SQLException e) {
      e.printStackTrace();
    }
    cbTypeModel = new DefaultComboBoxModel<Address>();
    cbTypeModel.removeAllElements();
    for (Address address : list) {
      cbTypeModel.addElement(address);
    }

    cbType.setModel(cbTypeModel);
  }