use of eu.ggnet.dwoss.mandator.Mandators 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());
}
use of eu.ggnet.dwoss.mandator.Mandators in project dwoss by gg-net.
the class DocumentUpdateViewTryout method main.
public static void main(String[] args) {
// Test different settings of booking accounts in ledgers and in positions
// Test comment
Dl.remote().add(CustomerService.class, new CustomerServiceStub());
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
UiCore.startSwing(() -> {
JLabel l = new JLabel("Main Application");
l.setFont(new Font("DejaVu Sans", 0, 48));
return l;
});
Dossier dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
final Document doc = new Document(DocumentType.ORDER, SEND_ORDER, new DocumentHistory("UnitTest", "Ein Kommentar"));
dos.add(doc);
Address address = new Address("Max Mustermann\nMusterstrass 11\n22222 Musterstadt");
doc.setInvoiceAddress(address);
doc.setShippingAddress(address);
doc.setTaxType(GENERAL_SALES_TAX_DE_SINCE_2007);
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:123456 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(1).uniqueUnitProductId(1).price(100).tax(doc.getSingleTax()).build());
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:12345 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(2).uniqueUnitProductId(2).price(100).tax(doc.getSingleTax()).build());
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:1234 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).price(100).uniqueUnitId(3).uniqueUnitProductId(3).tax(0.07).build());
doc.append(Position.builder().type(SERVICE).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Service Acer Aspire E1-572P-74508G75Dnii").price(100).bookingAccount(L_1001_HW_SW_STORE).tax(0).build());
doc.append(Position.builder().type(SHIPPING_COST).amount(1).description("Versandkosten").name("Versandkosten").price(10).bookingAccount(L_1002_VERSANDKOSTEN).tax(doc.getSingleTax()).build());
Dl.remote().add(Mandators.class, new Mandators() {
@Override
public PostLedger loadPostLedger() {
return new PostLedger(PostLedger.add().positionTypes(UNIT).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1000_STD_UNIT), PostLedger.add().positionTypes(UNIT).taxTypes(UNTAXED).primaryLedger(2001, "Geräte ohne Ust."), PostLedger.add().positionTypes(UNIT, SERVICE, PRODUCT_BATCH, SHIPPING_COST, UNIT_ANNEX).taxTypes(REVERSE_CHARGE).primaryLedger(3000, "Reverse Charge"), PostLedger.add().positionTypes(SERVICE).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(2002, "Dienstleistung Store").alternativeLedger(L_1000_STD_UNIT).alternativeLedger(L_1002_VERSANDKOSTEN).alternativeLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(PRODUCT_BATCH).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(SHIPPING_COST).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1002_VERSANDKOSTEN));
}
@Override
public DefaultCustomerSalesdata loadSalesdata() {
return new DefaultCustomerSalesdata(ShippingCondition.DEFAULT, PaymentCondition.CUSTOMER, PaymentMethod.DIRECT_DEBIT, null, null);
}
// <editor-fold defaultstate="collapsed" desc="Unused Methods">
@Override
public ShippingTerms loadShippingTerms() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Mandator loadMandator() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ReceiptCustomers loadReceiptCustomers() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public SpecialSystemCustomers loadSystemCustomers() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Contractors loadContractors() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.remote().add(RedTapeWorker.class, new RedTapeWorkerStub());
Dl.remote().add(RedTapeAgent.class, null);
Dl.remote().add(UnitOverseer.class, null);
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setRights(new Operator("All Rights", 1, Arrays.asList(AtomicRight.values())));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
DocumentUpdateView view = new DocumentUpdateView(doc);
DocumentUpdateController controller = new DocumentUpdateController(view, doc);
view.setController(controller);
view.setCustomerValues(1);
Ui.exec(() -> {
Ui.build().title("Dokument bearbeiten").swing().eval(() -> OkCancelWrap.vetoResult(view)).opt().ifPresent(System.out::println);
});
}
use of eu.ggnet.dwoss.mandator.Mandators in project dwoss by gg-net.
the class DesktopBundleViewTryout method tryoutView.
@Test
public void tryoutView() throws InterruptedException {
final ProductSpec spec = new SpecGenerator().makeSpec();
DesktopBundleView view = new DesktopBundleView(new Mandators() {
@Override
public Mandator loadMandator() {
return Mandator.builder().defaultMailSignature(null).smtpConfiguration(null).mailTemplateLocation(null).company(CompanyGen.makeCompany()).dossierPrefix("DW").documentIntermix(null).documentIdentifierGeneratorConfigurations(new EnumMap<>(DocumentType.class)).build();
}
@Override
public DefaultCustomerSalesdata loadSalesdata() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("loadSalesdata - Not supported yet.");
}
@Override
public ReceiptCustomers loadReceiptCustomers() {
return ReceiptCustomers.builder().build();
}
@Override
public SpecialSystemCustomers loadSystemCustomers() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("loadSystemCustomers - Not supported yet.");
}
@Override
public Contractors loadContractors() {
return new Contractors(EnumSet.of(TradeName.ALSO, TradeName.ACER), EnumSet.of(TradeName.ACER));
}
@Override
public PostLedger loadPostLedger() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("loadPostLedger - Not supported yet.");
}
@Override
public ShippingTerms loadShippingTerms() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("loadShippingTerms - Not supported yet.");
}
}, new SpecAgent() {
@Override
public ProductSpec findProductSpecByPartNoEager(String partNo) {
if (partNo == null)
return null;
if (partNo.startsWith("X"))
return null;
spec.setPartNo(partNo);
return spec;
}
// <editor-fold defaultstate="collapsed" desc="Unneeded Methods">
@Override
public <T> long count(Class<T> entityClass) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAll(Class<T> entityClass) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAllEager(Class<T> entityClass) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findById(Class<T> entityClass, Object id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findByIdEager(Class<T> entityClass, Object id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
}, new ProductProcessorStub(), TradeName.ACER, TradeName.ACER, ProductGroup.DESKTOP, ProductGroup.MONITOR);
view.setSpec(new DesktopBundle());
OkCancelDialog<DesktopBundleView> dialog = new OkCancelDialog<>("BundleView", view);
dialog.setVisible(true);
dialog.dispose();
}
use of eu.ggnet.dwoss.mandator.Mandators in project dwoss by gg-net.
the class RedTapeTryout method main.
public static void main(String[] args) {
Dl.local().add(RemoteLookup.class, new RemoteLookup() {
@Override
public <T> boolean contains(Class<T> clazz) {
return false;
}
@Override
public <T> T lookup(Class<T> clazz) {
return null;
}
});
Dl.remote().add(RedTapeAgent.class, new RedTapeAgentStub());
Dl.remote().add(RedTapeWorker.class, new RedTapeWorkerStub());
Dl.remote().add(UniversalSearcher.class, new UniversalSearcherStub());
Dl.remote().add(CustomerService.class, new CustomerServiceStub());
Dl.remote().add(DocumentSupporter.class, new DocumentSupporter() {
@Override
public void mail(Document document, DocumentViewType jtype) throws UserInfoException, RuntimeException {
System.out.println("Mailing " + document);
}
@Override
public JasperPrint render(Document document, DocumentViewType viewType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Dossier briefed(Document detached, String arranger) {
detached.add(Document.Flag.CUSTOMER_BRIEFED);
detached.add(Document.Flag.CUSTOMER_EXACTLY_BRIEFED);
return detached.getDossier();
}
@Override
public FileJacket toXls(String identifier) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.local().add(Guardian.class, new AbstractGuardian() {
@Override
public void login(String user, char[] pass) throws AuthenticationException {
setRights(new Operator(user, 1, Arrays.asList(AtomicRight.values())));
}
});
Dl.remote().add(StockAgent.class, null);
Dl.remote().add(UniqueUnitAgent.class, null);
// Dl.remote().add(LegacyRemoteBridge.class, null);
Dl.remote().add(ShippingCostService.class, null);
Mandators mandatorSupporterMock = mock(Mandators.class);
when(mandatorSupporterMock.loadSalesdata()).thenReturn(new DefaultCustomerSalesdata(ShippingCondition.DEFAULT, PaymentCondition.CUSTOMER, PaymentMethod.DIRECT_DEBIT, Arrays.asList(SalesChannel.CUSTOMER, SalesChannel.RETAILER), null));
Dl.remote().add(Mandators.class, mandatorSupporterMock);
CustomerUpi ccos = mock(CustomerUpi.class);
when(ccos.createCustomer(any())).thenReturn(0L);
when(ccos.updateCustomer(any(), anyLong())).thenReturn(true);
Dl.local().add(CustomerUpi.class, ccos);
UiCore.startSwing(() -> new JLabel("Main Applikation"));
Ui.exec(() -> {
Ui.build().swing().show(() -> RedTapeController.build().getView());
});
}
use of eu.ggnet.dwoss.mandator.Mandators in project dwoss by gg-net.
the class RevenueReportSelectionViewTryout method main.
public static void main(String[] args) {
Mandators mandatorSupporterMock = mock(Mandators.class);
when(mandatorSupporterMock.loadContractors()).thenReturn(new Contractors(EnumSet.of(TradeName.FUJITSU), EnumSet.of(TradeName.FUJITSU)));
// Not yet implemented
Dl.remote().add(Mandators.class, mandatorSupporterMock);
Ui.exec(() -> {
UiCore.startSwing(() -> new JLabel("Main Applikation"));
Ui.build().fx().eval(() -> new RevenueReportSelectionView()).opt().ifPresent(System.out::println);
});
}
Aggregations