001package edu.pdx.cs.joy.family; 002 003import java.sql.Connection; 004import java.sql.SQLException; 005 006/** 007 * Data Access Object interface for managing FamilyTree entities in the database. 008 */ 009public interface FamilyTreeDAO { 010 011 /** 012 * Drops all family tree related tables from the database if they exist. 013 * 014 * @param connection the database connection to use 015 * @throws SQLException if a database error occurs 016 */ 017 static void dropTables(Connection connection) throws SQLException { 018 FamilyTreeDAOImpl.dropTables(connection); 019 } 020 021 /** 022 * Creates all family tree related tables in the database. 023 * 024 * @param connection the database connection to use 025 * @throws SQLException if a database error occurs 026 */ 027 static void createTables(Connection connection) throws SQLException { 028 FamilyTreeDAOImpl.createTables(connection); 029 } 030 031 /** 032 * Saves a complete family tree to the database. 033 * This includes all persons and marriages in the tree. 034 * 035 * @param familyTree the family tree to save 036 * @throws SQLException if a database error occurs 037 */ 038 void save(FamilyTree familyTree) throws SQLException; 039 040 /** 041 * Loads a complete family tree from the database. 042 * This includes all persons and marriages, with relationships properly resolved. 043 * 044 * @return the family tree loaded from the database 045 * @throws SQLException if a database error occurs 046 */ 047 FamilyTree load() throws SQLException; 048} 049