当前位置: 首页>>代码示例>>Java>>正文


Java Schema.addEntity方法代码示例

本文整理汇总了Java中de.greenrobot.daogenerator.Schema.addEntity方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.addEntity方法的具体用法?Java Schema.addEntity怎么用?Java Schema.addEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.greenrobot.daogenerator.Schema的用法示例。


在下文中一共展示了Schema.addEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addGroupInfo

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
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);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:23,代码来源:GreenDaoGenerator.java

示例2: addThread

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static Property addThread(Schema schema) {
    Property threadId;

    thread = schema.addEntity(EntityProperties.BThread);
    thread.addIdProperty();
    threadId = thread.addStringProperty(EntityProperties.EntityID).getProperty();
    thread.addDateProperty(EntityProperties.CreationDate);
    thread.addBooleanProperty(EntityProperties.HasUnreadMessaged);
    thread.addBooleanProperty(EntityProperties.BDeleted);
    thread.addStringProperty(EntityProperties.Name);
    thread.addDateProperty(EntityProperties.LastMessageAdded);
    thread.addIntProperty(EntityProperties.Type);
    thread.addStringProperty(EntityProperties.CreatorEntityID);
    thread.addStringProperty(EntityProperties.BThreadImageUrl);
    thread.addStringProperty(EntityProperties.RootKey).columnName(EntityProperties.C_RootKey);
    thread.addStringProperty(EntityProperties.ApiKey).columnName(EntityProperties.C_ApiKey);

    Property threadPropCreator = thread.addLongProperty(EntityProperties.CreatorID).getProperty();
    ToOne threadToOneCreator = thread.addToOne(user, threadPropCreator);
    threadToOneCreator.setName(EntityProperties.Creator);

    return threadId;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:24,代码来源:Generator.java

示例3: addMessages

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static Property addMessages(Schema schema){
    Property messageId;
    message = schema.addEntity(EntityProperties.BMessage);
    message.addIdProperty();
    messageId = message.addStringProperty(EntityProperties.EntityID).getProperty();
    message.addDateProperty(EntityProperties.Date);
    message.addBooleanProperty(EntityProperties.isRead);
    message.addStringProperty(EntityProperties.Resource);
    message.addStringProperty(EntityProperties.ResourcePath);
    message.addStringProperty(EntityProperties.Text);
    message.addStringProperty(EntityProperties.ImageDimensions);
    message.addIntProperty(EntityProperties.Type);
    message.addIntProperty(EntityProperties.Status);
    message.addIntProperty(EntityProperties.Delivered);

    // The sender ID
    Property messagePropSender = message.addLongProperty("Sender").getProperty();
    ToOne messageToOneSender = message.addToOne(user, messagePropSender);
    messageToOneSender.setName("BUserSender");

    return messageId;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:23,代码来源:Generator.java

示例4: addDepartment

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
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);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:18,代码来源:GreenDaoGenerator.java

示例5: addMessage

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static Entity addMessage(Schema schema){
    Entity message = schema.addEntity("Message");
    message.addIdProperty().primaryKey().autoincrement();
    message.addStringProperty("message_id");
    message.addStringProperty("created_at");
    message.addStringProperty("updated_at");
    message.addStringProperty("attachments");
    message.addStringProperty("read_ids");
    message.addStringProperty("delivered_ids");
    message.addStringProperty("chat_dialog_id");
    message.addLongProperty("date_sent");
    message.addStringProperty("message");
    message.addStringProperty("recipient_id");
    message.addIntProperty("sender_id");
    message.addIntProperty("read");
    return message;
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:18,代码来源:InitDao.java

示例6: addSessionInfo

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
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);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:23,代码来源:GreenDaoGenerator.java

示例7: testMinimalSchema

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
@Test
public void testMinimalSchema() throws Exception {
    Schema schema = new Schema(1, "de.greenrobot.testdao");
    Entity addressEntity = schema.addEntity("Addresse");
    Property idProperty = addressEntity.addIdProperty().getProperty();
    addressEntity.addIntProperty("count").index();
    addressEntity.addIntProperty("dummy").notNull();
    assertEquals(1, schema.getEntities().size());
    assertEquals(3, addressEntity.getProperties().size());

    File daoFile = new File("test-out/de/greenrobot/testdao/" + addressEntity.getClassName() + "Dao.java");
    daoFile.delete();
    assertFalse(daoFile.exists());

    new DaoGenerator().generateAll(schema, "test-out");

    assertEquals("PRIMARY KEY", idProperty.getConstraints());
    assertTrue(daoFile.toString(), daoFile.exists());
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:20,代码来源:SimpleDaoGeneratorTest.java

示例8: addNote

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
/**
 * @param schema
 */
private static void addNote(Schema schema) {
    // 一个实体(类)就关联到数据库中的一张表,此处表名为「Note」(既类名)
    Entity note = schema.addEntity("Note");
    // 你也可以重新给表命名
    // note.setTableName("NODE");

    // greenDAO 会自动根据实体类的属性值来创建表字段,并赋予默认值
    // 接下来你便可以设置表中的字段:
    note.addIdProperty();
    note.addStringProperty("text").notNull();
    // 与在 Java 中使用驼峰命名法不同,默认数据库中的命名是使用大写和下划线来分割单词的。
    // For example, a property called “creationDate” will become a database column “CREATION_DATE”.
    note.addStringProperty("comment");
    note.addDateProperty("date");
}
 
开发者ID:Thereisnospon,项目名称:BlogReader,代码行数:19,代码来源:DataDaoGenerator.java

示例9: addHtml

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static void addHtml(Schema schema) {

        // 实体类
        Entity mHtmlEntity = schema.addEntity("HtmlEntity");//表名

        //列名
        mHtmlEntity.addIdProperty();//主键id
        mHtmlEntity.addStringProperty("url");//连接
        mHtmlEntity.addStringProperty("type");//类型
        mHtmlEntity.addStringProperty("title");//标题
        mHtmlEntity.addStringProperty("html");//html
        mHtmlEntity.addStringProperty("summary");//总结
        mHtmlEntity.addStringProperty("collect");//是否收藏



        mHtmlEntity.addDateProperty("hireDate");


        // 收藏实体类
        Entity mCollectEntity = schema.addEntity("CollectEntity");//表名
        mCollectEntity.addIdProperty();//主键id
        Property htmlID =   mCollectEntity.addLongProperty("html_id").getProperty();//收藏的id
        mCollectEntity.addStringProperty("collect");//是否收藏
        mCollectEntity.addToOne(mHtmlEntity, htmlID);
    }
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:27,代码来源:DBClass.java

示例10: getTable

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
public static Entity getTable(Schema schema, Class c){
    Entity entity = null;
    String table = null;
    try {
        Field field = c.getDeclaredField("TABLE_NAME");
        field.setAccessible(true);
        table = (String) field.get(null);
        table = table.substring(0,1).toUpperCase() + table.substring(1);
        entity = schema.addEntity(table);
    } catch (Exception e) {
    }

    return entity;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:15,代码来源:AnalysisDao.java

示例11: addContactLink

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static Property addContactLink(Schema schema) {
    Property contactLinkId;
    Entity contactLink = schema.addEntity(EntityProperties.ContactLink);
    contactLinkId = contactLink.addIdProperty().getProperty();
    setManyToMany(contactLink, user, user);

    contactLink.setSuperclass("Entity");

    return contactLinkId;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:11,代码来源:Generator.java

示例12: addUserThreadLink

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static Property addUserThreadLink(Schema schema){
    Property userThreadLinkId;
    userThreadLink = schema.addEntity(EntityProperties.UserThreadLink);
    userThreadLinkId = userThreadLink.addIdProperty().primaryKey().getProperty();


    // Link data for user and thread.
    setManyToMany(userThreadLink, user, thread);

    return userThreadLinkId;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:12,代码来源:Generator.java

示例13: addUserInfo

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
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();
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:30,代码来源:GreenDaoGenerator.java

示例14: addAppData

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static void addAppData(Schema schema) {
    Entity tableName = schema.addEntity("AppData");

    tableName.addIdProperty().autoincrement();
    tableName.addStringProperty("appName");
    tableName.addStringProperty("appPackageName").unique();
    tableName.addLongProperty("lastModified");
    tableName.addIntProperty("isSystem");
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:10,代码来源:ExampleDaoGenerator.java

示例15: addHistoryRecord

import de.greenrobot.daogenerator.Schema; //导入方法依赖的package包/类
private static void addHistoryRecord(Schema schema) {
    Entity tableName = schema.addEntity("HistoryData");

    tableName.addIdProperty().autoincrement();
    tableName.addStringProperty("name");
    tableName.addStringProperty("path").unique();
    tableName.addStringProperty("appName");
    tableName.addStringProperty("appPackageName");
    tableName.addLongProperty("size");
    tableName.addLongProperty("lastModified");
    tableName.addLongProperty("openTime");
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:13,代码来源:ExampleDaoGenerator.java


注:本文中的de.greenrobot.daogenerator.Schema.addEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。