#include "datatable/DataTableConversion.h"


DataTableConversion::DataTableConversion()
{
    //assert(0);
}

DataTablePtr DataTableConversion::beanToTable(AgObject* bean, TableFormatPtr format, bool setReadOnlyFields, bool ignoreErrors)
{
    UNUSED(bean);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    UNUSED(ignoreErrors);
    assert(0);
    return DataTablePtr();

}

DataTablePtr DataTableConversion::beansToTable(AgObjectPtr beans, TableFormatPtr format, bool setReadOnlyFields)
{
    UNUSED(beans);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    assert(0);
    return DataTablePtr();

}

AgObjectPtr DataTableConversion::beanFromTable(DataTablePtr table, const std::string &beanClass, TableFormatPtr format, bool setReadOnlyFields)
{
    UNUSED(table);
    UNUSED(beanClass);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    assert(0);
    return AgObjectPtr();
}

std::vector<AgObjectPtr> DataTableConversion::beansFromTable(DataTablePtr table, const std::string &beanClass, TableFormatPtr format, bool setReadOnlyFields)
{
    UNUSED(table);
    UNUSED(beanClass);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    assert(0);
    return std::vector<AgObjectPtr>();
}

AgObjectPtr DataTableConversion::beanFromRecord(DataRecordPtr rec, const std::string &beanClass, TableFormatPtr format, bool setReadOnlyFields)
{
    UNUSED(rec);
    UNUSED(beanClass);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    assert(0);
    return AgObjectPtr();
}

void DataTableConversion::populateBeanFromRecord(AgObject* bean, DataRecordPtr rec, TableFormatPtr format, bool setReadOnlyFields)
{
    UNUSED(bean);
    UNUSED(rec);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    assert(0);
}

void DataTableConversion::populateBeanFromRecord(AgObjectPtr bean, DataRecordPtr rec, TableFormatPtr format, bool setReadOnlyFields, std::list<AgString> fieldsToSkip)
{
    UNUSED(bean);
    UNUSED(rec);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    UNUSED(fieldsToSkip);
    assert(0);
}

DataRecordPtr DataTableConversion::beanToRecord(AgObject* bean, TableFormatPtr format, bool setReadOnlyFields, bool ignoreErrors)
{
    UNUSED(bean);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    UNUSED(ignoreErrors);
    assert(0);
    return DataRecordPtr();
}

DataRecordPtr DataTableConversion::beanToRecord(AgObjectPtr bean, TableFormatPtr format, bool setReadOnlyFields, bool ignoreErrors, const std::list<AgString> &fieldsToSkip)
{
    UNUSED(bean);
    UNUSED(format);
    UNUSED(setReadOnlyFields);
    UNUSED(ignoreErrors);
    UNUSED(fieldsToSkip);
    assert(0);
    return DataRecordPtr();
}

AgObjectPtr DataTableConversion::convertValueToField(FieldFormat* ff, AgObjectPtr value, const std::string &requiredClass)
{
    UNUSED(ff);
    UNUSED(value);
    UNUSED(requiredClass);
    assert(0);
    return AgObjectPtr();
}

AgObjectPtr DataTableConversion::convertValueFromField(AgObjectPtr value)
{
    UNUSED(value);
    assert(0);
    return AgObjectPtr();
}

AgObjectPtr DataTableConversion::convertValueFromField(AgObjectPtr value, const std::string &requiredClass)
{
    UNUSED(value);
    UNUSED(requiredClass);
    assert(0);
    return AgObjectPtr();
}

AgObjectPtr DataTableConversion::convertValueToField(FieldFormat* ff, AgObjectPtr value)
{
    UNUSED(ff);
    UNUSED(value);
    assert(0);
    return AgObjectPtr();
}

void DataTableConversion::registerFormatConverter(FormatConverterPtr converter)
{
    boost::lock_guard<boost::mutex> lock(FORMAT_CONVERTERS_LOCK);
    /*int i = 0;
    for (FormatConverter fc : DataTableConversion.FORMAT_CONVERTERS)
    {
        if (fc.getValueClass().isAssignableFrom(converter.getValueClass()))
        {
            break;
        }
        i++;
    }*/

    FORMAT_CONVERTERS.push_back(converter);
}

FormatConverterPtr DataTableConversion::getFormatConverter(const std::string &valueClass)
{
    UNUSED(valueClass);
    assert(0);
    return FormatConverterPtr();
}

FieldFormat* DataTableConversion::createFieldFormat(const AgString &name, AgObjectPtr value)
{
    UNUSED(name);
    UNUSED(value);
    assert(0);
    return 0;
}

FieldFormat* DataTableConversion::createFieldFormat(const AgString &name, const std::string &valueClassName)
{
    UNUSED(name);
    UNUSED(valueClassName);
    assert(0);
    return 0;
}

FieldFormat* DataTableConversion::createTableField(const AgString &name, TableFormatPtr format)
{
    UNUSED(name);
    UNUSED(format);
    assert(0);
    return 0;
}

FieldFormat* DataTableConversion::createTableField(const AgString &name, const AgString &description, TableFormatPtr format)
{
    UNUSED(name);
    UNUSED(description);
    UNUSED(format);
    assert(0);
    return 0;
}

AgObjectPtr DataTableConversion::createAggreGateBean(AgObjectPtr value, const std::string &requiredClass)
{
    UNUSED(value);
    UNUSED(requiredClass);
    assert(0);
    return AgObjectPtr();
}

TableFormatPtr DataTableConversion::getFormatFromDefaultValue(FieldFormat* ff)
{
    UNUSED(ff);
    assert(0);
    return TableFormatPtr();
}

AgObjectPtr DataTableConversion::createArray(FieldFormat* ff, AgObjectPtr value)
{
    UNUSED(ff);
    UNUSED(value);
    assert(0);
    return AgObjectPtr();
}

std::vector<AgObjectPtr> DataTableConversion::createList(AgObjectPtr bean, DataRecordPtr rec, bool setReadOnlyFields, FieldFormat* ff)
{
    UNUSED(bean);
    UNUSED(rec);
    UNUSED(setReadOnlyFields);
    UNUSED(ff);
    assert(0);
    return std::vector<AgObjectPtr>();
}

DataTablePtr DataTableConversion::convertList(AgObjectPtr bean, AgObjectPtr value, bool setReadOnlyFields, FieldFormat* ff)
{
    UNUSED(bean);
    UNUSED(value);
    UNUSED(setReadOnlyFields);
    UNUSED(ff);
    assert(0);
    return DataTablePtr();
}

DataTablePtr DataTableConversion::convertArray(FieldFormat* ff, AgObjectPtr value)
{
    UNUSED(ff);
    UNUSED(value);
    assert(0);
    return DataTablePtr();
}
