use of eu.ggnet.dwoss.customer.ee.entity.Company 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();
}
use of eu.ggnet.dwoss.customer.ee.entity.Company in project dwoss by gg-net.
the class CompanyUpdateTryOut method main.
// CustomerComapnyController
public static void main(String[] args) {
CustomerGenerator gen = new CustomerGenerator();
Company company = gen.makeCompany();
company.setTaxId("Steuernummer");
gen.makeAddresses(5).forEach(a -> company.getAddresses().add(a));
gen.makeContacts(6).forEach(c -> company.getContacts().add(c));
company.getCommunications().add(gen.makeCommunication());
company.getCommunications().add(gen.makeCommunication());
company.getCommunications().add(gen.makeCommunication());
company.getCommunications().add(gen.makeCommunication());
company.getCommunications().get(new Random().nextInt(company.getCommunications().size() - 1)).setPrefered(true);
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(() -> company, CompanyUpdateController.class).opt().ifPresent(System.out::println);
});
});
JButton addButton = new JButton("add");
addButton.addActionListener(ev -> {
Ui.exec(() -> {
Ui.build().fxml().eval(() -> new Company(), CompanyUpdateController.class).opt().ifPresent(System.out::println);
});
});
JPanel p = new JPanel();
p.add(editButton);
p.add(addButton);
p.add(close);
UiCore.startSwing(() -> p);
}
Aggregations