com.neatech.climbplan.dataaccess
Interface Database

All Known Implementing Classes:
DatabaseImpl

public interface Database

Author:
Erdal Sivri Interface of the data access layer Exposes the functionalities demanded from the data access layer Note: This interface is subject to change!

Method Summary
 void addMountaineerToTeam(TeamModel team, MountaineerModel mountaineer)
          This method adds a mountaineer to a team.
 void changePassword(OrganizerModel organizer, String password)
          This method changes the password of an organizer.
 OrganizerModel checkAuthorization(String userName, String passwd)
          This method checks whether a supplied user name and password belongs to an organizer
 void deleteMap(MapModel map)
          This method deletes a MapModel from the database.
 void deleteMountaineer(MountaineerModel mountaineer)
          This method deletes a MountaineerModel from the database.
 void deleteMountaineerFromTeam(TeamModel team, MountaineerModel mountaineer)
          This method deletes a mountaineer from a team.
 void deleteOrganizer(OrganizerModel organizer)
          This method deletes a OrganizerModel from the database.
 void deleteTeam(TeamModel team)
          This method deletes a TeamModel from the database.
 void getAllMaps(List<MapModel> maps)
          This method returns all the maps stored in the database as a list of MapModel by filling the list of MapModel given as a parameter.
 void getAllMountaineers(List<MountaineerModel> mountaineers)
          This method returns all the mountaineers stored in the database in a single list by filling the list of MountaineerModel given as a parameter.
 void getAllOrganizers(List<MountaineerModel> mountaineers)
          This method returns all the organizers stored in the database in a single list by filling the list of MountaineerModel given as a parameter.
 void getAllTeams(List<TeamModel> teams, List<MountaineerModel> mountaineers)
          This methods returns all the teams stored in the database as a list of TeamModel by filling the list of TeamModel given as a parameter.
 void insertMap(MapModel map)
          This method inserts a MapModel to the database by filling the given list of MapModel as a parameter.
 void insertMountaineer(MountaineerModel mountaineer)
          This method inserts a MountaineerModel to the database.
 void insertOrganizer(OrganizerModel organizer)
          This method inserts a OrganizerModel to the database.
 void insertTeam(TeamModel team)
          This method inserts a TeamModel to the database.
 void updateMap(MapModel map)
          This method updates a MapModel by storing the data to the database if necessary.
 void updateMountaineer(MountaineerModel mountaineer)
          This method updates a MountaineerModel by storing the data to the database if necessary.
 void updateOrganizer(OrganizerModel organizer)
          This method updates a OrganizerModel by storing the data to the database if necessary.
 void updateTeam(TeamModel team)
          This method updates a TeamModel by storing the data to the database if necessary.
 

Method Detail

checkAuthorization

OrganizerModel checkAuthorization(String userName,
                                  String passwd)
                                  throws DatabaseException
This method checks whether a supplied user name and password belongs to an organizer

Parameters:
userName - of the organizer
passwd - of the organizer
Returns:
an OrganizerModel if the login info is correct else null
Throws:
DatabaseException

changePassword

void changePassword(OrganizerModel organizer,
                    String password)
                    throws DatabaseException
This method changes the password of an organizer.

Parameters:
organizer - whose password is to be changed
password - new password to be set
Throws:
DatabaseException

getAllMountaineers

void getAllMountaineers(List<MountaineerModel> mountaineers)
                        throws DatabaseException
This method returns all the mountaineers stored in the database in a single list by filling the list of MountaineerModel given as a parameter.

Parameters:
mountaineers - a list of MountaineerModel to be filled
Throws:
DatabaseException

insertMountaineer

void insertMountaineer(MountaineerModel mountaineer)
                       throws DatabaseException
This method inserts a MountaineerModel to the database.

Parameters:
mountaineer - a MountaineerModel to insert to the database
Throws:
DatabaseException

updateMountaineer

void updateMountaineer(MountaineerModel mountaineer)
                       throws DatabaseException
This method updates a MountaineerModel by storing the data to the database if necessary.

Parameters:
mountaineer - a MountaineerModel to update to the database
Throws:
DatabaseException

deleteMountaineer

void deleteMountaineer(MountaineerModel mountaineer)
                       throws DatabaseException
This method deletes a MountaineerModel from the database.

Parameters:
mountaineer - a MountaineerModel to delete from the database
Throws:
DatabaseException

getAllOrganizers

void getAllOrganizers(List<MountaineerModel> mountaineers)
                      throws DatabaseException
This method returns all the organizers stored in the database in a single list by filling the list of MountaineerModel given as a parameter. Note: OrganizerModel must be cast to MountaineerModel and added to the list.

Parameters:
mountaineers - a list of MountaineerModel to be filled
Throws:
DatabaseException

insertOrganizer

void insertOrganizer(OrganizerModel organizer)
                     throws DatabaseException
This method inserts a OrganizerModel to the database.

Parameters:
organizer - a OrganizerModel to insert to the database
Throws:
DatabaseException

updateOrganizer

void updateOrganizer(OrganizerModel organizer)
                     throws DatabaseException
This method updates a OrganizerModel by storing the data to the database if necessary.

Parameters:
organizer - a OrganizerModel to update to the database
Throws:
DatabaseException

deleteOrganizer

void deleteOrganizer(OrganizerModel organizer)
                     throws DatabaseException
This method deletes a OrganizerModel from the database.

Parameters:
organizer - a OrganizerModel to delete from the database
Throws:
DatabaseException

getAllTeams

void getAllTeams(List<TeamModel> teams,
                 List<MountaineerModel> mountaineers)
                 throws DatabaseException
This methods returns all the teams stored in the database as a list of TeamModel by filling the list of TeamModel given as a parameter. TeamModel contains a list of MountaineerModel; this list must be filled from the given parameter, list of MountaineerModel. The following procedure may be implemented (pseudo-code): For each mountaineerId in TeamModel team // find the index of the mountaineer // having id = mountaineerId from mountaineers index = mountaineers.indexOf(mountaineerId); teams.mountaineers.add(mountaineers.get(index));

Parameters:
teams - a list of TeamModel to be filled
mountaineers - the mountaineer models to be used
Throws:
DatabaseException

insertTeam

void insertTeam(TeamModel team)
                throws DatabaseException
This method inserts a TeamModel to the database.

Parameters:
team - a TeamModel to insert to the database
Throws:
DatabaseException

updateTeam

void updateTeam(TeamModel team)
                throws DatabaseException
This method updates a TeamModel by storing the data to the database if necessary.

Parameters:
team - a TeamModel to update from the database
Throws:
DatabaseException

deleteTeam

void deleteTeam(TeamModel team)
                throws DatabaseException
This method deletes a TeamModel from the database.

Parameters:
team - a TeamModel to delete from the database
Throws:
DatabaseException

addMountaineerToTeam

void addMountaineerToTeam(TeamModel team,
                          MountaineerModel mountaineer)
                          throws DatabaseException
This method adds a mountaineer to a team.

Parameters:
team - a TeamModel to add to
mountaineer - a MountaineerModel to add
Throws:
DatabaseException

deleteMountaineerFromTeam

void deleteMountaineerFromTeam(TeamModel team,
                               MountaineerModel mountaineer)
                               throws DatabaseException
This method deletes a mountaineer from a team.

Parameters:
team - a TeamModel to delete from
mountaineer - a MountaineerModel to delete
Throws:
DatabaseException

getAllMaps

void getAllMaps(List<MapModel> maps)
                throws DatabaseException
This method returns all the maps stored in the database as a list of MapModel by filling the list of MapModel given as a parameter.

Parameters:
maps - a list of MapModel to be filled
Throws:
DatabaseException

insertMap

void insertMap(MapModel map)
               throws DatabaseException
This method inserts a MapModel to the database by filling the given list of MapModel as a parameter.

Parameters:
team - a MapModel to insert to the database
map -
Throws:
DatabaseException

updateMap

void updateMap(MapModel map)
               throws DatabaseException
This method updates a MapModel by storing the data to the database if necessary.

Parameters:
map - a MapModel to update from the database
Throws:
DatabaseException

deleteMap

void deleteMap(MapModel map)
               throws DatabaseException
This method deletes a MapModel from the database.

Parameters:
map - a MapModel to delete from the database
Throws:
DatabaseException