com.flickrrecsys.db
Class DbUser

java.lang.Object
  extended by com.flickrrecsys.db.DbUser

public class DbUser
extends java.lang.Object

Connection to the user table

Author:
Hossein

Constructor Summary
DbUser(java.lang.String path)
          Constructor which gets the connection to the database
 
Method Summary
 void insert(java.lang.String nsid, java.lang.String realname, java.lang.String username, java.lang.String token, java.lang.String location, java.sql.Timestamp firstPhotoUploaded, int noPhotos)
          Insert users
 void update(java.lang.String nsid, java.lang.String realname, java.lang.String username, java.lang.String location, java.sql.Timestamp firstPhotoUploaded, int noPhotos)
          Update user details
 boolean userExist(java.lang.String nsid)
          Check if the user already exists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUser

public DbUser(java.lang.String path)
Constructor which gets the connection to the database

Parameters:
path - to where the database details are
Method Detail

insert

public void insert(java.lang.String nsid,
                   java.lang.String realname,
                   java.lang.String username,
                   java.lang.String token,
                   java.lang.String location,
                   java.sql.Timestamp firstPhotoUploaded,
                   int noPhotos)
            throws java.sql.SQLException,
                   java.security.NoSuchAlgorithmException,
                   java.io.UnsupportedEncodingException
Insert users

Parameters:
nsid - user id from flickr website
realname - real name of the user
username - username of the user
token - generated token
location - location of the user - if available
firstPhotoUploaded - first date and time of photo uploaded
noPhotos - number of public photos uploaded
Throws:
java.sql.SQLException
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException

userExist

public boolean userExist(java.lang.String nsid)
                  throws java.sql.SQLException
Check if the user already exists

Parameters:
nsid - user id from the flickr website
Returns:
true/false
Throws:
java.sql.SQLException

update

public void update(java.lang.String nsid,
                   java.lang.String realname,
                   java.lang.String username,
                   java.lang.String location,
                   java.sql.Timestamp firstPhotoUploaded,
                   int noPhotos)
            throws java.sql.SQLException
Update user details

Parameters:
nsid - user id
realname - real name
username - username
location - location
firstPhotoUploaded - first date and time a photo being uploaded
noPhotos - number of public photos
Throws:
java.sql.SQLException