当前位置: 首页>>代码示例>>Java>>正文


Java Query.unique方法代码示例

本文整理汇总了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);
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:25,代码来源:IOTUserDBManager.java

示例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;
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:22,代码来源:IOTUserDBManager.java

示例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();
    }
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:23,代码来源:IOTUserDBManager.java

示例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;
    }
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:18,代码来源:IOTDeviceDBManager.java

示例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");
    }
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:17,代码来源:IOTDeviceDBManager.java

示例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");
    }
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:17,代码来源:IOTDeviceDBManager.java

示例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;
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:12,代码来源:IOTGenericDataDirectoryDBManager.java

示例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;
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:12,代码来源:IOTDownloadIdValueDBManager.java

示例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;
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:8,代码来源:IOTDeviceDBManager.java

示例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;
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:8,代码来源:IOTDeviceDBManager.java

示例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();
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:6,代码来源:IOTApDBManager.java

示例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();
}
 
开发者ID:EspressifApp,项目名称:IOT-Espressif-Android,代码行数:6,代码来源:IOTApDBManager.java


注:本文中的de.greenrobot.dao.query.Query.unique方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。