Troubles in RunBase's Pack and Unpack Methods

发布时间 2023-07-18 17:19:09作者: 舜前喾后

Trouble description:

When user processed the batch job after clearing the usage data, dialog's parameters will catch the current data from processing form page, this is correct(or as expected). However, dialog still catch the previous parameters even user change the execution form page.

The solution to this bug is as follows:

public boolean allowSaveLast()
{
	return false;
}

After overriding this method, the system does not get the last data that system stored.

Why didn't some batch job need to override this method?

The part of the dialog's parameters were cought by dialog's controls, there is a kind of business requirement that user want to get the previous controls' value every processing this batch job.

When the allowSaveLast method output the trur or false, the pack and the unpack method's excute sequence is as follow:

  • True: unpack() --> pack() --> unpack()
  • False: pack() --> unpack()

In general, overrided the allowSaveLast method needs to consider business scenario:

  1. If the requirement hope handle some form page's records through batch job, it should override this method and return false;

  2. If the requirement doesn't need to catch the selected records;
    a. If requirement need to show the parameters from previous parameters after dialog was pop up, it doesn't need to override;
    b. If requirement need to blanked all parameters every pop up dialog, it should override this method and return false.