[bug] list of entities with null attributes

8 posts / 0 new
Last post
atao
Offline
Joined: 10/15/2008
[bug] list of entities with null attributes

Hello,

I have an entity Branch:

  <bean
    id="Branch"
    parent="entity">
    <constructor-arg value="org.popsuite.hr.model.Branch" />
    <property name="propertyDescriptors">
      <list>
        <bean parent="stringType">
          <property name="name"        value="name" />
          <property name="i18nNameKey" value="branch.name" />
          <property name="maxLength"   value="60" />
        </bean>
        <bean parent="stringType">
          <property name="name"        value="code" /><!-- registration number, e.g. SIRET number in France -->
          <property name="i18nNameKey" value="branch.code" />
          <property name="maxLength"   value="20" />
        </bean>
        <bean parent="stringType">
          <property name="name"        value="category" /><!-- activity code, e.g. NAF code in France -->
          <property name="i18nNameKey" value="branch.category" />
          <property name="maxLength"   value="20" />
        </bean>
        <ref local="Branch-workers" />
      </list>
    </property>
    <property
      name="iconImageURL" value="classpath:org/popsuite/hr/images/factory.png" />
  </bean>

displayed as a module with:

              <bean parent="abstractFilterableBeanCollectionModule">
                <property name="name"                       value="masterdata.branch.module" />
                <property name="description"                value="masterdata.branch.module.description" />
                <property name="elementComponentDescriptor" ref="Branch" />
              </bean>

Everything runs fine until I add a new attribute:

        <bean parent="refType">
          <property name="name"                 value="legalStatus" />
          <property name="referencedDescriptor" ref="LegalStatusType" />
        </bean>

with this definition:

  <bean
    id="LegalStatusType"
    parent="entity">
    <constructor-arg value="org.popsuite.hr.model.LegalStatusType" />
    <property name="propertyDescriptors">
      <list>
        <bean parent="stringType">
          <property name="name"        value="name" />
        </bean>
        <bean parent="stringType">
          <property name="name"        value="abbreviation" />
        </bean>
      </list>
    </property>   
  </bean>

then only the branches with attribute "legalStatus" initialized are displayed in the module list.

It is still true if I remove this attribute of the list of attributes displayed in the list (renderedProperties).

Is it the expected behavior? If not, what did I miss?

Regards

Pierre

 

vvandens
Offline
Joined: 05/29/2008
[bug] list of entities with null attributes

Hi Pierre,

You didn't miss anything. This buggy behaviour was introduced with yesterday snapshot while trying to implement deeply nested properties for filter panels (with automatic query joins generation). It should be fine now. Can you confirm (mvn -U package) ?

 

Thanks,

Vincent

atao
Offline
Joined: 10/15/2008
Vincent With the same data as

Vincent

With the same data as above, I get the exception below, with or without null as value for the attribute.

Regards

Pierre

Exception in thread "AWT-EventQueue-1" org.jspresso.framework.util.bean.MissingPropertyException: Missing property comparator for bean class class java.lang.Integer
    at org.jspresso.framework.util.bean.PropertyHelper.getPropertyDescriptor(PropertyHelper.java:102)
    at org.jspresso.framework.util.accessor.bean.BeanPropertyAccessor.<init>(BeanPropertyAccessor.java:52)
    at org.jspresso.framework.util.accessor.bean.BeanAccessorFactory.createPropertyAccessor(BeanAccessorFactory.java:58)
    at org.jspresso.framework.util.accessor.basic.BasicAccessorFactory.createPropertyAccessor(BasicAccessorFactory.java:53)
    at org.jspresso.framework.binding.model.ModelPropertyConnector.modelProviderChanged(ModelPropertyConnector.java:230)
    at org.jspresso.framework.binding.model.ModelPropertyConnector.setParentConnector(ModelPropertyConnector.java:180)
    at org.jspresso.framework.binding.model.ModelRefPropertyConnector.getChildConnector(ModelRefPropertyConnector.java:144)
    at org.jspresso.framework.binding.model.ModelRefPropertyConnector.getChildConnector(ModelRefPropertyConnector.java:157)
    at org.jspresso.framework.binding.DefaultMvcBinder.bindChildren(DefaultMvcBinder.java:61)
    at org.jspresso.framework.binding.DefaultMvcBinder.bind(DefaultMvcBinder.java:43)
    at org.jspresso.framework.binding.DefaultMvcBinder.bindChildren(DefaultMvcBinder.java:71)
    at org.jspresso.framework.binding.DefaultMvcBinder.bind(DefaultMvcBinder.java:43)
    at org.jspresso.framework.binding.DefaultMvcBinder.bindChildren(DefaultMvcBinder.java:71)
    at org.jspresso.framework.binding.DefaultMvcBinder.bind(DefaultMvcBinder.java:43)
    at org.jspresso.framework.view.AbstractViewFactory$2.valueChange(AbstractViewFactory.java:716)
    at org.jspresso.framework.util.event.ValueChangeSupport.fireConnectorValueChange(ValueChangeSupport.java:106)
    at org.jspresso.framework.binding.AbstractValueConnector.fireConnectorValueChange(AbstractValueConnector.java:720)
    at org.jspresso.framework.binding.AbstractValueConnector.setConnectorValue(AbstractValueConnector.java:551)
    at org.jspresso.framework.binding.AbstractValueConnector.valueChange(AbstractValueConnector.java:339)
    at org.jspresso.framework.binding.AbstractValueConnector.setModelConnector(AbstractValueConnector.java:600)
    at org.jspresso.framework.binding.DefaultMvcBinder.bind(DefaultMvcBinder.java:41)
    at org.jspresso.framework.binding.masterdetail.DefaultModelCascadingBinder$BoundConnectorSelectionListener.selectedItemChange(DefaultModelCascadingBinder.java:83)
    at org.jspresso.framework.util.event.ItemSelectionSupport.fireSelectedConnectorChange(ItemSelectionSupport.java:63)
    at org.jspresso.framework.binding.AbstractCompositeValueConnector.implFireSelectedItemChange(AbstractCompositeValueConnector.java:291)
    at org.jspresso.framework.binding.basic.BasicCollectionConnectorProvider.fireSelectedItemChange(BasicCollectionConnectorProvider.java:97)
    at org.jspresso.framework.binding.AbstractCompositeValueConnector.implFireSelectedItemChange(AbstractCompositeValueConnector.java:299)
    at org.jspresso.framework.binding.AbstractCompositeValueConnector.implFireSelectedConnectorChange(AbstractCompositeValueConnector.java:322)
    at org.jspresso.framework.binding.AbstractCollectionConnector.setSelectedIndices(AbstractCollectionConnector.java:272)
    at org.jspresso.framework.binding.AbstractCollectionConnector.setSelectedIndices(AbstractCollectionConnector.java:261)
    at org.jspresso.framework.binding.swing.DefaultTreeSelectionModelBinder$SelectionModelListener.valueChanged(DefaultTreeSelectionModelBinder.java:195)
    at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:629)
    at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1078)
    at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:287)
    at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:170)
    at javax.swing.JTree.setSelectionPath(JTree.java:1598)
    at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2316)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3525)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressedDND(BasicTreeUI.java:3502)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3461)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
    at java.awt.Component.processMouseEvent(Component.java:6260)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4235)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at org.jspresso.framework.util.swing.WaitCursorEventQueue.dispatchEvent(WaitCursorEventQueue.java:56)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

 

 

 

vvandens
Offline
Joined: 05/29/2008
Strange...

Pierre,

This is definitely strange... I had this kind of exception this morning when I changed the code to build the query filter. But I fixed it and the snapshot of this afternoon *should* have the correct version. Moreover, I've tested with 3 different apps and none breaked like this.

I'm rebuilding everything and publishing again from scratch.

If you still experience this bug, can you try to extract a small case so that I can reproduce it ? Your stacktrace talks about an integer property but there is none in the model you've sent. Moreover, when does the exception exactly occurs ? It seems to me that it is not on the query itself, but before (i.e. when trying to display the filter module).

 

Regards,

Vincent

atao
Offline
Joined: 10/15/2008
Strange...

Vincent

when does the exception exactly occurs ?

I get the exception each time I try to select one of the modules

Your stacktrace talks about an integer property

Even after removing any integer from the model, I get the same exception.

Below is the minimal model with the exception. As soon I remove the définition of LegalStatusType, there is no more exception.

Regards

Pierre

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
  default-lazy-init="true">

  <bean
    id="Branch"
    class="org.jspresso.framework.model.descriptor.entity.basic.BasicEntityDescriptor">
    <constructor-arg value="org.popsuite.hr.model.Branch" />
    <property name="propertyDescriptors">
      <list>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"        value="name" />
          <property name="i18nNameKey" value="branch.name" />
          <property name="maxLength"   value="60" />
        </bean>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"        value="code" /><!-- registration number, e.g. SIRET number in France -->
          <property name="i18nNameKey" value="branch.code" />
          <property name="maxLength"   value="20" />
        </bean>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"        value="category" /><!-- activity code, e.g. NAF code in France -->
          <property name="i18nNameKey" value="branch.category" />
          <property name="maxLength"   value="20" />
        </bean>
        <ref local="Branch-workers" />
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicReferencePropertyDescriptor">
          <property name="name"                 value="legalStatus" />
          <property name="referencedDescriptor" ref="LegalStatusType" />
        </bean>
      </list>
    </property>
    <property
      name="iconImageURL" value="classpath:org/popsuite/hr/images/factory.png" />
  </bean>

  <bean
    id="LegalStatusType"
    class="org.jspresso.framework.model.descriptor.entity.basic.BasicEntityDescriptor">
    <constructor-arg value="org.popsuite.hr.model.LegalStatusType" />
    <property name="propertyDescriptors">
      <list>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"        value="name" />
          <property name="mandatory"   value="true" />
        </bean>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"        value="abbreviation" />
          <property name="mandatory"   value="true" />
        </bean>
      </list>
    </property>   
  </bean>
 
  <bean
    id="Branch-workers"
    class="org.jspresso.framework.model.descriptor.basic.BasicCollectionPropertyDescriptor"
    >
    <property name="name"        value="workers" />
    <property name="composition" value="true" />
    <property name="referencedDescriptor" ref="Workers" />
  </bean>

  <bean
    id="Workers"
    class="org.jspresso.framework.model.descriptor.basic.BasicCollectionDescriptor"
    >
    <property name="collectionInterface" value="java.util.Set" />
    <property name="elementDescriptor"   ref="Worker" />
  </bean>

  <bean
    id="Worker"
    class="org.jspresso.framework.model.descriptor.entity.basic.BasicEntityDescriptor">
    <constructor-arg value="org.popsuite.hr.model.Worker" />
    <property name="propertyDescriptors">
      <list>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"                value="lastName" />
        </bean>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicStringPropertyDescriptor">
          <property name="name"                value="firstName" />
        </bean>
        <bean class="org.jspresso.framework.model.descriptor.basic.BasicReferencePropertyDescriptor">
          <property name="name"                 value="branch" />
          <property name="referencedDescriptor" ref="Branch" />
          <property name="reverseRelationEnd"   ref="Branch-workers" />
          <property name="mandatory"            value="true" />
        </bean>
      </list>
    </property>
  </bean>
 
  <!--
    Common service beans
  --> 

</beans>

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
  default-lazy-init="true">

  <!--
    FrontAction
  -->
  <!--
    ActionMap (menu)
  -->
 
  <!--
    The workspaces and modules
  -->
  <!-- Describe your workspaces and modules here. -->
 
  <bean
    id="Masterdata.workspace"
    parent="abstractWorkspace"
    scope="prototype">
    <property name="name"         value="masterdata.workspace" />
    <property name="description"  value="masterdata.workspace.description" />
    <property name="iconImageURL" value="classpath:org/popsuite/hr/images/sample/masterdata-48x48.png" />
    <property name="modules">
      <list>
              <bean parent="abstractFilterableBeanCollectionModule">
                <property name="name"                       value="masterdata.branch.module" />
                <property name="description"                value="masterdata.branch.module.description" />
                <property name="elementComponentDescriptor" ref="Branch" />
              </bean>
              <bean parent="abstractFilterableBeanCollectionModule">
                <property name="name"                       value="masterdata.worker.module" />
                <property name="description"                value="masterdata.worker.module.description" />
                <property name="elementComponentDescriptor" ref="Worker" />
              </bean>
      </list>
    </property>
  </bean>
   

  <!--
    The controller
  -->
 
  <bean
    id="applicationFrontController"
    parent="frontController"
    scope="prototype">
    <property name="name"                 value="popsuite-mfm.name" />
    <property name="description"          value="popsuite-mfm.description" />
    <property name="iconImageURL"         value="classpath:org/popsuite/hr/images/icon.png" />
    <property name="loginContextName"     value="popsuite-mfm" />
    <property name="forcedStartingLocale" value="en" />
    <property name="workspaces">
      <list>
        <!-- Reference your workspaces here. -->
        <ref bean="Masterdata.workspace" />
      </list>
    </property>
  </bean>

</beans>

 

atao
Offline
Joined: 10/15/2008
Strange...

And now with the full model: same thing. As soon as I remove the entity LegalStatusType, the exception is no more thrown.

vvandens
Offline
Joined: 05/29/2008
Should be fixed

Pierre,

Sometimes, I'm just blind... I'm uploading the snapshot with the fix. Can you confirm that it solves the issue ?

 

Thanks for having taken the time to send the test-case.

 

Best,

Vincent

atao
Offline
Joined: 10/15/2008
Should be fixed

Vincent

It is.

Thanks

Pierre