Search in sources :

Example 6 with Communication

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

the class CommunicationUpdateTryout method main.

public static void main(String[] args) {
    Communication comm = new Communication(Type.MOBILE, "040123456789");
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton editButton = new JButton("Edit");
    editButton.addActionListener(ev -> {
        if (comm.getViolationMessage() != null) {
            System.out.println("Communication ViolationMessages: " + comm.getViolationMessage());
        }
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> comm, CommunicationUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JButton addButton = new JButton("Add");
    addButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> new Communication(), CommunicationUpdateController.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) Communication(eu.ggnet.dwoss.customer.ee.entity.Communication)

Example 7 with Communication

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

the class CommunicationUpdateController method getCommunication.

/**
 * Get the Communication back
 */
private Communication getCommunication() {
    Communication c = new Communication();
    c.setType(commtypbox.getSelectionModel().getSelectedItem());
    c.setIdentifier(identifer.getText());
    return c;
}
Also used : Communication(eu.ggnet.dwoss.customer.ee.entity.Communication)

Example 8 with Communication

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

the class CustomerSimpleController method getSimpleCustomer.

private SimpleCustomer getSimpleCustomer() throws IllegalStateException {
    SimpleCustomer sc = new SimpleCustomer();
    sc.setTitle(titleTextField.getText());
    sc.setFirstName(firstNameTextField.getText());
    sc.setLastName(lastNameTextField.getText());
    sc.setStreet(streetTextField.getText());
    sc.setZipCode(zipcodeTextField.getText());
    sc.setCity(cityTextField.getText());
    sc.setIsoCountry(countryTextField.getText());
    if (StringUtils.isNotBlank(mobileTextField.getText())) {
        Communication communication = new Communication(Type.MOBILE, mobileTextField.getText());
        if (communication.getViolationMessage() != null)
            throw new IllegalStateException(communication.getViolationMessage());
        sc.setMobilePhone(mobileTextField.getText());
    }
    if (StringUtils.isNotBlank(landLineTextField.getText())) {
        Communication communication = new Communication(Type.PHONE, landLineTextField.getText());
        if (communication.getViolationMessage() != null)
            throw new IllegalStateException(communication.getViolationMessage());
        sc.setLandlinePhone(landLineTextField.getText());
    }
    if (StringUtils.isNotBlank(emailTextField.getText())) {
        Communication communication = new Communication(Type.EMAIL, emailTextField.getText());
        if (communication.getViolationMessage() != null)
            throw new IllegalStateException(communication.getViolationMessage());
        sc.setEmail(emailTextField.getText());
    }
    sc.setSex(genderChoiseBox.getSelectionModel().getSelectedItem());
    sc.setSource(sourceChoiseBox.getSelectionModel().getSelectedItem());
    sc.setCompanyName(companyNameTextField.getText());
    sc.setTaxId(ustIdTextField.getText());
    sc.setComment(commentTextArea.getText());
    return sc;
}
Also used : SimpleCustomer(eu.ggnet.dwoss.customer.ee.entity.dto.SimpleCustomer) Communication(eu.ggnet.dwoss.customer.ee.entity.Communication)

Example 9 with Communication

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

the class CommunicationTest method testValidPhonenumber.

@Test
public void testValidPhonenumber() {
    Communication makeValidCommunication = makeValidCommunication();
    makeValidCommunication.setType(PHONE);
    makeValidCommunication.setIdentifier("0401234567");
    assertThat(makeValidCommunication.getViolationMessage()).as("Communication with valid phonenumber").isNull();
}
Also used : Communication(eu.ggnet.dwoss.customer.ee.entity.Communication) Test(org.junit.Test)

Example 10 with Communication

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

the class CommunicationTest method makeValidCommunication.

public static Communication makeValidCommunication() {
    Communication validCommunication = new Communication(EMAIL, "max.mustermann@gmail.com");
    assertThat(validCommunication.getViolationMessage()).as("valid Communication").isNull();
    return validCommunication;
}
Also used : Communication(eu.ggnet.dwoss.customer.ee.entity.Communication)

Aggregations

Communication (eu.ggnet.dwoss.customer.ee.entity.Communication)10 Test (org.junit.Test)6 Company (eu.ggnet.dwoss.customer.ee.entity.Company)1 Contact (eu.ggnet.dwoss.customer.ee.entity.Contact)1 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)1 MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)1 SimpleCustomer (eu.ggnet.dwoss.customer.ee.entity.dto.SimpleCustomer)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1