/*
Copyright 2010 Cesar Valiente Gordo
This file is part of QuiteSleep.
QuiteSleep is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QuiteSleep is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QuiteSleep. If not, see <http://www.gnu.org/licenses/>.
*/
package es.cesar.quitesleep.ddbb;
import java.util.List;
import android.util.Log;
import com.db4o.ObjectContainer;
import com.db4o.ext.StoredClass;
import com.db4o.query.Query;
import es.cesar.quitesleep.interfaces.IDDBB;
import es.cesar.quitesleep.staticValues.DDBBValues;
import es.cesar.quitesleep.utils.ExceptionUtils;
import es.cesar.quitesleep.utils.QSLog;
/**
*
* @author Cesar Valiente Gordo
* @mail [email protected]
*
*/
public class Selects implements IDDBB {
private final String CLASS_NAME = getClass().getName();
private ObjectContainer db;
/**
* Constructor
*
* @param db
*/
public Selects (ObjectContainer db) {
this.db = db;
}
/**
* This function gets the number of the contacts objects in the ddbb.
*
* @return
*/
public int getNumberOfContacts () {
try {
synchronized (SEMAPHORE) {
StoredClass sc = db.ext().storedClass(Contact.class);
if (sc != null)
return sc.getIDs().length;
else
return 0;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return -1;
}
}
/**
* This function gets the number of the MuteOrHangUp objects in the ddbb.
* At most, should only be one object
*
* @return
*/
public int getNumberOfMuteOrHangup () {
try {
synchronized (SEMAPHORE) {
StoredClass sc = db.ext().storedClass(MuteOrHangUp.class);
if (sc != null)
return sc.getIDs().length;
else
return 0;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return -1;
}
}
/**
* This function gets the number of the BlockCallsConf objects in the ddbb.
* At most, should only be one object
*
* @return
*/
public int getNumberOfBlockCallsConf () {
try {
synchronized (SEMAPHORE) {
StoredClass sc = db.ext().storedClass(BlockCallsConf.class);
if (sc != null)
return sc.getIDs().length;
else
return 0;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return -1;
}
}
/**
* Select all Contact objects from the DDBB and return it.
*
* @return All Contact objects from the DDBB
* @see List<Contact>
*/
public List<Contact> selectAllContacts () {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Contact.class);
//Ordered by name (first A....last Z)
query.descend(DDBBValues.CONTACT_NAME).orderAscending();
List<Contact> contactList = query.execute();
return contactList;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return null;
}
}
/**
* Select one Contact that is the same with the name passed
*
* @param contactName
* @return The contact match with the passed name
* @see Contact
*/
public Contact selectContactForName (String contactName) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Contact.class);
query.descend(DDBBValues.CONTACT_NAME).constrain(contactName);
List<Contact> contactList = query.execute();
if (contactList != null && contactList.size() == 1)
return contactList.get(0);
else
return null;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, e.toString());
return null;
}
}
/**
* Select Contact object match with the passed phoneNumber, search
* along all contact's phone numbers.
*
* @param phoneContact
* @return Contact that match with the passed phone number
* any contact's phone number
* @see Contact
*/
public Contact selectContactForPhoneNumber (String phoneContact) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Phone.class);
query.descend(DDBBValues.CONTACT_PHONE).constrain(phoneContact);
List<Phone> contactList = query.execute();
if (contactList != null && contactList.size() == 1) {
Phone phone = contactList.get(0);
return phone.getContact();
}
else
return null;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, e.toString());
return null;
}
}
/**
* Select Contact object match with the passed phoneNumber, search
* along all contact's phone numbers.
*
* @param phoneNumber
* @return Contact that match with the passed phone number
* any contact's phone number
* @see Contact
*/
public Contact selectContactForMail (String mailContact) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Mail.class);
query.descend(DDBBValues.CONTACT_MAIL).constrain(mailContact);
List<Mail> contactList = query.execute();
if (contactList != null && contactList.size() == 1) {
Mail mail = contactList.get(0);
return mail.getContact();
}
else
return null;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, e.toString());
return null;
}
}
/**
* Get all phones of the selected contact
* @param contactName
* @return All phones about the selected contact
* @see List<Phone>
*/
public List<Phone> selectAllContactPhonesForName (String contactName) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Phone.class);
query.descend(DDBBValues.CONTACT).descend(
DDBBValues.CONTACT_NAME).constrain(contactName);
List<Phone> phonesList = query.execute();
return phonesList;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return null;
}
}
/**
* Get all mails from the selected contact
* @param contactName
* @return List with all contact's mails
* @see List<Mail>
*/
public List<Mail> selectAllContactMailsForName (String contactName) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Mail.class);
query.descend(DDBBValues.CONTACT).descend(
DDBBValues.CONTACT_NAME).constrain(contactName);
List<Mail> mailsList = query.execute();
return mailsList;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
e.getStackTrace()));
return null;
}
}
/**
*
* @param contact
* @return
*/
public List<Mail> selectAllContactMailForContact (Contact contact) {
try {
synchronized (SEMAPHORE) {
Query query = db.query();
query.constrain(Mail.class);
query.descend(DDBBValues.CONTACT).constrain(contact);
List<Mail> mailList = query.execute();
return mailList;
}
}catch (Exception e) {
if (QSLog.DEBUG_E)QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(
e.toString(),
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码 quitesleep手机电话功能软件.rar
共1038个文件
i:535个
html:253个
png:105个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 181 浏览量
2023-03-19
20:37:10
上传
评论
收藏 14.1MB RAR 举报
温馨提示
小程序源码 quitesleep手机电话功能软件.rar
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码 quitesleep手机电话功能软件.rar (1038个子文件)
ITelephony.aidl 9KB
resources.ap_ 339KB
QuiteSleep.apk 1.09MB
branch 8B
undo.branch 7B
branchheads 93B
certification.cert 1KB
CHANGES 2KB
.classpath 586B
COPYING 34KB
stylesheet.css 1KB
_quite_sleep.apk.d 3.57MB
classes.dex.d 2.45MB
db4o-7.12.132.14217-core-java5.jar.d 1.1MB
resources.ap__.d 400KB
mail.jar.d 400KB
db4o-7.12.132.14217-cs-java5.jar.d 168KB
undo.desc 56B
classes.dex 1.69MB
dirstate 29KB
undo.dirstate 0B
fncache 27KB
inherit.gif 57B
hgrc 69B
index-18.html 69KB
constant-values.html 43KB
ConfigAppValues.html 34KB
Selects.html 33KB
index-7.html 33KB
index-14.html 29KB
ClientDDBB.html 26KB
Schedule.html 26KB
Contact.html 24KB
SettingsTab.html 22KB
overview-tree.html 22KB
SendMail.html 22KB
Settings.html 21KB
index-3.html 21KB
index-9.html 21KB
Inserts.html 20KB
CallLog.html 20KB
DDBBValues.html 20KB
SHA1Utils.html 18KB
serialized-form.html 18KB
SendSMSThread.html 18KB
BlockCallsConf.html 18KB
SyncContactsDialog.html 18KB
WarningDialog.html 17KB
Deletes.html 17KB
ContactsTab.html 17KB
index-17.html 17KB
SyncContactsNew.html 17KB
LogsTab.html 17KB
SyncContactsRefresh.html 17KB
Phone.html 17KB
DialogOperations.html 17KB
Mail.html 17KB
ScheduleTab.html 17KB
BlockTypes.html 16KB
index-4.html 16KB
CallLog.html 16KB
InputStreamUtils.html 16KB
QSLog.html 16KB
Contact.html 16KB
DeleteBanned.html 16KB
Banned.html 16KB
AddBanned.html 15KB
IncomingCallOperations.html 15KB
index-2.html 15KB
package-use.html 14KB
RefreshCallLogMenu.html 14KB
SendSMSService.html 14KB
SmsSettings.html 14KB
RemoveAllMenu.html 14KB
MuteOrHangUp.html 14KB
RemoveCallLogMenu.html 14KB
StartTimeDialog.html 14KB
AddAllMenu.html 14KB
EndTimeDialog.html 14KB
CheckSettingsOperations.html 14KB
ContactOperations.html 13KB
Main.html 13KB
ByteArrayDataSource.html 13KB
Updates.html 13KB
BCBean.html 13KB
JSSEProvider.html 13KB
Id.html 13KB
QSToast.html 13KB
index-5.html 12KB
IDialogs.html 12KB
Schedule.html 12KB
ServerDDBB.html 12KB
StartStopServicesOperations.html 12KB
index-12.html 12KB
TokenizerUtils.html 12KB
MailSettings.html 12KB
MailOperations.html 12KB
SyncContactsDialog.html 12KB
index-8.html 12KB
CallLogDialog.html 12KB
共 1038 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
荣华富贵8
- 粉丝: 150
- 资源: 7649
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功