de.greenrobot.dao.Property Java Examples

The following examples show how to use de.greenrobot.dao.Property. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuaManager.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private String getDBLuaFileByVersion(String s)
{
    LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
    int j = (int)luazipfiledao.count();
    Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
    if (j > 0)
    {
        QueryBuilder querybuilder = luazipfiledao.queryBuilder();
        Property aproperty[] = new Property[1];
        aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
        querybuilder.orderDesc(aproperty);
        querybuilder.where(de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version.eq(s), new WhereCondition[0]);
        LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
        String s1 = luazipfile.getVersion();
        Debug.i("chenee", (new StringBuilder()).append("luaZipFile.version:").append(s1).toString());
        return unzip(luazipfile.getZipFile());
    } else
    {
        Debug.e("chenee", (new StringBuilder()).append("read DB zip failed,version:").append(s).toString());
        return null;
    }
}
 
Example #2
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private transient void orderAscOrDesc(String s, Property aproperty[])
{
    int i = aproperty.length;
    for (int j = 0; j < i; j++)
    {
        Property property = aproperty[j];
        checkOrderBuilder();
        append(orderBuilder, property);
        if (java/lang/String.equals(property.type))
        {
            orderBuilder.append(" COLLATE LOCALIZED");
        }
        orderBuilder.append(s);
    }

}
 
Example #3
Source File: AbstractDaoTestSinglePk.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected void setUp()
{
    super.setUp();
    Property aproperty[] = daoAccess.getProperties();
    int i = aproperty.length;
    for (int j = 0; j < i; j++)
    {
        Property property = aproperty[j];
        if (!property.primaryKey)
        {
            continue;
        }
        if (pkColumn != null)
        {
            throw new RuntimeException("Test does not work with multiple PK columns");
        }
        pkColumn = property;
    }

    if (pkColumn == null)
    {
        throw new RuntimeException("Test does not work without a PK column");
    } else
    {
        return;
    }
}
 
Example #4
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example #5
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param orderProperty
 * @param whereCondition
 * @param whereConditions
 * @return
 */
public static List getList(AbstractDao dao, Property orderProperty, WhereCondition whereCondition, WhereCondition... whereConditions) {
    setIfLog();
    List indexFavList = dao.queryBuilder()
            .where(whereCondition, whereConditions)
            .orderAsc(orderProperty)
            .list();
    return indexFavList;
}
 
Example #6
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example #7
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static List getList(AbstractDao dao, Property orderProperty, WhereCondition cond, WhereCondition... condMore) {
    setIfLog();
    List indexFavList = dao.queryBuilder()
            .where(cond, condMore)
            .orderAsc(orderProperty)
            .list();
    return indexFavList;
}
 
Example #8
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example #9
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param orderProperty
 * @param whereCondition
 * @param whereConditions
 * @return
 */
public static List getList(AbstractDao dao, Property orderProperty, WhereCondition whereCondition, WhereCondition... whereConditions) {
    setIfLog();
    List indexFavList = dao.queryBuilder()
            .where(whereCondition, whereConditions)
            .orderAsc(orderProperty)
            .list();
    return indexFavList;
}
 
Example #10
Source File: LuaListAdapter.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void refreshList()
{
    LuaListDao lualistdao = DaoManager.getInstance().getLuaListDao();
    String s = getDate();
    QueryBuilder querybuilder = lualistdao.queryBuilder().where(de.greenrobot.daobracelet.LuaListDao.Properties.Date.eq(s), new WhereCondition[0]).where(de.greenrobot.daobracelet.LuaListDao.Properties.Type.notEq("8888"), new WhereCondition[0]).where(de.greenrobot.daobracelet.LuaListDao.Properties.Type.notEq("9999"), new WhereCondition[0]);
    Property aproperty[] = new Property[1];
    aproperty[0] = de.greenrobot.daobracelet.LuaListDao.Properties.Id;
    List list = querybuilder.orderDesc(aproperty).list();
    Collections.sort(list, new MyComparator());
    setList(list);
}
 
Example #11
Source File: LuaManager.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private String getLatestDBLuaFile()
{
    LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
    int j = (int)luazipfiledao.count();
    Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
    if (j > 0)
    {
        QueryBuilder querybuilder = luazipfiledao.queryBuilder();
        Property aproperty[] = new Property[1];
        aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
        querybuilder.orderDesc(aproperty);
        LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
        String s = luazipfile.getVersion();
        String s1 = getDefaultLuaFileVersion();
        if (s.compareTo(s1) <= 0)
        {
            Debug.e("chenee", (new StringBuilder()).append("version compare failed: version:").append(s).append(" default version is:").append(s1).toString());
            return null;
        } else
        {
            Debug.i("chenee", (new StringBuilder()).append("use latest script, version:").append(s).append(" (default version is:").append(s1).append(")").toString());
            return unzip(luazipfile.getZipFile());
        }
    } else
    {
        Debug.e("chenee", "read DB zip file failed");
        return null;
    }
}
 
Example #12
Source File: LuaAction.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public LuaList queryLastItem(QueryBuilder querybuilder)
{
    Property aproperty[] = new Property[1];
    aproperty[0] = de.greenrobot.daobracelet.LuaListDao.Properties.Id;
    querybuilder.orderDesc(aproperty);
    List list = querybuilder.list();
    if (list.size() > 0)
    {
        return (LuaList)list.get(0);
    } else
    {
        return null;
    }
}
 
Example #13
Source File: DaoConfig.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private static Property[] reflectProperties(Class class1)
{
    Field afield[] = Class.forName((new StringBuilder()).append(class1.getName()).append("$Properties").toString()).getDeclaredFields();
    ArrayList arraylist = new ArrayList();
    int i = afield.length;
    for (int j = 0; j < i; j++)
    {
        Field field = afield[j];
        if ((9 & field.getModifiers()) != 9)
        {
            continue;
        }
        Object obj = field.get(null);
        if (obj instanceof Property)
        {
            arraylist.add((Property)obj);
        }
    }

    Property aproperty[] = new Property[arraylist.size()];
    for (Iterator iterator = arraylist.iterator(); iterator.hasNext();)
    {
        Property property = (Property)iterator.next();
        if (aproperty[property.ordinal] != null)
        {
            throw new DaoException("Duplicate property ordinals");
        }
        aproperty[property.ordinal] = property;
    }

    return aproperty;
}
 
Example #14
Source File: WhereCondition$PropertyCondition.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private static Object[] checkValuesForType(Property property1, Object aobj[])
{
    for (int i = 0; i < aobj.length; i++)
    {
        aobj[i] = checkValueForType(property1, aobj[i]);
    }

    return aobj;
}
 
Example #15
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public QueryBuilder orderCustom(Property property, String s)
{
    checkOrderBuilder();
    append(orderBuilder, property).append(' ');
    orderBuilder.append(s);
    return this;
}
 
Example #16
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected void checkProperty(Property property)
    {
        if (dao != null)
        {
            Property aproperty[] = dao.getProperties();
            int i = aproperty.length;
            int j = 0;
label0:
            do
            {
label1:
                {
                    boolean flag = false;
                    if (j < i)
                    {
                        if (property != aproperty[j])
                        {
                            break label1;
                        }
                        flag = true;
                    }
                    if (!flag)
                    {
                        throw new DaoException((new StringBuilder()).append("Property '").append(property.name).append("' is not part of ").append(dao).toString());
                    }
                    break label0;
                }
                j++;
            } while (true);
        }
    }
 
Example #17
Source File: WhereCondition$PropertyCondition.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public op(Property property1, String s, Object aobj[])
{
    super(checkValuesForType(property1, aobj));
    property = property1;
    op = s;
}
 
Example #18
Source File: WhereCondition$PropertyCondition.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public op(Property property1, String s, Object obj)
{
    super(checkValueForType(property1, obj));
    property = property1;
    op = s;
}
 
Example #19
Source File: WhereCondition$PropertyCondition.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private static Object checkValueForType(Property property1, Object obj)
    {
        if (obj != null && obj.getClass().isArray())
        {
            throw new DaoException("Illegal value: found array, but simple object required");
        }
        if (property1.type != java/util/Date) goto _L2; else goto _L1
_L1:
        if (!(obj instanceof Date)) goto _L4; else goto _L3
_L3:
        obj = Long.valueOf(((Date)obj).getTime());
_L6:
        return obj;
_L4:
        if (obj instanceof Long) goto _L6; else goto _L5
_L5:
        throw new DaoException((new StringBuilder()).append("Illegal date value: expected java.util.Date or Long for value ").append(obj).toString());
_L2:
        if (property1.type != Boolean.TYPE && property1.type != java/lang/Boolean) goto _L6; else goto _L7
_L7:
        int i;
        if (obj instanceof Boolean)
        {
            int j;
            if (((Boolean)obj).booleanValue())
            {
                j = 1;
            } else
            {
                j = 0;
            }
            return Integer.valueOf(j);
        }
        if (!(obj instanceof Number))
        {
            continue; /* Loop/switch isn't completed */
        }
        i = ((Number)obj).intValue();
        if (i == 0 || i == 1) goto _L6; else goto _L8
_L8:
        throw new DaoException((new StringBuilder()).append("Illegal boolean value: numbers must be 0 or 1, but was ").append(obj).toString());
        if (!(obj instanceof String)) goto _L6; else goto _L9
_L9:
        String s = (String)obj;
        if ("TRUE".equalsIgnoreCase(s))
        {
            return Integer.valueOf(1);
        }
        if ("FALSE".equalsIgnoreCase(s))
        {
            return Integer.valueOf(0);
        } else
        {
            throw new DaoException((new StringBuilder()).append("Illegal boolean value: Strings must be \"TRUE\" or \"FALSE\" (case insesnsitive), but was ").append(obj).toString());
        }
    }
 
Example #20
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public transient QueryBuilder orderDesc(Property aproperty[])
{
    orderAscOrDesc(" DESC", aproperty);
    return this;
}
 
Example #21
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public transient QueryBuilder orderAsc(Property aproperty[])
{
    orderAscOrDesc(" ASC", aproperty);
    return this;
}
 
Example #22
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public QueryBuilder joinToMany(Class class1, Property property)
{
    throw new UnsupportedOperationException();
}
 
Example #23
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static List getList(AbstractDao dao, Property... orderProperty) {
    return getList(dao,true,orderProperty);
}
 
Example #24
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public QueryBuilder join(Class class1, Property property)
{
    throw new UnsupportedOperationException();
}
 
Example #25
Source File: QueryBuilder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
protected StringBuilder append(StringBuilder stringbuilder, Property property)
{
    checkProperty(property);
    stringbuilder.append(tablePrefix).append('.').append('\'').append(property.columnName).append('\'');
    return stringbuilder;
}
 
Example #26
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 2 votes vote down vote up
/**
 * @see #getList(de.greenrobot.dao.AbstractDao, de.greenrobot.dao.Property, de.greenrobot.dao.query.WhereCondition, de.greenrobot.dao.query.WhereCondition...)
 * @param dao
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, Property... orderProperty) {
    return getList(dao,true,orderProperty);
}
 
Example #27
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 2 votes vote down vote up
/**
 * @see #getList(de.greenrobot.dao.AbstractDao, de.greenrobot.dao.Property, de.greenrobot.dao.query.WhereCondition, de.greenrobot.dao.query.WhereCondition...)
 * @param dao
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, Property... orderProperty) {
    return getList(dao,true,orderProperty);
}