<commit_before>/**
 * Copyright (c) 2005-2008 Intalio inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Intalio inc. - initial API and implementation
 */
package org.intalio.tempo.uiframework.actions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequestWrapper;

import org.intalio.tempo.uiframework.Configuration;
import org.intalio.tempo.uiframework.URIUtils;
import org.intalio.tempo.uiframework.forms.FormManager;
import org.intalio.tempo.uiframework.forms.FormManagerBroker;
import org.intalio.tempo.uiframework.model.TaskHolder;
import org.intalio.tempo.workflow.auth.AuthException;
import org.intalio.tempo.workflow.task.Notification;
import org.intalio.tempo.workflow.task.PATask;
import org.intalio.tempo.workflow.task.PIPATask;
import org.intalio.tempo.workflow.task.Task;
import org.intalio.tempo.workflow.tms.ITaskManagementService;
import org.intalio.tempo.workflow.tms.client.RemoteTMSFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This class is responsible for collecting task and sending them back to the
 * user interface
 * 
 * @author niko
 * 
 */
public class TasksCollector {

    final String[] parameters = new String[] { "page", "rp", "sortname", "sortorder", "query", "qtype", "type" };

    /**
     * Parameters that can come from the user interface
     */
    final class ParameterMap extends HashMap<String, String> {
        public ParameterMap() {
            super(parameters.length);
            put("page", "1");
            put("page", "3");
            put("sortname", "_creationDate");
            put("sortorder", "DESC");
            put("query", null);
            put("qtype", null);
            put("type", "PATask");
            init();
        }

        /**
         * Do not copy over null values and empty values for parameters
         */
        public void init() {
            for (String param : parameters) {
                String value = _request.getParameter(param);
                if (value != null && !value.trim().equalsIgnoreCase("") && !value.equalsIgnoreCase("undefined"))
                    put(param, value);
            }
        }

        /**<commit_msg>Fix for delayed tasks list refresh<commit_after>/**
 * Copyright (c) 2005-2008 Intalio inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Intalio inc. - initial API and implementation
 */
package org.intalio.tempo.uiframework.actions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequestWrapper;

import org.intalio.tempo.uiframework.Configuration;
import org.intalio.tempo.uiframework.URIUtils;
import org.intalio.tempo.uiframework.forms.FormManager;
import org.intalio.tempo.uiframework.forms.FormManagerBroker;
import org.intalio.tempo.uiframework.model.TaskHolder;
import org.intalio.tempo.workflow.auth.AuthException;
import org.intalio.tempo.workflow.task.Notification;
import org.intalio.tempo.workflow.task.PATask;
import org.intalio.tempo.workflow.task.PIPATask;
import org.intalio.tempo.workflow.task.Task;
import org.intalio.tempo.workflow.tms.ITaskManagementService;
import org.intalio.tempo.workflow.tms.client.RemoteTMSFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This class is responsible for collecting task and sending them back to the
 * user interface
 * 
 * @author niko
 * 
 */
public class TasksCollector {

    final String[] parameters = new String[] { "page", "rp", "sortname", "sortorder", "query", "qtype", "type" };

    /**
     * Parameters that can come from the user interface
     */
    final class ParameterMap extends HashMap<String, String> {
        public ParameterMap() {
            super(parameters.length);
            put("page", "1");
            put("rp", "3");
            put("sortname", "_creationDate");
            put("sortorder", "DESC");
            put("query", null);
            put("qtype", null);
            put("type", "PATask");
            init();
        }

        /**
         * Do not copy over null values and empty values for parameters
         */
        public void init() {
            for (String param : parameters) {
                String value = _request.getParameter(param);
                if (value != null && !value.trim().equalsIgnoreCase("") && !value.equalsIgnoreCase("undefined"))
                    put(param, value);
            }
        }

        /**
{'fraction_non_alphanumeric': 0.11958511287370348, 'fraction_numerical': 0.006508033353670938, 'mean_word_length': 2.9789644012944985, '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': '682128', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1437, 'n_words': 351}