Package de.archivator.entities

Examples of de.archivator.entities.Name


        // ein Name von beiden ist gesetzt
        q.setParameter("nachname", lastName);
        q.setParameter("vorname", firstName);
        @SuppressWarnings("unchecked")
        List<Name> selectedNames = q.getResultList();
        Name name;
        if (selectedNames.size() == 0) {
          // Name ist neu in der Datenbank
          name = new Name(lastName, firstName);
        } else {
          name = selectedNames.get(0);
        }
        if (!archivaleNames.contains(name)) {
          name = entityManager.merge(name);
          archivaleNames.add(name);
          List<Archivale> archivalien = name.getArchivalien();
          archivalien.add(aktuellesArchivale);
        }
        name.setMarked(true);
      }
    }
    for (int i = archivaleNames.size(); i > 0; i--) {
      Name archivaleName = archivaleNames.get(i - 1);
      if (!archivaleName.isMarked()) {
        archivaleName.getArchivalien().remove(aktuellesArchivale);
        archivaleNames.remove(i - 1);
      }
    }

    // speichere in den Compass-Index
View Full Code Here


   * Test method for {@link de.archivator.beans.EditBean#loadNamen()}.
   */
  @Test
  public void testLoadNamen() {
    List<Name> namen = new ArrayList<Name>();
    namen.add(new Name("Müller", "Hans"));
    namen.add(new Name("Meier", "Franz"));
    aktuellesArchivale.setNamen(namen);

    String navigation = proband.loadNamen();

    assertNull("loadNamen() muss zum gleichen View navigieren", navigation);
View Full Code Here

   */
  @Test
  public void testSaveNamen() {
    proband.setFormularNames("Müller, Hans;");
    nameList = new ArrayList<Name>();
    Name name = new Name("Müller", "Hans");
    nameList.add(name);
    List<Name> archivaleNamen = new ArrayList<Name>();
    aktuellesArchivale.setNamen(archivaleNamen);

    when(query.getResultList()).thenReturn(nameList);
    when(entityManager.merge(name)).thenReturn(new Name("Müller", "Hans"));

    String navigation = proband.saveNamen();
    assertNull("saveNamen() muss zum gleichen View navigieren", navigation);
    assertEquals(1, aktuellesArchivale.getNamen().size());
  }
View Full Code Here

  private Name extractName(String nameString) {
    String nachname = nameString.split(",").length > 0 ? nameString
        .split(",")[0].trim() : null;
    String vorname = nameString.split(",").length > 1 ? nameString
        .split(",")[1].trim() : null;
    Name actualName = new Name(nachname, vorname);
    return actualName;
  }
View Full Code Here

   */
  private void addArchivaleName(List<Name> databaseNames,
      Archivale archivale, String nameString) {
    if (nameString != null) {
      List<Name> namen = archivale.getNamen();
      Name name = extractName(nameString);
      for (Name databaseName : databaseNames) {
        if (name.equals(databaseName)) {
          name = databaseName;
        }
      }
      if (name.getId() == 0) {
        databaseNames.add(name);
      }
      namen.add(name);
      name.getArchivalien().add(archivale);
    }
  }
View Full Code Here

TOP

Related Classes of de.archivator.entities.Name

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.