cancel
Showing results for 
Search instead for 
Did you mean: 

Custmize CMS Restriction Error

Former Member
0 Kudos

I defined own restriction called MyStoreTypeRestriction like below.

but, I got a error when I ant clean all. [yjavac] 1. ERROR in D:\xxxx\my-hybris\extensions\my\mycore\src\com\my\cms2\jalo\restrictions\MyStoreTypeRestriction.java (at line 9) [yjavac] public class MyStoreTypeRestriction extends GeneratedMyStoreTypeRestriction [yjavac] ^^^^^^^^^^^^^^^^^^^^^^^^ [yjavac] The type MyStoreTypeRestriction must implement the inherited abstract method AbstractRestriction.getDescription(SessionContext) [yjavac] ---------- [yjavac] ---------- [yjavac] 2. ERROR in D:\xxxx\my-hybris\extensions\my\mycore\src\com\my\core\jalo\MyStoreTypeRestriction.java (at line 9) [yjavac] public class MyStoreTypeRestriction extends GeneratedmyStoreTypeRestriction [yjavac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [yjavac] GeneratedmyStoreTypeRestriction cannot be resolved to a type [yjavac] ---------- [yjavac] 3. ERROR in D:\xxxx\my-hybris\extensions\my\mycore\src\com\my\core\jalo\MyStoreTypeRestriction.java (at line 15) [yjavac] protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes) throws JaloBusinessException [yjavac] ^^^^^^^^^^^^^^^^ [yjavac] ItemAttributeMap cannot be resolved to a type [yjavac] ---------- [yjavac] ---------- [yjavac] 4. ERROR in D:\xxxx\my-hybris\extensions\my\mycore\src\de\hybris\platform\cms2\jalo\restrictions\MyStoreTypeRestriction.java (at line 22) [yjavac] public class MyStoreTypeRestriction extends GeneratedMyStoreTypeRestriction [yjavac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [yjavac] GeneratedMyStoreTypeRestriction cannot be resolved to a type [yjavac] ---------- [yjavac] 5. ERROR in D:\xxxx\my-hybris\extensions\my\mycore\src\de\hybris\platform\cms2\jalo\restrictions\MyStoreTypeRestriction.java (at line 28) [yjavac] protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes) throws JaloBusinessException [yjavac] ^^^^^^^^^^^^^^^^ [yjavac] ItemAttributeMap cannot be resolved to a type [yjavac] ----------

pls, suggest how to resolve these errors, thanks.

Former Member
0 Kudos

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

I guess this doesn't work even if the method is added because the file will be overwritten every time on the build and the method will be removed. Please validate if my understanding is correct.

0 Kudos

problem:

 must implement the inherited abstract method AbstractRestriction.getDescription(SessionContext)

For now as a workaround you could just add the get description method to the jalo class:

 public class CMSProductDeliverableRestriction extends GeneratedCMSProductDeliverableRestriction
 {
     @SuppressWarnings("unused")
     private static final Logger LOG = Logger.getLogger( CMSProductDeliverableRestriction.class.getName() );
     
     @Override
     protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes) throws JaloBusinessException
     {
         // business code placed here will be executed before the item is created
         // then create the item
         final Item item = super.createItem( ctx, type, allAttributes );
         // business code placed here will be executed after the item was created
         // and return the item
         return item;
     }
 
     /**
      * @paessionContext
      * @deprecated
      */
     @Override
     public String getDescription(SessionContext sessionContext) {
         return Localization.getLocalizedString("type.CMSProductDeliverableRestriction.description.text");
     }
 }


Former Member
0 Kudos

me too,have you solved the problem?