package orz.sorz.lab.smallcloudemoji.daogenerator;

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;

public class AppDaoGenerator {

    public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, "org.sorz.lab.smallcloudemoji.db");

        addEntities(schema);

        new DaoGenerator().generateAll(schema, "app/src-gen");
    }

    private static void addEntities(Schema schema) {
        Entity repository = schema.addEntity("Repository");
        Property repositoryId = repository.addIdProperty().getProperty();
        repository.addStringProperty("url").notNull().unique();
        repository.addStringProperty("alias");
        repository.addDateProperty("lastUpdateDate");

        Entity category = schema.addEntity("Category");
        Property categoryId = category.addIdProperty().getProperty();
        category.addStringProperty("name");
        category.addToOne(repository, repositoryId);

        ToMany repositoryToCategories = repository.addToMany(category, repositoryId);
        repositoryToCategories.setName("categories");

        Entity entry = schema.addEntity("Entry");
        entry.addIdProperty();
        entry.addStringProperty("emoticon").notNull();
        entry.addStringProperty("description");
        entry.addDateProperty("lastUsed");
        entry.addToOne(category, categoryId);

        ToMany categoryToEntries = category.addToMany(entry, categoryId);
        categoryToEntries.setName("entries");
    }

}

@@ -657,32 +657,8 @@
     
- Property repositoryId =
  rep
@@ -676,38 +676,24 @@
 IdProperty()
-.getProperty()
 ;%0A        re
@@ -915,30 +915,8 @@
     
- Property categoryId =
  cat
@@ -992,24 +992,112 @@
 ty(%22name%22);%0A
+        Property repositoryId = category.addLongProperty(%22repositoryId%22).getProperty();%0A
         cate
@@ -1502,24 +1502,105 @@
 lastUsed%22);%0A
+        Property categoryId = entry.addLongProperty(%22categoryId%22).getProperty();%0A
         entr

Fix model relations