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

The following examples show how to use de.greenrobot.daogenerator.Entity#setTableName() . 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: 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 2
Source File: EhDaoGenerator.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
private static void addHistoryInfo(Schema schema) {
    Entity entity = schema.addEntity("HistoryInfo");
    entity.setTableName("HISTORY");
    entity.setClassNameDao("HistoryDao");
    entity.setSuperclass("GalleryInfo");
    // GalleryInfo data
    entity.addStringProperty("gid").notNull();
    entity.addStringProperty("token");
    entity.addStringProperty("title");
    entity.addStringProperty("titleJpn");
    entity.addStringProperty("thumb");
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("posted");
    entity.addStringProperty("uploader");
    entity.addFloatProperty("rating").notNull();
    entity.addStringProperty("simpleLanguage");
    // HistoryInfo data
    entity.addIntProperty("mode").notNull();
    entity.addLongProperty("time").notNull();
    entity.addStringProperty("id").primaryKey().notNull();
}
 
Example 3
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private static void addQuickSearch(Schema schema) {
    Entity entity = schema.addEntity("QuickSearch");
    entity.setTableName("QUICK_SEARCH");
    entity.setClassNameDao("QuickSearchDao");
    entity.addIdProperty();
    entity.addStringProperty("name");
    entity.addIntProperty("mode").notNull();
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("keyword");
    entity.addIntProperty("advanceSearch").notNull();
    entity.addIntProperty("minRating").notNull();
    // Since 4
    entity.addIntProperty("pageFrom").notNull();
    // Since 4
    entity.addIntProperty("pageTo").notNull();
    entity.addLongProperty("time").notNull();
}
 
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: EhDaoGenerator.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
private static void addBookmarks(Schema schema) {
    Entity entity = schema.addEntity("BookmarkInfo");
    entity.setTableName("BOOKMARKS");
    entity.setClassNameDao("BookmarksBao");
    entity.setSuperclass("GalleryInfo");
    // GalleryInfo data
    entity.addStringProperty("gid").primaryKey().notNull();
    entity.addStringProperty("token");
    entity.addStringProperty("title");
    entity.addStringProperty("titleJpn");
    entity.addStringProperty("thumb");
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("posted");
    entity.addStringProperty("uploader");
    entity.addFloatProperty("rating").notNull();
    entity.addStringProperty("simpleLanguage");
    // Bookmark data
    entity.addIntProperty("page").notNull();
    entity.addLongProperty("time").notNull();
}
 
Example 6
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private static void addDownloads(Schema schema) {
    Entity entity = schema.addEntity("DownloadInfo");
    entity.setTableName("DOWNLOADS");
    entity.setClassNameDao("DownloadsDao");
    entity.setSuperclass("GalleryInfo");
    // GalleryInfo data
    entity.addLongProperty("gid").primaryKey().notNull();
    entity.addStringProperty("token");
    entity.addStringProperty("title");
    entity.addStringProperty("titleJpn");
    entity.addStringProperty("thumb");
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("posted");
    entity.addStringProperty("uploader");
    entity.addFloatProperty("rating").notNull();
    entity.addStringProperty("simpleLanguage");
    // DownloadInfo data
    entity.addIntProperty("state").notNull();
    entity.addIntProperty("legacy").notNull();
    entity.addLongProperty("time").notNull();
    entity.addStringProperty("label");
}
 
Example 7
Source File: GreenDaoGenerator.java    From sctalk with Apache License 2.0 6 votes vote down vote up
private static void addDepartment(Schema schema){
    Entity department = schema.addEntity("DepartmentEntity");
    department.setTableName("Department");
    department.setClassNameDao("DepartmentDao");
    department.setJavaPackage(entityPath);

    department.addIdProperty().autoincrement();
    department.addIntProperty("departId").unique().notNull().index();
    department.addStringProperty("departName").unique().notNull().index();
    department.addIntProperty("priority").notNull();
    department.addIntProperty("status").notNull();

    department.addIntProperty("created").notNull();
    department.addIntProperty("updated").notNull();

    department.setHasKeepSections(true);
}
 
Example 8
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private static void addBookmarks(Schema schema) {
    Entity entity = schema.addEntity("BookmarkInfo");
    entity.setTableName("BOOKMARKS");
    entity.setClassNameDao("BookmarksBao");
    entity.setSuperclass("GalleryInfo");
    // GalleryInfo data
    entity.addLongProperty("gid").primaryKey().notNull();
    entity.addStringProperty("token");
    entity.addStringProperty("title");
    entity.addStringProperty("titleJpn");
    entity.addStringProperty("thumb");
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("posted");
    entity.addStringProperty("uploader");
    entity.addFloatProperty("rating").notNull();
    entity.addStringProperty("simpleLanguage");
    // Bookmark data
    entity.addIntProperty("page").notNull();
    entity.addLongProperty("time").notNull();
}
 
Example 9
Source File: DbDaoGenerator.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private static void addCustomerOrder(Schema schema) {
    Entity customer = schema.addEntity("Customer");
    customer.addIdProperty();
    customer.addStringProperty("name").notNull();

    Entity order = schema.addEntity("Order");
    order.setTableName("ORDERS"); // "ORDER" is a reserved keyword
    order.addIdProperty();
    Property orderDate = order.addDateProperty("date").getProperty();
    Property customerId = order.addLongProperty("customerId").notNull().getProperty();
    order.addToOne(customer, customerId);

    ToMany customerToOrders = customer.addToMany(order, customerId);
    customerToOrders.setName("orders");
    customerToOrders.orderAsc(orderDate);
}
 
Example 10
Source File: GreenDaoGenerator.java    From sctalk with Apache License 2.0 6 votes vote down vote up
private static void addSessionInfo(Schema schema){
    Entity sessionInfo = schema.addEntity("SessionEntity");
    sessionInfo.setTableName("Session");
    sessionInfo.setClassNameDao("SessionDao");
    sessionInfo.setJavaPackage(entityPath);

    //point to userId/groupId need sessionType 区分
    sessionInfo.addIdProperty().autoincrement();
    sessionInfo.addStringProperty("sessionKey").unique().notNull(); //.unique()
    sessionInfo.addIntProperty("peerId").notNull();
    sessionInfo.addIntProperty("peerType").notNull();

    sessionInfo.addIntProperty("latestMsgType").notNull();
    sessionInfo.addIntProperty("latestMsgId").notNull();
    sessionInfo.addStringProperty("latestMsgData").notNull();

    sessionInfo.addIntProperty("talkId").notNull();
    sessionInfo.addIntProperty("created").notNull();
    sessionInfo.addIntProperty("updated").notNull();

    sessionInfo.setHasKeepSections(true);
}
 
Example 11
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 12
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private static void addLocalFavorites(Schema schema) {
    Entity entity = schema.addEntity("LocalFavoriteInfo");
    entity.setTableName("LOCAL_FAVORITES");
    entity.setClassNameDao("LocalFavoritesDao");
    entity.setSuperclass("GalleryInfo");
    // GalleryInfo data
    entity.addLongProperty("gid").primaryKey().notNull();
    entity.addStringProperty("token");
    entity.addStringProperty("title");
    entity.addStringProperty("titleJpn");
    entity.addStringProperty("thumb");
    entity.addIntProperty("category").notNull();
    entity.addStringProperty("posted");
    entity.addStringProperty("uploader");
    entity.addFloatProperty("rating").notNull();
    entity.addStringProperty("simpleLanguage");
    // LocalFavoriteInfo data
    entity.addLongProperty("time").notNull();
}
 
Example 13
Source File: GreenDaoGenerator.java    From sctalk with Apache License 2.0 5 votes vote down vote up
private static void addUserInfo(Schema schema) {
    Entity userInfo = schema.addEntity("UserEntity");
    userInfo.setTableName("UserInfo");
    userInfo.setClassNameDao("UserDao");
    userInfo.setJavaPackage(entityPath);

    userInfo.addIdProperty().autoincrement();
    userInfo.addIntProperty("peerId").unique().notNull().index();
    userInfo.addIntProperty("gender").notNull();
    userInfo.addStringProperty("mainName").notNull();
    // 这个可以自动生成pinyin
    userInfo.addStringProperty("pinyinName").notNull();
    userInfo.addStringProperty("realName").notNull();
    userInfo.addStringProperty("avatar").notNull();
    userInfo.addStringProperty("phone").notNull();
    userInfo.addStringProperty("email").notNull();
    userInfo.addIntProperty("departmentId").notNull();

    userInfo.addIntProperty("status").notNull();
    userInfo.addIntProperty("created").notNull();
    userInfo.addIntProperty("updated").notNull();

    userInfo.setHasKeepSections(true);

    //todo 索引还没有设定
    // 一对一 addToOne 的使用
    // 支持protobuf
    // schema.addProtobufEntity();
}
 
Example 14
Source File: NMBDaoGenerator.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
/**
 * @since 3
 */
private static void addACCommonPost(Schema schema) {
    Entity entity = schema.addEntity("ACCommonPostRaw");
    entity.setTableName("AC_COMMON_POST");
    entity.setClassNameDao("ACCommonPostDao");
    entity.addIdProperty();
    entity.addStringProperty("name");
    entity.addStringProperty("postid");
}
 
Example 15
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 16
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 17
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 18
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private static void addDownloadLabel(Schema schema) {
    Entity entity = schema.addEntity("DownloadLabel");
    entity.setTableName("DOWNLOAD_LABELS");
    entity.setClassNameDao("DownloadLabelDao");
    entity.addIdProperty();
    entity.addStringProperty("label");
    entity.addLongProperty("time").notNull();
}
 
Example 19
Source File: EhDaoGenerator.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
private static void addDownloadLabel(Schema schema) {
    Entity entity = schema.addEntity("DownloadLabel");
    entity.setTableName("DOWNLOAD_LABELS");
    entity.setClassNameDao("DownloadLabelDao");
    entity.addIdProperty();
    entity.addStringProperty("label");
    entity.addLongProperty("time").notNull();
}
 
Example 20
Source File: EhDaoGenerator.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private static void addDownloadDirname(Schema schema) {
    Entity entity = schema.addEntity("DownloadDirname");
    entity.setTableName("DOWNLOAD_DIRNAME");
    entity.setClassNameDao("DownloadDirnameDao");
    entity.addLongProperty("gid").primaryKey().notNull();
    entity.addStringProperty("dirname");
}