0 Replies Latest reply on Oct 18, 2011 3:21 AM by wiwengweng wen

    the db schema creation explaination

    wiwengweng wen Newbie

      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);
        }
      }