package _VisualDVM.TestingSystem.SAPFOR.SapforPackage;
import Common.Database.SQLITE.SQLiteDatabase;
import Common.Passes.PassCode_;
import _VisualDVM.TestingSystem.SAPFOR.SapforTask.SapforTask;
import _VisualDVM.TestingSystem.SAPFOR.SapforTask.SapforTasksDBTable;

import java.io.File;
public class SapforPackageDatabase extends SQLiteDatabase {
    public SapforTasksDBTable tasks;
    //todo SapforVersionsDBTable
    public SapforPackageDatabase(SapforPackage sapforPackage) {
        super(new File(sapforPackage.getLocalWorkspace(), "sapfor_package.db"));
    }
    public void convertFromJson(SapforPackage sapforPackage) throws Exception {
        sapforPackage.readJson();
        BeginTransaction();
        for (SapforTask sapforTask : sapforPackage.package_json.tasks)
            Insert(sapforTask);
        Commit();
    }
    @Override
    protected void initAllTables() throws Exception {
        tasks = new SapforTasksDBTable();
    }
    @Override
    public PassCode_ getSynchronizePassCode() {
        return null;
    }
}
