/*
 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * Contributors:
 *     arussel
 */
package org.nuxeo.ecm.platform.jbpm.core.filter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.NuxeoPrincipal;
import org.nuxeo.ecm.platform.jbpm.JbpmListFilter;
import org.nuxeo.ecm.platform.jbpm.JbpmService;
import org.nuxeo.runtime.api.Framework;

/**
 * @author arussel
 *
 */

public class ConfigurableTypeFilter implements JbpmListFilter {

    private static final long serialVersionUID = 1L;

    public ConfigurableTypeFilter() {

    }

    @SuppressWarnings("unchecked")
    public <T> ArrayList<T> filter(JbpmContext jbpmContext,
            DocumentModel document, ArrayList<T> list, NuxeoPrincipal principal) {
        JbpmService jbpmService = null;
        try {
            jbpmService = Framework.getService(JbpmService.class);
        } catch (Exception e) {
            throw new IllegalStateException("Jbpm Service is not deployed.", e);
        }
        Map<String, String[]> filters = jbpmService.getTypeFilterConfiguration();
        ArrayList<ProcessDefinition> pds = new ArrayList<ProcessDefinition>();
        for (T t : list) {
            ProcessDefinition definition = (ProcessDefinition) t;
            String[] allowedTypes = filters.get(definition.getName());
            if(allowedTypes == null) {
                continue;
            }
            if(Arrays.asList(allowedTypes).contains(document.getType())) {
                pds.add(definition);
            }
        }

        return (ArrayList<T>) pds;
    }
}

@@ -730,22 +730,20 @@
 va.util.
-Arrays
+List
 ;%0Aimport
@@ -1702,24 +1702,28 @@
 String, 
+List%3C
 String
-%5B%5D
+%3E
 %3E filter
@@ -1956,16 +1956,20 @@
     
+List%3C
 String
-%5B%5D
+%3E
  all
@@ -2113,22 +2113,8 @@
  if(
-Arrays.asList(
 allo
@@ -2121,17 +2121,16 @@
 wedTypes
-)
 .contain

fix compilatin pb