Skip to Content
author's profile photo Former Member
Former Member

Localized String in HMC-Wizard

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 04, 2014 at 02:37 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.