de.greenrobot.daogenerator.Entity Java Examples
The following examples show how to use
de.greenrobot.daogenerator.Entity.
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 AndroidDatabaseLibraryComparison with MIT License | 6 votes |
public static void main(String[] args) { Schema schema = new Schema(1, "com.raizlabs.android.databasecomparison.greendao.gen"); Entity simpleAddressItem = getAddressItemEntity(schema, "SimpleAddressItem"); Entity addressItem = getAddressItemEntity(schema, "AddressItem"); Entity contactItem = getContactItemEntity(schema); Entity addressBook = getAddressBookEntity(schema); addressItem.addToOne(addressBook, addressItem.getProperties().get(0)); contactItem.addToOne(addressBook, contactItem.getProperties().get(0)); addressBook.addToMany(addressItem, addressItem.getProperties().get(0)); addressBook.addToMany(contactItem, contactItem.getProperties().get(0)); try { new DaoGenerator().generateAll(schema, "../app/src/main/java"); } catch (Exception e) { e.printStackTrace(); } }
Example #2
Source File: GreenDaoGen.java From iBeebo with GNU General Public License v3.0 | 6 votes |
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 #3
Source File: EhDaoGenerator.java From MHViewer with Apache License 2.0 | 6 votes |
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 #4
Source File: EhDaoGenerator.java From MHViewer with Apache License 2.0 | 6 votes |
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 #5
Source File: EhDaoGenerator.java From MHViewer with Apache License 2.0 | 6 votes |
private static void addLocalFavorites(Schema schema) { Entity entity = schema.addEntity("LocalFavoriteInfo"); entity.setTableName("LOCAL_FAVORITES"); entity.setClassNameDao("LocalFavoritesDao"); 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"); // LocalFavoriteInfo data entity.addLongProperty("time").notNull(); entity.addStringProperty("id").primaryKey().notNull(); }
Example #6
Source File: EhDaoGenerator.java From EhViewer with Apache License 2.0 | 6 votes |
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 #7
Source File: EhDaoGenerator.java From EhViewer with Apache License 2.0 | 6 votes |
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 #8
Source File: EhDaoGenerator.java From EhViewer with Apache License 2.0 | 6 votes |
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 #9
Source File: EhDaoGenerator.java From EhViewer with Apache License 2.0 | 6 votes |
private static void addHistoryInfo(Schema schema) { Entity entity = schema.addEntity("HistoryInfo"); entity.setTableName("HISTORY"); entity.setClassNameDao("HistoryDao"); 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"); // HistoryInfo data entity.addIntProperty("mode").notNull(); entity.addLongProperty("time").notNull(); }
Example #10
Source File: Generator.java From android-orm-benchmark with Apache License 2.0 | 6 votes |
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 #11
Source File: EhDaoGenerator.java From EhViewer with Apache License 2.0 | 6 votes |
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 #12
Source File: GreenDaoGenerator.java From DMusic with Apache License 2.0 | 6 votes |
/** * 添加公共字段 */ 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 #13
Source File: EhDaoGenerator.java From MHViewer with Apache License 2.0 | 6 votes |
private static void addDownloads(Schema schema) { Entity entity = schema.addEntity("DownloadInfo"); entity.setTableName("DOWNLOADS"); entity.setClassNameDao("DownloadsDao"); 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"); // DownloadInfo data entity.addIntProperty("state").notNull(); entity.addIntProperty("legacy").notNull(); entity.addLongProperty("time").notNull(); entity.addStringProperty("label"); }
Example #14
Source File: PrinterDaoGenerator.java From octoandroid with GNU General Public License v3.0 | 6 votes |
private static Entity addPrinter(Schema schema) { Entity printer = schema.addEntity("PrinterDbEntity"); printer.setTableName("PRINTER"); printer.addIdProperty().primaryKey().unique(); printer.addStringProperty("name").notNull().unique(); printer.addStringProperty("apiKey").columnName("api_key").notNull(); printer.addStringProperty("scheme").notNull(); printer.addStringProperty("host").notNull(); printer.addIntProperty("port").notNull(); printer.addStringProperty("websocketPath").columnName("websocket_path").notNull(); printer.addStringProperty("webcamPathQuery").columnName("webcam_path_query").notNull(); printer.addStringProperty("uploadLocation").columnName("upload_location").notNull(); printer.addStringProperty("versionJson").columnName("version_json"); printer.addStringProperty("connectionJson").columnName("connection_json"); printer.addStringProperty("printerStateJson").columnName("printer_state_json"); printer.addStringProperty("filesJson").columnName("files_json"); return printer; }
Example #15
Source File: GreenDaoGen.java From iBeebo with GNU General Public License v3.0 | 6 votes |
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 #16
Source File: DBClass.java From MeiZiNews with MIT License | 6 votes |
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); }
Example #17
Source File: NMBDaoGenerator.java From Nimingban with Apache License 2.0 | 6 votes |
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 #18
Source File: GreenDaoGenerator.java From sctalk with Apache License 2.0 | 6 votes |
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 #19
Source File: GreenDaoGenerator.java From sctalk with Apache License 2.0 | 6 votes |
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 #20
Source File: HttpCookieDaoGenerator.java From Nimingban with Apache License 2.0 | 6 votes |
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 #21
Source File: GreenDaoGenerator.java From sctalk with Apache License 2.0 | 6 votes |
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 #22
Source File: DbDaoGenerator.java From UltimateAndroid with Apache License 2.0 | 6 votes |
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 #23
Source File: Generator.java From AndroidDatabaseLibraryComparison with MIT License | 5 votes |
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 #24
Source File: Generator.java From AndroidDatabaseLibraryComparison with MIT License | 5 votes |
private static Entity getContactItemEntity(Schema schema) { Entity contactItem = schema.addEntity("Contact"); contactItem.addIdProperty(); contactItem.addStringProperty("name"); contactItem.addStringProperty("email"); return contactItem; }
Example #25
Source File: MyDaoGenerator.java From MyWeather with Apache License 2.0 | 5 votes |
private static void addUseArea(Schema schema) { Entity weekForeCast = schema.addEntity("UseArea"); weekForeCast.addStringProperty("areaid"); weekForeCast.addStringProperty("areaid2345"); weekForeCast.addStringProperty("areaName"); weekForeCast.addBooleanProperty("main"); }
Example #26
Source File: NMBDaoGenerator.java From Nimingban with Apache License 2.0 | 5 votes |
/** * @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 #27
Source File: MyDaoGenerator.java From MyWeather with Apache License 2.0 | 5 votes |
private static void addAlarms(Schema schema) { Entity weekForeCast = schema.addEntity("Alarms"); weekForeCast.implementsSerializable(); weekForeCast.addStringProperty("alarmContent"); weekForeCast.addStringProperty("alarmId"); weekForeCast.addStringProperty("alarmLevelNo"); weekForeCast.addStringProperty("alarmLevelNoDesc"); weekForeCast.addStringProperty("alarmType"); weekForeCast.addStringProperty("alarmTypeDesc"); weekForeCast.addStringProperty("publishTime"); weekForeCast.addStringProperty("areaid"); weekForeCast.addStringProperty("areaName"); }
Example #28
Source File: Generator.java From android-sholi with GNU General Public License v3.0 | 5 votes |
private static void addItem(Schema schema) { // Table and column names are overriden to match the ones set // by the Provider used in previous version. Entity item = schema.addEntity("Item"); item.setTableName("items"); item.implementsInterface("name.soulayrol.rhaa.sholi.data.model.PersistentObject"); item.implementsInterface("name.soulayrol.rhaa.sholi.data.model.Checkable"); item.addIdProperty().autoincrement(); item.addStringProperty("name").columnName("item").unique().notNull(); item.addIntProperty("status").columnName("status"); }
Example #29
Source File: NMBDaoGenerator.java From Nimingban with Apache License 2.0 | 5 votes |
/** * @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 #30
Source File: MyDaoGenerator.java From MyWeather with Apache License 2.0 | 5 votes |
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"); }