try {
List<GenericValue> productStoreRoles = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("roleTypeId", "VENDOR", "productStoreId", context.get("productStoreId")), UtilMisc.toList("-fromDate"));
productStoreRoles = EntityUtil.filterByDate(productStoreRoles, true);
GenericValue productStoreRole = EntityUtil.getFirst(productStoreRoles);
if (productStoreRole != null) {
toBeStored.add(delegator.makeValue("OrderRole",
UtilMisc.toMap("orderId", orderId, "partyId", productStoreRole.get("partyId"), "roleTypeId", "VENDOR")));
}
} catch (GenericEntityException e) {
Debug.logError(e, "Error looking up Vendor for the current Product Store", module);
}