@Override public void deleteHUAssignments( final Object model, final Collection<I_M_HU> husToUnAssign, final String trxName) { Check.assumeNotNull(model, "model not null"); Check.assumeNotNull(husToUnAssign, "husToUnAssign not null"); final Properties ctx = InterfaceWrapperHelper.getCtx(model); final int adTableId = InterfaceWrapperHelper.getModelTableId(model); final int recordId = InterfaceWrapperHelper.getId(model); final Set<Integer> huIds = new HashSet<Integer>(husToUnAssign.size()); for (final I_M_HU hu : husToUnAssign) { huIds.add(hu.getM_HU_ID()); } if (huIds.isEmpty()) { return; } final IQueryBuilder<I_M_HU_Assignment> queryBuilder = Services.get(IQueryBL.class).createQueryBuilder(I_M_HU_Assignment.class, ctx, trxName); // // Note that here we don't want to skip anything; we want the HUAssignmentBL to do it's job, so // we clean everything up queryBuilder .addEqualsFilter(I_M_HU_Assignment.COLUMN_AD_Table_ID, adTableId) .addEqualsFilter(I_M_HU_Assignment.COLUMN_Record_ID, recordId) .addInArrayFilter(I_M_HU_Assignment.COLUMN_M_HU_ID, huIds) .create() .delete(); }
private BigDecimal calculateQtyInvoicedInPriceUOM(final I_C_InvoiceLine invoiceLine) { Check.assumeNotNull(invoiceLine, "invoiceLine not null"); final BigDecimal qty = invoiceLine.getQtyInvoiced(); Check.assumeNotNull(qty, "qty not null"); final I_C_UOM priceUOM = invoiceLine.getPrice_UOM(); if (invoiceLine.getPrice_UOM_ID() <= 0) { return qty; } if (invoiceLine.getM_Product_ID() <= 0) { return qty; } final I_M_Product product = invoiceLine.getM_Product(); if (product.getC_UOM_ID() <= 0) { return qty; } final Properties ctx = InterfaceWrapperHelper.getCtx(invoiceLine); final BigDecimal qtyInPriceUOM = Services.get(IUOMConversionBL.class).convertFromProductUOM(ctx, product, priceUOM, qty); return qtyInPriceUOM; }
public CalloutMethodPointcut( final Class<?> modelClass, final Method method, final String[] columnNames, final boolean paramCalloutFieldRequired, final boolean skipIfCopying) { super(); Check.assumeNotNull(modelClass, "modelClass not null"); this.modelClass = modelClass; Check.assumeNotNull(method, "method not null"); this.method = method; Check.assumeNotNull(columnNames, "columnNames not null"); Check.assume(columnNames.length > 0, "columnNames not empty"); this.columnNames = new HashSet<String>(columnNames.length); for (final String columnName : columnNames) { Check.assumeNotNull(columnName, "columnName not null"); this.columnNames.add(columnName); } this.paramCalloutFieldRequired = paramCalloutFieldRequired; this.skipIfCopying = skipIfCopying; }
public MRPDemandsPool( final IMRPContext mrpContext, final IMRPNotesCollector mrpNotesCollector, final IMRPDemand mrpDemand) { super(); Check.assumeNotNull(mrpContext, "mrpContext not null"); this._mrpContext = mrpContext; Check.assumeNotNull(mrpNotesCollector, "mrpNotesCollector not null"); this._mrpNotesCollector = mrpNotesCollector; Check.assumeNotNull(mrpDemand, LiberoException.class, "mrpDemand not null"); // // Create MRP Demand & Qty that we will need to allocated BigDecimal qtyGrossReq = BigDecimal.ZERO; final List<IMutableMRPRecordAndQty> mrpDemandAndQtys = new ArrayList<IMutableMRPRecordAndQty>(); final MRPYield yield = mrpDemand.getYield(); for (final I_PP_MRP mrpDemandRecord : mrpDemand.getMRPDemandRecords()) { final BigDecimal mrpDemandQty = mrpDemandRecord.getQty(); final BigDecimal mrpDemandQtyWithYield = yield.calculateQtyWithYield(mrpDemandQty); final MRPRecordAndQty mrpDemandAndQty = new MRPRecordAndQty(mrpDemandRecord, mrpDemandQtyWithYield); qtyGrossReq = qtyGrossReq.add(mrpDemandQtyWithYield); mrpDemandAndQtys.add(mrpDemandAndQty); } this.demandDateStartSchedule = mrpDemand.getDateStartSchedule(); this.qtyNetReqRemaining = qtyGrossReq; this.mrpDemandsToAllocate = mrpDemandAndQtys; }
/** * Gets {@link HUItemExpectation} for given <code>piItem</code>. * * @param piItem * @return * @return {@link HUItemExpectation}; never return null */ public HUItemExpectation<HUExpectation<ParentExpectationType>> huItemExpectation( final I_M_HU_PI_Item piItem) { Check.assumeNotNull(piItem, "piItem not null"); Check.assumeNotNull(huItemExpectations, "huItemExpectations not null"); final List<HUItemExpectation<HUExpectation<ParentExpectationType>>> result = new ArrayList<>(); for (final HUItemExpectation<HUExpectation<ParentExpectationType>> huItemExpectation : huItemExpectations) { final I_M_HU_PI_Item current_piItem = huItemExpectation.getM_HU_PI_Item(); if (current_piItem == null) { continue; } if (current_piItem.getM_HU_PI_Item_ID() != piItem.getM_HU_PI_Item_ID()) { continue; } result.add(huItemExpectation); } if (result.isEmpty()) { throw new IllegalArgumentException("No HU Item Expectation found for " + piItem); } else if (result.size() > 1) { throw new IllegalArgumentException( "More then one HU Item Expectation found for " + piItem + "\n\n" + result); } return result.get(0); }
public PlainPackingMaterialDocumentLineSource( final I_M_HU_PackingMaterial packingMaterial, final BigDecimal qty) { super(); Check.assumeNotNull(packingMaterial, "packingMaterial not null"); packingMaterials = Collections.singletonList(packingMaterial); Check.assumeNotNull(qty, "qty not null"); this.qty = qty; }
public CoProductReceiptHUProducer(final I_PP_Cost_Collector cc) { super(cc); Check.assumeNotNull(cc, "cc not null"); _costCollector = cc; Check.assume( cc.getPP_Order_BOMLine_ID() > 0, "Order BOM Line shall be set to cost collector when receiving co/bu products: {}", cc); _ppOrderBOMLine = InterfaceWrapperHelper.create(cc.getPP_Order_BOMLine(), I_PP_Order_BOMLine.class); Check.assumeNotNull(_ppOrderBOMLine, "ppOrderBOMLine not null"); }
public MutableAttributeSplitRequest( final IAttributeStorage parentAttributeStorage, final List<IAttributeStorage> attributeStorages, final org.compiere.model.I_M_Attribute attribute) { super(); Check.assumeNotNull(parentAttributeStorage, "parentAttributeStorage not null"); this.parentAttributeStorage = parentAttributeStorage; Check.assumeNotNull(attributeStorages, "attributeStorages not null"); this.attributeStorages = Collections.unmodifiableList(attributeStorages); Check.assumeNotNull(attribute, "attribute not null"); this.attribute = InterfaceWrapperHelper.create(attribute, I_M_Attribute.class); }
@Override public final void invoke() { Runnable runnableWrapped = getRunnable(); Check.assumeNotNull(runnableWrapped, "runnable shall be configured"); // Wrap to Long Operation // NOTE: this needs to be wrapped BEFORE "invoke later" or "glass pane" because those will // execute the runnable asynchronously if (isLongOperation()) { runnableWrapped = asLongOperationRunnable(runnableWrapped); } // Wrap to Exception handled (if needed) runnableWrapped = asExceptionHandledRunnable(runnableWrapped); // Wrap to invoke later // NOTE: this needs to be wrapped after "exception handled" because else the exception won't be // catched. if (isInvokeLater()) { runnableWrapped = asInvokeLaterRunnable(runnableWrapped); } // Wrap to showing glass pane runnable // NOTE: this needs to be wrapped after "long operation", "exception handled" and "invoke later" if (isShowGlassPane()) { runnableWrapped = asShowGlassPaneRunnable(runnableWrapped); } // // Execute it runnableWrapped.run(); }
@Override public boolean hasMoreLUAssigmentsForSameModelType(final I_M_HU_Assignment luAssignment) { Check.assumeNotNull(luAssignment, "luAssignment not null"); final int luHUId = luAssignment.getM_LU_HU_ID(); if (luHUId <= 0) { return false; } final int adTableId = luAssignment.getAD_Table_ID(); final int recordId = luAssignment.getRecord_ID(); return Services.get(IQueryBL.class) .createQueryBuilder(I_M_HU_Assignment.class, luAssignment) .addOnlyActiveRecordsFilter() // only active assignments are counted .addEqualsFilter(I_M_HU_Assignment.COLUMN_AD_Table_ID, adTableId) // for same kind of model .addCompareFilter( I_M_HU_Assignment.COLUMN_Record_ID, Operator.LESS, recordId) // on a model which was created before ours .addEqualsFilter(I_M_HU_Assignment.COLUMN_M_LU_HU_ID, luHUId) // for our LU .addEqualsFilter( I_M_HU_Assignment.COLUMNNAME_VHU_ID, luAssignment.getVHU_ID()) // 08564 : also check the vhu // .create() .match(); }
private ProcessInfoParameter createProcessInfoParameter( final I_C_Queue_WorkPackage_Param workpackageParam) { // NOTE to developer: when changing this, make sure you are also changing the counterpart method // setParameterValue() Check.assumeNotNull(workpackageParam, "workpackageParam not null"); final String parameterName = workpackageParam.getParameterName(); final int displayType = workpackageParam.getAD_Reference_ID(); final Object parameter; if (DisplayType.isText(displayType)) { parameter = workpackageParam.getP_String(); } else if (DisplayType.YesNo == displayType) { parameter = workpackageParam.getP_String(); } else if (DisplayType.isNumeric(displayType)) { parameter = workpackageParam.getP_Number(); } else if (DisplayType.isDate(displayType)) { parameter = workpackageParam.getP_Date(); } else { throw new AdempiereException( "Unsupported display type: " + displayType + "\n @C_Queue_WorkPackage_Param_ID@: " + workpackageParam); } final Object parameter_To = null; // N/A final String info = parameter == null ? "" : String.valueOf(parameter); final String info_To = null; // N/A return new ProcessInfoParameter(parameterName, parameter, parameter_To, info, info_To); }
private final void addAllocationPerformed(final IMRPDemandToSupplyAllocation alloc) { Check.assumeNotNull(alloc, "alloc not null"); final I_PP_MRP mrpSupplyRecord = alloc.getMRPSupply(); final BigDecimal mrpSupplyQty = alloc.getQtyAllocated(); // // Check allocated MRP supply and create MRP notes in case something is not ok checkMRPSupplyDates(alloc); // // Update cummulated values if (mrpBL.isQtyOnHandReservation(mrpSupplyRecord)) { this.qtyOnHandReserved = this.qtyOnHandReserved.add(mrpSupplyQty); } else if (mrpBL.isQtyOnHandAnyReservation(mrpSupplyRecord)) { // skip any other kind of reservations } else { final boolean mrpSupplyIsFirm = mrpBL.isReleased(mrpSupplyRecord); if (mrpSupplyIsFirm) { this.qtyScheduledReceipts = qtyScheduledReceipts.add(mrpSupplyQty); } this.qtySuppliedTotal = qtySuppliedTotal.add(mrpSupplyQty); } subtractFromQtyToSupplyRemaining(mrpSupplyQty); mrpDemand2supplyAllocations.add(alloc); }
@Override public void assertNotChanged(final I_M_HU_LUTU_Configuration lutuConfiguration) { Check.assumeNotNull(lutuConfiguration, "lutuConfiguration not null"); // // Check if we were explicitly asked to not check the changes final Boolean disableChangeCheckingOnSave = InterfaceWrapperHelper.getDynAttribute( lutuConfiguration, DYNATTR_DisableChangeCheckingOnSave); if (disableChangeCheckingOnSave != null && disableChangeCheckingOnSave == true) { return; } // // Make sure LU/TU configuration does not changed (from LUTU Producer perspective) final I_M_HU_LUTU_Configuration lutuConfigurationOld = InterfaceWrapperHelper.createOld(lutuConfiguration, I_M_HU_LUTU_Configuration.class); if (isSameForHUProducer(lutuConfiguration, lutuConfigurationOld)) { return; } // // Prevent changing the configuration // NOTE: it's safe to throw an english/internal error because mainly this is an internal error throw new HUException( "Changing already saved LU/TU Configuration is not allowed: " + lutuConfiguration); }
@Override @Cached(cacheName = I_C_ConversionType_Default.Table_Name + "#by#Dimension") public I_C_ConversionType retrieveDefaultConversionType( @CacheCtx final Properties ctx, final int adClientId, final int adOrgId, final Date date) { // NOTE to developer: keep in sync with: getDefaultConversionType_ID database function Check.assumeNotNull(date, "date not null"); final Date dateDay = TimeUtil.trunc(date, TimeUtil.TRUNC_DAY); return Services.get(IQueryBL.class) .createQueryBuilder(I_C_ConversionType_Default.class, ctx, ITrx.TRXNAME_None) .addOnlyActiveRecordsFilter() .addInArrayFilter( I_C_ConversionType_Default.COLUMN_AD_Client_ID, adClientId, Env.CTXVALUE_AD_Client_ID_System) .addInArrayFilter( I_C_ConversionType_Default.COLUMN_AD_Org_ID, adClientId, Env.CTXVALUE_AD_Org_ID_System) .addCompareFilter( I_C_ConversionType_Default.COLUMN_ValidFrom, Operator.LESS_OR_EQUAL, dateDay) // .orderBy() .addColumn(I_C_ConversionType_Default.COLUMN_ValidFrom, Direction.Descending, Nulls.Last) .addColumn(I_C_ConversionType_Default.COLUMN_AD_Client_ID, Direction.Descending, Nulls.Last) .addColumn(I_C_ConversionType_Default.COLUMN_AD_Org_ID, Direction.Descending, Nulls.Last) .endOrderBy() // .setLimit(1) // only the first one // .andCollect(I_C_ConversionType_Default.COLUMN_C_ConversionType_ID) .create() .firstOnlyNotNull(I_C_ConversionType.class); }
@Override public int calculateQtyLUForTotalQtyCUs( final I_M_HU_LUTU_Configuration lutuConfiguration, final BigDecimal qtyCUsTotal, final I_C_UOM qtyCUsTotalUOM) { Check.assumeNotNull(lutuConfiguration, "lutuConfiguration not null"); if (qtyCUsTotal == null || qtyCUsTotal.signum() <= 0) { return 0; } if (isNoLU(lutuConfiguration)) { return 0; } // // Calculate how many CUs we need for an LU final BigDecimal qtyCUsPerLU = lutuConfiguration.getQtyCU().multiply(lutuConfiguration.getQtyTU()); if (qtyCUsPerLU.signum() <= 0) { return 0; } // // Convert the total QtyCU to our internal capacity UOM, to be able to compute using same UOM. final Quantity qtyCUsTotal_Converted = convertQtyToLUTUConfigurationUOM(qtyCUsTotal, qtyCUsTotalUOM, lutuConfiguration); // // Calculate how many LUs we need for given total QtyCU (converted to our capacity UOM) final int qtyLUs = qtyCUsTotal_Converted.getQty().divide(qtyCUsPerLU, 0, RoundingMode.UP).intValueExact(); return qtyLUs; }
/** * Retrieves workpackage parametes as {@link ProcessInfoParameter} list: * * <ul> * <li>parameters which were directly set to workpackage (i.e. {@link * I_C_Queue_WorkPackage_Param}) * <li>fallback: parameters which were set to creator AD_PInstance_ID * </ul> * * @param workpackage * @return */ private List<ProcessInfoParameter> retrieveWorkpackageProcessInfoParameters( final I_C_Queue_WorkPackage workpackage) { Check.assumeNotNull(workpackage, "workpackage not null"); final Map<String, ProcessInfoParameter> workpackagesParamsMap = new HashMap<>(); // // Load parameters from creator's AD_PInstance_ID { final Properties ctx = InterfaceWrapperHelper.getCtx(workpackage); final int adPInstanceId = extractAD_PInstance_ID(workpackage); final IADPInstanceDAO adPInstanceDAO = Services.get(IADPInstanceDAO.class); for (final ProcessInfoParameter param : adPInstanceDAO.retrieveProcessInfoParameters(ctx, adPInstanceId)) { workpackagesParamsMap.put(param.getParameterName(), param); } } // // Load parameters which are directly set to this workpackage // NOTE: this will OVERRIDE AD_PInstance level parameters for (final I_C_Queue_WorkPackage_Param workpackageParam : retrieveWorkpackageParametersList(workpackage)) { final ProcessInfoParameter param = createProcessInfoParameter(workpackageParam); workpackagesParamsMap.put(param.getParameterName(), param); } return new ArrayList<>(workpackagesParamsMap.values()); }
private List<SyncProductSupply> createPlannedSyncProductSupplies( final I_C_RfQResponseLine rfqResponseLine) { final I_C_Flatrate_Term contract = rfqResponseLine.getC_Flatrate_Term(); Check.assumeNotNull(contract, "contract not null"); final List<I_C_RfQResponseLineQty> rfqResponseLineQtys = pmmRfQDAO.retrieveResponseLineQtys(rfqResponseLine); if (rfqResponseLineQtys.isEmpty()) { return ImmutableList.of(); } final String bpartner_uuid = SyncUUIDs.toUUIDString(contract.getDropShip_BPartner()); final String contractLine_uuid = SyncUUIDs.toUUIDString(contract); final String product_uuid = SyncUUIDs.toUUIDString(contract.getPMM_Product()); final List<SyncProductSupply> plannedSyncProductSupplies = new ArrayList<>(rfqResponseLineQtys.size()); for (final I_C_RfQResponseLineQty rfqResponseLineQty : rfqResponseLineQtys) { final SyncProductSupply syncProductSupply = new SyncProductSupply(); syncProductSupply.setBpartner_uuid(bpartner_uuid); syncProductSupply.setContractLine_uuid(contractLine_uuid); syncProductSupply.setProduct_uuid(product_uuid); syncProductSupply.setDay(rfqResponseLineQty.getDatePromised()); syncProductSupply.setQty(rfqResponseLineQty.getQtyPromised()); plannedSyncProductSupplies.add(syncProductSupply); } return plannedSyncProductSupplies; }
/** * Schedule given item to be enqueued in a transaction level workpackage which will be submitted * when the transaction is committed. * * <p>The transaction is extracted from item, using {@link #extractTrxNameFromItem(Object)}. * * <p>If item has no transaction, a workpackage with given item will be automatically created and * enqueued to be processed. * * @param item */ public final void schedule(final ItemType item) { Check.assumeNotNull(item, "Param 'item' is not null"); // Avoid collecting the item if is not eligible if (!isEligibleForScheduling(item)) { return; } scheduleFactory.collect(item); }
public void markReadyForProcessing(I_C_Queue_WorkPackage... workpackages) { Check.assumeNotNull(workpackages, "workpackages not null"); if (workpackages.length == 0) { return; } markReadyForProcessing(Arrays.asList(workpackages)); }
public void createReversals(final I_PP_Cost_Collector reversalCostCollector) { Check.assumeNotNull(reversalCostCollector, "reversalCostCollector not null"); // // Get the original cost collector final I_PP_Cost_Collector costCollector = reversalCostCollector.getReversal(); Check.assumeNotNull(costCollector, "costCollector not null"); // // Get the original cost details final List<I_M_CostDetail> costDetails = Services.get(IPPCostCollectorDAO.class).retrieveCostDetails(costCollector); for (final I_M_CostDetail cd : costDetails) { createReversal(cd, reversalCostCollector); } }
private IContextAware getContextProviderToUse() { if (_contextProvider != null) { return InterfaceWrapperHelper.getContextAware(_contextProvider); } Check.assumeNotNull(_mrpContext, LiberoException.class, "contextProvider shall be set"); return _mrpContext; }
@Override public I_M_DeliveryDay createDeliveryDay( final I_M_TourVersionLine tourVersionLine, final Date deliveryDate, final String trxName) { Check.assumeNotNull(tourVersionLine, "tourVersionLine not null"); Check.assumeNotNull(deliveryDate, "deliveryDate not null"); final int bpartnerId = tourVersionLine.getC_BPartner_ID(); final int bpartnerLocationId = tourVersionLine.getC_BPartner_Location_ID(); final boolean isToBeFetched = tourVersionLine.isToBeFetched(); final int bufferHours = tourVersionLine.getBufferHours(); final int seqNo = tourVersionLine.getSeqNo(); final I_M_TourVersion tourVersion = tourVersionLine.getM_TourVersion(); final int tourId = tourVersion.getM_Tour_ID(); final int adOrgId = tourVersion.getAD_Org_ID(); // // Get Preparation Date+Time // If we do not have preparation time, do not try to generate. final Timestamp preparationTime = Services.get(ITourBL.class).getPreparationDateTime(tourVersion, deliveryDate); if (preparationTime == null) { return null; } final Properties ctx = InterfaceWrapperHelper.getCtx(tourVersionLine); final I_M_DeliveryDay deliveryDay = InterfaceWrapperHelper.create(ctx, I_M_DeliveryDay.class, trxName); deliveryDay.setC_BPartner_ID(bpartnerId); deliveryDay.setAD_Org_ID(adOrgId); deliveryDay.setC_BPartner_Location_ID(bpartnerLocationId); deliveryDay.setIsManual(false); deliveryDay.setM_Tour_ID(tourId); deliveryDay.setM_TourVersion(tourVersion); deliveryDay.setIsToBeFetched(isToBeFetched); deliveryDay.setSeqNo(seqNo); // Dates deliveryDay.setDeliveryDate(preparationTime); deliveryDay.setBufferHours(bufferHours); setDeliveryDateTimeMax(deliveryDay); InterfaceWrapperHelper.save(deliveryDay); return deliveryDay; }
/* package */ Lock( final ILockDatabase lockDatabase, final LockOwner owner, final boolean isAutoCleanup, final int countLocked) { super(); Check.assumeNotNull(lockDatabase, "lockDatabase not null"); this.lockDatabase = lockDatabase; Check.assumeNotNull(owner, "owner not null"); Check.assume( owner.isRealOwnerOrNoOwner(), "owner shall be a real owner or no owner: {}", owner); this.owner = owner; this.isAutoCleanup = isAutoCleanup; _countLocked = countLocked; }
/** * @param workpackageProcessorClass workpackage processor class to be used when workpackages are * enqueued. */ public WorkpackagesOnCommitSchedulerTemplate( final Class<? extends IWorkpackageProcessor> workpackageProcessorClass) { super(); Check.assumeNotNull(workpackageProcessorClass, "workpackageProcessorClass not null"); this.workpackageProcessorClass = workpackageProcessorClass; this.trxPropertyName = getClass().getSimpleName() + "-" + workpackageProcessorClass.getName(); }
@Override public I_M_HU_LUTU_Configuration copy(final I_M_HU_LUTU_Configuration lutuConfiguration) { Check.assumeNotNull(lutuConfiguration, "lutuConfiguration not null"); final I_M_HU_LUTU_Configuration lutuConfigurationNew = InterfaceWrapperHelper.newInstance(I_M_HU_LUTU_Configuration.class, lutuConfiguration); final boolean honorIsCalculated = true; InterfaceWrapperHelper.copyValues(lutuConfiguration, lutuConfigurationNew, honorIsCalculated); return lutuConfigurationNew; }
@Override public List<I_M_ShippingPackage> retrieveShippingPackages(final I_M_Package mpackage) { Check.assumeNotNull(mpackage, "mpackage not null"); return Services.get(IQueryBL.class) .createQueryBuilder(I_M_ShippingPackage.class, mpackage) .filter( new EqualsQueryFilter<I_M_ShippingPackage>( I_M_ShippingPackage.COLUMNNAME_M_Package_ID, mpackage.getM_Package_ID())) .create() .list(I_M_ShippingPackage.class); }
/** * Delete MRP Alternative records for given {@link I_DD_OrderLine_Alternative}. * * @param ddOrderLineAlt */ private void deleteMRPAlternatives(final I_DD_OrderLine_Alternative ddOrderLineAlt) { Check.assumeNotNull(ddOrderLineAlt, "ddOrderLineAlt not null"); final IQueryBL queryBL = Services.get(IQueryBL.class); final IQueryBuilder<I_PP_MRP_Alternative> queryBuilder = queryBL .createQueryBuilder(I_PP_MRP_Alternative.class, ddOrderLineAlt) .addEqualsFilter( I_PP_MRP_Alternative.COLUMN_DD_OrderLine_Alternative_ID, ddOrderLineAlt.getDD_OrderLine_Alternative_ID()); queryBuilder.create().deleteDirectly(); }
private I_AD_Message getMRPCode_AD_Message_ToUse() { final Properties ctx = getCtx(); final String mrpCode = getMRPCode_ToUse(); I_AD_Message adMessage = adMessageDAO.retrieveByValue(ctx, mrpCode); if (adMessage == null) { // If MRP code not found, use MRP-999 - unknown error adMessage = adMessageDAO.retrieveByValue(ctx, IMRPExecutor.MRP_ERROR_999_Unknown); } Check.assumeNotNull( adMessage, LiberoException.class, "adMessage not null (MRPCode: {0})", mrpCode); return adMessage; }
@Override public ICompositeQueryFilter<T> removeFilter(final IQueryFilter<T> filter) { Check.assumeNotNull(filter, "filter not null"); if (filters == null || filters.isEmpty()) { return this; } filters.remove(filter); return this; }
/** * Retrieves MRP Alternative record for given {@link I_DD_OrderLine_Alternative}. * * @param ddOrderLineAlt * @param mrp * @return MRP Alternative or <code>null</code> */ private I_PP_MRP_Alternative retrieveMRPAlternative( final I_DD_OrderLine_Alternative ddOrderLineAlt, final I_PP_MRP mrp) { // Optimization: in case the DD_OrderLine was just created, there is no point to query because // there won't be any result for sure if (InterfaceWrapperHelper.isJustCreated(ddOrderLineAlt)) { return null; } Check.assumeNotNull(ddOrderLineAlt, "ddOrderLineAlt not null"); Check.assumeNotNull(mrp, "mrp not null"); final IQueryBL queryBL = Services.get(IQueryBL.class); final IQueryBuilder<I_PP_MRP_Alternative> queryBuilder = queryBL .createQueryBuilder(I_PP_MRP_Alternative.class, ddOrderLineAlt) .addEqualsFilter( I_PP_MRP_Alternative.COLUMN_DD_OrderLine_Alternative_ID, ddOrderLineAlt.getDD_OrderLine_Alternative_ID()) .addEqualsFilter(I_PP_MRP_Alternative.COLUMN_PP_MRP_ID, mrp.getPP_MRP_ID()); return queryBuilder.create().firstOnly(I_PP_MRP_Alternative.class); }