5 Replies Latest reply on Nov 19, 2008 8:47 AM by ben abdallah Firas

    drools+seam+parametrize application

    ben abdallah Firas Newbie

      First of all, i want to congratulate all people who contribute to this framework, i have 3 months that i worked with it to use it in my application.
      I want to parametrize my application using drools without jbpm  or you have another solution to do it ?


      the problem is:
      i have some controls inputText and according to this value some input inputext are required, disabled or calculated.


      for exemple:
      you have 4 inputext
      input1
      input2
      input3
      input4



      if value of input1 equals A then input2 then B and disabled, input3 IS REQUIRED,  input4 is disabled.


      if value of input1 equals B then input2 is required etc...



      my solution is :


      <h:inputText required="#{mysession.reqinput1}" disabled="#{mysession.disinput1}"/>

      @Stateful
      @Name("mysession")
      public class Mysession implements MysessionInt{

      reqinput1=false;
      disinput1=false

      getter and setter
      }


      but i want just to parametrize with drools or any other solution
      i don't want to go to the code to do it


      thanks

        • 1. Re: drools+seam+parametrize application
          ben abdallah Firas Newbie

          you have no idea or exemples with seam+drools without jbpm

          • 2. Re: drools+seam+parametrize application
            ben abdallah Firas Newbie
            <blockquote>
            _ben abdallah Firas wrote on Nov 18, 2008 09:42:_<br/>

            First of all, i want to congratulate all people who contribute to this framework, i have 3 months that i worked with it to use it in my application.
            I want to parametrize my application using drools without jbpm  or you have another solution to do it ?

            the problem is:
            i have some controls inputText and according to this value some input inputext are required, disabled or calculated.

            for exemple:
            you have 4 inputext
            input1
            input2
            input3
            input4


            if value of input1 equals A then input2 then B and disabled, input3 IS REQUIRED,  input4 is disabled.

            if value of input1 equals B then input2 is required etc...


            my solution is :

            <h:inputText required="#{mysession.reqinput1}" disabled="#{mysession.disinput1}"/>





            @Stateful
            @Name("mysession")
            public class Mysession implements MysessionInt{

            reqinput1=false;
            disinput1=false

            getter and setter
            }

            but i want just to parametrize with drools or any other solution
            i don't want to go to the code to do it

            thanks

            </blockquote>

            Click HELP for text formatting instructions. Then edit this text and check the preview.
            • 3. Re: drools+seam+parametrize application
              ben abdallah Firas Newbie

              ben abdallah Firas wrote on Nov 18, 2008 15:01:



              ben abdallah Firas wrote on Nov 18, 2008 09:42:


              First of all, i want to congratulate all people who contribute to this framework, i have 3 months that i worked with it to use it in my application.
              I want to parametrize my application using drools without jbpm  or you have another solution to do it ?

              the problem is:
              i have some controls inputText and according to this value some input inputext are required, disabled or calculated.

              for exemple:
              you have 4 inputext
              input1
              input2
              input3
              input4


              if value of input1 equals A then input2 then B and disabled, input3 IS REQUIRED,  input4 is disabled.

              if value of input1 equals B then input2 is required etc...


              my solution is :


              <h:inputText required="#{mysession.reqinput1}" disabled="#{mysession.disinput1}"/>
              
              







              @Stateful
              @Name("mysession")
              public class Mysession implements MysessionInt{
              
              reqinput1=false;
              disinput1=false
              
              getter and setter
              }
              



              but i want just to parametrize with drools or any other solution
              i don't want to go to the code to do it

              thanks



              Click HELP for text formatting instructions. Then edit this text and check the preview.


              Click HELP for text formatting instructions. Then edit this text and check the preview.

              • 4. Re: drools+seam+parametrize application
                Ingo Jobling Master

                A possible solution would be to run the rules (Drools) from your action (mySession), then set your context variables according to the outcome.

                • 5. Re: drools+seam+parametrize application
                  ben abdallah Firas Newbie

                  thank you for your reply but i don't understand



                  then set your context variables according to the outcome.

                  what does it mean


                  i will show this to understand me more:




                  <s:decorate id="input1" template="layout/edit.xhtml">
                                  <ui:define name="label">Emetteur</ui:define>
                                  <h:inputText id="emetteur" 
                                     
                                  required="true"
                                  requiredMessage="il est obligatoire"
                                           
                                     
                                            value="#{enteteHome.instance.emeMes}">
                                              <a4j:support event="onblur" reRender="input2,input3"    ajaxSingle="true"    actionListener="#{mysession.validateinput1}"/>
                                  </h:inputText>
                  </s:decorate>
                  
                   <s:decorate id="input2" template="layout/edit.xhtml">
                                  <ui:define name="label">dest</ui:define>
                                  <h:inputText id="dest" 
                                     disabled="#{mysession.dest}"
                                  required="#{mysession.reqdest}"
                                  
                                     
                                            value="#{enteteHome.instance.destMes}">
                                              <a4j:support event="onblur" reRender="input2"    ajaxSingle="true"    />
                                  </h:inputText>
                  </s:decorate>
                  
                   <s:decorate id="input3" template="layout/edit.xhtml">
                                  <ui:define name="label">coddos</ui:define>
                                  <h:inputText id="coddos" 
                                     disabled="#{mysession.coddos}"
                                  required="#{mysession.reqcoddos}"
                                
                                             
                                        
                                            value="#{dossierHome.instance.codDos}">
                                              <a4j:support event="onblur" reRender="input3"    ajaxSingle="true"    />
                                  </h:inputText>
                  </s:decorate>
                  





                  @Stateful
                  @Name("mysession")
                  public class Mysession implements MysessionInt{
                  
                  boolean dest=false;//---not disabled
                  boolean reqdest=false;//---not required
                  boolean coddos=false;//---not disabled
                  boolean reqcoddos=false;//---not required
                  
                  @In(create=true)
                  EnteteHome enteteHome;
                  @In(create=true)
                  DossierHome dossierHome;
                  
                  getter and setter
                  
                  
                  public void  validateinput1(ActionEvent e){
                            if (enteteHome.getInstance().getEmeMes().equals("BHE"))
                              dest=true;
                                 coddos=false;
                                 
                            }
                  
                            if (enteteHome.getInstance().getEmeMes().equals(""))
                            {
                            dossierHome.getInstance().setCodDos("66654");
                            coddos=true;
                            }
                   etc........
                  }
                  



                  i have in my vue a lot of inputext and some input have an actionlistner like the mentionned (and you can have some transaction with the database ( em.createQuery())
                  you have some exemples like that or any idea (you cand this with xml but i want to do it with drools without JBpm)


                  thanks