Search in sources :

Example 1 with Contact

use of eu.ggnet.dwoss.customer.ee.entity.Contact in project dwoss by gg-net.

the class PersistenceIT method testPersistence.

@Test
public void testPersistence() throws Exception {
    utx.begin();
    em.joinTransaction();
    Customer c = GEN.makeCustomer();
    em.persist(c);
    utx.commit();
    utx.begin();
    em.joinTransaction();
    CriteriaQuery<Customer> customerQ = em.getCriteriaBuilder().createQuery(Customer.class);
    c = em.createQuery(customerQ.select(customerQ.from(Customer.class))).getSingleResult();
    assertThat(c.getContacts()).describedAs("customer.getContacts()").isNotEmpty();
    L.info("{}", c);
    L.info("===== Contacts");
    for (Contact contact : c.getContacts()) {
        L.info(contact.toString());
        L.info("===== - Communications");
        for (Communication communication : contact.getCommunications()) {
            L.info(communication.toString());
        }
    }
    L.info("===== Companies");
    for (Company company : c.getCompanies()) {
        L.info(company.toString());
        L.info("===== - Communications:");
        for (Communication communication : company.getCommunications()) {
            L.info(communication.toString());
        }
    }
    L.info("===== MandatorMetaData");
    for (MandatorMetadata man : c.getMandatorMetadata()) {
        L.info(man.toString());
    }
    utx.commit();
}
Also used : Company(eu.ggnet.dwoss.customer.ee.entity.Company) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) Contact(eu.ggnet.dwoss.customer.ee.entity.Contact) Communication(eu.ggnet.dwoss.customer.ee.entity.Communication) Test(org.junit.Test)

Example 2 with Contact

use of eu.ggnet.dwoss.customer.ee.entity.Contact in project dwoss by gg-net.

the class ContactUpdateTryout method main.

public static void main(String[] args) {
    CustomerGenerator gen = new CustomerGenerator();
    Contact contact = gen.makeContact();
    contact.setTitle("Dr.");
    contact.getAddresses().add(gen.makeAddress());
    contact.getAddresses().add(gen.makeAddress());
    contact.getAddresses().add(gen.makeAddress());
    contact.getCommunications().add(gen.makeCommunication());
    contact.getCommunications().add(gen.makeCommunication());
    contact.getCommunications().add(gen.makeCommunication());
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton editButton = new JButton("edit");
    editButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> contact, ContactUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JButton addButton = new JButton("add");
    addButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> new Contact(), ContactUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JPanel p = new JPanel();
    p.add(editButton);
    p.add(addButton);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) Contact(eu.ggnet.dwoss.customer.ee.entity.Contact)

Aggregations

Contact (eu.ggnet.dwoss.customer.ee.entity.Contact)2 CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)1 Communication (eu.ggnet.dwoss.customer.ee.entity.Communication)1 Company (eu.ggnet.dwoss.customer.ee.entity.Company)1 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)1 MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1 Test (org.junit.Test)1