use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionType in project dwoss by gg-net.
the class CreateSelectionTryout method tryout.
@Test
public void tryout() throws InterruptedException {
JButton b = new JButton("Press to close");
b.setPreferredSize(new Dimension(200, 50));
CountDownLatch l = new CountDownLatch(1);
b.addActionListener(e -> {
l.countDown();
});
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(new Stock(0, "Rotes Lager"), new Stock(1, "Blaues Lager"));
return null;
}
// <editor-fold defaultstate="collapsed" desc="Unused Methodes">
@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 StockTransaction findOrCreateRollInTransaction(int stockId, String userName, String comment) {
// 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.");
}
});
UiCore.startSwing(() -> b);
Ui.exec(() -> {
Ui.build().fxml().eval(CreateSelectionController.class).opt().ifPresent(System.out::println);
});
l.await();
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionType in project dwoss by gg-net.
the class CreateSimpleActionTryout method tryout.
@Test
public void tryout() throws InterruptedException {
JPanel p = new JPanel();
JButton b = new JButton("Press to close");
b.setPreferredSize(new Dimension(200, 50));
CountDownLatch l = new CountDownLatch(1);
b.addActionListener(e -> {
l.countDown();
});
p.add(new JButton(new CreateSimpleAction()));
p.add(b);
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(new Stock(0, "Rotes Lager"), new Stock(1, "Blaues Lager"));
return null;
}
@Override
public List<StockUnit> findStockUnitsByRefurbishIdEager(List<String> refurbishIds) {
if (refurbishIds.contains("1")) {
Stock s = new Stock(0, "Lager1");
StockUnit s1 = new StockUnit("1", "Gerät Eins", 1);
s1.setStock(s);
return Arrays.asList(s1);
}
return Collections.EMPTY_LIST;
}
// <editor-fold defaultstate="collapsed" desc="Unused Methodes">
@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 <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 StockTransaction findOrCreateRollInTransaction(int stockId, String userName, String comment) {
// 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(StockTransactionProcessor.class, new StockTransactionProcessor() {
@Override
public SortedMap<Integer, String> perpareTransfer(List<StockUnit> stockUnits, int destinationStockId, String arranger, String comment) throws UserInfoException {
SortedMap<Integer, String> r = new TreeMap<>();
r.put(1, "1");
return r;
}
// <editor-fold defaultstate="collapsed" desc="Unused Methodes">
@Override
public List<Integer> rollIn(List<StockTransaction> detachtedTransactions, String arranger) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void cancel(StockTransaction transaction, String arranger, String comment) throws UserInfoException {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void commission(List<StockTransaction> transactions, String picker, String deliverer) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void receive(List<StockTransaction> transactions, String deliverer, String reciever) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeFromPreparedTransaction(String refurbishId, String arranger, String comment) throws UserInfoException {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Guardian guardianMock = mock(Guardian.class);
given(guardianMock.getUsername()).willAnswer(i -> "Testuser");
Dl.local().add(Guardian.class, guardianMock);
UiCore.startSwing(() -> p);
l.await();
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionType in project dwoss by gg-net.
the class SalesChannelManager method testSalesChannelManager.
@Test
public void testSalesChannelManager() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException ex) {
}
final Stock laden = new Stock(0, "Laden");
final Stock lager = new Stock(1, "Lager");
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="properties">
@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 StockTransaction findOrCreateRollInTransaction(int stockId, String userName, String comment) {
// 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.");
}
});
JFrame f = new JFrame();
SalesChannelManagerDialog dialog = new SalesChannelManagerDialog(f);
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()));
Map<SalesChannel, Stock> stockToChannel = new EnumMap<>(SalesChannel.class);
stockToChannel.put(CUSTOMER, laden);
stockToChannel.put(RETAILER, lager);
dialog.setModel(new SalesChannelTableModel(lines, stockToChannel));
Dimension dim = dialog.getToolkit().getScreenSize();
Rectangle abounds = dialog.getBounds();
dialog.setLocation((int) ((dim.width - abounds.width) / 3), (dim.height - abounds.height) / 2);
dialog.setVisible(true);
System.out.println("OK = " + dialog.isOk());
Map<Stock, List<String>> destinationsWithStockUnitIds = lines.stream().filter(// No Destination change
l -> l.getDestination() != null).sorted(// Sort
new LastCharsRefurbishIdSorter()).collect(Collectors.groupingBy(SalesChannelLine::getDestination, Collectors.mapping(SalesChannelLine::getRefurbishedId, Collectors.toList())));
for (Entry<Stock, List<String>> entry : destinationsWithStockUnitIds.entrySet()) {
System.out.println(entry.getKey().getName() + ",refurbishIds=" + entry.getValue());
}
f.dispose();
}
Aggregations