genealogy.dbhandler
Class DBReader

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

public class DBReader
extends DBGeneral

Read the genealogy data from the database.


Fields inherited from class genealogy.dbhandler.DBGeneral
DBUrl
 
Constructor Summary
DBReader()
           
 
Method Summary
 boolean isFreeAccount(java.lang.String Account)
          Check if Account is free to use.
 boolean isOwnerOfResearch(int ResearchId, int UserId)
          Check if a User is an owner of a research.
 User isValidUser(java.lang.String account, java.lang.String password)
          Try to validate user.
 java.util.Vector readAllContents()
          Read all Indies in the Content.
 java.util.Vector readChildren(int researchId, java.lang.String refId)
          Read all children in a family.
 Incident readEvent(int researchId, java.lang.String eventId)
          Read a event.
 java.util.Vector readEvents(int researchId, java.lang.String refId)
          Read all events.
 java.util.Vector readFamilies(int researchId, java.lang.String refId)
          Read all families.
 PrintableIndi readFather(int researchId, java.lang.String indiId)
          Read Father.
 PrintableIndi[] readGranparents(int researchId, java.lang.String indiId, char sex)
          Read granparents of an indi.
 PrintableIndi readMother(int researchId, java.lang.String indiId)
          Read Mother
 Text readNote(int researchId, java.lang.String noteId)
          Read a note.
 java.util.Vector readNotes(int researchId, java.lang.String refId)
          Read notes.
 java.util.Vector readNotes2(int researchId, java.lang.String textId)
          Read notes with researchid and _textid_
 PrintableIndi readPrintableIndi(int researchId, java.lang.String indiId)
          Reads name, sex, occupation, birth and death from db.
 java.util.Vector readRefTexts(int researchId, java.lang.String refId)
          Read refTexts.
 Research readResearch(int researchId)
          Read a research.
 java.util.Vector readResearches(int UserId)
          Read users researches.
 Text readSource(int researchId, java.lang.String sourceId)
          Read a single source.
 java.util.Vector readSources(int researchId, java.lang.String refId)
          Read sources.
 java.util.Vector readSpouses(int researchId, java.lang.String indiId)
          Read spouses to a indi
 User readUser(int UserId)
          Read a user-object from the database.
 java.util.Vector searchContents(java.lang.String name, java.lang.String plac, int eventCode, int date1, int date2, int dateTyp)
          Search indies from the Contect.
 
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

DBReader

public DBReader()
Method Detail

readChildren

public java.util.Vector readChildren(int researchId,
                                     java.lang.String refId)
                              throws GenealogyException
Read all children in a family.
Parameters:
researchId - Research id
refId - Family id
Returns:
Vector Vector of Family-objects if no Families found, empty Vector

readEvent

public Incident readEvent(int researchId,
                          java.lang.String eventId)
                   throws GenealogyException
Read a event. (Incident)
Parameters:
researchId - Research id.
eventId - Event (Incident) id to be read.
Returns:
Incident Incident-object, null if none found

readEvents

public java.util.Vector readEvents(int researchId,
                                   java.lang.String refId)
                            throws GenealogyException
Read all events.
Parameters:
researchId - Research id.
refId - Parent of events.
Returns:
Vector Vector of events, empty Vector if none found

readFamilies

public java.util.Vector readFamilies(int researchId,
                                     java.lang.String refId)
                              throws GenealogyException
Read all families.
Parameters:
researchId - Research id.
redId - Indi whoms families are being read.
Returns:
Vector Vector of Famillies, empty Vector if none found.

readPrintableIndi

public PrintableIndi readPrintableIndi(int researchId,
                                       java.lang.String indiId)
                                throws GenealogyException
Reads name, sex, occupation, birth and death from db.
Parameters:
researchId - Research id.
IndiId - Id of an Indi whoms info are beign read.
Returns:
PrintableIndi name, sex, occupation, birthdate (begin,end), birthtype, birthplace, same for .. death... field filled.

readFather

public PrintableIndi readFather(int researchId,
                                java.lang.String indiId)
                         throws GenealogyException
Read Father.
Parameters:
researchId - Research id.
indiId - Id of the indi whoms father is beign read.
Returns:
PrintableIndi Father (type=-1)

readSpouses

public java.util.Vector readSpouses(int researchId,
                                    java.lang.String indiId)
                             throws GenealogyException
Read spouses to a indi
Parameters:
researchId - Research id
indiId - id of the indi whoms spouses are being read
Returns:
Vector Vector of Spouses

readMother

public PrintableIndi readMother(int researchId,
                                java.lang.String indiId)
                         throws GenealogyException
Read Mother
Parameters:
researchId - Research id.
indiId - Id of the Indi whoms Moter is being read
Returns:
PrintableIndi Mother (type= -1)

readGranparents

public PrintableIndi[] readGranparents(int researchId,
                                       java.lang.String indiId,
                                       char sex)
                                throws GenealogyException
Read granparents of an indi.
Parameters:
researchId - Research id.
indiId - Indi id, whoms granparent are being read.
sex - Fathers/Mother side: M/F
Returns:
PrintableIndi[] [0] granfather [i] granmother
[0]/[1] null if not found
M --> type: -2
F --> type: -3

readRefTexts

public java.util.Vector readRefTexts(int researchId,
                                     java.lang.String refId)
                              throws GenealogyException
Read refTexts.
Parameters:
researchId - Research id.
refId - Parent of this refId
Returns:
Vector Vector of RefText-objects. empty Vector if none found

readAllContents

public java.util.Vector readAllContents()
                                 throws GenealogyException
Read all Indies in the Content. Not used, not tested.
Returns:
Vector Vector of Content-objects. empty Vector if none found.

readNote

public Text readNote(int researchId,
                     java.lang.String noteId)
              throws GenealogyException
Read a note. Not used, Not tested.
Parameters:
researchId - Research id.
noteId - id of the note
Returns:
Text Text-object marked with read tag. null if not found

searchContents

public java.util.Vector searchContents(java.lang.String name,
                                       java.lang.String plac,
                                       int eventCode,
                                       int date1,
                                       int date2,
                                       int dateTyp)
                                throws GenealogyException
Search indies from the Contect.
Parameters:
name - name of the searched indi
plac - Place of the birt/deat
eventCode - - 1=birt 2=deat
date1 - - first date
date2 - - second date (if searched a gap)
dateType - - 1-exact 2-before 3-after 4-gap
Returns:
Vector Vector of Content-objects. If none found, empty Vector.

readNotes

public java.util.Vector readNotes(int researchId,
                                  java.lang.String refId)
                           throws GenealogyException
Read notes.
Parameters:
researchId - Research id.
refId - Parent of this Note.
Returns:
Vector Vector of Text objects marked with read tag. empty Vector if no Notes found.

readNotes2

public java.util.Vector readNotes2(int researchId,
                                   java.lang.String textId)
                            throws GenealogyException
Read notes with researchid and _textid_
Parameters:
researchId - Research id.
textId - Text id (not refID!)
Returns:
Vector Vector of Text-objects marked with read tag. If no notes found, empty Vector.

isOwnerOfResearch

public boolean isOwnerOfResearch(int ResearchId,
                                 int UserId)
                          throws GenealogyException
Check if a User is an owner of a research.
Parameters:
researchId - Research id.
UserId - Users id
Returns:
boolean true, if is an owner, false if isn't

readResearch

public Research readResearch(int researchId)
                      throws GenealogyException
Read a research.
Parameters:
researchId - Research id.
Returns:
Research Research-object if found, otherwise null

readResearches

public java.util.Vector readResearches(int UserId)
                                throws GenealogyException
Read users researches.
Parameters:
UserId - Id of the User
Returns:
Vector Vector of research-objects if found, otherwise empty Vector

readSource

public Text readSource(int researchId,
                       java.lang.String sourceId)
                throws GenealogyException
Read a single source. Not used. Not tested.
Parameters:
researchId - Research id.
sourceId - Id of the source to be read.
Returns:
Text Text-object marked to source, if found otherwise null

readSources

public java.util.Vector readSources(int researchId,
                                    java.lang.String refId)
                             throws GenealogyException
Read sources.
Parameters:
researchId - Research id.
refId - The parent of this source.
Returns:
Vector Vector of Text-objects (marked as source) if sources not found empty Vector

readUser

public User readUser(int UserId)
              throws GenealogyException
Read a user-object from the database.
Parameters:
UserId - Id of the User
Returns:
User User-object, null if no User found with the id.

isFreeAccount

public boolean isFreeAccount(java.lang.String Account)
                      throws GenealogyException
Check if Account is free to use.
Parameters:
Account - Account to be cheked if it is free to use.
Returns:
boolean true if free, false if not

isValidUser

public User isValidUser(java.lang.String account,
                        java.lang.String password)
                 throws GenealogyException
Try to validate user. Used when user id trying to log in.
Parameters:
account - Account of the user to be valitated.
password - Password of the user to be valitated.
Returns:
User User-object, null if account and password did not match