LK-Test-Solutions / OpenTDK

The open tool development kit provides java libraries for efficient implementation of data processing tools. Primarily the libraries have been build to close gaps within the process of test automation, but they can be helpful for implementing any application that needs to collect data from different sources, transform the data and generate output in different formats (textual, graphical etc.).
BSD 2-Clause "Simplified" License
3 stars 1 forks source link

Enhance metadata concept for DataContainer #25

Open hwalter67 opened 2 years ago

hwalter67 commented 2 years ago

With the setMetaData method of the DataContainer class, it is possible to define columns and values the will be assigned to each dataset which is added to the container. The metadata needs to be declared before the rows are added to the container from the source. After metadata is set using the setMetaData method, the defined column and values will be added to each dataset afterwards.

With the current implementation, there are several open issues like:

A concept is required for fully implement the metadata functionality, so that also:

Sample code using DataContainer with metadata with current implementation:

DataContainer dc = new DataContainer(";", EHeader.COLUMN);
dc.setMetaData("Company", "happy inc.");
dc.readData("c:\\data\\happy-inc.csv");

Content of happy-inc.csv

Firstname;Surname;Email;Phone
Max;Muster;mm@happyinc.com;11987654321
John;Doe;jd@happyinc.com;+11123456789

Content within DataContainer dc after performing the readData method

Firstname;Surname;Email;Phone;Company
Max;Muster;mm@happyinc.com;11987654321;happy inc.
John;Doe;jd@happyinc.com;+11123456789;happy inc.