Search in sources :

Example 1 with UserInfoException

use of eu.ggnet.dwoss.core.common.UserInfoException in project dwoss by gg-net.

the class ResolveRepaymentController method handleResolveButtonAction.

@FXML
public void handleResolveButtonAction() {
    if (sopoField.getText().isEmpty()) {
        sopoField.setText(" IDENTIFIER EINGEBEN!!!!!");
        return;
    }
    resolveButton.setDisable(true);
    ForkJoinPool.commonPool().execute(() -> {
        try {
            ResolveResult result = Dl.remote().lookup(ResolveRepayment.class).resolveUnit(sopoField.getText(), contractor, Dl.local().lookup(Guardian.class).getUsername(), commentField.getText());
            Ui.build(sopoField).alert().title("Repayment resolved").message("Gutschrift gegenüber " + contractor.getDescription() + " aufgelöst").nl("Stock: " + result.stockMessage).nl("RedTape: " + result.redTapeMessage).nl("Report: " + result.reportMessage).show(AlertType.INFO);
            reset();
        } catch (UserInfoException ex) {
            Ui.handle(ex);
        } finally {
            reset();
        }
    });
}
Also used : ResolveRepayment(eu.ggnet.dwoss.misc.ee.ResolveRepayment) UserInfoException(eu.ggnet.dwoss.core.common.UserInfoException) ResolveResult(eu.ggnet.dwoss.misc.ee.ResolveRepayment.ResolveResult) FXML(javafx.fxml.FXML)

Example 2 with UserInfoException

use of eu.ggnet.dwoss.core.common.UserInfoException in project dwoss by gg-net.

the class SalesChannelManagerTryout method main.

public static void main(String... args) {
    final Stock laden = new Stock(0, "Laden");
    laden.setPrimaryChannel(RETAILER);
    final Stock lager = new Stock(1, "Lager");
    lager.setPrimaryChannel(CUSTOMER);
    Dl.remote().add(StockAgent.class, new StockAgent() {

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            if (entityClass.equals(Stock.class))
                return (List<T>) Arrays.asList(laden, lager);
            return null;
        }

        // <editor-fold defaultstate="collapsed" desc="unused">
        @Override
        public StockUnit findStockUnitByUniqueUnitIdEager(Integer uniqueUnitId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public StockUnit findStockUnitByRefurbishIdEager(String refurbishId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<StockTransaction> findStockTransactionEager(StockTransactionType type, StockTransactionStatusType statusType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<StockTransaction> findStockTransactionEager(StockTransactionType type, StockTransactionStatusType statusType, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<StockUnit> findStockUnitsByRefurbishIdEager(List<String> refurbishIds) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T persist(T t) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T merge(T t) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> void delete(T t) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @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, 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.");
        }
    });
    Dl.remote().add(SalesChannelHandler.class, new SalesChannelHandler() {

        @Override
        public List<SalesChannelLine> findAvailableUnits() {
            List<SalesChannelLine> lines = new ArrayList<>();
            lines.add(new SalesChannelLine(0, "22231", "Acer Aspire 3222-üäö", "gebraucht", 10, 10, "Lager", SalesChannel.UNKNOWN, lager.getId()));
            lines.add(new SalesChannelLine(1, "23212", "Acer Aspire 5102WLMi-€", "gebraucht", 10, 10, "Lager", SalesChannel.RETAILER, lager.getId()));
            lines.add(new SalesChannelLine(2, "43521", "Acer Aspire X3200", "gebraucht", 10, 10, "Lager", SalesChannel.RETAILER, lager.getId()));
            lines.add(new SalesChannelLine(4, "58247", "Acer Aspire One A150X blau", "gebraucht", 10, 10, "Lager", SalesChannel.CUSTOMER, laden.getId()));
            lines.add(new SalesChannelLine(5, "82235", "Acer Aspire 8930G-583G32Bn", "gebraucht", 10, 10, "Lager", SalesChannel.CUSTOMER, laden.getId()));
            lines.add(new SalesChannelLine(6, "19262", "Acer Aspire 8920G-834G32Bn", "gebraucht", 10, 10, "Lager", SalesChannel.CUSTOMER, lager.getId()));
            lines.add(new SalesChannelLine(7, "17239", "Acer Aspire 7330-572G16Mn", "Originalkarton, nahezu neuwertig", 10, 10, "Lager", SalesChannel.UNKNOWN, lager.getId()));
            return lines;
        }

        @Override
        public boolean update(List<SalesChannelLine> lines, String arranger, String transactionComment) throws UserInfoException {
            System.out.println("Update");
            System.out.println("Lines: " + lines);
            System.out.println("Arranger: " + arranger);
            System.out.println("Comment: " + transactionComment);
            return true;
        }
    });
    Dl.local().add(Guardian.class, new Guardian() {

        @Override
        public String getUsername() {
            return "Demo";
        }

        // <editor-fold defaultstate="collapsed" desc="unused">
        @Override
        public void logout() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Set<String> getOnceLoggedInUsernames() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Set<String> getAllUsernames() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void login(String user, char[] pass) throws AuthenticationException {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Set<AtomicRight> getRights() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public boolean quickAuthenticate(int userId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void remove(Object instance) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void addUserChangeListener(UserChangeListener listener) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void removeUserChangeListener(UserChangeListener listener) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void add(Accessable accessable) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void add(Object enableAble, AtomicRight authorisation) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void remove(Accessable accessable) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public boolean hasRight(AtomicRight authorisation) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton run = new JButton("Verkaufskanalmanager öffnen");
    run.setAction(new OpenSalesChannelManagerAction());
    JPanel p = new JPanel();
    p.add(run);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) SalesChannelHandler(eu.ggnet.dwoss.misc.ee.SalesChannelHandler) AtomicRight(eu.ggnet.dwoss.rights.api.AtomicRight) OpenSalesChannelManagerAction(eu.ggnet.dwoss.misc.ui.cap.OpenSalesChannelManagerAction) SalesChannelLine(eu.ggnet.dwoss.stock.ee.model.SalesChannelLine) StockAgent(eu.ggnet.dwoss.stock.ee.StockAgent) LockModeType(javax.persistence.LockModeType) UserInfoException(eu.ggnet.dwoss.core.common.UserInfoException)

Example 3 with UserInfoException

use of eu.ggnet.dwoss.core.common.UserInfoException in project dwoss by gg-net.

the class UnitProcessorStub method findEditableUnit.

@Override
public EditableUnit findEditableUnit(String refurbishedIdOrSerial) throws UserInfoException {
    UniqueUnit uniqueUnit = uniqueUnits.stream().filter(uu -> refurbishedIdOrSerial.equals(uu.getRefurbishId()) || refurbishedIdOrSerial.equals(uu.getSerial())).findAny().orElseThrow(() -> new UserInfoException("Keine UniqeuUnit mit SopoNr/Seriennummer: " + refurbishedIdOrSerial));
    StockUnit stockUnit = stockUnits.stream().filter(su -> uniqueUnit.getRefurbishId().equals(su.getRefurbishId())).findAny().orElseThrow(() -> new UserInfoException("Keine StockUnit mit SopoNr/Seriennummer: " + refurbishedIdOrSerial));
    return new EditableUnit(uniqueUnit, stockUnit, ReceiptOperation.values()[R.nextInt(ReceiptOperation.values().length)], uniqueUnit.getProduct().getPartNo());
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) UserInfoException(eu.ggnet.dwoss.core.common.UserInfoException) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit)

Example 4 with UserInfoException

use of eu.ggnet.dwoss.core.common.UserInfoException in project dwoss by gg-net.

the class StockApiBean method scrap.

@AutoLogger
@Override
public List<Scraped> scrap(List<Long> stockUnitIds, String reason, String arranger) throws NullPointerException, UserInfoException {
    if (StringUtils.isBlank(reason))
        throw new UserInfoException("Keine Grund angeben");
    List<Scraped> result = scrapDelete(stockUnitIds, "Verschrottung : " + reason, arranger);
    scrapObservers.fire(new ScrapEvent(result.stream().filter(Scraped::successful).map(Scraped::uniqueUnitId).collect(Collectors.toList()), arranger, reason));
    return result;
}
Also used : ScrapEvent(eu.ggnet.dwoss.stock.api.event.ScrapEvent) UserInfoException(eu.ggnet.dwoss.core.common.UserInfoException) AutoLogger(eu.ggnet.dwoss.core.system.autolog.AutoLogger)

Example 5 with UserInfoException

use of eu.ggnet.dwoss.core.common.UserInfoException in project dwoss by gg-net.

the class StockApiBean method delete.

@AutoLogger
@Override
public List<Scraped> delete(List<Long> stockUnitIds, String reason, String arranger) throws NullPointerException, UserInfoException {
    if (StringUtils.isBlank(reason))
        throw new UserInfoException("Keine Grund angeben");
    List<Scraped> result = scrapDelete(stockUnitIds, "Löschung : " + reason, arranger);
    deleteObservers.fire(new DeleteEvent(result.stream().filter(Scraped::successful).map(Scraped::uniqueUnitId).collect(Collectors.toList()), arranger, reason));
    return result;
}
Also used : DeleteEvent(eu.ggnet.dwoss.stock.api.event.DeleteEvent) UserInfoException(eu.ggnet.dwoss.core.common.UserInfoException) AutoLogger(eu.ggnet.dwoss.core.system.autolog.AutoLogger)

Aggregations

UserInfoException (eu.ggnet.dwoss.core.common.UserInfoException)42 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)8 DocumentType (eu.ggnet.dwoss.core.common.values.DocumentType)7 Inject (javax.inject.Inject)6 PositionType (eu.ggnet.dwoss.core.common.values.PositionType)5 ReceiptGeneratorOperation (eu.ggnet.dwoss.receipt.ee.gen.ReceiptGeneratorOperation)5 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)5 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)5 EJB (javax.ejb.EJB)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 Arquillian (org.jboss.arquillian.junit.Arquillian)5 RunWith (org.junit.runner.RunWith)5 FileJacket (eu.ggnet.dwoss.core.common.FileJacket)4 SubMonitor (eu.ggnet.dwoss.core.system.progress.SubMonitor)4 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)4 eu.ggnet.dwoss.redtape.ee.entity (eu.ggnet.dwoss.redtape.ee.entity)4 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)4 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)4 java.util (java.util)4 Collectors (java.util.stream.Collectors)4