|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.neatech.climbplan.dataaccess.DatabaseImpl
public class DatabaseImpl
| Field Summary | |
|---|---|
private Connection |
con
|
private static org.apache.log4j.Logger |
logger
|
| Constructor Summary | |
|---|---|
DatabaseImpl()
|
|
| 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 |
private void |
closeConnection(Connection con)
|
private Connection |
connectToDatabase()
|
void |
deleteMap(MapModel map)
This method deletes a MapModel
from the database. |
void |
deleteMountaineer(MountaineerModel mountaineer)
This method deletes a MountaineerModel
from the database. |
private boolean |
deleteMountaineer(MountaineerModel mountaineer,
Connection con)
|
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. |
private void |
insertLayer(MapModel map,
Layer layer)
|
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. |
private boolean |
insertMountaineer(MountaineerModel mountaineer,
Connection con)
|
void |
insertOrganizer(OrganizerModel organizer)
This method inserts a OrganizerModel to
the database. |
void |
insertTeam(TeamModel team)
This method inserts a TeamModel to
the database. |
private void |
updateLayer(MapModel map,
Layer layer)
|
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. |
private boolean |
updateMountaineer(MountaineerModel mountaineer,
Connection con)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final org.apache.log4j.Logger logger
private Connection con
| Constructor Detail |
|---|
public DatabaseImpl()
| Method Detail |
|---|
private Connection connectToDatabase()
throws DatabaseException
DatabaseException
private void closeConnection(Connection con)
throws DatabaseException
DatabaseException
public OrganizerModel checkAuthorization(String userName,
String passwd)
throws DatabaseException
Database
checkAuthorization in interface DatabaseuserName - of the organizerpasswd - of the organizer
DatabaseException
public void changePassword(OrganizerModel organizer,
String password)
throws DatabaseException
Database
changePassword in interface Databaseorganizer - whose password is to be changedpassword - new password to be set
DatabaseException
public void deleteMap(MapModel map)
throws DatabaseException
DatabaseMapModel
from the database.
deleteMap in interface Databasemap - a MapModel
to delete from the database
DatabaseException
private boolean deleteMountaineer(MountaineerModel mountaineer,
Connection con)
public void deleteMountaineer(MountaineerModel mountaineer)
throws DatabaseException
DatabaseMountaineerModel
from the database.
deleteMountaineer in interface Databasemountaineer - a MountaineerModel
to delete from the database
DatabaseException
public void deleteOrganizer(OrganizerModel organizer)
throws DatabaseException
DatabaseOrganizerModel
from the database.
deleteOrganizer in interface Databaseorganizer - a OrganizerModel
to delete from the database
DatabaseException
public void deleteTeam(TeamModel team)
throws DatabaseException
DatabaseTeamModel
from the database.
deleteTeam in interface Databaseteam - a TeamModel
to delete from the database
DatabaseException
public void getAllMaps(List<MapModel> maps)
throws DatabaseException
DatabaseMapModel by filling the
list of MapModel given as a parameter.
getAllMaps in interface Databasemaps - a list of MapModel to be filled
DatabaseException
public void getAllMountaineers(List<MountaineerModel> mountaineers)
throws DatabaseException
DatabaseMountaineerModel given as a parameter.
getAllMountaineers in interface Databasemountaineers - a list of MountaineerModel
to be filled
DatabaseException
public void getAllOrganizers(List<MountaineerModel> mountaineers)
throws DatabaseException
DatabaseMountaineerModel given as a parameter.
Note: OrganizerModel must be cast to
MountaineerModel and added to the list.
getAllOrganizers in interface Databasemountaineers - a list of MountaineerModel
to be filled
DatabaseException
public void getAllTeams(List<TeamModel> teams,
List<MountaineerModel> mountaineers)
throws DatabaseException
DatabaseTeamModel 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));
getAllTeams in interface Databaseteams - a list of TeamModel to be filledmountaineers - the mountaineer models to be used
DatabaseException
public void insertMap(MapModel map)
throws DatabaseException
DatabaseMapModel to
the database by filling the given list of
MapModel as a parameter.
insertMap in interface DatabaseDatabaseException
private void insertLayer(MapModel map,
Layer layer)
throws SQLException
SQLException
private boolean insertMountaineer(MountaineerModel mountaineer,
Connection con)
public void insertMountaineer(MountaineerModel mountaineer)
throws DatabaseException
DatabaseMountaineerModel to
the database.
insertMountaineer in interface Databasemountaineer - a MountaineerModel
to insert to the database
DatabaseException
public void insertOrganizer(OrganizerModel organizer)
throws DatabaseException
DatabaseOrganizerModel to
the database.
insertOrganizer in interface Databaseorganizer - a OrganizerModel
to insert to the database
DatabaseException
public void insertTeam(TeamModel team)
throws DatabaseException
DatabaseTeamModel to
the database.
insertTeam in interface Databaseteam - a TeamModel
to insert to the database
DatabaseException
public void updateMap(MapModel map)
throws DatabaseException
DatabaseMapModel
by storing the data to the database if necessary.
updateMap in interface Databasemap - a MapModel
to update from the database
DatabaseException
private void updateLayer(MapModel map,
Layer layer)
throws SQLException
SQLException
private boolean updateMountaineer(MountaineerModel mountaineer,
Connection con)
public void updateMountaineer(MountaineerModel mountaineer)
throws DatabaseException
DatabaseMountaineerModel
by storing the data to the database if necessary.
updateMountaineer in interface Databasemountaineer - a MountaineerModel
to update to the database
DatabaseException
public void updateOrganizer(OrganizerModel organizer)
throws DatabaseException
DatabaseOrganizerModel
by storing the data to the database if necessary.
updateOrganizer in interface Databaseorganizer - a OrganizerModel
to update to the database
DatabaseException
public void addMountaineerToTeam(TeamModel team,
MountaineerModel mountaineer)
throws DatabaseException
Database
addMountaineerToTeam in interface Databaseteam - a TeamModel to add tomountaineer - a MountaineerModel to add
DatabaseException
public void deleteMountaineerFromTeam(TeamModel team,
MountaineerModel mountaineer)
throws DatabaseException
Database
deleteMountaineerFromTeam in interface Databaseteam - a TeamModel to delete frommountaineer - a MountaineerModel to delete
DatabaseException
public void updateTeam(TeamModel team)
throws DatabaseException
DatabaseTeamModel
by storing the data to the database if necessary.
updateTeam in interface Databaseteam - a TeamModel
to update from the database
DatabaseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||