RE: SystemEvent TYPE_DELETE dont working

thumbnail
Joaquin Cabal, modified 5 Years ago. Regular Member Posts: 106 Join Date: 9/7/09 Recent Posts
I'm using the event to can have the deletes events marked for future export / import data. this is working for one model and for the other one is not working. The only difference is one model has a ModelPortletDataHandler related and the other one dont. Is working for ProductPresentation. This is the one dont have the PortletDataHandler related. Here is the code:

Appreciate any help. Thanks!

***********************ProductLocalServiceImpl class ***********************************************************
/***
* Delete product and relations
* @param productId
* @return
*/
@Override
@Indexable(type = IndexableType.DELETE)
public Product deleteProduct(long productId) throws PortalException {

Product product = getProduct(productId);
deleteProduct(product);

return product;
}

/***
* Delete product and relations
* @param product the product
* @return
*/
@Indexable(type = IndexableType.DELETE)
@Override
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public Product deleteProduct(Product product) {
//delete product
super.deleteProduct(product);
//remove product presentations
productPresentationLocalService.deleteByProductId(product.getProductId());

//delete article and successCase products
articleLocalService.clearProductArticles(product.getProductId());
successCaseLocalService.clearProductSuccessCases(product.getProductId());

return product;
}

**************************************** ***********************************************************
***********************ProductPresentationLocalServiceImpl class ***********************************************************

@Override
@Indexable(type = IndexableType.DELETE)
public ProductPresentation deleteProductPresentation(long productPresentationId) throws PortalException {
ProductPresentation productPresentation = getProductPresentation(productPresentationId);

return deleteProductPresentation(productPresentation);
}


@Indexable(type = IndexableType.DELETE)
@Override
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public ProductPresentation deleteProductPresentation(ProductPresentation productPresentation) {
return super.deleteProductPresentation(productPresentation);
}
thumbnail
Joaquin Cabal, modified 5 Years ago. Regular Member Posts: 106 Join Date: 9/7/09 Recent Posts
I could fix it. The problem was that I was calling to deleteProduct(Product product) without the interface attribute. The right way is using  productLocalService.deleteProduct(Product product) .