Hi,<br><br>It sounds like a bug then :)<br><br>Can you please raise a JIRA (<a href="https://issues.jboss.org/browse/GUVNOR">https://issues.jboss.org/browse/GUVNOR</a>) and assign to me?<br><br>I won&#39;t be looking at coding a fix until the New Year (vacation) but if you want to submit a GIT pull request I&#39;ll happily take a look.<br>
<br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">2011/12/20 Toshiya Kobayashi <span dir="ltr">&lt;<a href="mailto:tkobayas@redhat.com">tkobayas@redhat.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-family:Times New Roman;font-size:10pt;color:#000000">Thanks Michael and Mark.<br><br>&gt; If the member has a getter it is available in the LHS (=Guided Rule Editor lists it in &quot;Modify constraints&quot; popup)<br>
<br>Got it. I see it&#39;s true with a basic uploaded Pojo.<br><br>But, hmm, in my case, it&#39;s not.<br>If I annotate the Pojo in &quot;New Declarable Model&quot;, the getter-only-member becomes unavailable in the LHS (=Guided Rule Editor doesn&#39;t list it in &quot;Modify constraints&quot; popup).<br>
<br># Maybe you misread the word &quot;Modify&quot;? I meant the popup in LHS.<br><br>So it can be an issue only when I want to use existing beans and need to annotate them (e.g. for CEP support).<br><br>=== Analysis ===<br>
With a debugger, I observed that SuggestionCompletionLoader.populateDeclaredFactType() overwrites SuggestionCompletionEngineBuilder.fieldsForType if a Pojo is annotated as a declarative model.<br><br>SuggestionCompletionLoader.java<br>
<br>407     private void populateDeclaredFactType(List&lt;TypeDeclarationDescr&gt; th) {<br>...<br>469         this.builder.addFieldsForType( declaredType,<br>470                                        fieldNames.toArray( new String[fieldNames.size()] ) );<br>
...<br>473     }<br><br>SuggestionCompletionEngineBuilder.java<br><br>111     public void addFieldsForType(final String type,<br>112                                  final String[] fields) {<br>113         this.fieldsForType.put( type,<br>
114                                 fields );<br>115     }<br><br>fieldsForType is overwritten based on TypeDeclarationDescr of the declarative model.<br>The TypeDeclarationDescr is created in SuggestionCompletionLoader.makePseudoTypeDeclarationDescrFromSuperClassType(). It accepts only setter+getter fields.<br>
It looks intentional... but misses to concern the above use case?<br><br>Cheers,<br>Toshiya<br><br><hr><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt">
<b>From: </b>&quot;Mark Proctor&quot; &lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;<br><b>To: </b><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<b>Sent: </b>Tuesday, December 20, 2011 1:28:09 AM<br><b>Subject: </b>Re: [rules-users] Guided Rule Editor doesn&#39;t list no-setter-fields if a fact is annotated<div><div class="h5"><br><br>
  
    
  
  
    Sorry I misread what you said. I thought you said that beans are
    only usable in the IDE if it has both a getter and a setter - my
    misundestanding.<br>
    <br>
    M<br>
    On 19/12/2011 16:19, Michael Anstis wrote:
    <blockquote>I&#39;m not clear on what you are saying.<br>
      <br>
      We reflect the methods of existing beans:-<br>
      <ul>
        <li>If the member has a getter it is available in the LHS</li>
        <li>If the member has a setter it is available in the RHS</li>
        <li>If the member has a getter and a setter it is available in
          both the LHS and RHS</li>
      </ul>
      Members of declared types are available in both the LHS and RHS
      (as we implicitly create getters and setters).<br>
      <br>
      I don&#39;t understand &quot;we should only support getters&quot; but &quot;be
      intelligent enough not to allow the setter to be used in the IDE&quot;.
      If we only support getters there is no setter; and if there is no
      setter how do we allow the user to set the value? Of course my
      comments are from a Guvnor perspective, if you mean to change the
      way declared types work, then... well, we&#39;ll have to change Guvnor
      anyway :)<br>
      <br>
      <div class="gmail_quote">2011/12/19 Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</span><br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div>
            <div> On 19/12/2011 16:04, Michael Anstis wrote:
              <blockquote>You are not mistaken.<br>
                <br>
                For POJO models we use reflection (class.getMethods) to
                determine whether a Type&#39;s methods members are available
                in the LHS or RHS or both, according to Java Bean
                conventions. Declarative models have their members
                available in both the LHS and RHS by default as we
                generate &quot;getters&quot; and &quot;setters&quot; for them.<br>
              </blockquote>
            </div>
            It probably looks like we should support only getters
            though, for existing beans. We just need to be intelligent
            enough not to allow the setter to be used in the IDE.<br>
            <br>
            Toshiya: Sounds like a great introduction task, you up for
            the challenge?<span><font color="#888888"><br>
                <br>
                Mark</font></span>
            <div><br>
              <blockquote> <br>
                <div class="gmail_quote">On 19 December 2011 05:47,
                  Toshiya Kobayashi <span dir="ltr">&lt;<a href="mailto:tkobayas@redhat.com" target="_blank">tkobayas@redhat.com</a>&gt;</span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Hello,<br>
                    <br>
                    In Guvnor 5.3.0, I can use CEP feature support in
                    Guided Rule Editor after uploading a class by
                    &quot;Upload POJO Model jar&quot; and annotating it in &quot;New
                    Declarable Mode&quot;.<br>
                    <br>
                    1.      |       declare TestPojo<br>
                    2.      |           @role(value = event)<br>
                    3.      |       end<br>
                    <br>
                    But if some fields of the POJO class have only
                    getter methods, Guided Rule Editor won&#39;t list those
                    fields in &quot;Modify constraints&quot; popup. (if a field
                    has a setter method, it will be listed)<br>
                    <br>
                    public class TestPojo {<br>
                           private String name;<br>
                           public TestPojo() {}<br>
                           public String getName() { return name; }<br>
                    //      public void setName(String name) { <a href="http://this.name" target="_blank">this.name</a> = name; }<br>
                    }<br>
                    <br>
                    Am I missing something? If it&#39;s not an expected
                    behaviour, I will raise a JIRA.<br>
                    <br>
                    Cheers,<br>
                    Toshiya<br>
                    _______________________________________________<br>
                    rules-users mailing list<br>
                    <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
                    <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
                  </blockquote>
                </div>
                <br>
                <br>
                <fieldset></fieldset>
                <br>
                <pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
              </blockquote>
              <br>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          rules-users mailing list<br>
          <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
          <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
          <br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
  

<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></div><br></div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>