Example usage for com.liferay.portal.convert ConvertProcess getPath

List of usage examples for com.liferay.portal.convert ConvertProcess getPath

Introduction

In this page you can find the example usage for com.liferay.portal.convert ConvertProcess getPath.

Prototype

@Deprecated
public default String getPath() 

Source Link

Usage

From source file:com.liferay.portlet.admin.action.EditServerAction.java

License:Open Source License

protected String convertProcess(ActionRequest actionRequest, ActionResponse actionResponse, String cmd)
        throws Exception {

    ActionResponseImpl actionResponseImpl = (ActionResponseImpl) actionResponse;

    PortletSession portletSession = actionRequest.getPortletSession();

    String className = StringUtil.replaceFirst(cmd, "convertProcess.", StringPool.BLANK);

    ConvertProcess convertProcess = (ConvertProcess) InstancePool.get(className);

    String[] parameters = convertProcess.getParameterNames();

    if (parameters != null) {
        String[] values = new String[parameters.length];

        for (int i = 0; i < parameters.length; i++) {
            String parameter = className + StringPool.PERIOD + parameters[i];

            if (parameters[i].contains(StringPool.EQUAL)) {
                String[] parameterPair = StringUtil.split(parameters[i], CharPool.EQUAL);

                parameter = className + StringPool.PERIOD + parameterPair[0];
            }//from   ww  w  . j a  v a2 s  . c  om

            values[i] = ParamUtil.getString(actionRequest, parameter);
        }

        convertProcess.setParameterValues(values);
    }

    String path = convertProcess.getPath();

    if (path != null) {
        PortletURL portletURL = actionResponseImpl.createRenderURL();

        portletURL.setWindowState(WindowState.MAXIMIZED);

        portletURL.setParameter("struts_action", path);

        return portletURL.toString();
    } else {
        MaintenanceUtil.maintain(portletSession.getId(), className);

        MessageBusUtil.sendMessage(DestinationNames.CONVERT_PROCESS, className);

        return null;
    }
}

From source file:com.liferay.server.admin.web.internal.portlet.action.EditServerMVCActionCommand.java

License:Open Source License

protected String convertProcess(ActionRequest actionRequest, ActionResponse actionResponse, String cmd)
        throws Exception {

    ActionResponseImpl actionResponseImpl = (ActionResponseImpl) actionResponse;

    PortletSession portletSession = actionRequest.getPortletSession();

    String className = StringUtil.replaceFirst(cmd, "convertProcess.", StringPool.BLANK);

    ConvertProcess convertProcess = (ConvertProcess) InstancePool.get(className);

    String[] parameters = convertProcess.getParameterNames();

    if (parameters != null) {
        String[] values = new String[parameters.length];

        for (int i = 0; i < parameters.length; i++) {
            String parameter = className + StringPool.PERIOD + parameters[i];

            if (parameters[i].contains(StringPool.EQUAL)) {
                String[] parameterPair = StringUtil.split(parameters[i], CharPool.EQUAL);

                parameter = className + StringPool.PERIOD + parameterPair[0];
            }//from ww w . j  ava 2  s . co m

            values[i] = ParamUtil.getString(actionRequest, parameter);
        }

        convertProcess.setParameterValues(values);
    }

    try {
        convertProcess.validate();
    } catch (ConvertException ce) {
        SessionErrors.add(actionRequest, ce.getClass(), ce);

        return null;
    }

    String path = convertProcess.getPath();

    if (path != null) {
        PortletURL portletURL = actionResponseImpl.createRenderURL();

        portletURL.setParameter("mvcRenderCommandName", path);
        portletURL.setWindowState(WindowState.MAXIMIZED);

        return portletURL.toString();
    }

    MaintenanceUtil.maintain(portletSession.getId(), className);

    MessageBusUtil.sendMessage(DestinationNames.CONVERT_PROCESS, className);

    return null;
}