How to use java code start a Start Events of BPM?

we need more document about BPM

for example:
we have a order;
after creat the order,we need start the Start Events in background;
then when the order over, we need edit state to over (the process end in background);
after edit order state,we can start next process in background.

Take a look here

PROCESS_CODE is the name you gave to BPM process.

and in the process,we have some service
the service might return some result,
and Determine whether to proceed to the next procedure based on the result.
how to do it