/**
 * 
 */
package com.ejie.ab63.adaptadores;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ejie.ab63.adaptadores.service.X43ExpedienteElectronicoService;
import com.ejie.ab63.clientesWS.X43ExpedienteElectronico.AExtensionPoint;
import com.ejie.ab63.clientesWS.X43ExpedienteElectronico.TBoolean;
import com.ejie.ab63.clientesWS.X43ExpedienteElectronico.TFolderList;
import com.ejie.ab63.clientesWS.X43ExpedienteElectronico.TFolderQuery;
import com.ejie.ab63.clientesWS.X43ExpedienteElectronico.TGetTelActionDocumentList;

/**
 *  
 * 
 */
@Service(value = "X43ExpedienteElectronicoAdapterServiceImpl")
public class X43ExpedienteElectronicoAdaptadorServiceImpl implements X43ExpedienteElectronicoAdaptadorService {

	public static final Logger logger = LoggerFactory.getLogger(X43ExpedienteElectronicoAdaptadorServiceImpl.class);

	@Autowired()
	private X43ExpedienteElectronicoService x43ExpedienteElectronicoService;

	/**
	 * Metodo que devuele los canalees de aviso de las personasde un expediente
	 * 
	 * @param query
	 *            TFolderQuery
	 * @param ep
	 *            AExtensionPoint
	 * @return TFolderList
	 * @throws Exception_Exception
	 *             Exception_Exception
	 */

	public TFolderList SearchFolders(TFolderQuery query, AExtensionPoint ep) throws Exception {
		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.info("X43ExpedienteElectronicoAdaptadorServiceImpl.SearchFolders - Inicio");
		TFolderList respuesta = this.x43ExpedienteElectronicoService.SearchFolders(query, ep);

		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.debug("X43ExpedienteElectronicoAdaptadorServiceImpl.SearchFolders - Return: " + respuesta);
		return respuesta;

	}

	/**
	 * Metodo que devuelve los documentos de un expediente
	 * 
	 * @param folderID
	 *            String
	 * @param procedureID
	 *            String
	 * @param auditUser
	 *            String
	 * @param ep
	 *            AExtensionPoint
	 * @return TGetTelActionDocumentList
	 * @throws Exception
	 */
	public TGetTelActionDocumentList GetTelActionDocuments(String folderID, String procedureID, String auditUser,
			AExtensionPoint ep) throws Exception {
		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.info("X43ExpedienteElectronicoAdaptadorServiceImpl.GetTelActionDocuments - Inicio");
		TGetTelActionDocumentList respuesta = this.x43ExpedienteElectronicoService.GetTelActionDocuments(folderID,
				procedureID, auditUser, ep);

		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.debug("X43ExpedienteElectronicoAdaptadorServiceImpl.GetTelActionDocuments - Return: " + respuesta);
		return respuesta;
	}

	@Override
	public Boolean updateTitle(String folderID, String title, String auditUser, AExtensionPoint ep) throws Exception {
		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.info("X43ExpedienteElectronicoAdaptadorServiceImpl.updateTitle - Inicio");
		TBoolean respuesta = this.x43ExpedienteElectronicoService.updateTitle(folderID, title, auditUser, ep);

		X43ExpedienteElectronicoAdaptadorServiceImpl.logger
				.debug("X43ExpedienteElectronicoAdaptadorServiceImpl.updateTitle - Return: " + respuesta);
		return TBoolean.TRUE == respuesta;
	}

}
