Search in sources :

Example 11 with AddressLabel

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

the class CustomerEnhanceTryout method main.

public static void main(String[] args) {
    CustomerGenerator gen = new CustomerGenerator();
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton firmenKundenButton = new JButton("Lade FirmenKunde");
    firmenKundenButton.addActionListener(ev -> {
        Customer customer = gen.makeCustomer();
        customer.getContacts().clear();
        customer.getCompanies().add(gen.makeCompany());
        customer.getCompanies().add(gen.makeCompany());
        customer.getCompanies().add(gen.makeCompany());
        customer.getCompanies().add(gen.makeCompany());
        customer.setSource(Source.ONEADO);
        customer.setKeyAccounter("Herr Meier");
        customer.getFlags().add(CustomerFlag.ITC_CUSTOMER);
        customer.getFlags().add(CustomerFlag.CS_UPDATE_CANDIDATE);
        customer.getAdditionalCustomerIds().put(ExternalSystem.SAGE, "testsage");
        if (customer.getViolationMessage() != null) {
            Ui.exec(() -> {
                Ui.build().alert("customer is invalid" + customer.getViolationMessage());
            });
            return;
        }
        customer.getAddressLabels().add(new AddressLabel(gen.makeCompany(), null, gen.makeAddress(), AddressType.SHIPPING));
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> customer, CustomerEnhanceController.class).opt().ifPresent(System.out::println);
        });
    });
    JButton endKundenButton = new JButton("Lade Endkunde");
    endKundenButton.addActionListener(ev -> {
        Customer customer = gen.makeCustomer();
        customer.getCompanies().clear();
        customer.getContacts().add(gen.makeContact());
        customer.getContacts().add(gen.makeContact());
        customer.getContacts().add(gen.makeContact());
        customer.getContacts().add(gen.makeContact());
        customer.setSource(Source.ONEADO);
        customer.getFlags().add(CustomerFlag.ITC_CUSTOMER);
        customer.getFlags().add(CustomerFlag.CS_UPDATE_CANDIDATE);
        customer.getAdditionalCustomerIds().put(ExternalSystem.SAGE, "testsage");
        if (customer.getViolationMessage() != null) {
            Ui.exec(() -> {
                Ui.build().alert("customer is invalid" + customer.getViolationMessage());
            });
            return;
        }
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> customer, CustomerEnhanceController.class).opt().ifPresent(System.out::println);
        });
    });
    JPanel p = new JPanel();
    p.add(endKundenButton);
    p.add(firmenKundenButton);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) AddressLabel(eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel) JButton(javax.swing.JButton) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)

Example 12 with AddressLabel

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

the class CustomerSimpleTest method makeValidAddressLabel.

public static AddressLabel makeValidAddressLabel() {
    AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.INVOICE);
    assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
    return validAddressLabel;
}
Also used : AddressLabel(eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)

Example 13 with AddressLabel

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

the class CustomerTest method makeValidAddressLabel.

public static AddressLabel makeValidAddressLabel() {
    AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.INVOICE);
    assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
    return validAddressLabel;
}
Also used : AddressLabel(eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)

Example 14 with AddressLabel

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

the class CustomerTestUtil method makeValidShippingAddressLabel.

/**
 * Uses makeValidCompany, makeValidContact and makeValidAddress.
 *
 * @return Valid AddressLabel of Type SHIPPING as in AddressLabel.getViolationMessage()
 */
public static AddressLabel makeValidShippingAddressLabel() {
    AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.SHIPPING);
    assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
    return validAddressLabel;
}
Also used : AddressLabel(eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)

Example 15 with AddressLabel

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

the class CustomerTestUtil method makeValidConsumerCustomer.

public static Customer makeValidConsumerCustomer() {
    Customer customer = new Customer();
    customer.getContacts().add(makeValidContact());
    customer.getContacts().get(0).getCommunications().add(makeValidCommunication(Type.MOBILE, "0170123456"));
    customer.getAddressLabels().add(new AddressLabel(null, customer.getContacts().get(0), customer.getContacts().get(0).getAddresses().get(0), AddressType.INVOICE));
    customer.getAddressLabels().add(new AddressLabel(null, customer.getContacts().get(0), makeValidAddress(), AddressType.SHIPPING));
    customer.getFlags().add(CustomerFlag.values()[(int) Math.random() * (CustomerFlag.values().length - 1)]);
    assertThat(customer.getViolationMessage()).overridingErrorMessage("ConsumerCustomer is not valid, because: " + customer.getViolationMessage()).isNull();
    assertThat(customer.isSimple()).overridingErrorMessage("ConsumerCustomer is not simple, because: " + customer.getSimpleViolationMessage()).isFalse();
    assertThat(customer.getSimpleViolationMessage()).as("ConsumerCustomer is not simple").isNotNull();
    assertThat(customer.isValid()).isTrue();
    assertThat(customer.isConsumer()).isTrue();
    return customer;
}
Also used : AddressLabel(eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)

Aggregations

AddressLabel (eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)20 Test (org.junit.Test)7 InvoiceAddressLabelWithNullableShippingAddressLabel (eu.ggnet.dwoss.customer.ui.neo.PreferedAddressLabelsController.InvoiceAddressLabelWithNullableShippingAddressLabel)3 SimpleCustomer (eu.ggnet.dwoss.customer.ee.entity.dto.SimpleCustomer)2 PicoCustomer (eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)2 CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)1 eu.ggnet.dwoss.customer.ee.entity (eu.ggnet.dwoss.customer.ee.entity)1 Type (eu.ggnet.dwoss.customer.ee.entity.Communication.Type)1 Sex (eu.ggnet.dwoss.customer.ee.entity.Contact.Sex)1 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)1 CustomerTestUtil (eu.ggnet.dwoss.customer.test.CustomerTestUtil)1 AddressType (eu.ggnet.dwoss.rules.AddressType)1 INVOICE (eu.ggnet.dwoss.rules.AddressType.INVOICE)1 SHIPPING (eu.ggnet.dwoss.rules.AddressType.SHIPPING)1 CustomerFlag (eu.ggnet.dwoss.rules.CustomerFlag)1 Arrays (java.util.Arrays)1 Locale (java.util.Locale)1 GERMANY (java.util.Locale.GERMANY)1 InvalidationListener (javafx.beans.InvalidationListener)1 Observable (javafx.beans.Observable)1