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

Remove Interceptor issue

Hi all

i am implementing remove interceptor but getting error

public class MyCustomerDeletedCustomer implements RemoveInterceptor {

 @Override
 public void onRemove(final Object object, final InterceptorContext ctx) throws InterceptorException
 {

     if (object instanceof MyCustomerModel)
     {
         final MyCustomerModel myCustomerModel = (MyCustomerModel) object;
         final DeletedCustomerModel deletedCustomerModel = ctx.getModelService().create(DeletedCustomerModel.class);
         deletedCustomerModel.setDate(new Date());
         deletedCustomerModel.setEmailID(myCustomerModel.getEmailId());
         deletedCustomerModel.setUid(myCustomerModel.getUid());
         ctx.registerElementFor(deletedCustomerModel, PersistenceOperation.SAVE);
     }
 }

}

in spring xml

 </bean>
 
 <bean id="MyValidateInterceptorMapping" class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
   <property name="interceptor" ref="MyCustomerDeletedCustomer"></property>
   <property name="typeCode" ref="MyCustomer"></property>
 </bean>


is it the correct way?

if i missing anything please do tell.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2016 at 10:00 AM

    Hi Bharamani,

    If You want to implement many interceptors, each InterceptorMapping should be defined in separate bean.

    Regards,
    Artur

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2016 at 10:36 AM

    These posts clearly describe how you can implement interceptors with clear examples.

    https://help.hybris.com/6.0.0/hcd/8bfbf43e8669101480d0f060d79b1baa.html

    https://wiki.hybris.com/display/release5/Interceptors

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2016 at 05:43 AM
    -1

    HI Luke Thanks for your reply

    Yes i defined MyCustomerDeletedCustomer in spring.xml i was doing mistake in

    here ref="MyCustomer" should be value="MyCustomer"

    Luke,

    If i want to implement two interceptor than how to mention interceptormapping?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2016 at 06:07 AM
    -1

    Thanks to Jonathan ,Arthur and Luke

    I got the concept...

    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.