8 Replies Latest reply on May 14, 2006 11:07 PM by aksharma

    Assignign default values to variables

    aksharma

      Is there a way i can assign a default value to a variable in a task controller.

      I dont see any column in the database too.

      Any ideas...

        • 1. Re: Assignign default values to variables
          kukeltje

          Yes, I have an idea. Since it is not in the documentation (and in the db as you say, but that is no signal), it is likely that it is not possible.

          My idea would be to search the forum.

          • 2. Re: Assignign default values to variables
            cavalera

            Maybe you could define some Aspect using AspectJ - Spring AOP or whatever that targets...

            TaskController.initializeVariables(TaskInstanace)

            and populate the variables values in the aspect.

            • 3. Re: Assignign default values to variables
              aguizar

              AOP ??? Nah, too high... How about a custom TaskControllerHandler?

              • 4. Re: Assignign default values to variables
                aguizar

                Take a look at the task controllers section in the jBPM user guide. You have to do it yourself but you can reuse many things from the default controller.

                • 5. Re: Assignign default values to variables
                  kukeltje

                  Alex,

                  Although the taskcontroler thingy seems handy, I person ally had some problems with it. It almost comes down to redoing the webui completely. I did not want to comment since this has been brought up many times before, but think I should now.

                  Using the processdefinition that can and is stored fully in the db since 3.1.1 and the upcomming 3.2 is imo an easier way. Ok, you have to turn of validation of the process in the engine (which should be adapted so you *can* turn/keep it on) but the basic ui is now so fully grown (ok, it is adolesent in 3.2 ;-) ) that I prefere to use the ui as it is, including te taskcontroler.

                  just my ?0.02

                  • 6. Re: Assignign default values to variables
                    aguizar

                    Ronald,

                    How do you use the stored process definition document to deal with this? I'd like to hear more of that approach.

                    I just tought we are taking the long route. Why not writing a simple script that initializes the variables at some event (node-enter, task-create, ...)?

                    • 7. Re: Assignign default values to variables
                      kukeltje

                      I'll elaborate on this in the comming week. If there was a process-start event (it is most often required at that moment) that could be used for this that would be great. AFAIK, there is none

                      • 8. Re: Assignign default values to variables
                        aksharma

                        Alex

                        Yaa I agree we can do that using CustomHandler but it would help to have
                        an attribute in

                        <variable name=xxx access=xxx />
                        called value. Where I can assign a value if I want to write without having to redo what has been achieved in TaskController.

                        Thanks
                        Akshay