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

The following examples show how to use de.greenrobot.daogenerator.Entity#setHasKeepSections() . 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 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 2
Source File: GreenDaoGenerator.java    From sctalk with Apache License 2.0 6 votes vote down vote up
private static void addGroupInfo(Schema schema) {
    Entity groupInfo = schema.addEntity("GroupEntity");
    groupInfo.setTableName("GroupInfo");
    groupInfo.setClassNameDao("GroupDao");
    groupInfo.setJavaPackage(entityPath);

    groupInfo.addIdProperty().autoincrement();
    groupInfo.addIntProperty("peerId").unique().notNull();
    groupInfo.addIntProperty("groupType").notNull();
    groupInfo.addStringProperty("mainName").notNull();
    groupInfo.addStringProperty("avatar").notNull();
    groupInfo.addIntProperty("creatorId").notNull();
    groupInfo.addIntProperty("userCnt").notNull();

    groupInfo.addStringProperty("userList").notNull();
    groupInfo.addIntProperty("version").notNull();
    groupInfo.addIntProperty("status").notNull();
    groupInfo.addIntProperty("created").notNull();
    groupInfo.addIntProperty("updated").notNull();

    groupInfo.setHasKeepSections(true);
}
 
Example 3
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 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: 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 6
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 7
Source File: BrainphaserDaoGenerator.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
public static Entity createUserEntity(Schema schema) {
    Entity user = schema.addEntity("User");
    user.addIdProperty();
    user.addStringProperty("name").notNull();
    user.addStringProperty("avatar").notNull();
    user.setHasKeepSections(true);

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

        Entity table = schema.addEntity("Green_AtUsersBean");
        table.setHasKeepSections(true);
        table.setTableName(AtUsersTable.TABLE_NAME);
        table.implementsSerializable();

        table.addStringProperty(AtUsersTable.ACCOUNTID);
        table.addStringProperty(AtUsersTable.AT_USERID);
        table.addStringProperty(AtUsersTable.AT_USER_INFO_JSON);
    }
 
Example 9
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 10
Source File: DbDaoGenerator.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private static void addNote(Schema schema) {
    Entity note = schema.addEntity("Brand");
    note.addIdProperty();
    note.addStringProperty("brandName").notNull();
    note.addStringProperty("brandId").notNull();
    note.addDateProperty("brandImageUri");
    note.addStringProperty("brandInfos");
    note.setHasKeepSections(true);
    note.setSkipGeneration(true);
}
 
Example 11
Source File: DbDaoGenerator.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private static void addNote(Schema schema) {
    Entity note = schema.addEntity("Brand");
    note.addIdProperty();
    note.addStringProperty("brandName").notNull();
    note.addStringProperty("brandId").notNull();
    note.addDateProperty("brandImageUri");
    note.addStringProperty("brandInfos");
    note.setHasKeepSections(true);
    note.setSkipGeneration(true);
}
 
Example 12
Source File: GreenDaoGen.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private static void addAtUsersTable(Schema schema) {

        Entity table = schema.addEntity("Green_AtUsersBean");
        table.setHasKeepSections(true);
        table.setTableName(AtUsersTable.TABLE_NAME);
        table.implementsSerializable();

        table.addStringProperty(AtUsersTable.ACCOUNTID);
        table.addStringProperty(AtUsersTable.AT_USERID);
        table.addStringProperty(AtUsersTable.AT_USER_INFO_JSON);
    }
 
Example 13
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);

    }