3 Replies Latest reply on Jul 31, 2006 11:03 AM by kvak_tnt

    jBPM HowTo add User Group Swimlane to DB?

    kvak_tnt

      Hi all!

      actually I try to develop a small processengine in jBPM.
      Some stuff is allready done and working.

      But now I wanted to add user (s), group (s), swimlane (s) to the jBPM Persistance (DB) but I cannot find any add-function or any setter to do so?

      I use jBPM 3.1.1 and also jBPM identity 3.1.1

      Do I have to add them manually in hard SQL?
      I'm also using Hibernate for mapping and for testing I'm using HSQL (Hibersonic in Memory Database) like in the example.

      Thanks in advance for your help!

      Greetings

      Claus

        • 1. Re: jBPM HowTo add User Group Swimlane to DB?
          newbie007

          You can add the user etc eigher by using the SQL or by using the hibernate session (You should be able to get the session from the jbpm context or configuration).

          Use <hibernate session>.save(user) if you are using hibernate session. make sure you populate the user object before saving. Also please make sure you follow the correct order for inserting (if there is any foreign key reference, you will have to insert the record in the other table first).

          Thanks.

          • 2. Re: jBPM HowTo add User Group Swimlane to DB?
            kvak_tnt

            Thanks for the quick reply. I will try to.

            I have found another info about this "problem"
            identity.hbm.xml
            Does anyone know something about the use of this file?
            I haven't found anything in the web but I have found another post with this file:
            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76736

            Greetings

            Claus

            • 3. Re: jBPM HowTo add User Group Swimlane to DB?
              kvak_tnt

              OK I solved it myself.

              Example:
              identity.xml

              <identity>
               <user name="bert" email="bert@sesamestreet.tv" password="theresabananainyourear" />
               <user name="ernie" email="ernie@sesamestreet.tv" password="canthereyoubert,theresabananainmyear" />
               <group name="sesameinhabitants" />
               <group name="bananalovers" parent="sesameinhabitants" type="fruitpreference" />
               <membership user="ernie" group="bananalovers" />
              </identity>


              Your handling class for users and so on:
              public void setUp(){
               JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
              
               Entity[] entities = IdentityXmlParser.parseEntitiesResource("identity.xml");
              
               for (int i=0; i < entities.length; i++) {
               jbpmContext.getSession().save(entities);
               }



              Thats all.

              Greetings Claus