本文整理汇总了Java中de.greenrobot.dao.query.Query.unique方法的典型用法代码示例。如果您正苦于以下问题:Java Query.unique方法的具体用法?Java Query.unique怎么用?Java Query.unique使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.greenrobot.dao.query.Query
的用法示例。
在下文中一共展示了Query.unique方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeUserInfo
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
/**
* change User info in local db
*
* @param id user's id
* @param email user's email
* @param key user's key
* @param name user name
*/
@Override
public void changeUserInfo(long id, String email, String key, String name)
{
log.info(Thread.currentThread().toString() + "##changeUserInfo(id=[" + id + "],email=[" + email
+ "],key=[" + key + "]");
Query<UserDB> query = userDao.queryBuilder().where(Properties.IsLastLogin.eq(true)).build();
UserDB result = query.unique();
if (result != null)
{
// clear the old login info
result.setIsLastLogin(false);
userDao.update(result);
}
result = new UserDB(id, email, key, name, true);
userDao.insertOrReplace(result);
}
示例2: load
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
/**
* load the UserDB from local db
*
* @return UserDB info
*/
@Override
public IUserDB load()
{
UserDB result = null;
Query<UserDB> query = userDao.queryBuilder().where(Properties.IsLastLogin.eq(true)).build();
result = query.unique();
if (result != null)
{
log.debug(Thread.currentThread().toString() + "##load(): " + result);
return result;
}
// the app hasn't been login yet
log.debug(Thread.currentThread().toString() + "##load(): " + result);
return result;
}
示例3: __getUserDeviceList
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private List<IDeviceDB> __getUserDeviceList(long userId)
{
Query<UserDB> query = userDao.queryBuilder().where(Properties.Id.eq(userId)).build();
UserDB user = query.unique();
List<DeviceDB> result = null;
if (user != null)
{
user.resetDevices();
result = user.getDevices();
}
log.debug(Thread.currentThread().toString() + "##getUserDeviceList(userId=[" + userId + "]): " + result);
if (result != null)
{
List<IDeviceDB> deviceList = new ArrayList<IDeviceDB>();
deviceList.addAll(result);
return deviceList;
}
else
{
return Collections.emptyList();
}
}
示例4: getNegativeDeviceIdByBssid
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private long getNegativeDeviceIdByBssid(String bssid)
{
Query<DeviceDB> query = deviceDao.queryBuilder().where(Properties.Bssid.eq(bssid)).build();
DeviceDB device = query.unique();
if (device == null)
{
log.info(Thread.currentThread().toString() + "##getNegativeDeviceIdByBssid(bssid=[" + bssid + "]): 0");
return 0;
}
else
{
long result = device.getId();
log.info(Thread.currentThread().toString() + "##getNegativeDeviceIdByBssid(bssid=[" + bssid + "]): "
+ result);
return result;
}
}
示例5: delete
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
@Override
public synchronized void delete(long deviceId)
{
Query<DeviceDB> query = deviceDao.queryBuilder().where(Properties.Id.eq(deviceId)).build();
DeviceDB result = query.unique();
if (result != null)
{
deviceDao.delete(result);
log.info(Thread.currentThread().toString() + "##delete(deviceId=[" + deviceId + "]): " + result);
}
else
{
log.debug(Thread.currentThread().toString() + "##delete(deviceId=[" + deviceId
+ "]): the device isn't exist");
}
}
示例6: deleteDevicesByDeviceId
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
@Override
public void deleteDevicesByDeviceId(long deviceId)
{
Query<DeviceDB> query = deviceDao.queryBuilder().where(Properties.Id.eq(deviceId)).build();
DeviceDB result = query.unique();
if (result != null)
{
String bssid = result.getBssid();
deleteDevicesByBssid(bssid);
}
else
{
log.debug(Thread.currentThread().toString() + "##deleteDevicesByDeviceId(deviceId=[" + deviceId
+ "]): the device isn't exist");
}
}
示例7: __getGenericDataDirectory
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private GenericDataDirectoryDB __getGenericDataDirectory(long deviceId, long dayStartTimestamp)
{
Query<GenericDataDirectoryDB> query =
genericDataDirectoryDao.queryBuilder()
.where(Properties.DeviceId.eq(deviceId), Properties.Day_start_timestamp.eq(dayStartTimestamp))
.build();
GenericDataDirectoryDB result = query.unique();
log.debug(Thread.currentThread().toString() + "##__getGenericDataDirectory(deviceId=[" + deviceId
+ "],dayStartTimestamp=[" + TimeUtil.getDateStr(dayStartTimestamp, null) + "]): " + result);
return result;
}
示例8: getDownloadIdValueDB
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private DownloadIdValueDB getDownloadIdValueDB(long downloadIdValue)
{
Query<DownloadIdValueDB> query =
downloadIdValueDao.queryBuilder()
.where(DownloadIdValueDBDao.Properties.IdValue.eq(downloadIdValue))
.build();
DownloadIdValueDB downloadIdValueDB = query.unique();
log.debug(Thread.currentThread().toString() + "##getDownloadIdValueDB(downloadIdValue=[" + downloadIdValue
+ "]): " + downloadIdValueDB);
return downloadIdValueDB;
}
示例9: getDeviceById
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private DeviceDB getDeviceById(long deviceId)
{
Query<DeviceDB> query = deviceDao.queryBuilder().where(Properties.Id.eq(deviceId)).build();
DeviceDB result = query.unique();
log.debug(Thread.currentThread().toString() + "##getDeviceById(deviceId=[" + deviceId + "]): " + result);
return result;
}
示例10: getDeviceByBssid
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private DeviceDB getDeviceByBssid(String bssid)
{
Query<DeviceDB> query = deviceDao.queryBuilder().where(Properties.Bssid.eq(bssid)).build();
DeviceDB result = query.unique();
log.debug(Thread.currentThread().toString() + "##getDeviceByBssid(bssid=[" + bssid + "]): " + result);
return result;
}
示例11: __getLastSelectedApDB
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private ApDB __getLastSelectedApDB()
{
Query<ApDB> query = apDao.queryBuilder().where(Properties.IsLastSelected.eq(true)).build();
return query.unique();
}
示例12: __getApDB
import de.greenrobot.dao.query.Query; //导入方法依赖的package包/类
private ApDB __getApDB(String bssid)
{
Query<ApDB> query = apDao.queryBuilder().where(Properties.Bssid.eq(bssid)).build();
return query.unique();
}