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

New Item type extending AbstractOrder with defined Jalo class getting Exception

Former Member
0 Likes
2,802

The type QuotationOrder must implement the inherited abstract method AbstractOrder.createNewEntry(SessionContext, ComposedType, Product, long, Unit, int) The type QuotationOrder must implement the inherited abstract method AbstractOrder.getAbstractOrderEntryTypeCode()

Accepted Solutions (1)

Accepted Solutions (1)

geffchang
Active Contributor
0 Likes

AbstractOrder is an abstract class which contains abstract method createNewEntry. So, if you extend AbstractOrder, you need to implement the abstract method. Otherwise, you need to define your class as abstract.

 public class QuotationOrder {
    protected OrderEntry createNewEntry(SessionContext ctx, ComposedType entryType, Product product, long quantity, Unit unit, int position) {
       // custom logic
    }
 }

You could try to check/decompile the de.hybris.platform.jalo.order.Order class for an idea, or you can just do a super in your constructor.

JavaDoc: https://help.hybris.com/1808/api/commerce-suite/de/hybris/platform/jalo/order/AbstractOrder.html#cre...

Answers (2)

Answers (2)

arvind-kumar_avinash
Active Contributor
0 Likes

There are two options: (1) Extend Order instead of AbstractOrder e.g.

 <itemtype code="QuotationOrder"
           extends="Order"
           jaloclass="org.training.jalo.order.QuotationOrder"
           autocreate="true"
           generate="true">
     <attributes>
         <attribute autocreate="true" qualifier="sampleStringAttribute" type="java.lang.String">
             <persistence type="property"/>
             <modifiers read="true" write="true" search="true" optional="false"/>
         </attribute>
     </attributes>
 </itemtype>

(2) Extend AbstractOrder as follows

 <itemtype code="CustomOrder"
           extends="AbstractOrder"
           jaloclass="org.training.jalo.order.CustomOrder"
           autocreate="true"
           generate="true">
     <attributes>
         <attribute autocreate="true" qualifier="sampleStringAttribute" type="java.lang.String">
             <persistence type="property"/>
             <modifiers read="true" write="true" search="true" optional="false"/>
         </attribute>
     </attributes>
 </itemtype>

perform ant clean all and update the generated CustomOrder.java to implement the abstract methods ( createNewEntry and getAbstractOrderEntryTypeCode ) of AbstractOrder:

 package org.training.jalo.order;    
 //For brevity, import statements have been removed  
 public class CustomOrder extends GeneratedCustomOrder {
     @SuppressWarnings("unused")
     private static final Logger LOG = Logger.getLogger( CustomOrder.class.getName() );
     @Override
     protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes) throws JaloBusinessException {
         final Item item = super.createItem( ctx, type, allAttributes );
         return item;
     }
     @Override
     protected AbstractOrderEntry createNewEntry(final SessionContext arg0, final ComposedType arg1, final Product arg2, final long arg3, final Unit arg4, final int arg5) {
         return null; //replace null with the required value
     }
     @Override
     protected String getAbstractOrderEntryTypeCode() {
         return null; //replace null with the required value
     }
 }

Before adding these methods, you will see the following compilation errors which will go away after adding these methods and then performing ant clean all :

 [yjavac] ----------
 [yjavac] 1. ERROR in hybris/bin/custom/training/src/org/training/jalo/order/CustomOrder.java (at line 9)
 [yjavac]     public class CustomOrder extends GeneratedCustomOrder
 [yjavac]                  ^^^^^^^^^^^
 [yjavac] The type CustomOrder must implement the inherited abstract method AbstractOrder.createNewEntry(SessionContext, ComposedType, Product, long, Unit, int)
 [yjavac] ----------
 [yjavac] 2. ERROR in hybris/bin/custom/training/src/org/training/jalo/order/CustomOrder.java (at line 9)
 [yjavac]     public class CustomOrder extends GeneratedCustomOrder
 [yjavac]                  ^^^^^^^^^^^
 [yjavac] The type CustomOrder must implement the inherited abstract method AbstractOrder.getAbstractOrderEntryTypeCode()
 [yjavac] ----------
 [yjavac] 2 problems (2 errors)

I hope it helps.
Best regards.

mpern
Product and Topic Expert
Product and Topic Expert
0 Likes

I hope you are aware that the platform supports quotes out-of-the-box since 6.3...

https://help.hybris.com/1808/hcd/a795b4722f6942c091ef716c66ddb37d.html

Former Member
0 Likes

yes you are right