es.cesar.quitesleep.ddbb
Class Selects

java.lang.Object
  extended by es.cesar.quitesleep.ddbb.Selects
All Implemented Interfaces:
IDDBB

public class Selects
extends java.lang.Object
implements IDDBB

Author:
Cesar Valiente Gordo

Field Summary
 
Fields inherited from interface es.cesar.quitesleep.interfaces.IDDBB
DDBB_DIR, DDBB_FILE, DEEP, QUITESLEEP_PATH, SDCARD_PATH, SEMAPHORE
 
Constructor Summary
Selects(com.db4o.ObjectContainer db)
          Constructor
 
Method Summary
 int countCallLog()
          Return an integer counts the number of CallLog objects in the ddbb.
 int getNumberOfBlockCallsConf()
          This function gets the number of the BlockCallsConf objects in the ddbb.
 int getNumberOfContacts()
          This function gets the number of the contacts objects in the ddbb.
 int getNumberOfMuteOrHangup()
          This function gets the number of the MuteOrHangUp objects in the ddbb.
 java.util.List<Banned> selectAllBannedContacts()
          Get all banned contacts from the database
 java.util.List<CallLog> selectAllCallLog()
          Select all CallLog objects from the ddbb
 java.util.List<Mail> selectAllContactMailForContact(Contact contact)
           
 java.util.List<Mail> selectAllContactMailsForName(java.lang.String contactName)
          Get all mails from the selected contact
 java.util.List<Phone> selectAllContactPhonesForName(java.lang.String contactName)
          Get all phones of the selected contact
 java.util.List<Contact> selectAllContacts()
          Select all Contact objects from the DDBB and return it.
 java.util.List<Contact> selectAllNotBannedContacts()
          Get all not banned contacts from the database
 Banned selectBannedContactForName(java.lang.String contactName)
          Get the banned object that match with the contactName passed.
 Contact selectBannedContactForPhoneNumber(java.lang.String phoneNumber)
          Get the banned contact associate to the phone number passed to the function.
 BlockCallsConf selectBlockCallConf()
          Select the BlockCallsConfig object in the ddbb, only must return one object.
 Contact selectContactForMail(java.lang.String mailContact)
          Select Contact object match with the passed phoneNumber, search along all contact's phone numbers.
 Contact selectContactForName(java.lang.String contactName)
          Select one Contact that is the same with the name passed
 Contact selectContactForPhoneNumber(java.lang.String phoneContact)
          Select Contact object match with the passed phoneNumber, search along all contact's phone numbers.
 MuteOrHangUp selectMuteOrHangUp()
          This function gets a MuteOrHangUp object from the ddbb.
 Phone selectPhoneForPhoneNumber(java.lang.String phoneNumber)
          Select the Phone object that contains the phoneNumber passed throw the param value.
 Schedule selectSchedule()
          Get the (for the moment) the one Schedule object in the database.
 Settings selectSettings()
          Return the settings object only if is the one in the ddbb, else return null because have to be an error, only must be one Settings object in the ddbb.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Selects

public Selects(com.db4o.ObjectContainer db)
Constructor

Parameters:
db -
Method Detail

getNumberOfContacts

public int getNumberOfContacts()
This function gets the number of the contacts objects in the ddbb.

Returns:

getNumberOfMuteOrHangup

public int getNumberOfMuteOrHangup()
This function gets the number of the MuteOrHangUp objects in the ddbb. At most, should only be one object

Returns:

getNumberOfBlockCallsConf

public int getNumberOfBlockCallsConf()
This function gets the number of the BlockCallsConf objects in the ddbb. At most, should only be one object

Returns:

selectAllContacts

public java.util.List<Contact> selectAllContacts()
Select all Contact objects from the DDBB and return it.

Returns:
All Contact objects from the DDBB
See Also:
List

selectContactForName

public Contact selectContactForName(java.lang.String contactName)
Select one Contact that is the same with the name passed

Parameters:
contactName -
Returns:
The contact match with the passed name
See Also:
Contact

selectContactForPhoneNumber

public Contact selectContactForPhoneNumber(java.lang.String phoneContact)
Select Contact object match with the passed phoneNumber, search along all contact's phone numbers.

Parameters:
phoneContact -
Returns:
Contact that match with the passed phone number any contact's phone number
See Also:
Contact

selectContactForMail

public Contact selectContactForMail(java.lang.String mailContact)
Select Contact object match with the passed phoneNumber, search along all contact's phone numbers.

Parameters:
phoneNumber -
Returns:
Contact that match with the passed phone number any contact's phone number
See Also:
Contact

selectAllContactPhonesForName

public java.util.List<Phone> selectAllContactPhonesForName(java.lang.String contactName)
Get all phones of the selected contact

Parameters:
contactName -
Returns:
All phones about the selected contact
See Also:
List

selectAllContactMailsForName

public java.util.List<Mail> selectAllContactMailsForName(java.lang.String contactName)
Get all mails from the selected contact

Parameters:
contactName -
Returns:
List with all contact's mails
See Also:
List

selectAllContactMailForContact

public java.util.List<Mail> selectAllContactMailForContact(Contact contact)
Parameters:
contact -
Returns:

selectAllBannedContacts

public java.util.List<Banned> selectAllBannedContacts()
Get all banned contacts from the database

Returns:
List with all contacts or null if there any exception
See Also:
List

selectAllNotBannedContacts

public java.util.List<Contact> selectAllNotBannedContacts()
Get all not banned contacts from the database

Returns:

selectBannedContactForPhoneNumber

public Contact selectBannedContactForPhoneNumber(java.lang.String phoneNumber)
Get the banned contact associate to the phone number passed to the function. Check if the contact name associate to the phone is in the ddbb and if the contact has the flag banned to true.

Parameters:
phoneNumber -
Returns:
contact if exists one contact banned who has the incoming number passed
See Also:
Contact

selectBannedContactForName

public Banned selectBannedContactForName(java.lang.String contactName)
Get the banned object that match with the contactName passed.

Parameters:
contactName -
Returns:
The banned object matches with the contactName passed.
See Also:
Banned

selectSchedule

public Schedule selectSchedule()
Get the (for the moment) the one Schedule object in the database. For now (04-17-2010) in this application version of quitesleep, must be only one Schedule object in the database, so all banned objects have to use the same Schedule object.

Returns:
The (for the moment) only Schedule object in the database
See Also:
Schedule

selectSettings

public Settings selectSettings()
Return the settings object only if is the one in the ddbb, else return null because have to be an error, only must be one Settings object in the ddbb.

Returns:
The settings object
See Also:
Settings

selectPhoneForPhoneNumber

public Phone selectPhoneForPhoneNumber(java.lang.String phoneNumber)
Select the Phone object that contains the phoneNumber passed throw the param value. Returns null if exists more than one object, or there isn't nothing in the ddbb.

Parameters:
phoneNumber -
Returns:

selectAllCallLog

public java.util.List<CallLog> selectAllCallLog()
Select all CallLog objects from the ddbb

Returns:

countCallLog

public int countCallLog()
Return an integer counts the number of CallLog objects in the ddbb.

Returns:
int

selectBlockCallConf

public BlockCallsConf selectBlockCallConf()
Select the BlockCallsConfig object in the ddbb, only must return one object. If there are more than one, then returns null.

Returns:
BlockCallsConf

selectMuteOrHangUp

public MuteOrHangUp selectMuteOrHangUp()
This function gets a MuteOrHangUp object from the ddbb.

Returns: