Search in sources :

Example 1 with Mandator

use of eu.ggnet.dwoss.mandator.api.value.Mandator in project dwoss by gg-net.

the class MandatorHtmlTryout method start.

@Override
public void start(Stage stage) throws Exception {
    Company company = Company.builder().name("Example GmbH").street("Test Street 7").zip("99999").city("Testcity").email("test@example.de").emailName("Example GmbH Shop").build();
    SmtpConfiguration smtpConfiguration = new SmtpConfiguration("example.de", "user", "password", "UTF-8", true);
    DocumentIntermix documentIntermix = new DocumentIntermix(null);
    documentIntermix.setFooter("Geschäftsführer: Mr. Tester | USt. ID: XXXXXXXXXXX | HRB: 0000\n" + "Tel: 1-800-555-0199 | eMail: test@example.de\n" + "www.example.de | www.example.de\n" + "Bankverbindung: Awesome Bank | Bankleitzal:133 713 37 | Kontonummer: 133713371\n" + "IBAN: XXXXXXXXXXXXXXXXXXXXXX | BIC: XXXXXXXX");
    Map<DocumentType, DocumentIdentifierGeneratorConfiguration> documentIdentifierGeneratorConfigurations = new HashMap<>();
    documentIdentifierGeneratorConfigurations.put(DocumentType.INVOICE, new DocumentIdentifierGeneratorConfiguration("RS{PREFIX}_{COUNTER}", PrefixType.YY, new DecimalFormat("00000")));
    documentIdentifierGeneratorConfigurations.put(DocumentType.ANNULATION_INVOICE, new DocumentIdentifierGeneratorConfiguration("SR{PREFIX}_{COUNTER}", PrefixType.YY, new DecimalFormat("00000")));
    documentIdentifierGeneratorConfigurations.put(DocumentType.CREDIT_MEMO, new DocumentIdentifierGeneratorConfiguration("GS{PREFIX}_{COUNTER}", PrefixType.YY, new DecimalFormat("00000")));
    String defaultMailSignature = "Mail Signatur \n Test Test \t Senior System Requirements Specilist \n  Mobiel: 0174 123 45 67 \n  Phone; 040 123 45 67 \n Impressums: xxxx";
    UrlLocation mailTemplateLocation = new UrlLocation(new URL("http://example.com/"));
    MandatorMailAttachment attachment1 = MandatorMailAttachment.builder().attachmentName("NewFile.txt").attachmentDescription("txt file").attachmentData(mailTemplateLocation).build();
    MandatorMailAttachment attachment2 = MandatorMailAttachment.builder().attachmentName("NewFile.docx").attachmentDescription("Microsoft Word Document").attachmentData(mailTemplateLocation).build();
    Set<MandatorMailAttachment> defaultMailAttachment = new HashSet<>();
    defaultMailAttachment.add(attachment1);
    defaultMailAttachment.add(attachment2);
    Mandator mandator = Mandator.builder().smtpConfiguration(smtpConfiguration).company(company).dossierPrefix("DW").documentIntermix(documentIntermix).defaultMailSignature(defaultMailSignature).mailTemplateLocation(mailTemplateLocation).defaultMailAttachment(defaultMailAttachment).documentIdentifierGeneratorConfigurations(documentIdentifierGeneratorConfigurations).applyDefaultChannelOnRollIn(false).matchCode("SAMPLE").bugMail("error@localhost").build();
    stage.setTitle("HtmlViewer");
    WebView view = new WebView();
    view.getEngine().loadContent(Css.toHtml5WithStyle(mandator.toHtml()));
    BorderPane p = new BorderPane(view);
    Scene scene = new Scene(p, Color.ALICEBLUE);
    stage.setScene(scene);
    stage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) DecimalFormat(java.text.DecimalFormat) Scene(javafx.scene.Scene) URL(java.net.URL) Mandator(eu.ggnet.dwoss.mandator.api.value.Mandator) WebView(javafx.scene.web.WebView)

Example 2 with Mandator

use of eu.ggnet.dwoss.mandator.api.value.Mandator in project dwoss by gg-net.

the class TestWildfly method tryClassicJndi.

public static void tryClassicJndi() throws Exception {
    final Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
    env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
    // the property below is required ONLY if there is no ejb client configuration loaded (such as a
    // jboss-ejb-client.properties in the class path) and the context will be used to lookup EJBs
    env.put("jboss.naming.client.ejb.context", true);
    InitialContext remoteContext = new InitialContext(env);
    Object lookupObject = remoteContext.lookup("dwoss-server/MandatorSupporterBean!eu.ggnet.dwoss.mandator.MandatorSupporter");
    Mandators supporter = (Mandators) lookupObject;
    Mandator mandator = supporter.loadMandator();
    System.out.println(mandator);
    System.out.println(mandator.getDocumentIntermix().toMultiLine());
}
Also used : Mandators(eu.ggnet.dwoss.mandator.Mandators) Mandator(eu.ggnet.dwoss.mandator.api.value.Mandator) Properties(java.util.Properties) InitialContext(javax.naming.InitialContext)

Example 3 with Mandator

use of eu.ggnet.dwoss.mandator.api.value.Mandator in project dwoss by gg-net.

the class TestWildfly method tryEjbJndi.

public static void tryEjbJndi() throws Exception {
    final Properties env = new Properties();
    env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
    InitialContext remoteContext = new InitialContext(env);
    Object lookupObject = remoteContext.lookup("ejb:/dwoss-server//MandatorSupporterBean!eu.ggnet.dwoss.mandator.MandatorSupporter");
    Mandators supporter = (Mandators) lookupObject;
    Mandator mandator = supporter.loadMandator();
    System.out.println(mandator);
    System.out.println(mandator.getDocumentIntermix().toMultiLine());
}
Also used : Mandators(eu.ggnet.dwoss.mandator.Mandators) Mandator(eu.ggnet.dwoss.mandator.api.value.Mandator) Properties(java.util.Properties) InitialContext(javax.naming.InitialContext)

Example 4 with Mandator

use of eu.ggnet.dwoss.mandator.api.value.Mandator in project dwoss by gg-net.

the class TestWildfly method tryRemoteLookupImplementation.

public static void tryRemoteLookupImplementation() {
    WildflyLookup l = new WildflyLookup(EjbConnectionConfiguration.builder().host("localhost").port(8080).username("admin").password("admin").app("dwoss-server").build());
    Mandators supporter = l.lookup(Mandators.class);
    Mandator mandator = supporter.loadMandator();
    System.out.println(mandator);
    System.out.println(mandator.getDocumentIntermix().toMultiLine());
}
Also used : Mandators(eu.ggnet.dwoss.mandator.Mandators) WildflyLookup(eu.ggnet.dwoss.assembly.remote.lookup.WildflyLookup) Mandator(eu.ggnet.dwoss.mandator.api.value.Mandator)

Aggregations

Mandator (eu.ggnet.dwoss.mandator.api.value.Mandator)4 Mandators (eu.ggnet.dwoss.mandator.Mandators)3 Properties (java.util.Properties)2 InitialContext (javax.naming.InitialContext)2 WildflyLookup (eu.ggnet.dwoss.assembly.remote.lookup.WildflyLookup)1 URL (java.net.URL)1 DecimalFormat (java.text.DecimalFormat)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 WebView (javafx.scene.web.WebView)1