Search in sources :

Example 1 with Customer

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) DefaultCustomerSalesdata(eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene)

Example 2 with Customer

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;
}
Also used : Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer)

Example 3 with 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);
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) Test(org.junit.Test)

Example 4 with Customer

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();
}
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 5 with Customer

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);
    }
}
Also used : UiCustomer(eu.ggnet.dwoss.customer.opi.UiCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) CustomerFlag(eu.ggnet.dwoss.rules.CustomerFlag)

Aggregations

Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)11 OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)5 CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)3 Test (org.junit.Test)3 MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)2 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)2 CustomerAgent (eu.ggnet.dwoss.customer.ee.CustomerAgent)1 CustomerEao (eu.ggnet.dwoss.customer.ee.eao.CustomerEao)1 Communication (eu.ggnet.dwoss.customer.ee.entity.Communication)1 Company (eu.ggnet.dwoss.customer.ee.entity.Company)1 Contact (eu.ggnet.dwoss.customer.ee.entity.Contact)1 SearchField (eu.ggnet.dwoss.customer.ee.entity.Customer.SearchField)1 AddressLabel (eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)1 PicoCustomer (eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)1 CustomerTaskService (eu.ggnet.dwoss.customer.ui.CustomerTaskService)1 CustomerContinue (eu.ggnet.dwoss.customer.ui.neo.CustomerSimpleController.CustomerContinue)1 DefaultCustomerSalesdata (eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata)1 Css (eu.ggnet.dwoss.rules.Css)1 CustomerFlag (eu.ggnet.dwoss.rules.CustomerFlag)1 HtmlPane (eu.ggnet.dwoss.util.HtmlPane)1