com.flickrrecsys.db
Class DbLoadingDuration

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

public class DbLoadingDuration
extends java.lang.Object

Connection to the loading duration

Author:
Hossein Ghodsi

Constructor Summary
DbLoadingDuration(java.lang.String path)
          Constructor which gets the connection to the database
 
Method Summary
 boolean alreadyExist(java.lang.String nsid)
          Check if the timestamp has already been recorded
 int getlId(java.lang.String nsid)
          Get loading duration id
 java.sql.Timestamp getStartingTime(java.lang.String nsid, java.sql.Timestamp endTime)
          Get the starting time in Timestamp
 void insert(java.lang.String nsid, java.sql.Timestamp startingTime)
          Insert loading duration
 void updateEndTime(java.lang.String nsid, java.sql.Timestamp endTime)
          Update the finish time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbLoadingDuration

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

Parameters:
path - to where the database is located
Method Detail

insert

public void insert(java.lang.String nsid,
                   java.sql.Timestamp startingTime)
            throws java.sql.SQLException,
                   java.security.NoSuchAlgorithmException,
                   java.io.UnsupportedEncodingException
Insert loading duration

Parameters:
nsid - user id from the flickr website
startingTime - current time of the machine
Throws:
java.sql.SQLException
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException

alreadyExist

public boolean alreadyExist(java.lang.String nsid)
                     throws java.sql.SQLException
Check if the timestamp has already been recorded

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

getlId

public int getlId(java.lang.String nsid)
           throws java.sql.SQLException
Get loading duration id

Parameters:
nsid - user id from the flickr website
Returns:
loading duration id
Throws:
java.sql.SQLException

updateEndTime

public void updateEndTime(java.lang.String nsid,
                          java.sql.Timestamp endTime)
                   throws java.sql.SQLException
Update the finish time

Parameters:
nsid - user id from the flickr website
endTime - the end time
Throws:
java.sql.SQLException

getStartingTime

public java.sql.Timestamp getStartingTime(java.lang.String nsid,
                                          java.sql.Timestamp endTime)
                                   throws java.sql.SQLException
Get the starting time in Timestamp

Parameters:
nsid - user id from the flickr website
endTime - end time
Returns:
Timestamp of the starting time
Throws:
java.sql.SQLException