Java Code Examples for de.greenrobot.daogenerator.Entity#addIntProperty()

The following examples show how to use de.greenrobot.daogenerator.Entity#addIntProperty() . 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: Generator.java    From android-orm-benchmark with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    Schema schema = new Schema(DB_VERSION, PACKAGE);

    Entity user = schema.addEntity(USER_ENTITY);
    Property userPk = addCommonColumns(user);

    Entity message = schema.addEntity(MESSAGE_ENTITY);
    message.addIdProperty().autoincrement();
    message.addStringProperty(CONTENT);
    message.addLongProperty(CLIENT_ID);
    message.addIntProperty(CREATED_AT);
    message.addDoubleProperty(SORTED_BY);
    message.addLongProperty(COMMAND_ID).index();
    message.addLongProperty(SENDER_ID).notNull();
    message.addLongProperty(CHANNEL_ID).notNull();

    // One-to-many relationship
    message.addToMany(user, userPk, READERS);

    try {
        new DaoGenerator().generateAll(schema, "../ORM-Benchmark/src/");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: GreenDaoGenerator.java    From DMusic with Apache License 2.0 6 votes vote down vote up
/**
 * 添加公共字段
 */
private static void addProperty(Entity entity) {
    entity.addStringProperty("id").primaryKey(); // 文件完整路径---主键

    entity.addIntProperty("type"); // 类型:本地、百度、网易、QQ等
    entity.addIntProperty("seq"); // 自定义序号
    entity.addStringProperty("songId"); // 歌曲ID
    entity.addStringProperty("songName"); // 歌曲名
    entity.addStringProperty("songUrl"); // 歌曲url
    entity.addStringProperty("artistId"); // 艺术家ID
    entity.addStringProperty("artistName"); // 歌手名
    entity.addStringProperty("albumId"); // 专辑ID
    entity.addStringProperty("albumName"); // 专辑
    entity.addStringProperty("albumUrl"); // 专辑url
    entity.addStringProperty("lrcName"); // 歌词名称
    entity.addStringProperty("lrcUrl"); // 歌词路径

    entity.addLongProperty("fileDuration"); // 歌曲时长
    entity.addLongProperty("fileSize"); // 文件大小
    entity.addStringProperty("filePostfix"); // 文件后缀类型
    entity.addStringProperty("fileFolder"); // 父文件夹绝对路径

    entity.addBooleanProperty("isCollected"); // 是否收藏
    entity.addLongProperty("timeStamp"); // 时间戳,插入时间
}
 
Example 3
Source File: GreenDaoGen.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
private static void addAccountTable(Schema schema) {

        Entity table = schema.addEntity("Green_AccountBean");
        table.setHasKeepSections(true);
        table.setTableName(AccountTable.ACCOUNT_TABLE);
        table.implementsSerializable();

        table.addLongProperty(AccountTable.UID).primaryKey();
        table.addStringProperty(AccountTable.USER_NAME);
        table.addStringProperty(AccountTable.USER_PWD);
        table.addStringProperty(AccountTable.COOKIE);
        table.addStringProperty(AccountTable.OAUTH_TOKEN);
        table.addLongProperty(AccountTable.OAUTH_TOKEN_EXPIRES_TIME);
        table.addStringProperty(AccountTable.ACCESS_TOKEN_HACK);
        table.addLongProperty(AccountTable.ACCESS_TOKEN_HACK_EXPIRES_TIME);
        table.addStringProperty(AccountTable.G_SID);
        table.addIntProperty(AccountTable.NAVIGATION_POSITION);
        table.addStringProperty(AccountTable.USER_INFO_JSON);
    }
 
Example 4
Source File: GreenDaoGen.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
private static void addAccountTable(Schema schema) {

        Entity table = schema.addEntity("Green_AccountBean");
        table.setHasKeepSections(true);
        table.setTableName(AccountTable.ACCOUNT_TABLE);
        table.implementsSerializable();

        table.addLongProperty(AccountTable.UID).primaryKey();
        table.addStringProperty(AccountTable.USER_NAME);
        table.addStringProperty(AccountTable.USER_PWD);
        table.addStringProperty(AccountTable.COOKIE);
        table.addStringProperty(AccountTable.OAUTH_TOKEN);
        table.addLongProperty(AccountTable.OAUTH_TOKEN_EXPIRES_TIME);
        table.addStringProperty(AccountTable.ACCESS_TOKEN_HACK);
        table.addLongProperty(AccountTable.ACCESS_TOKEN_HACK_EXPIRES_TIME);
        table.addStringProperty(AccountTable.G_SID);
        table.addIntProperty(AccountTable.NAVIGATION_POSITION);
        table.addStringProperty(AccountTable.USER_INFO_JSON);
    }
 
Example 5
Source File: HttpCookieDaoGenerator.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
private static void addHttpCookie(Schema schema) {
    Entity entity = schema.addEntity("HttpCookieRaw");
    entity.setTableName("HTTP_COOKIE");
    entity.setClassNameDao("HttpCookieDao");
    entity.addIdProperty();
    entity.addStringProperty("name");
    entity.addStringProperty("value");
    entity.addStringProperty("comment");
    entity.addStringProperty("commentURL");
    entity.addBooleanProperty("discard");
    entity.addStringProperty("domain");
    entity.addLongProperty("maxAge");
    entity.addStringProperty("path");
    entity.addStringProperty("portList");
    entity.addBooleanProperty("secure");
    entity.addIntProperty("version");
    entity.addStringProperty("url");
    entity.addLongProperty("whenCreated");
}
 
Example 6
Source File: NMBDaoGenerator.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
private static void addACForum(Schema schema) {
    Entity entity = schema.addEntity("ACForumRaw");
    entity.setTableName("AC_FORUM");
    entity.setClassNameDao("ACForumDao");
    entity.addIdProperty();
    entity.addStringProperty("forumid");
    entity.addStringProperty("displayname");
    entity.addIntProperty("priority");
    entity.addBooleanProperty("visibility");

    // @since 4
    entity.addStringProperty("msg");

    // @since 5
    entity.addBooleanProperty("official");

    // @since 6
    entity.addIntProperty("frequency");
}
 
Example 7
Source File: GreenDaoGen.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private static void addStatusTable(Schema schema) {

        Entity table = schema.addEntity("Green_TimeLineStatus");
        table.setHasKeepSections(true);
        table.setTableName(TimeLineStatusTable.TABLE_NAME);
        table.implementsSerializable();

        table.addIntProperty(TimeLineStatusTable.ID);
        table.addStringProperty(TimeLineStatusTable.ACCOUNTID);
        table.addStringProperty(TimeLineStatusTable.MBLOGID);
        table.addStringProperty(TimeLineStatusTable.JSONDATA);

    }
 
Example 8
Source File: GreenDaoGen.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private static void addStatusTable(Schema schema) {

        Entity table = schema.addEntity("Green_TimeLineStatus");
        table.setHasKeepSections(true);
        table.setTableName(TimeLineStatusTable.TABLE_NAME);
        table.implementsSerializable();

        table.addIntProperty(TimeLineStatusTable.ID);
        table.addStringProperty(TimeLineStatusTable.ACCOUNTID);
        table.addStringProperty(TimeLineStatusTable.MBLOGID);
        table.addStringProperty(TimeLineStatusTable.JSONDATA);

    }
 
Example 9
Source File: MyDaoGenerator.java    From JianDan_OkHttp with Apache License 2.0 5 votes vote down vote up
/**
 * 添加不同的缓存表
 * @param schema
 * @param tableName
 */
private static void addCache(Schema schema, String tableName) {

	Entity joke = schema.addEntity(tableName);

	//主键id自增长
	joke.addIdProperty().primaryKey().autoincrement();
	//请求结果
	joke.addStringProperty("result");
	//页数
	joke.addIntProperty("page");
	//插入时间,暂时无用
	joke.addLongProperty("time");

}
 
Example 10
Source File: MyDaoGenerator.java    From JianDanRxJava with Apache License 2.0 5 votes vote down vote up
/**
 * 添加不同的缓存表
 * @param schema
 * @param tableName
 */
private static void addCache(Schema schema, String tableName) {

	Entity joke = schema.addEntity(tableName);

	//主键id自增长
	joke.addIdProperty().primaryKey().autoincrement();
	//请求结果
	joke.addStringProperty("result");
	//页数
	joke.addIntProperty("page");
	//插入时间,暂时无用
	joke.addLongProperty("time");

}
 
Example 11
Source File: MyDaoGenerator.java    From JianDan with Apache License 2.0 5 votes vote down vote up
/**
 * 添加不同的缓存表
 * @param schema
 * @param tableName
 */
private static void addCache(Schema schema, String tableName) {

	Entity joke = schema.addEntity(tableName);

	//主键id自增长
	joke.addIdProperty().primaryKey().autoincrement();
	//请求结果
	joke.addStringProperty("result");
	//页数
	joke.addIntProperty("page");
	//插入时间,暂时无用
	joke.addLongProperty("time");

}
 
Example 12
Source File: MyDaoGenerator.java    From JianDan_OkHttpWithVolley with Apache License 2.0 5 votes vote down vote up
/**
 * 添加不同的缓存表
 * @param schema
 * @param tableName
 */
private static void addCache(Schema schema, String tableName) {

	Entity joke = schema.addEntity(tableName);

	//主键id自增长
	joke.addIdProperty().primaryKey().autoincrement();
	//请求结果
	joke.addStringProperty("result");
	//页数
	joke.addIntProperty("page");
	//插入时间,暂时无用
	joke.addLongProperty("time");

}
 
Example 13
Source File: NMBDaoGenerator.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
/**
 * @since 2
 */
private static void addACRecord(Schema schema) {
    Entity entity = schema.addEntity("ACRecordRaw");
    entity.setTableName("AC_RECORD");
    entity.setClassNameDao("ACRecordDao");
    entity.addIdProperty();
    entity.addIntProperty("type");
    entity.addStringProperty("recordid");
    entity.addStringProperty("postid");
    entity.addStringProperty("content");
    entity.addStringProperty("image");
    entity.addLongProperty("time");
}
 
Example 14
Source File: MyDaoGenerator.java    From MyWeather with Apache License 2.0 5 votes vote down vote up
private static void addAqi(Schema schema) {
    Entity weekForeCast = schema.addEntity("Aqi");
    weekForeCast.addStringProperty("areaid");
    weekForeCast.addIntProperty("aqi");
    weekForeCast.addStringProperty("quality");
    weekForeCast.addIntProperty("pm2_5");
    weekForeCast.addIntProperty("pm10");
    weekForeCast.addIntProperty("so2");
    weekForeCast.addIntProperty("no2");
}
 
Example 15
Source File: MyDaoGenerator.java    From MyWeather with Apache License 2.0 5 votes vote down vote up
private static void addHourForeCast(Schema schema) {
    Entity weekForeCast = schema.addEntity("HourForeCast");
    weekForeCast.addStringProperty("areaid");
    weekForeCast.addStringProperty("hour");
    weekForeCast.addStringProperty("weatherCondition");
    weekForeCast.addIntProperty("temp");
}
 
Example 16
Source File: MyDaoGenerator.java    From MyWeather with Apache License 2.0 5 votes vote down vote up
private static void addForeCast(Schema schema) {
    Entity weekForeCast = schema.addEntity("WeekForeCast");
    weekForeCast.addStringProperty("areaid");
    weekForeCast.addDateProperty("weatherDate");
    weekForeCast.addStringProperty("weatherConditionStart");
    weekForeCast.addStringProperty("weatherConditionEnd");
    weekForeCast.addIntProperty("tempH");
    weekForeCast.addIntProperty("tempL");
    weekForeCast.addStringProperty("fx");
    weekForeCast.addStringProperty("fj");
    weekForeCast.addIntProperty("rainPerCent");
}
 
Example 17
Source File: MyDaoGenerator.java    From MyWeather with Apache License 2.0 5 votes vote down vote up
private static void addRealWeather(Schema schema) {
    Entity realWeather = schema.addEntity("RealWeather");
    realWeather.addStringProperty("areaid");
    realWeather.addStringProperty("areaName");
    realWeather.addStringProperty("weatherCondition");
    realWeather.addStringProperty("fx");
    realWeather.addStringProperty("fj");
    realWeather.addIntProperty("temp");
    realWeather.addIntProperty("feeltemp");
    realWeather.addIntProperty("shidu");
    realWeather.addStringProperty("sunrise");
    realWeather.addStringProperty("sundown");
    realWeather.addDateProperty("lastUpdate");
}
 
Example 18
Source File: GreenDaoGenerator.java    From Dota2Helper with Apache License 2.0 5 votes vote down vote up
public static void addHistoryVideo(Schema schema) {
    Entity video = schema.addEntity("GreenWatchedVideo");
    video.addStringProperty("videoyoukuvid").primaryKey();
    video.addStringProperty("videobackground");
    video.addStringProperty("videotitle");
    video.addLongProperty("videowatchtime");
    video.addIntProperty("videoduration");
    video.addIntProperty("videoplaytime");
    video.addBooleanProperty("videoEnded");
}
 
Example 19
Source File: BrainphaserDaoGenerator.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
public static Entity createCompletedEntity(Schema schema) {
    Entity completed = schema.addEntity("Completion");
    completed.addIdProperty();
    completed.addIntProperty("stage");
    completed.addDateProperty("lastCompleted");

    return completed;
}
 
Example 20
Source File: GreenDaoGenerator.java    From DMusic with Apache License 2.0 5 votes vote down vote up
/**
 * TransferModel - 传输
 */
private static void addTransferModel(Schema schema) {
    Entity entity = schema.addEntity("TransferModel"); // 表名
    entity.addStringProperty("transferId").primaryKey(); // 文件完整路径---主键
    entity.addIntProperty("transferType");
    entity.addIntProperty("transferState");
    entity.addLongProperty("transferCurrentLength");
    entity.addLongProperty("transferTotalLength");

    entity.addStringProperty("id"); // 文件完整路径

    entity.addIntProperty("type"); // 类型:本地、百度、网易、QQ等
    entity.addIntProperty("seq"); // 自定义序号
    entity.addStringProperty("songId"); // 歌曲ID
    entity.addStringProperty("songName"); // 歌曲名
    entity.addStringProperty("songUrl"); // 歌曲url
    entity.addStringProperty("artistId"); // 艺术家ID
    entity.addStringProperty("artistName"); // 歌手名
    entity.addStringProperty("albumId"); // 专辑ID
    entity.addStringProperty("albumName"); // 专辑
    entity.addStringProperty("albumUrl"); // 专辑url
    entity.addStringProperty("lrcName"); // 歌词名称
    entity.addStringProperty("lrcUrl"); // 歌词路径

    entity.addLongProperty("fileDuration"); // 歌曲时长
    entity.addLongProperty("fileSize"); // 文件大小
    entity.addStringProperty("filePostfix"); // 文件后缀类型
    entity.addStringProperty("fileFolder"); // 父文件夹绝对路径

    entity.addBooleanProperty("isCollected"); // 是否收藏
    entity.addLongProperty("timeStamp"); // 时间戳,插入时间
}