protected void solveAutomaticPressed() { okPressed(); Set<ArticleID> articleIDs = new HashSet<ArticleID>(); if (getPaymentDatas() != null && (transferWizard.getTransferMode() & TransferWizard.TRANSFER_MODE_PAYMENT) > 0) { // add all ArticleIDs from all invoices of all payments Set<PayableObjectID> payableObjectIDs = new HashSet<PayableObjectID>(); for (PaymentData pd : getPaymentDatas()) { payableObjectIDs.addAll(pd.getPayment().getPayableObjectIDs()); } Set<InvoiceID> invoiceIDs = CollectionUtil.castSet(payableObjectIDs); List<Invoice> invoices = InvoiceDAO.sharedInstance() .getInvoices( invoiceIDs, new String[] {FetchPlan.DEFAULT, Invoice.FETCH_GROUP_ARTICLES}, NLJDOHelper.MAX_FETCH_DEPTH_NO_LIMIT, new NullProgressMonitor()); for (Invoice invoice : invoices) { Collection<? extends ArticleID> tmpArticleIDSet = NLJDOHelper.getObjectIDSet(invoice.getArticles()); articleIDs.addAll(tmpArticleIDSet); } } if (getDeliveryDatas() != null && (transferWizard.getTransferMode() & TransferWizard.TRANSFER_MODE_DELIVERY) > 0) { // add all ArticleIDs from all deliveryNotes of all deliveries for (DeliveryData dd : getDeliveryDatas()) { articleIDs.addAll(dd.getDelivery().getArticleIDs()); } } CombiTransferArticlesWizard wizard = new CombiTransferArticlesWizard(articleIDs, transferWizard.getTransferMode()); wizard.setErrorHandler(new QuickSaleErrorHandler()); DynamicPathWizardDialog dialog = new DynamicPathWizardDialog(wizard); dialog.open(); this.transfersSuccessful = wizard.isTransfersSuccessful(); }
@Override public Set<TimePattern> _getTimePatterns() { return CollectionUtil.castSet(timePatterns); }