/**
 * OpenCPS is the open source Core Public Services software Copyright (C)
 * 2016-present OpenCPS community This program is free software: you can
 * redistribute it and/or modify it under the terms of the GNU Affero General
 * Public License as published by the Free Software Foundation, either version 3
 * of the License, or any later version. This program is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details. You should have received a
 * copy of the GNU Affero General Public License along with this program. If
 * not, see <http://www.gnu.org/licenses/>
 */

package org.opencps.servicemgt.portlet;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletPreferences;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import com.liferay.portal.kernel.portlet.ConfigurationAction;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portlet.PortletPreferencesFactoryUtil;

/**
 * @author khoavd
 */
public class ConfigurationImpl implements ConfigurationAction {

	/*
	 * (non-Javadoc)
	 * @see
	 * com.liferay.portal.kernel.portlet.ConfigurationAction#processAction(javax
	 * .portlet.PortletConfig, javax.portlet.ActionRequest,
	 * javax.portlet.ActionResponse)
	 */
	@Override
	public void processAction(
	    PortletConfig portletConfig, ActionRequest actionRequest,
	    ActionResponse actionResponse)
	    throws Exception {

		String menuType = ParamUtil.getString(actionRequest, "menuType");

		String portletResource =
		    ParamUtil.getString(actionRequest, "portletResource");
		
		PortletPreferences preferences =
		    PortletPreferencesFactoryUtil.getPortletSetup(
		        actionRequest, portletResource);
		
		preferences.setValue("menuType", menuType);
		preferences.store();
		
		SessionMessages.add(actionRequest, "potlet-config-saved");

	}

	/*
	 * (non-Javadoc)
	 * @see
	 * com.liferay.portal.kernel.portlet.ConfigurationAction#render(javax.portlet
	 * .PortletConfig, javax.portlet.RenderRequest,
	 * javax.portlet.RenderResponse)
	 */
	@Override
	public String render(
	    PortletConfig portletConfig, RenderRequest renderRequest,
	    RenderResponse renderResponse)
	    throws Exception {

		// TODO Auto-generated method stub
		return "/html/portlets/servicemgt/menu/configuration.jsp";
	}
}

@@ -56,16 +56,19 @@
 software
+%0A *
  Copyrig
@@ -73,19 +73,16 @@
 ight (C)
-%0A *
  2016-pr
@@ -104,16 +104,23 @@
 ommunity
+%0A * %0A *
  This pr
@@ -150,19 +150,16 @@
  you can
-%0A *
  redistr
@@ -180,16 +180,19 @@
 r modify
+%0A *
  it unde
@@ -228,19 +228,16 @@
  General
-%0A *
  Public 
@@ -259,16 +259,19 @@
 ished by
+%0A *
  the Fre
@@ -309,19 +309,16 @@
 ersion 3
-%0A *
  of the 
@@ -328,16 +328,19 @@
 ense, or
+%0A *
  any lat
@@ -350,16 +350,23 @@
 version.
+%0A * %0A *
  This pr
@@ -397,19 +397,16 @@
 the hope
-%0A *
  that it
@@ -421,16 +421,19 @@
  useful,
+%0A *
  but WIT
@@ -475,19 +475,16 @@
  implied
-%0A *
  warrant
@@ -487,16 +487,19 @@
 ranty of
+%0A *
  MERCHAN
@@ -555,15 +555,15 @@
  the
+%0A *
  GNU
-%0A *
  Aff
@@ -606,16 +606,19 @@
 details.
+%0A *
  You sho
@@ -636,19 +636,16 @@
 ceived a
-%0A *
  copy of
@@ -682,16 +682,19 @@
  License
+%0A *
  along w
@@ -713,19 +713,16 @@
 gram. If
-%0A *
  not, se

Update Copyright