本文整理汇总了Java中org.apache.commons.collections4.IteratorUtils.asIterable方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.asIterable方法的具体用法?Java IteratorUtils.asIterable怎么用?Java IteratorUtils.asIterable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.asIterable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: comparePathFilters
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
private Map<PathNodeFilterSet, PathNodeFilterSet> comparePathFilters(final Set<PathNodeFilterSet> filters1,
final Set<PathNodeFilterSet> filters2, final Map<Path, Path> pathMap) {
if (filters1.size() == 0) return new HashMap<>();
final Iterator<PathNodeFilterSet> iterator = filters1.iterator();
final PathNodeFilterSet filter1 = iterator.next();
iterator.remove();
try {
for (final PathNodeFilterSet filter2 : IteratorUtils
.asIterable(pool.getEqualFilters(filter1).stream().filter(f -> filters2.contains(f)).iterator())) {
final Map<Path, Path> tmpPathMap = new HashMap<>(pathMap);
if (PathNodeFilterSet.equals(filter1, filter2, tmpPathMap)) {
final Map<PathNodeFilterSet, PathNodeFilterSet> filterMap =
comparePathFilters(filters1, filters2, tmpPathMap);
if (null != filterMap) {
filterMap.put(filter1, filter2);
return filterMap;
}
}
}
return null;
} finally {
filters1.add(filter1);
}
}
示例2: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
int counter = 0;
final Iterator<I_C_Invoice_Candidate> unprocessedCands = invoiceCandDAO.retrieveNonProcessed(new PlainContextAware(getCtx(), ITrx.TRXNAME_None));
try (final IAutoCloseable updateInProgressCloseable = invoiceCandBL.setUpdateProcessInProgress())
{
for (final I_C_Invoice_Candidate ic : IteratorUtils.asIterable(unprocessedCands))
{
Services.get(IAggregationBL.class)
.getUpdateProcessor()
.process(ic);
// disable the model validation engine for this PO to gain performance
InterfaceWrapperHelper.setDynAttribute(ic, ModelValidationEngine.DYNATTR_DO_NOT_INVOKE_ON_MODEL_CHANGE, true);
InterfaceWrapperHelper.save(ic);
counter++;
}
}
return "@[email protected] " + counter + " @[email protected]";
}
示例3: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
@RunOutOfTrx
protected String doIt() throws Exception
{
final IQueryFilter<I_M_ReceiptSchedule> selectedSchedsFilter = getProcessInfo().getQueryFilterOrElse(ConstantQueryFilter.of(false));
final Iterator<I_M_ReceiptSchedule> scheds = queryBL.createQueryBuilder(I_M_ReceiptSchedule.class)
.addOnlyActiveRecordsFilter()
.filter(selectedSchedsFilter)
.create()
.iterate(I_M_ReceiptSchedule.class);
int counter = 0;
for (final I_M_ReceiptSchedule receiptSchedule : IteratorUtils.asIterable(scheds))
{
if (!receiptScheduleBL.isClosed(receiptSchedule))
{
addLog(msgBL.getMsg(getCtx(), MSG_SKIP_OPEN_1P, new Object[] { receiptSchedule.getM_ReceiptSchedule_ID() }));
continue;
}
reopenInTrx(receiptSchedule);
counter++;
}
return "@[email protected]: " + counter;
}
示例4: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
final Iterator<I_M_ShipmentSchedule> scheds = getSelectedShipmentSchedules();
int counter = 0;
for (final I_M_ShipmentSchedule shipmentSchedule : IteratorUtils.asIterable(scheds))
{
if (!shipmentSchedule.isProcessed())
{
addLog(msgBL.getMsg(getCtx(), MSG_SHIPMENT_SCHEDULES_SKIP_OPEN, new Object[] { shipmentSchedule.getM_ShipmentSchedule_ID() }));
continue;
}
openInTrx(shipmentSchedule);
counter++;
}
return "@[email protected]: " + counter;
}
示例5: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
@RunOutOfTrx
protected String doIt() throws Exception
{
final IQueryFilter<I_M_ReceiptSchedule> selectedSchedsFilter = getProcessInfo().getQueryFilterOrElse(ConstantQueryFilter.of(false));
final Iterator<I_M_ReceiptSchedule> scheds = queryBL.createQueryBuilder(I_M_ReceiptSchedule.class)
.addOnlyActiveRecordsFilter()
.filter(selectedSchedsFilter)
.create()
.iterate(I_M_ReceiptSchedule.class);
int counter = 0;
for (final I_M_ReceiptSchedule receiptSchedule : IteratorUtils.asIterable(scheds))
{
if (receiptScheduleBL.isClosed(receiptSchedule))
{
addLog(msgBL.getMsg(getCtx(), MSG_SKIP_CLOSED_1P, new Object[] { receiptSchedule.getM_ReceiptSchedule_ID() }));
continue;
}
closeInTrx(receiptSchedule);
counter++;
}
return "@[email protected]: " + counter;
}
示例6: logDocOutbound
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Create Document Outbound only if Status column just changed to Done
*
* @param jobInstructions
*/
@ModelChange(timings = { ModelValidator.TYPE_AFTER_CHANGE, ModelValidator.TYPE_AFTER_CHANGE_REPLICATION }, ifColumnsChanged = I_C_Print_Job_Instructions.COLUMNNAME_Status)
public void logDocOutbound(final I_C_Print_Job_Instructions jobInstructions)
{
// We log the doc outbound only when Status changed to Done
if (!X_C_Print_Job_Instructions.STATUS_Done.equals(jobInstructions.getStatus()))
{
return;
}
final I_AD_User userToPrint = jobInstructions.getAD_User_ToPrint();
final Iterator<I_C_Print_Job_Line> lines = Services.get(IPrintingDAO.class).retrievePrintJobLines(jobInstructions);
for (final I_C_Print_Job_Line line : IteratorUtils.asIterable(lines))
{
logDocOutbound(line, userToPrint);
}
}
示例7: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
final IQueryFilter<I_C_Printing_Queue> queryFilter = getProcessInfo().getQueryFilter();
final Iterator<I_C_Printing_Queue> iterator = Services.get(IQueryBL.class)
.createQueryBuilder(I_C_Printing_Queue.class, getCtx(), getTrxName())
.filter(queryFilter)
.orderBy().addColumn(I_C_Printing_Queue.COLUMN_C_Printing_Queue_ID)
.endOrderBy()
.create()
.setOption(IQuery.OPTION_GuaranteedIteratorRequired, false)
.setOption(IQuery.OPTION_IteratorBufferSize, 1000)
.iterate(I_C_Printing_Queue.class);
final IPrintingQueueBL printingQueueBL = Services.get(IPrintingQueueBL.class);
for(final I_C_Printing_Queue item: IteratorUtils.asIterable(iterator))
{
printingQueueBL.setItemAggregationKey(item);
InterfaceWrapperHelper.save(item);
}
return "@[email protected]";
}
示例8: createTermForBPartners
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* create terms for all the BPartners iterated from the subclass, each of them in its own transaction
*/
private void createTermForBPartners()
{
for (final I_C_BPartner partner : IteratorUtils.asIterable(getBPartners()))
{
// create each term in its own transaction
trxManager.run(new TrxRunnableAdapter()
{
@Override
public void run(final String localTrxName)
{
createTerm(partner);
}
@Override
public boolean doCatch(Throwable ex)
{
addLog("@[email protected] @[email protected]:" + partner.getValue() + "_" + partner.getName() + ": " + ex.getLocalizedMessage());
log.warn("Failed creating contract for {}", partner, ex);
return true; // rollback
}
@Override
public void doFinally()
{
addLog("@[email protected] @[email protected]:" + partner.getValue() + "_" + partner.getName());
}
});
}
}
示例9: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
final IQueryFilter<I_C_OLCand> queryFilter = getProcessInfo().getQueryFilter();
final IQueryBuilder<I_C_OLCand> queryBuilder = queryBL.createQueryBuilder(I_C_OLCand.class, getCtx(), get_TrxName())
.addEqualsFilter(I_C_OLCand.COLUMNNAME_Processed, false) // already processed records shall not be validated
.filter(queryFilter);
final Iterator<I_C_OLCand> selectedCands = queryBuilder
.create()
.iterate(I_C_OLCand.class); // working with a iterator, because the there might be *a lot* of C_OLCands, and the issue-solver that we use in the endcustomer.project also iterates.
olCandValdiatorBL.setValidationProcessInProgress(true); // avoid the InterfaceWrapperHelper.save to trigger another validation from a MV.
try
{
int candidatesWithError = 0;
for (final I_C_OLCand olCand : IteratorUtils.asIterable(selectedCands))
{
olCandValdiatorBL.validate(olCand);
if (olCand.isError())
{
candidatesWithError++;
}
InterfaceWrapperHelper.save(olCand);
}
return msgBL.getMsg(getCtx(), IOLCandValdiatorBL.MSG_ERRORS_FOUND, new Object[] { candidatesWithError });
}
finally
{
olCandValdiatorBL.setValidationProcessInProgress(false);
}
}
示例10: doIt
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
final Mutable<Integer> purchaseOrderLineCount = new Mutable<Integer>(0);
final Iterator<I_C_Order> it = orderCreatePOFromSOsDAO.createSalesOrderIterator(
this,
p_allowMultiplePOOrders,
p_C_Order_ID,
p_C_BPartner_ID,
p_Vendor_ID,
p_poReference,
p_DatePromised_From,
p_DatePromised_To);
final String purchaseQtySource = orderCreatePOFromSOsBL.getConfigPurchaseQtySource();
final CreatePOFromSOsAggregator workpackageAggregator = new CreatePOFromSOsAggregator(this,
p_IsDropShip,
purchaseQtySource);
workpackageAggregator.setItemAggregationKeyBuilder(new CreatePOFromSOsAggregationKeyBuilder(p_Vendor_ID, this));
workpackageAggregator.setGroupsBufferSize(100);
for (final I_C_Order salesOrder : IteratorUtils.asIterable(it))
{
final List<I_C_OrderLine> salesOrderLines = orderCreatePOFromSOsDAO.retrieveOrderLines(salesOrder,
p_allowMultiplePOOrders,
purchaseQtySource);
for (final I_C_OrderLine salesOrderLine : salesOrderLines)
{
workpackageAggregator.add(salesOrderLine);
purchaseOrderLineCount.setValue(purchaseOrderLineCount.getValue() + 1);
}
}
workpackageAggregator.closeAllGroups();
return "Success";
}
示例11: inValidateScheds
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
*
*
* @param bPartner
*/
@ModelChange(timings = {
ModelValidator.TYPE_AFTER_NEW,
ModelValidator.TYPE_AFTER_CHANGE }, ifColumnsChanged = {
I_C_BPartner.COLUMNNAME_AllowConsolidateInOut })
public void inValidateScheds(final I_C_BPartner bPartner)
{
//
// Services
final IShipmentSchedulePA shipmentSchedulePA = Services.get(IShipmentSchedulePA.class);
final IBPartnerBL bpartnerBL = Services.get(IBPartnerBL.class);
final String trxName = InterfaceWrapperHelper.getTrxName(bPartner);
// using iterator because there might be a lot of scheds to update
final Iterator<? extends I_M_ShipmentSchedule> scheds = shipmentSchedulePA.retrieveForBPartner(bPartner);
for (final I_M_ShipmentSchedule sched : IteratorUtils.asIterable(scheds))
{
final boolean isSOTrx = true;
final boolean isBPAllowConsolidateInOut = bpartnerBL.isAllowConsolidateInOutEffective(bPartner, isSOTrx);
final boolean allowConsChg = isBPAllowConsolidateInOut != sched.isAllowConsolidateInOut();
if (!allowConsChg)
{
continue;
}
sched.setAllowConsolidateInOut(isBPAllowConsolidateInOut);
InterfaceWrapperHelper.save(sched, trxName);
// note that we do not need to invalidate the current sched explicitly..it will be updated as part of the segment, unless it has delivery rule force..and if it has that rule, then the
// bpartner change makes no difference to it, anyways.
Services.get(IShipmentScheduleInvalidateBL.class).invalidateSegmentForShipmentSchedule(sched);
}
}
示例12: createPrintPackage0
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
private void createPrintPackage0(final I_C_Print_Package printPackage,
final I_C_Print_Job_Instructions jobInstructions,
final IPrintPackageCtx printPackageCtx,
final String trxName)
{
final String jobInstructionsTrxName = InterfaceWrapperHelper.getTrxName(jobInstructions);
final ITrxManager trxManager = Services.get(ITrxManager.class);
Check.assume(trxManager.isSameTrxName(trxName, jobInstructionsTrxName), "Same transaction (Param 'trxName': {}, jobInstructions' trxName: {}; jobInstructions={})",
trxName, jobInstructionsTrxName, jobInstructions);
printPackage.setCopies(jobInstructions.getCopies());
final IPrintJobLinesAggregator aggregator = createPrintJobLinesAggregator(printPackageCtx, jobInstructions);
aggregator.setPrintPackageToUse(printPackage);
final Mutable<ArrayKey> lastKey = new Mutable<>();
final Iterator<I_C_Print_Job_Line> jobLines = Services.get(IPrintingDAO.class).retrievePrintJobLines(jobInstructions);
for (final I_C_Print_Job_Line jobLine : IteratorUtils.asIterable(jobLines))
{
aggregator.add(jobLine, lastKey);
}
final I_C_Print_Package printPackageCreated = aggregator.createPrintPackage();
Check.assumeNotNull(printPackageCreated, "Print package created for {}", jobInstructions);
InterfaceWrapperHelper.save(printPackage);
}
示例13: resolveSeqNo
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected int resolveSeqNo(final I_C_Print_Job job, final int seqNo)
{
if (seqNo > 0)
{
return seqNo;
}
int min = -1;
int max = -1;
for (final I_C_Print_Job_Line line : IteratorUtils.asIterable(retrievePrintJobLines0(job, SEQNO_First, SEQNO_Last)))
{
if (min == -1 || min > line.getSeqNo())
{
min = line.getSeqNo();
}
if (max == -1 || max < line.getSeqNo())
{
max = line.getSeqNo();
}
}
if (seqNo == SEQNO_First)
{
return min;
}
else if (seqNo == SEQNO_Last)
{
return max;
}
else
{
return seqNo;
}
}
示例14: collectSeenPackages
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* collects in a map aleardy seen packages
* @param jobLines
* @return
*/
private Map<Integer, Integer> collectSeenPackages(final Iterator<I_C_Print_Job_Line> jobLines)
{
final Map<Integer, Integer> seenPackages = new HashMap<Integer, Integer>();
for (final I_C_Print_Job_Line jobLine : IteratorUtils.asIterable(jobLines))
{
if (jobLine.getC_Print_Package_ID() <= 0)
{
continue;
}
final int key = jobLine.getC_Print_Package_ID();
if (seenPackages.containsKey(key))
{
final int value = seenPackages.get(key);
seenPackages.put(key, value + 1);
// already printed
continue;
}
seenPackages.put(jobLine.getC_Print_Package_ID(), 1);
}
return seenPackages;
}
示例15: process0
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
private <T> String process0(final Iterator<T> lines, final IProcessor<T> processor) throws InterruptedException
{
for (final T line : IteratorUtils.asIterable(lines))
{
// Check if the thread was interrupted
if (Thread.currentThread().isInterrupted())
{
throw new InterruptedException();
}
// Report current status
{
final int countAll = getCounter(COUNTER_ALL);
if (countAll > 0 && countAll % 100 == 0)
{
logger.warn("STATUS: " + getCountersAsString());
}
}
incrementCounterAndGet(COUNTER_ALL);
// now do the actual work, in a dedicated transaction
trxManager.run(new TrxRunnable()
{
@Override
public void run(final String localTrxName) throws Exception
{
processor.process(line);
}
});
}
return "@[email protected]: " + getCountersAsString();
}