use of edu.cornell.kfs.module.purap.document.validation.event.AddIWantItemEvent in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method addNewItem.
private boolean addNewItem(IWantDocumentForm iWantDocumentForm, IWantDocument iWantDoc, IWantItem item) {
KualiRuleService ruleService = SpringContext.getBean(KualiRuleService.class);
boolean rulePassed = true;
// call business rules
rulePassed &= ruleService.applyRules(new AddIWantItemEvent(StringUtils.EMPTY, iWantDoc, item));
if (rulePassed) {
item = iWantDocumentForm.getAndResetNewIWantItemLine();
iWantDoc.addItem(item);
}
return rulePassed;
}
use of edu.cornell.kfs.module.purap.document.validation.event.AddIWantItemEvent in project cu-kfs by CU-CommunityApps.
the class IWantDocumentFeedServiceImpl method populateIWantDocItems.
/**
* Populates I Want doc items.
*
* @param batchIWantDocument
* @param iWantDocument
* @return true if no errors encountered, false otherwise
*/
protected boolean populateIWantDocItems(BatchIWantDocument batchIWantDocument, IWantDocument iWantDocument) {
LOG.info("Populate I Want doc items");
boolean noErrors = true;
// items
List<IWantItem> iWantItems = batchIWantDocument.getItems();
if (CollectionUtils.isNotEmpty(iWantItems)) {
for (IWantItem item : iWantItems) {
IWantItem addItem = new IWantItem();
addItem.setItemDescription(item.getItemDescription());
addItem.setItemTypeCode(item.getItemUnitOfMeasureCode());
addItem.setItemCatalogNumber(item.getItemCatalogNumber());
addItem.setItemUnitPrice(item.getItemUnitPrice());
addItem.setPurchasingCommodityCode(item.getPurchasingCommodityCode());
addItem.setItemQuantity(item.getItemQuantity());
boolean rulePassed = ruleService.applyRules(new AddIWantItemEvent(StringUtils.EMPTY, iWantDocument, addItem));
if (rulePassed) {
iWantDocument.addItem(addItem);
} else {
logErrorMessages();
}
noErrors &= rulePassed;
}
}
return noErrors;
}
Aggregations