Back to project page JayJayLab-Android-Demo.
The source code is released under:
Apache License
If you think the Android project JayJayLab-Android-Demo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2011 Markus Junginger, greenrobot (http://greenrobot.de) */*from w w w .jav a 2 s .co m*/ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.greenrobot.daogenerator.gentest; import de.greenrobot.daogenerator.DaoGenerator; import de.greenrobot.daogenerator.Entity; import de.greenrobot.daogenerator.Property; import de.greenrobot.daogenerator.Schema; import de.greenrobot.daogenerator.ToMany; /** * Generates entities and DAOs for the example project DaoExample. * * Run it as a Java application (not Android). * * @author Markus */ public class ExampleDaoGenerator { public static void main(String[] args) throws Exception { Schema schema = new Schema(1, "com.jayjaylab.androiddemo"); addPath(schema); // addNote(schema); // addCustomerOrder(schema); new DaoGenerator().generateAll(schema, "../app/src/main/java-gen"); } static void addPath(Schema schema) { // index int pk, nn, ai // gpx mediumtext nn // start_time datetime // end_time datetime Entity path = schema.addEntity("Path"); path.setTableName("path"); path.addIdProperty().primaryKeyAsc().autoincrement().index(); path.addStringProperty("gpxPath").notNull(); path.addStringProperty("startTime").notNull(); path.addStringProperty("endTime").notNull(); } private static void addNote(Schema schema) { Entity note = schema.addEntity("Note"); note.addIdProperty().primaryKeyAsc().notNull().autoincrement().index(); note.addStringProperty("text").notNull(); note.addStringProperty("comment"); note.addDateProperty("date"); } 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); } }