/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fidufosyga.rules;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
 *
 * @author Marinela.QuinteroT1
 */

public class ValidaDiscapacidad extends AbstractRule {
	// params="01#02#03#04#05#06#07"

	/** Creates a new instance of NoContieneValorObligatorio */
	public ValidaDiscapacidad() {
	}

	public void setParams(Object[] params) {
		String valores = (String) params[0];
		ArrayList<String> listaString = new ArrayList<String>();
		StringTokenizer st = new StringTokenizer(valores, ",");
		while (st.hasMoreTokens()) {
			listaString.add(st.nextToken());
		}
		String[] array = listaString.toArray(new String[listaString.size()]);
		Arrays.sort(array);
                
        

		params[0] = array;
		super.setParams(params);
	}

	  public boolean performValidation(String field, String[] registro, String nombreArchivo) {
              
              String[] valoresPermitidos = (String[]) getParams()[0];
        
              for (String valor : valoresPermitidos) {
                if (valor.equals(field)) {
                return false;
        }
    }

    
    return !field.isEmpty();
}
}


        