boolean done = false;
RecordType type = RECORD_TYPE_MAP.get(record.get(0));
if (type == null)
{
throw new MPXJException(MPXJException.INVALID_FORMAT);
}
switch (type)
{
case HEADER :
{
processHeader(record);
break;
}
case TABLE :
{
m_currentTableName = record.get(1).toLowerCase();
m_skipTable = !REQUIRED_TABLES.contains(m_currentTableName);
if (m_skipTable)
{
m_currentTable = null;
}
else
{
m_currentTable = new LinkedList<Row>();
m_tables.put(m_currentTableName, m_currentTable);
}
break;
}
case FIELDS :
{
if (m_skipTable)
{
m_currentFieldNames = null;
}
else
{
m_currentFieldNames = record.toArray(new String[record.size()]);
for (int loop = 0; loop < m_currentFieldNames.length; loop++)
{
m_currentFieldNames[loop] = m_currentFieldNames[loop].toLowerCase();
}
}
break;
}
case DATA :
{
if (!m_skipTable)
{
Map<String, Object> map = new HashMap<String, Object>();
for (int loop = 1; loop < record.size(); loop++)
{
String fieldName = m_currentFieldNames[loop];
String fieldValue = record.get(loop);
FieldType fieldType = FIELD_TYPE_MAP.get(fieldName);
if (fieldType == null)
{
fieldType = FieldType.STRING;
}
Object objectValue;
if (fieldValue.length() == 0)
{
objectValue = null;
}
else
{
switch (fieldType)
{
case DATE :
{
try
{
objectValue = m_df.parseObject(fieldValue);
}
catch (ParseException ex)
{
throw new MPXJException(MPXJException.INVALID_DATE, ex);
}
break;
}
case CURRENCY :
{
try
{
objectValue = Double.valueOf(m_numberFormat.parse(fieldValue).doubleValue());
}
catch (ParseException ex)
{
throw new MPXJException(MPXJException.INVALID_NUMBER, ex);
}
break;
}
case DOUBLE :
{
try
{
objectValue = Double.valueOf(m_numberFormat.parse(fieldValue).doubleValue());
}
catch (ParseException ex)
{
throw new MPXJException(MPXJException.INVALID_NUMBER, ex);
}
break;
}
case DURATION :
{
try
{
objectValue = Double.valueOf(m_numberFormat.parse(fieldValue).doubleValue());
}
catch (ParseException ex)
{
throw new MPXJException(MPXJException.INVALID_NUMBER, ex);
}
break;
}
case INTEGER :