genealogy.dbhandler
Class DBWriter

java.lang.Object
  |
  +--genealogy.dbhandler.DBGeneral
        |
        +--genealogy.dbhandler.DBWriter

public class DBWriter
extends DBGeneral

Write the genealogy to the database.


Fields inherited from class genealogy.dbhandler.DBGeneral
DBUrl
 
Constructor Summary
DBWriter()
           
 
Method Summary
 void deleteResearch(int researchId)
          Delete a research from all tables.
Tablenames are in Config.cfg
 void deleteUser(int userId)
          Delete User.
 void updateResearchMessage(int researchId, java.lang.String message)
          Update message of a research
 void updateResearchStatus(int researchId, int status)
          Update researchstatus.
 int writeResearch(Research research)
          Write/update a new research to the db.
write new if research id == 0
update message/status if id!
 int writeUser(User user)
          Write/Update a user to the db.
Update if userId !
 
Methods inherited from class genealogy.dbhandler.DBGeneral
getDbConn, loadDBUrl
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

DBWriter

public DBWriter()
Method Detail

writeUser

public int writeUser(User user)
              throws GenealogyException
Write/Update a user to the db.
Update if userId != 0
Parameters:
User - User-object to write.
Returns:
int uid, if write successful, 0 if isn't

deleteUser

public void deleteUser(int userId)
                throws GenealogyException
Delete User.
Parameters:
userId - Users id to be deleted.

deleteResearch

public void deleteResearch(int researchId)
                    throws GenealogyException
Delete a research from all tables.
Tablenames are in Config.cfg
Parameters:
researchId - Id of the research to be deleted.

writeResearch

public int writeResearch(Research research)
                  throws GenealogyException
Write/update a new research to the db.
write new if research id == 0
update message/status if id!=0
see updateResearchStatus, updateResearchMessage
Parameters:
research - Research to be written.
Returns:
int Id of the written research.

updateResearchStatus

public void updateResearchStatus(int researchId,
                                 int status)
                          throws GenealogyException
Update researchstatus.
Parameters:
researchId - Id of the research
status - new status Id

updateResearchMessage

public void updateResearchMessage(int researchId,
                                  java.lang.String message)
                           throws GenealogyException
Update message of a research
Parameters:
researchId - Id of the research to be updated
message - A new status for the research