FantasySportsModule 0.0.2-dev

org.fanfoot.db
Class Players

java.lang.Object
  |
  +--org.fanfoot.db.Players

public class Players
extends java.lang.Object

Provides access to the player information in the database.

Author:
rgardler

Field Summary
static java.lang.String COLLECTION_NAME
          The name of the collection in the database that stores the players data
static java.lang.String POSITION_CENTREBACK
          The goalkeeper playing position
static java.lang.String POSITION_FORWARD
          The goalkeeper playing position
static java.lang.String POSITION_FULLBACK
          The goalkeeper playing position
static java.lang.String POSITION_GOALKEEPER
          The goalkeeper playing position
static java.lang.String POSITION_MIDFIELD
          The goalkeeper playing position
 
Constructor Summary
Players()
          Create a players object to connect to the default players database and default collection
Players(java.lang.String uri)
          Create a players object to connect to the indicated players database with the default colelction
 
Method Summary
 void addInfo(java.lang.String strPlayerID, org.w3c.dom.Element elemInfo)
          Add some info to a pl;ayer record.
 void addPlayer(java.lang.String firstName, java.lang.String surname, java.lang.String registeredTeam, java.lang.String team, java.lang.String position)
          Add the supplied player to the database.
 void addScoringEvents(java.lang.String strPlayerID, org.w3c.dom.Element event)
          Add a scoring event to a player.
 org.w3c.dom.Element getPlayer(java.lang.String id)
          Get the player associated with the supplied id.
 java.lang.Integer getTotalScore(java.lang.String id)
          Get the total score of a player.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLLECTION_NAME

public static java.lang.String COLLECTION_NAME
The name of the collection in the database that stores the players data


POSITION_GOALKEEPER

public static java.lang.String POSITION_GOALKEEPER
The goalkeeper playing position


POSITION_CENTREBACK

public static java.lang.String POSITION_CENTREBACK
The goalkeeper playing position


POSITION_FULLBACK

public static java.lang.String POSITION_FULLBACK
The goalkeeper playing position


POSITION_MIDFIELD

public static java.lang.String POSITION_MIDFIELD
The goalkeeper playing position


POSITION_FORWARD

public static java.lang.String POSITION_FORWARD
The goalkeeper playing position

Constructor Detail

Players

public Players()
        throws DBException
Create a players object to connect to the default players database and default collection

Throws:
DBException - Description of the Exception

Players

public Players(java.lang.String uri)
        throws DBException
Create a players object to connect to the indicated players database with the default colelction

Parameters:
uri - the uri of the DB to use
Throws:
DBException - Description of the Exception
Method Detail

getPlayer

public org.w3c.dom.Element getPlayer(java.lang.String id)
                              throws DBException
Get the player associated with the supplied id.

Parameters:
id - the ID of the plaer required
Returns:
an Element representing the players record, null if there is none
Throws:
DBException - if there is more than one player with the supplied ID or is the resource cannot be parsed for any reason.

getTotalScore

public java.lang.Integer getTotalScore(java.lang.String id)
                                throws DBException,
                                       UnknownPlayerException
Get the total score of a player.

Parameters:
id - id of player
Returns:
total score in the database for the indicated player
Throws:
DBException - if there is an error accessing the DB
UnknownPlayerException - if the player is not found

addScoringEvents

public void addScoringEvents(java.lang.String strPlayerID,
                             org.w3c.dom.Element event)
                      throws DBException
Add a scoring event to a player.

Parameters:
strPlayerID - ide of player to add event to
event - an element representing the event
Throws:
DBException - Description of the Exception
DBExeption - if there is a problem updating the DB

addPlayer

public void addPlayer(java.lang.String firstName,
                      java.lang.String surname,
                      java.lang.String registeredTeam,
                      java.lang.String team,
                      java.lang.String position)
               throws DBException
Add the supplied player to the database. No checks for duplicates are done.

Parameters:
firstName - is the first name of the player
surname - is the surname of the player
registeredTeam - is the team the player with
team - is the team the player is currently playing for
position - is the players normal position
Throws:
DBException - Description of the Exception

addInfo

public void addInfo(java.lang.String strPlayerID,
                    org.w3c.dom.Element elemInfo)
             throws DBException
Add some info to a pl;ayer record. .

Parameters:
elemInfo - the info to be added
strPlayerID - The feature to be added to the Info attribute
Throws:
DBException - Description of the Exception

FantasySportsModule 0.0.2-dev

Copyright © 2003 We know What you Want.net. All Rights Reserved.