In extension usage scenario, there are 4 methods may be
commonly extended by alpha developer in their application. Detailed
information is listed below:
- protected abstract String getCommand(): This method
returns the command of behavior which will be brought to client side.
For instance, a extended Client State used for printing form maybe
returns a command like ‘fromPrint’. And then, the JavaScript handlers
registered for command ‘formPrint’ will be invoked. It is required
method to be implemented.
- protected void afterFirstExecute(): Client State
will be executed twice during the flow execution. One is when it is
activated and makes response to client request; the other one is when
handles client response after the execution of client logics and navigates
to next state of the flow. So alpha developers could add extra logics
for server side in this method.
- protected void addRequiredDataToContext(Context context):
This method could be overridden to add or remove data which may be
brought to client side. The thing to be notice is that, if you need
to render a page or pop up a page, you should set value for the reply
page like the code snippet below.
Otherwise, if you are going to implement
your own logic instead of page rendering, you can just leverage the
implementation of the super class like the code snippet below.
- public String generateClientResponse(): This method
is used to convert the server data to JSON message and send them back
to client side. In the implementation of class ‘com.ibm.btt.automaton.ext.ClientState’,
all the flow context data will be formatted into JSON as response
data. So alpha developers could override this method to filter the
response data.