Overriding Liferay MVC Commands in 7.2

thumbnail
Steve Weiss, modified 3 Years ago. Regular Member Posts: 112 Join Date: 9/20/11 Recent Posts

I am trying to override the document library EditFolderMVCActionCommand class. I've created the class following the instructions found here: https://help.liferay.com/hc/en-us/articles/360028831752-Introduction-to-Overriding-Liferay-MVC-Commands

 

Below is my class, my problem is that when I edit a DL folder the parent class processAction is being called but my class is not. Any help or advice as to what I'm doing wrong is appreciated.

 

-Steve

package gov.nasa.hq.liferay.document.library.folder;

import com.liferay.document.library.constants.DLPortletKeys;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
 * @author sweiss
 *
 */
@Component(
        immediate = true,
        property = {
                "javax.portlet.name=" + DLPortletKeys.DOCUMENT_LIBRARY,
                "javax.portlet.name=" + DLPortletKeys.DOCUMENT_LIBRARY_ADMIN,
                "javax.portlet.name=" + DLPortletKeys.MEDIA_GALLERY_DISPLAY,
                "mvc.command.name=/document_library/edit_folder",
                "service.ranking:Integer=100"
        },
        service = MVCActionCommand.class)
public class CustomEditFolderMVCActionCommand extends BaseMVCActionCommand {

    private static Log _log = LogFactoryUtil.getLog(CustomEditFolderMVCActionCommand.class);;

    @Reference(
            target = "(component.name=com.liferay.document.library.web.internal.portlet.action.EditFolderMVCActionCommand)")
    protected MVCActionCommand mvcActionCommand;

    @Override
    protected void doProcessAction(ActionRequest request, ActionResponse response) throws Exception {

        String ID = "doProcessAction: ";
        _log.info(ID + "ENTER");
        mvcActionCommand.processAction(request, response);
        _log.info(ID + "EXIT");
    }

}