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();
}
});
}
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);
}
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());
}
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;
}
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;
}
Aggregations