JBoss Community

the db schema creation explaination

created by wiwengweng wen in jBPM - View the full discussion

this is how I debug the codes, and find out something I don't understand so far.

 

I use mysql db, when codes go into "createGroup", one record is created in the jbpm_id_group table. can someone tell me how the commandService work? what is the "execute" function mean?? :)

 

hope to learn and heard from you~

Vincent

 

appended codes:

 

identityService.createGroup("management");

 

 

public String createGroup(String groupName) {

    return commandService.execute(new CreateGroupCmd(groupName, null, null));

  }

 

public interface CommandService {
 
  String NAME_TX_REQUIRED_COMMAND_SERVICE = "txRequiredCommandService";
  String NAME_NEW_TX_REQUIRED_COMMAND_SERVICE = "newTxRequiredCommandService";

  /**
   * @throws JbpmException if command throws an exception.
   */
  <T> T execute(Command<T> command);
}

 

public class CreateGroupCmd implements Command<String> {

  private static final long serialVersionUID = 1L;

  protected String groupName;
  protected String groupType;
  protected String parentGroupId;

  public CreateGroupCmd(String groupName, String groupType, String parentGroupId) {
    this.groupName = groupName;
    this.groupType = groupType;
    this.parentGroupId = parentGroupId;
  }

  public String execute(Environment environment) throws Exception {
    IdentitySession identitySession = environment.get(IdentitySession.class);
    return identitySession.createGroup(groupName, groupType, parentGroupId);
  }
}

Reply to this message by going to Community

Start a new discussion in jBPM at Community