cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to show few enum values in backoffice specific to loggedIN User?

Former Member
0 Likes
2,166

My requirement is to show few enum values not all in backoffice based on the user loggedIn. At Model level,I have one attribute of enum type, so I need to show only few values of that field in drop down specific to login user.

I have extended my customEditor class with OOTB "com.hybris.cockpitng.editor.defaultenum.DefaultEnumEditor". But still OOTB Editor(DefaultEnumEditor) is getting called. My customEditor class (TestEnumEditor) is not getting triggered.

Below are the changes made by me.

My custom class: public class TestEnumEditor extends DefaultEnumEditor{ }

definition.xml : ----------------

customextension-backoffice-spring.xml :

     <cng:put key-type="java.lang.String" value-type="java.lang.String">
         <entry key="de.hybris.platform.core.PK" value="com.hybris.cockpitng.editor.onpremise.pk"/>
         <!-- <entry key="de.hybris.platform.core.HybrisEnumValue" value="com.hybris.cockpitng.editor.defaultenum"/> -->
         **<entry key="de.hybris.platform.core.HybrisEnumValue" value="org.test.editor.defaultenum.TestEnumEditor"/>**
         <entry key="^ClassificationEnum\((.*)\)$" value="com.hybris.cockpitng.editor.defaultenum"/>
         <entry key="Feature" value="com.hybris.cockpitng.editor.feature"/>
         <entry key="de.hybris.platform.util.TaxValue"
                value="de.hybris.platform.platformbackoffice.editors.taxdiscountvalueeditor.TaxDiscountValueEditor"/>
         <entry key="de.hybris.platform.util.DiscountValue"
                value="de.hybris.platform.platformbackoffice.editors.taxdiscountvalueeditor.TaxDiscountValueEditor"/>
         <entry key="^FeatureValue\((.*)\)$" value="com.hybris.cockpitng.editor.featurevalue"/>
         <entry key="de.hybris.platform.util.StandardDateRange"
                value="com.hybris.cockpitng.editor.standardDateRange"/>
         <entry key="com.hybris.cockpitng.editor.numberwithclassificationunit"
                value="com.hybris.cockpitng.editor.numberwithclassificationunit"/>
         <entry key="Undefined" value="com.hybris.cockpitng.editor.undefinedtype"/>
         
     </cng:put>
 </cng:map-extender>
 
 

**config.xml :*

Am I missing any configuration here? Kindly help me.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

Hi

Instated of overriding DefaultEnumEditor class, you can extend PlatformEnumValueResolver class and override getAllValues() method and bean enumValueResolver . The DefaultEnumEditor class is calling PlatformEnumValueResolver class inside getAllvalues() method. It's not required to define in <entry key="de.hybris.platform.core.HybrisEnumValue" value="org.test.editor.defaultenum.TestEnumEditor"/> (customextension-backoffice-spring.xml)

extend to this class :

 <alias name="platformEnumValueResolver" alias="enumValueResolver"/>
     <bean id="platformEnumValueResolver" class="de.hybris.platform.platformbackoffice.editors.yenum.PlatformEnumValueResolver">







Amit-Panwar
Product and Topic Expert
Product and Topic Expert
0 Likes

This is something you can do by creating search restrictions on the enum. However, search restrictions do not work for admin user or users in admin group.

Former Member
0 Likes

Hi Amit,

I even tried with search restrctions on the enum for users other than admin group. It's not working.