cancel
Showing results for 
Search instead for 
Did you mean: 

Localized String in HMC-Wizard

Former Member
0 Kudos

Hi, i need to create a hmc-wizard, where users can inter alia upload medias. The user should also be able to specify a localized title for this document. This is is the itemype in my items.xml file:

 <itemtype code="DocumentUploadWizard"
   jaloclass="x.wizards.DocumentUploadWizard"
   autocreate="true" generate="true" extends="WizardBusinessItem">
   <attributes>
     <!-- tab 1: meta-information -->
     <attribute qualifier="document" type="Media">
       <modifiers read="true" write="true" optional="false" />
       <persistence type="property" />
     </attribute>
    [...]
     <attribute qualifier="documentTitle" type="localized:java.lang.String">
       <modifiers read="true" write="true" optional="false" />
       <persistence type="property" />
     </attribute>
   </attributes>
 </itemtype>

And this is in my hmc.xml:

 <type name="DocumentUploadWizard" icon="images/ext/catalog/e_catalog_import.gif">
     <organizer>
       <editor>
         <tab name="tab.documentuploadwizard.meta" position="0">
           <section name="section.documentuploadwizard.information">
              <listlayout>
            <attribute name="document">
              <uploadtomediaeditor presettype="Media" />
            </attribute>
            <attribute name="documentTitle"/>
              </listlayout>
           </section>
         </tab>
       </editor>
     </organizer>
   </type>

When i open the Wizard I get this error in my console:

 ERROR m.hmc.util.visitor.ChipVisitor | 
 java.lang.NullPointerException
     at de.hybris.platform.jalo.c2l.LocalizableItem.getAllLocalizedProperties(LocalizableItem.java:473)
     at x.wizards.GeneratedDocumentUploadWizard.getAllDocumentTitle(GeneratedDocumentUploadWizard.java:175)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at de.hybris.platform.jalo.type.ReflectionAttributeAccess$AttributeMethod.invokeGetter(ReflectionAttributeAccess.java:742)
     at de.hybris.platform.jalo.type.ReflectionAttributeAccess.getValue(ReflectionAttributeAccess.java:921)
     at de.hybris.platform.jalo.Item.getAttribute(Item.java:1813)
     at de.hybris.platform.hmc.util.action.LoadAction.loadAttributeValue(LoadAction.java:76)
     at de.hybris.platform.servicelayer.hmc.ServicelayerHMCLoadAction.loadAttributeValue(ServicelayerHMCLoadAction.java:75)
     at de.hybris.platform.hmc.util.visitor.InitialValueVisitor.readValue(InitialValueVisitor.java:112)
     at de.hybris.platform.hmc.util.visitor.InitialValueVisitor.visit(InitialValueVisitor.java:76)
     at de.hybris.platform.hmc.util.visitor.ChipVisitor.inviteInternal(ChipVisitor.java:75)
 

Do I miss something?

My Hybris-Version: 4.8.9

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member437308
Active Participant
0 Kudos

Hello,

Please refer to the tutorial how to create a wizard https://wiki.hybris.com/display/release4/How+To+Create+a+Wizard+-+Tutorial . Pay attention how the attribute of WizardItem should be declared:

   <attribute type="localized:java.lang.String"
      qualifier="description">
      <persistence type="jalo" />
   </attribute>

The wizard extends from "WizardBusinessItem" who is jaloOnly type. This mean that it only exist in memory and not to be written to the database. You declared the localized attribute as a "property" what quarrel with Jalo only item. Default getter does not work for a localized attribute in a jaloOnly types.

Please change this attribute to jalo, rebuild and update your platform. It should help you.

Best regards.