Search in sources :

Example 1 with DocumentViewType

use of eu.ggnet.dwoss.mandator.api.DocumentViewType 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());
    });
}
Also used : Operator(eu.ggnet.dwoss.rights.api.Operator) DocumentViewType(eu.ggnet.dwoss.mandator.api.DocumentViewType) AuthenticationException(eu.ggnet.saft.core.auth.AuthenticationException) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) FileJacket(eu.ggnet.dwoss.util.FileJacket) CustomerUpi(eu.ggnet.dwoss.customer.upi.CustomerUpi) JasperPrint(net.sf.jasperreports.engine.JasperPrint) JLabel(javax.swing.JLabel) DefaultCustomerSalesdata(eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata) AbstractGuardian(eu.ggnet.dwoss.common.AbstractGuardian) RemoteLookup(eu.ggnet.saft.core.cap.RemoteLookup) Mandators(eu.ggnet.dwoss.mandator.Mandators) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) UserInfoException(eu.ggnet.dwoss.util.UserInfoException)

Aggregations

AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 CustomerUpi (eu.ggnet.dwoss.customer.upi.CustomerUpi)1 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 DocumentViewType (eu.ggnet.dwoss.mandator.api.DocumentViewType)1 DefaultCustomerSalesdata (eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata)1 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)1 Operator (eu.ggnet.dwoss.rights.api.Operator)1 FileJacket (eu.ggnet.dwoss.util.FileJacket)1 UserInfoException (eu.ggnet.dwoss.util.UserInfoException)1 AuthenticationException (eu.ggnet.saft.core.auth.AuthenticationException)1 RemoteLookup (eu.ggnet.saft.core.cap.RemoteLookup)1 JLabel (javax.swing.JLabel)1 JasperPrint (net.sf.jasperreports.engine.JasperPrint)1