private final I_M_HU createHU_InTrx(final I_M_HU_Item parentHUItem) { // // Get HUStatus to set final String huStatus; if (isHUStatusSet()) { huStatus = getHUStatus(); } else if (parentHUItem != null) { huStatus = parentHUItem.getM_HU().getHUStatus(); } else { huStatus = null; } // // Get M_Locator to set final I_M_Locator locator; if (_locatorSet) { locator = _locator; } else if (parentHUItem != null) { locator = parentHUItem.getM_HU().getM_Locator(); } else { locator = null; } // // Create and save HU final I_M_HU hu = InterfaceWrapperHelper.newInstance(I_M_HU.class, getContext()); POJOWrapper.setInstanceName(hu, _instanceName); hu.setM_HU_PI_Version(getM_HU_PI_Version()); hu.setM_HU_Item_Parent(parentHUItem); hu.setC_BPartner(_bpartner); hu.setC_BPartner_Location(_bpartnerLocation); hu.setHUStatus(huStatus); hu.setM_Locator(locator); InterfaceWrapperHelper.save(hu); // // Create HU Attributes if (attributesExpectations != null) { attributesExpectations.createHUAttributes(hu); } // // Create HU Items if (huItemExpectations != null) { for (final HUItemExpectation<HUExpectation<ParentExpectationType>> huItemExpectation : huItemExpectations) { huItemExpectation.createHUItem(hu); } } // Capture the HU if required if (_huToSetRef != null) { _huToSetRef.setValue(hu); } return hu; }
public List<I_C_Queue_WorkPackage> createAndEnqueueWorkpackages( final IWorkPackageQueue workpackageQueue, final int count, final boolean markReadyForProcessing) { final I_C_Queue_Block block = workpackageQueue.enqueueBlock(ctx); final List<I_C_Queue_WorkPackage> workpackages = new ArrayList<I_C_Queue_WorkPackage>(count); for (int i = 1; i <= count; i++) { final I_C_Queue_WorkPackage wp = workpackageQueue.enqueueWorkPackage(block, IWorkPackageQueue.PRIORITY_AUTO); POJOWrapper.setInstanceName(wp, "workpackage-" + i); if (markReadyForProcessing) { workpackageQueue.markReadyForProcessing(wp); } workpackages.add(wp); } return workpackages; }