// This code was generated by Ander Telleria using IMS Development Environment (version 1.66 build 3233.21563)
// Copyright (C) 1995-2008 IMS MAXIMS plc. All rights reserved.

package ims.RefMan.domain.impl;

import java.util.List;

import ims.RefMan.domain.base.impl.BaseInterpreterDetailsImpl;
import ims.RefMan.domain.objects.InterpreterDetails;
import ims.RefMan.vo.InterpreterDetailsVoCollection;
import ims.RefMan.vo.domain.InterpreterDetailsVoAssembler;
import ims.domain.DomainFactory;
import ims.domain.exceptions.StaleObjectException;
import ims.domain.hibernate3.IMSCriteria;

public class InterpreterDetailsImpl extends BaseInterpreterDetailsImpl
{

	private static final long serialVersionUID = 1L;

	public ims.RefMan.vo.InterpreterDetailsVoCollection getInterpreters(ims.RefMan.vo.CatsReferralRefVo catsReferral)
	{
		DomainFactory factory = getDomainFactory();
		IMSCriteria imsc=new IMSCriteria(InterpreterDetails.class,factory);
		imsc.equal("catsReferral.id", catsReferral.getID_CatsReferral());
		List interpreters = imsc.find();
		if (interpreters!=null)
			return InterpreterDetailsVoAssembler.createInterpreterDetailsVoCollectionFromInterpreterDetails(interpreters);
		return null;
	}

	public InterpreterDetailsVoCollection saveInterpreters(InterpreterDetailsVoCollection interpreters) throws StaleObjectException
	{
		InterpreterDetailsVoCollection interpretersColl=new InterpreterDetailsVoCollection();
		DomainFactory factory = getDomainFactory();
		for (int i=0;i<interpreters.size();i++)
		{
			InterpreterDetails interpreterDo = InterpreterDetailsVoAssembler.extractInterpreterDetails(factory, interpreters.get(i));
			factory.save(interpreterDo);
			interpretersColl.add(InterpreterDetailsVoAssembler.create(interpreterDo));
			
		}
		return interpretersColl;
	}
}
