use of eu.ggnet.dwoss.customer.ee.entity.Customer in project dwoss by gg-net.
the class CustomerHtmlTryout method start.
@Override
public void start(Stage primaryStage) throws Exception {
CustomerGenerator gen = new CustomerGenerator();
Customer c1 = gen.makeOldCustomer();
Customer c2 = gen.makeCustomer();
DefaultCustomerSalesdata defaults = DefaultCustomerSalesdata.builder().allowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER)).paymentCondition(PaymentCondition.CUSTOMER).shippingCondition(ShippingCondition.DEALER_ONE).paymentMethod(PaymentMethod.DIRECT_DEBIT).build();
String MATCHCODE = c1.getMandatorMetadata().stream().map(MandatorMetadata::getMandatorMatchcode).findFirst().orElse("NONE");
OldCustomer c0 = ConverterUtil.convert(c1, MATCHCODE, defaults);
WebView view = new WebView();
view.getEngine().loadContent(Css.toHtml5WithStyle("<h1>OldCustomer.toHtml()</h1>" + c0.toHtmlHighDetailed() + "<hr /><h1>makeOldCustmer : Customer.toHtml(MATCHCODE,defaults)</h1>" + c1.toHtml(MATCHCODE, defaults) + "<hr /><h1>makeOldCustmer : Customer.toHtml()</h1>" + c1.toHtml() + "<hr /><h1>makeCustmer : Customer.toHtml()</h1>" + c2.toHtml()));
primaryStage.setScene(new Scene(new BorderPane(view)));
primaryStage.sizeToScene();
primaryStage.show();
}
use of eu.ggnet.dwoss.customer.ee.entity.Customer in project dwoss by gg-net.
the class CustomerSearchIT method convert.
private Customer convert(OldCustomer old) {
Customer customer = new Customer();
ConverterUtil.mergeFromOld(old, customer, mandator.getMatchCode(), salesData);
return customer;
}
use of eu.ggnet.dwoss.customer.ee.entity.Customer in project dwoss by gg-net.
the class CustomerSearchIT method testLucenceSearch.
@Test
public void testLucenceSearch() throws Exception {
OldCustomer c1 = new OldCustomer("Die Firma", "Herr", "Max", "Mustermann", "Keine Bemerkungen", "Helle Strasse 22", "12345", "Musterhausen");
OldCustomer c2 = new OldCustomer(null, "Frau", "Marria", "Mustermann", "Grosse Tüten", "Dunkle Allee 7", "12345", "Musterhausen", "Dünne Gasse 2", "22222", "Wolfsstaaad");
c2.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
c2.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c1.setPaymentCondition(PaymentCondition.CUSTOMER);
// by pp
OldCustomer c3 = new OldCustomer("Schlagstock Ltd.", "Herr", "Michael", "Wankelmeier", "Bloß freundlich sein !!!", "Adamsweg 3", "00666", "Eisenhüttenstadt");
c3.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c3.addFlag(CustomerFlag.CONFIRMED_CASH_ON_DELIVERY);
c3.setPaymentMethod(PaymentMethod.CASH_ON_DELIVERY);
c3.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER, SalesChannel.RETAILER));
c3.setPaymentCondition(PaymentCondition.DEALER_3_PERCENT_DISCOUNT);
c3.setShippingCondition(ShippingCondition.DEALER_ONE);
OldCustomer c4 = new OldCustomer(null, "Frau", "Lisa", "Lüstling", null, "Freie Straße 2", "98745", "Heimwehrhausen", "Dünne Gasse 2", "22222", "Heimwehrhausen");
c4.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c4.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER));
c4.setPaymentCondition(PaymentCondition.EMPLOYEE);
c4.setShippingCondition(ShippingCondition.DEALER_ONE);
c4.setPaymentMethod(PaymentMethod.INVOICE);
utx.begin();
em.joinTransaction();
em.persist(convert(c1));
em.persist(convert(c2));
em.persist(convert(c3));
em.persist(convert(c4));
utx.commit();
List<Customer> find = eao.find("schlag*");
assertThat(find).as("Result of search").hasSize(1);
assertTrue("Only One element should be here: " + find, find.size() == 1);
find = eao.find("schlag");
assertTrue("No element should be here: " + find, find.isEmpty());
find = eao.find("schlagstock ltd");
assertTrue("One element should be here: " + find, find.size() == 1);
// Testing Search via Provider
assertThat(searchProvider).as("Searchprovider").isNotNull().returns(GlobalKey.Component.CUSTOMER, e -> e.getSource());
SearchRequest req = new SearchRequest("schlag*");
int estimateMaxResults = searchProvider.estimateMaxResults(req);
assertThat(estimateMaxResults).as("estimated max results").isEqualTo(1);
List<ShortSearchResult> result = searchProvider.search(req, 0, 10);
assertThat(result).as("Searchresult").hasSize(1);
}
use of eu.ggnet.dwoss.customer.ee.entity.Customer 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.Customer in project dwoss by gg-net.
the class CustomerServiceBean method updateCustomerFlags.
@Override
public void updateCustomerFlags(long customerId, Set<CustomerFlag> flags) {
Customer customer = customerEao.findById(customerId);
customer.getFlags().clear();
for (CustomerFlag customerFlag : flags) {
customer.getFlags().add(customerFlag);
}
}
Aggregations