Package org.springframework.samples.petclinic

Examples of org.springframework.samples.petclinic.Vet


        s1.setName("Surgery");
        s2.setName("Dentist");
        s1 = (Specialty) system.save(s1);
        s2 = (Specialty) system.save(s2);
       
        Vet v1 = new Vet();
        Vet v2 = new Vet();
        v1.setFirstName("Robert");
        v1.setLastName("DeNiro");
        v1.addSpecialty(s1);
        v2.setFirstName("Al");
        v2.setLastName("Pacino");
        v2.addSpecialty(s2);
        v1 = (Vet) system.save(v1);
        v2 = (Vet) system.save(v2);
    }
View Full Code Here


    List specialties = getBrokerTemplate().selectMany("getSpecialties");

    // Build each vet's list of specialties.
    Iterator vi = vets.iterator();
    while (vi.hasNext()) {
      Vet vet = (Vet) vi.next();
      List vetSpecialtiesIds = getBrokerTemplate().selectMany("getSpecialtiesByVet", "id", vet.getId());
      Iterator vsi = vetSpecialtiesIds.iterator();
      while (vsi.hasNext()) {
        int specialtyId = ((Integer) vsi.next()).intValue();
        Specialty specialty = (Specialty) EntityUtils.getById(specialties, Specialty.class, specialtyId);
        vet.addSpecialty(specialty);
      }
    }

    return vets;
  }
View Full Code Here

    private void createVetManagerTree() {
        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Vets");
        Collection vets = clinic.getVets();
        for (Iterator i = vets.iterator(); i.hasNext();) {
            Vet vet = (Vet)i.next();
            DefaultMutableTreeNode vetNode = new DefaultMutableTreeNode(vet);
            for (Iterator s = vet.getSpecialties().iterator(); s.hasNext();) {
                Specialty specialty = (Specialty)s.next();
                vetNode.add(new DefaultMutableTreeNode(specialty));
            }
            rootNode.add(vetNode);
        }
        this.vetsTreeModel = new DefaultTreeModel(rootNode);
        this.vetsTree = new JTree(vetsTreeModel);
        vetsTree.setShowsRootHandles(true);
        vetsTree.addTreeSelectionListener(new TreeStatusBarUpdater(getStatusBar()) {
            public String getSelectedObjectName() {
                Vet selectedVet = getSelectedVet();
                if (selectedVet != null)
                    return selectedVet.getFirstName() + " " + selectedVet.getLastName();

                return "Vets";
            }
        });
        vetsTree.setCellRenderer(getTreeCellRenderer());
View Full Code Here

    Collection<Vet> vets = this.clinic.getVets();
    // Use the inherited countRowsInTable() convenience method (from
    // AbstractTransactionalDataSourceSpringContextTests) to verify the
    // results.
    assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("VETS"), vets.size());
    Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
    assertEquals("Leary", v1.getLastName());
    assertEquals(1, v1.getNrOfSpecialties());
    assertEquals("radiology", (v1.getSpecialties().get(0)).getName());
    Vet v2 = EntityUtils.getById(vets, Vet.class, 3);
    assertEquals("Douglas", v2.getLastName());
    assertEquals(2, v2.getNrOfSpecialties());
    assertEquals("dentistry", (v2.getSpecialties().get(0)).getName());
    assertEquals("surgery", (v2.getSpecialties().get(1)).getName());
  }
View Full Code Here

    Collection<Vet> vets = this.clinic.getVets();
    // Use the inherited countRowsInTable() convenience method (from
    // AbstractTransactionalDataSourceSpringContextTests) to verify the
    // results.
    assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("vets"), vets.size());
    Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
    assertEquals("Leary", v1.getLastName());
    assertEquals(1, v1.getNrOfSpecialties());
    assertEquals("radiology", (v1.getSpecialties().get(0)).getName());
    Vet v2 = EntityUtils.getById(vets, Vet.class, 3);
    assertEquals("Douglas", v2.getLastName());
    assertEquals(2, v2.getNrOfSpecialties());
    assertEquals("dentistry", (v2.getSpecialties().get(0)).getName());
    assertEquals("surgery", (v2.getSpecialties().get(1)).getName());
  }
View Full Code Here

TOP

Related Classes of org.springframework.samples.petclinic.Vet

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.