/*
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
*/
|
package com.megatim.queryadhoc.queries.metadata;
|
|
import com.megatim.queryadhoc.exceptions.BadDataValueException;
|
import com.megatim.queryadhoc.exceptions.ColumnNotFoundException;
|
import com.megatim.queryadhoc.exceptions.LocalDateTimeValueParseError;
|
import com.megatim.queryadhoc.model.DbColumnDescription;
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
*
|
* @author ASUS
|
*/
|
public class ParsedData {
|
|
private final List<Map<String, Object>> sourceData;
|
private final List<DbColumnDescription> columnsDescription;
|
private final String tableName;
|
private final List<Map<String, Object>> cachedData = new ArrayList<>();
|
|
public ParsedData(List<Map<String, Object>> sourceData, List<DbColumnDescription> columnsDescription, String tableName) {
|
this.sourceData = sourceData;
|
this.tableName = tableName;
|
this.columnsDescription = columnsDescription;
|
}
|
|
public List<Map<String, Object>> data() throws BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException {
|
if (cachedData.isEmpty()) {
|
for (Map<String, Object> data : sourceData) {
|
cachedData.add(new ParsedDataRow(data, columnsDescription, tableName).dataRow());
|
}
|
}
|
return cachedData;
|
}
|
}
|