on ‎2018 Oct 09 3:53 PM
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 : ----------------
<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>
Am I missing any configuration here? Kindly help me.
Request clarification before answering.
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">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.