/*
Copyright (C) 2000-2010  Ministere de la culture et de la communication (France), AJLSM
See LICENCE file
*/
package fr.gouv.culture.sdx.oai;

import fr.gouv.culture.oai.OAIRecordImpl;
import fr.gouv.culture.sdx.document.IndexableFieldProperty;
import org.apache.cocoon.ProcessingException;
import org.xml.sax.SAXException;
import org.apache.cocoon.components.source.SourceUtil;
import java.io.IOException;

public class DocumentBaseOAIRecord extends OAIRecordImpl {

	IndexableFieldProperty[] _fields = null;

	public void setFields(IndexableFieldProperty[] fields) {
		_fields = fields;
		//TODO use sdx prefixed internal fields to set internal params
		//sdxdocid
		//sdxmoddate
		//sdxoaideletedrecord

	}

	protected void sendMetadata() throws SAXException {
		//TODO check metadataformat for mappings if not use its's pipeline to send the document
		//sending the document source
		try {
			//_recordSource.toSAX(this);
			SourceUtil.toSAX(_recordSource, this);
		} catch (ProcessingException e) {
			throw new SAXException(e);
		}
		catch (IOException e) {
			throw new SAXException(e);
		}
		//TODO send fields via super._oaiMetaDataFormat.sendElement(name, value);
	}
}
