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

The following examples show how to use de.greenrobot.daogenerator.Entity#addLongProperty() . 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: 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 2
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 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: 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 6
Source File: EhDaoGenerator.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
private static void addReadingRecord(Schema schema) {
    Entity entity = schema.addEntity("ReadingRecord");
    entity.setTableName("RECORDS");
    entity.setClassNameDao("ReadingRecordDao");
    entity.addStringProperty("id").primaryKey().notNull();
    entity.addLongProperty("update_time").notNull();
    entity.addLongProperty("read_time");
    entity.addStringProperty("chapter_info");
}
 
Example 7
Source File: GreenDaoGenerator.java    From DMusic with Apache License 2.0 5 votes vote down vote up
/**
 * CustomList - 自定义列表
 */
private static void addCustomList(Schema schema) {
    Entity entity = schema.addEntity("CustomListModel"); // 表名

    entity.addIdProperty().autoincrement(); // id主键自增
    entity.addStringProperty("name"); // 歌曲列表名
    entity.addLongProperty("count"); // 包含歌曲数
    entity.addIntProperty("seq"); // 排序显示序号
    entity.addIntProperty("sortType"); // 排序方式(1:按名称排序,2:按时间排序,3:自定义排序)
    entity.addIntProperty("pointer"); // 指针:指向数据库相应表
}
 
Example 8
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"); // 时间戳,插入时间
}
 
Example 9
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 10
Source File: NMBDaoGenerator.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
private static void addDraft(Schema schema) {
    Entity entity = schema.addEntity("DraftRaw");
    entity.setTableName("DRAFT");
    entity.setClassNameDao("DraftDao");
    entity.addIdProperty();
    entity.addStringProperty("content");
    entity.addLongProperty("time");
}
 
Example 11
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 12
Source File: Generator.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
static Entity getAddressItemEntity(Schema schema, String name) {
    Entity simpleAddressItem = schema.addEntity(name);
    simpleAddressItem.addIdProperty();
    simpleAddressItem.addStringProperty("name");
    simpleAddressItem.addStringProperty("address");
    simpleAddressItem.addStringProperty("city");
    simpleAddressItem.addStringProperty("state");
    simpleAddressItem.addLongProperty("phone");
    return simpleAddressItem;
}
 
Example 13
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 14
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 15
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 16
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");

}