on 07-25-2016 12:56 PM
Hi,all I implemented an InitDefaultsInterceptor for a Product as follows:
public class DefaultInterceptor implements InitDefaultsInterceptor { public void onInitDefaults(final Object obj,final InterceptorContext arg1) {
if(obj instanceof ProductModel)
{
final ProductModel productModel = (ProductModel) obj;
System.out.println(productModel.getCode());
}
}
} I registered this interceptor as follows in the file myextension-spring.xml:
Hello Rachit,
There are different types of interceptors meant for different stages in model's lifecycle. :https://wiki.hybris.com/display/release5/Interceptors#Interceptors-LifeCycleofaModel.
As Andrew explains: Init Defaults Interceptor is triggered when the model is populated with defaults values. You may look at this table to decide which type of Interceptor suits your requirement.
Hope this helps.
Br, Shwetha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The InitDefaultsInterceptor
fires when the model is created. This is before it saves any data to it. The model will always be empty at this point. It's meant for you to set default values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
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.