def execute(self): """ Create allocation row for each recipient until while_calling_allocator returns false :return: """ self.from_provider_row.log("Allocate " + self.from_provider_row.name) for each_recipient in self.to_recipients: new_allocation = self.creating_allocation() new_allocation_logic_row = LogicRow(row=new_allocation, old_row=new_allocation, ins_upd_dlt="ins", nest_level=self.from_provider_row.nest_level + 1, a_session=self.from_provider_row.session, row_sets=self.from_provider_row.row_sets) new_allocation_logic_row.link(to_parent=self.from_provider_row) each_recipient_logic_row = LogicRow(row=each_recipient, old_row=each_recipient, ins_upd_dlt="*", nest_level=0, a_session=self.from_provider_row.session, row_sets=None) new_allocation_logic_row.link(to_parent=each_recipient_logic_row) if self.while_calling_allocator is not None: allocator = self.while_calling_allocator(new_allocation_logic_row, self.from_provider_row) else: allocator = self.while_calling_allocator_default(new_allocation_logic_row, self.from_provider_row) if not allocator: break return self
def execute(self, logic_row: LogicRow): """ Called by logic engine, overriding generic EarlyEvent rule. Creates allocation row for each recipient until while_calling_allocator returns false :return: """ logic_row.log(f'BEGIN {str(self)}') provider = logic_row to_recipients = self.recipients(provider) for each_recipient in to_recipients: new_allocation = self.creating_allocation() new_allocation_logic_row = LogicRow( row=new_allocation, old_row=new_allocation, ins_upd_dlt="ins", nest_level=provider.nest_level + 1, a_session=provider.session, row_sets=provider.row_sets) new_allocation_logic_row.link(to_parent=provider) each_recipient_logic_row = LogicRow(row=each_recipient, old_row=each_recipient, ins_upd_dlt="*", nest_level=0, a_session=provider.session, row_sets=None) new_allocation_logic_row.link(to_parent=each_recipient_logic_row) if self.while_calling_allocator is not None: allocator = self.while_calling_allocator( new_allocation_logic_row, provider) else: allocator = self.while_calling_allocator_default( new_allocation_logic_row, provider) if not allocator: break provider.log(f'END {str(self)}') return self