/**
 * 
 */
package gov.va.med.cds.idm.client.stub;

import gov.va.med.cds.common.person.correlation.PersonIdentifierCorrelationServiceInterface;
import gov.va.med.cds.common.person.correlation.PersonIdentifierInterface;

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

/**
 * @author susarlan
 *
 */
public class IdmPersonIdentifierManagementStub
		implements PersonIdentifierCorrelationServiceInterface
{
	Map<String, List<PersonIdentifierInterface>> personIdentifiers = new HashMap<String, List<PersonIdentifierInterface>>();

	/* (non-Javadoc)
	 * @see gov.va.med.cds.common.person.correlation.PersonIdentifierCorrelationServiceInterface#obtainPersonIdentifiers(gov.va.med.cds.common.person.correlation.PersonIdentifierInterface)
	 */
	public Collection<PersonIdentifierInterface> obtainPersonIdentifiers(
			PersonIdentifierInterface personIdentifier)
	{
		List<PersonIdentifierInterface> localIdentifiers = personIdentifiers.get(personIdentifier.getIdentity());
		//we need to send back a copy of the collection so that it is not cleared out of memory by the filter resolver.
		List<PersonIdentifierInterface> clonedPersonIdentifiers = new ArrayList<PersonIdentifierInterface>();
		clonedPersonIdentifiers.addAll(localIdentifiers);
		return clonedPersonIdentifiers;
	}

	public void setPersonIdentifiers(
			Map<String, List<PersonIdentifierInterface>> personIdentifiers)
	{
		this.personIdentifiers = personIdentifiers;
	}
}
