Skip to Content
1
Former Member
Nov 28, 2016 at 02:00 PM

Calling a bean in the backoffice view

970 Views

I am trying to define a "create-wizard", some of the required values should be computed and not entered by the user/admin. One of these values is a code serving as a PK who is provided by a generator bean. I want to call the generate method of this bean in an assign element using the SPel syntax.

In my attempts to find a solution I have ssen that i can't use other beans, I have also found the bean "FixedBeanResolver" defined in backoffice who seems to list all available bean. I have tried making an other "FixedBeanResolver" containg the name of my generator bean and I've tried to implement a beanPostProcessor to add my bean to the "FixedBeanResolver".

Here is a snippet from the -backoffice-config.xml file.

 <context component="create-wizard" type="MyType">
 <wz:flow xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"id="ProductWizard" title="create.product.title">
     <wz:prepare id="productPrepare">
         <wz:initialize property="newType" type="MyType"/>
         <wz:assign property="newType.code" value="@translationRequestCodeGenerator.generate()" />
         <wz:assign property="newType.emissionDate" value="new java.util.Date()"/>
     </wz:prepare>
         <wz:step id="step1" label="create.product.essential.label" sublabel="create.product.essential.sublabel">
             <wz:content id="step1.content">
                 <wz:property-list root="newType">
                     <wz:property qualifier="author" type="java.lang.String"/>
                     <wz:property qualifier="code" readonly="true" />
                     
                     ...
                     
                 </wz:property-list>
             </wz:content>
             <wz:navigation id="step1.navigation">
                 <wz:cancel/>
                 <wz:next visible="!#empty(newType.code)"/>
                 <wz:done visible="!#empty(newType.code)">
                     <wz:save property="newType"/>
                 </wz:done>
             </wz:navigation>
         </wz:step>
 </wz:flow>
 </context>