/*
 * Created on May 18, 2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.taglib;

import gov.va.med.esr.common.model.lookup.ServicePeriod;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;
import javax.servlet.jsp.JspException;

/**
 * @author DNS   CHENB
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class SubsetPOSOptionsTag extends CustomOptionsTag {
	/**
	 * An instance of serialVersionUID
	 */
	private static final long serialVersionUID = 7621136698690784532L;
	
	
	private String subSetCode = null;
	
	protected Iterator getIterator(String col, String prop) throws JspException {
		
		Iterator iter = super.getIterator(col, prop);
		if (getSubSetCode() != null)
		{
			Collection subList = new ArrayList();
			for (; iter.hasNext();)
			{
				ServicePeriod obj = (ServicePeriod)iter.next();
				if (obj.isSubSetForNonVeteranCode(getSubSetCode()))
					subList.add(obj);
			}
			iter = subList.iterator();
		}
		return iter;
	}
	
	
	/**
	 * @return Returns the subSetCode.
	 */
	public String getSubSetCode() {
		return subSetCode;
	}
	/**
	 * @param subSetCode The subSetCode to set.
	 */
	public void setSubSetCode(String subSetCode) {
		this.subSetCode = subSetCode;
	}
	
}
