Created
March 10, 2014 17:02
-
-
Save nseidm1/9469161 to your computer and use it in GitHub Desktop.
GreenDao java generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2011 Markus Junginger, greenrobot (http://greenrobot.de) | |
* | |
* 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 com.paltalk.daogenerator; | |
import de.greenrobot.daogenerator.DaoGenerator; | |
import de.greenrobot.daogenerator.Entity; | |
import de.greenrobot.daogenerator.Schema; | |
/** | |
* 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(5, "com.project.vegassms"); | |
addContact(schema); | |
addPhoneEntry(schema); | |
addEmailEntry(schema); | |
addMessageEntry(schema); | |
addCallEntry(schema); | |
addPushEntry(schema); | |
new DaoGenerator().generateAll(schema, "../VegasSMS/src-gen"); | |
} | |
private static void addContact(Schema schema) { | |
Entity contactEntry = schema.addEntity("Contact"); | |
contactEntry.addIdProperty(); | |
contactEntry.addStringProperty("display_name"); | |
contactEntry.addStringProperty("address"); | |
contactEntry.addStringProperty("city"); | |
contactEntry.addStringProperty("state"); | |
contactEntry.addStringProperty("zip"); | |
contactEntry.addStringProperty("birthday"); | |
contactEntry.addStringProperty("signature_text"); | |
contactEntry.addStringProperty("prefix_text"); | |
contactEntry.addStringProperty("note"); | |
contactEntry.addStringProperty("draft_message"); | |
contactEntry.addStringProperty("snippet"); | |
contactEntry.addIntProperty("vibration_setting"); | |
contactEntry.addIntProperty("sound_setting"); | |
contactEntry.addIntProperty("new_messages"); | |
contactEntry.addIntProperty("new_calls"); | |
contactEntry.addIntProperty("background"); | |
contactEntry.addStringProperty("incoming_background"); | |
contactEntry.addStringProperty("outgoing_background"); | |
contactEntry.addStringProperty("incoming_text_color"); | |
contactEntry.addStringProperty("outgoing_text_color"); | |
contactEntry.addIntProperty("font"); | |
contactEntry.addIntProperty("font_size"); | |
contactEntry.addIntProperty("delivery_reports"); | |
contactEntry.addIntProperty("sent_reports"); | |
contactEntry.addIntProperty("keyboard_style"); | |
contactEntry.addIntProperty("auto_closing_keyboard"); | |
contactEntry.addIntProperty("send_confirm"); | |
contactEntry.addIntProperty("notification_icon"); | |
contactEntry.addStringProperty("vibration_pattern"); | |
contactEntry.addStringProperty("notification_title"); | |
contactEntry.addStringProperty("notification_body"); | |
contactEntry.addIntProperty("blink_rate_on"); | |
contactEntry.addIntProperty("blink_rate_off"); | |
contactEntry.addStringProperty("notification_sound"); | |
contactEntry.addIntProperty("root_send_to_voicemail"); | |
contactEntry.addIntProperty("root_call_terminator"); | |
contactEntry.addIntProperty("call_terminator"); | |
contactEntry.addIntProperty("call_silence"); | |
contactEntry.implementsSerializable(); | |
} | |
private static void addPhoneEntry(Schema schema) { | |
Entity phoneEntry = schema.addEntity("Phone"); | |
phoneEntry.addIdProperty(); | |
phoneEntry.addLongProperty("contact_id"); | |
phoneEntry.addStringProperty("number"); | |
phoneEntry.addIntProperty("type"); | |
phoneEntry.addIntProperty("new_messages"); | |
phoneEntry.addIntProperty("new_calls"); | |
phoneEntry.implementsSerializable(); | |
} | |
private static void addEmailEntry(Schema schema) { | |
Entity emailEntry = schema.addEntity("Email"); | |
emailEntry.addIdProperty(); | |
emailEntry.addLongProperty("contact_id"); | |
emailEntry.addStringProperty("email"); | |
emailEntry.addIntProperty("new_messages"); | |
emailEntry.implementsSerializable(); | |
} | |
private static void addMessageEntry(Schema schema) { | |
Entity messageEntity = schema.addEntity("Message"); | |
messageEntity.addIdProperty(); | |
messageEntity.addLongProperty("contact_id"); | |
messageEntity.addStringProperty("cellphone"); | |
messageEntity.addStringProperty("message"); | |
messageEntity.addLongProperty("time"); | |
messageEntity.addIntProperty("direction"); | |
messageEntity.addIntProperty("type"); | |
messageEntity.addIntProperty("received"); | |
messageEntity.addIntProperty("sent"); | |
messageEntity.addStringProperty("path_to_attachment"); | |
messageEntity.addStringProperty("regular_sms_uri"); | |
messageEntity.addIntProperty("failure_count"); | |
messageEntity.addIntProperty("sent_report_enabled"); | |
messageEntity.addIntProperty("delivery_report_enabled"); | |
messageEntity.addIntProperty("locked"); | |
messageEntity.implementsSerializable(); | |
} | |
private static void addCallEntry(Schema schema) { | |
Entity callEntity = schema.addEntity("Call"); | |
callEntity.addIdProperty(); | |
callEntity.addLongProperty("contact_id"); | |
callEntity.addStringProperty("cellphone"); | |
callEntity.addLongProperty("time"); | |
callEntity.addIntProperty("direction"); | |
callEntity.addLongProperty("duration"); | |
} | |
private static void addPushEntry(Schema schema) { | |
Entity callEntity = schema.addEntity("Push"); | |
callEntity.addIdProperty(); | |
callEntity.addByteArrayProperty("contact"); | |
callEntity.addByteArrayProperty("phone"); | |
callEntity.addByteArrayProperty("email"); | |
callEntity.addByteArrayProperty("pdu"); | |
callEntity.addBooleanProperty("filter_message"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment