com.flickrrecsys.db
Class DbContacts

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

public class DbContacts
extends java.lang.Object

Connection to the contacts table

Author:
Hossein Ghodsi

Constructor Summary
DbContacts(java.lang.String path)
          Constructor which gets the connection to the database
 
Method Summary
 boolean checkExistingContacts(java.lang.String nsid, java.lang.String contactNsid)
          Check if the users are already connection
 void deleteContacts(java.lang.String nsid)
          Delete contacts by user id
 java.util.Vector<Coac> getRecCoac(java.lang.String nsid, int limit)
          Get recommended contacts
 void insert(java.lang.String nsid, java.lang.String contactNsid)
          Inserting data to the contacts table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbContacts

public DbContacts(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.lang.String contactNsid)
            throws java.sql.SQLException,
                   java.security.NoSuchAlgorithmException,
                   java.io.UnsupportedEncodingException
Inserting data to the contacts table

Parameters:
nsid - user id from the flickr website
contactNsid - user id from the flickr website
Throws:
java.sql.SQLException
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException

checkExistingContacts

public boolean checkExistingContacts(java.lang.String nsid,
                                     java.lang.String contactNsid)
                              throws java.sql.SQLException
Check if the users are already connection

Parameters:
nsid - user id from the flickr website
contactNsid - user id from the flickr website
Returns:
true if already exists, false if not
Throws:
java.sql.SQLException

deleteContacts

public void deleteContacts(java.lang.String nsid)
                    throws java.sql.SQLException
Delete contacts by user id

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

getRecCoac

public java.util.Vector<Coac> getRecCoac(java.lang.String nsid,
                                         int limit)
                                  throws java.sql.SQLException
Get recommended contacts

Parameters:
nsid - user id from the flickr website
limit - limitation on the number of returns
Returns:
vector of result
Throws:
java.sql.SQLException