<commit_before>/**

 * 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.processmgt.portlet;

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

import org.opencps.processmgt.search.ProcessOrderDisplayTerms;
import org.opencps.util.WebKeys;

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

/**
 * @author trungnt
 *
 */
public class ConfigurationProcessOrderImpl 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 arg0, ActionRequest actionRequest,
			ActionResponse actionResponse) throws Exception {

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

		PortletPreferences preferences = PortletPreferencesFactoryUtil
				.getPortletSetup(actionRequest, portletResource);

		String tabs2 = ParamUtil.getString(actionRequest, "tabs2", "todolist");

		if (tabs2.equals("todolist")) {
			updateToDoList(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("justfinishedlist")) {
			updateJustFinishedList(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("processorder")) {
			updateProcessOrder(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("digital-signature")) {
			updateDigitalSignature(preferences, actionRequest, actionResponse);
		}

		boolean hiddenTreeNodeEqualNone = ParamUtil.getBoolean(actionRequest, "hiddenToDoListTreeMenuEmptyNode");
		String redirectToPageProcessCfg = ParamUtil.getString(actionRequest, "redirectToPageProcessCfg", "dossier_info");
		preferences.setValue("hiddenToDoListTreeMenuEmptyNode", String.valueOf(hiddenTreeNodeEqualNone));
		preferences.setValue("redirectToPageProcessCfg", String.valueOf(redirectToPageProcessCfg));
		
		preferences.store();

		SessionMessages.add(actionRequest, "potlet-config-saved");

	}

	protected void updateProcessOrder(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String[] reportTypes = ParamUtil.getParameterValues(actionRequest,
				"reportType", new String[] { ".pdf" });
		
		String processOrderViewer = ParamUtil.getString(actionRequest,
				"processOrderViewer", "default");

		preferences.setValue("reportTypes",
				String.valueOf(StringUtil.merge(reportTypes)));
		
		preferences.setValue("processOrderViewer", processOrderViewer);

	}

	protected void updateToDoList(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String todolistDisplayStyle = ParamUtil.getString(actionRequest,
				"todolistDisplayStyle", "default");
		String todolistOrderByField = ParamUtil.getString(actionRequest,
				"todolistOrderByField", ProcessOrderDisplayTerms.MODIFIEDDATE);
		String todolistOrderByType = ParamUtil.getString(actionRequest,
				"todolistOrderByType", WebKeys.ORDER_BY_DESC);
		String assignFormDisplayStyle = ParamUtil.getString(actionRequest,
				"assignFormDisplayStyle", "popup");
		boolean hiddenToDoListTreeMenuEmptyNode = ParamUtil.getBoolean(
				actionRequest, "hiddenToDoListTreeMenuEmptyNode", false);

		preferences.setValue("todolistOrderByField", todolistOrderByField);
		preferences.setValue("todolistDisplayStyle", todolistDisplayStyle);
		preferences.setValue("todolistOrderByType", todolistOrderByType);
		preferences.setValue("assignFormDisplayStyle", assignFormDisplayStyle);
		preferences.setValue("hiddenToDoListTreeMenuEmptyNode",
				String.valueOf(hiddenToDoListTreeMenuEmptyNode));

	}

	protected void updateJustFinishedList(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String justfinishedlistDisplayStyle = ParamUtil.getString(
				actionRequest, "justfinishedlistDisplayStyle", "default");
		String justfinishedlistOrderByType = ParamUtil.getString(actionRequest,
				"justfinishedlistOrderByType", WebKeys.ORDER_BY_DESC);

		String justfinishedlistOrderByField = ParamUtil.getString(
				actionRequest, "justfinishedlistOrderByField",
				ProcessOrderDisplayTerms.MODIFIEDDATE);

		boolean hiddenJustFinishedListEmptyNode = ParamUtil.getBoolean(
				actionRequest, "hiddenJustFinishedListEmptyNode", false);

		preferences.setValue("justfinishedlistDisplayStyle",
				justfinishedlistDisplayStyle);
		preferences.setValue("justfinishedlistOrderByType",
				justfinishedlistOrderByType);
		preferences.setValue("justfinishedlistOrderByField",
				justfinishedlistOrderByField);

		preferences.setValue("hiddenJustFinishedListEmptyNode",
				String.valueOf(hiddenJustFinishedListEmptyNode));

	}

	protected void updateDigitalSignature(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {

		boolean assignTaskAfterSign = ParamUtil.getBoolean(actionRequest,
				"assignTaskAfterSign", false);

		double offsetX = ParamUtil.getDouble(actionRequest, "offsetX", 0.0);

		double offsetY = ParamUtil.getDouble(actionRequest, "offsetY", 0.0);

		double imageZoom = ParamUtil.getDouble(actionRequest, "imageZoom", 1.0);
		
		boolean showSignatureInfo = ParamUtil.getBoolean(actionRequest,
				"showSignatureInfo", false);

		preferences.setValue("assignTaskAfterSign",
				String.valueOf(assignTaskAfterSign));

		preferences.setValue("offsetX", String.valueOf(offsetX));

		preferences.setValue("offsetY", String.valueOf(offsetY));

		preferences.setValue("imageZoom", String.valueOf(imageZoom));

		preferences.setValue("showSignatureInfo",
				String.valueOf(showSignatureInfo));
	}

	/*
	 * (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 {

		return "/html/portlets/processmgt/processorder/configuration_.jsp";
	}

}
<commit_msg>issue#No142 cấu hình ẩn phân nhóm hồ sơ khi số hồ sơ =0 thì bị mất cấu hình mặc định khi click nút Hành động chuyển vào tab Xử lý hồ sơ<commit_after>/**

 * 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.processmgt.portlet;

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

import org.opencps.processmgt.search.ProcessOrderDisplayTerms;
import org.opencps.util.WebKeys;

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

/**
 * @author trungnt
 *
 */
public class ConfigurationProcessOrderImpl 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 arg0, ActionRequest actionRequest,
			ActionResponse actionResponse) throws Exception {

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

		PortletPreferences preferences = PortletPreferencesFactoryUtil
				.getPortletSetup(actionRequest, portletResource);

		String tabs2 = ParamUtil.getString(actionRequest, "tabs2", "todolist");

		if (tabs2.equals("todolist")) {
			updateToDoList(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("justfinishedlist")) {
			updateJustFinishedList(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("processorder")) {
			updateProcessOrder(preferences, actionRequest, actionResponse);
		} else if (tabs2.equals("digital-signature")) {
			updateDigitalSignature(preferences, actionRequest, actionResponse);
		}
		
		preferences.store();

		SessionMessages.add(actionRequest, "potlet-config-saved");

	}

	protected void updateProcessOrder(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String[] reportTypes = ParamUtil.getParameterValues(actionRequest,
				"reportType", new String[] { ".pdf" });
		
		String processOrderViewer = ParamUtil.getString(actionRequest,
				"processOrderViewer", "default");
		
		String redirectToPageProcessCfg = 
				ParamUtil.getString(actionRequest, 
						"redirectToPageProcessCfg", "dossier_info");
		
		preferences.setValue("redirectToPageProcessCfg", 
				String.valueOf(redirectToPageProcessCfg));
		preferences.setValue("reportTypes",
				String.valueOf(StringUtil.merge(reportTypes)));
		
		preferences.setValue("processOrderViewer", processOrderViewer);

	}

	protected void updateToDoList(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String todolistDisplayStyle = ParamUtil.getString(actionRequest,
				"todolistDisplayStyle", "default");
		String todolistOrderByField = ParamUtil.getString(actionRequest,
				"todolistOrderByField", ProcessOrderDisplayTerms.MODIFIEDDATE);
		String todolistOrderByType = ParamUtil.getString(actionRequest,
				"todolistOrderByType", WebKeys.ORDER_BY_DESC);
		String assignFormDisplayStyle = ParamUtil.getString(actionRequest,
				"assignFormDisplayStyle", "popup");
		boolean hiddenToDoListTreeMenuEmptyNode = ParamUtil.getBoolean(
				actionRequest, "hiddenToDoListTreeMenuEmptyNode", false);

		preferences.setValue("todolistOrderByField", todolistOrderByField);
		preferences.setValue("todolistDisplayStyle", todolistDisplayStyle);
		preferences.setValue("todolistOrderByType", todolistOrderByType);
		preferences.setValue("assignFormDisplayStyle", assignFormDisplayStyle);
		preferences.setValue("hiddenToDoListTreeMenuEmptyNode",
				String.valueOf(hiddenToDoListTreeMenuEmptyNode));

	}

	protected void updateJustFinishedList(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {
		String justfinishedlistDisplayStyle = ParamUtil.getString(
				actionRequest, "justfinishedlistDisplayStyle", "default");
		String justfinishedlistOrderByType = ParamUtil.getString(actionRequest,
				"justfinishedlistOrderByType", WebKeys.ORDER_BY_DESC);

		String justfinishedlistOrderByField = ParamUtil.getString(
				actionRequest, "justfinishedlistOrderByField",
				ProcessOrderDisplayTerms.MODIFIEDDATE);

		boolean hiddenJustFinishedListEmptyNode = ParamUtil.getBoolean(
				actionRequest, "hiddenJustFinishedListEmptyNode", false);

		preferences.setValue("justfinishedlistDisplayStyle",
				justfinishedlistDisplayStyle);
		preferences.setValue("justfinishedlistOrderByType",
				justfinishedlistOrderByType);
		preferences.setValue("justfinishedlistOrderByField",
				justfinishedlistOrderByField);

		preferences.setValue("hiddenJustFinishedListEmptyNode",
				String.valueOf(hiddenJustFinishedListEmptyNode));

	}

	protected void updateDigitalSignature(PortletPreferences preferences,
			ActionRequest actionRequest, ActionResponse actionResponse)
			throws ReadOnlyException {

		boolean assignTaskAfterSign = ParamUtil.getBoolean(actionRequest,
				"assignTaskAfterSign", false);

		double offsetX = ParamUtil.getDouble(actionRequest, "offsetX", 0.0);

		double offsetY = ParamUtil.getDouble(actionRequest, "offsetY", 0.0);

		double imageZoom = ParamUtil.getDouble(actionRequest, "imageZoom", 1.0);
		
		boolean showSignatureInfo = ParamUtil.getBoolean(actionRequest,
				"showSignatureInfo", false);

		preferences.setValue("assignTaskAfterSign",
				String.valueOf(assignTaskAfterSign));

		preferences.setValue("offsetX", String.valueOf(offsetX));

		preferences.setValue("offsetY", String.valueOf(offsetY));

		preferences.setValue("imageZoom", String.valueOf(imageZoom));

		preferences.setValue("showSignatureInfo",
				String.valueOf(showSignatureInfo));
	}

	/*
	 * (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 {

		return "/html/portlets/processmgt/processorder/configuration_.jsp";
	}

}

{'fraction_non_alphanumeric': 0.0895604019963082, 'fraction_numerical': 0.002734668763246052, 'mean_word_length': 6.24517087667162, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2684780', 'n_tokens_mistral': 4396, 'n_tokens_neox': 4053, 'n_words': 821}