package org.damazio.flight.checklists.data;
public class SampleData {
/*
* Example checklist structure:
* Cessna 172: (group, id=1, parent 0)
* Pre-flight: (group, id=2, parent=1)
* Nose: (group, id=3, parent=2)
* Engine oil level (item)
* Fuel Strainer
* ...
* Cabin:
* Master switch on
* Flaps retract
* ...
* Take off:
* Before takeoff:
* Parking brake set
* Cabin doors closed and latched
* ...
* Cleared for takeoff:
* Strobes on
* Time copy
* ...
* Learjet 145:
* ...
*/
public static void insertSampleDataInto(CheckListsSchema schema) {
schema.beginTransaction();
try {
CheckListsTable checkListsTable = schema.getCheckListsTable();
CheckListItemsTable itemsTable = schema.getCheckListItemsTable();
long topId = checkListsTable.insert("Cessna 172", 0);
long preFlightId = checkListsTable.insert("Pre-flight", topId);
itemsTable.insert("Items mixed with groups", preFlightId);
long noseId = checkListsTable.insert("Nose", preFlightId);
itemsTable.insert("Engine oil level", noseId);
itemsTable.insert("Fuel Strainer", noseId);
long cabinId = checkListsTable.insert("Cabin", preFlightId);
itemsTable.insert("Master switch on", cabinId);
itemsTable.insert("Flaps retract", cabinId);
long takeOffId = checkListsTable.insert("Take off", topId);
long beforeId = checkListsTable.insert("Before takeoff", takeOffId);
itemsTable.insert("Parking brake set", beforeId);
itemsTable.insert("Cabin doors closed and latched", beforeId);
long clearedId = checkListsTable.insert("Cleared for takeoff", takeOffId);
itemsTable.insert("Strobes on", clearedId);
itemsTable.insert("Time copy", clearedId);
schema.setTransactionSuccessful();
} finally {
schema.endTransaction();
}
}
}
|