0

how to use this template GreenDao generator to generate ContentProvider class: https://github.com/greenrobot/greenDAO/blob/master/DaoGenerator/src-template/content-provider.ftl

And what it means this parameters:

public static final String BASE_PATH = "${contentProvider.basePath}";

https://github.com/greenrobot/greenDAO/blob/master/DaoGenerator/src-template/content-provider.ftl#L28

private static final String PK = ${entity.classNameDao}.Properties.${entity.pkProperty.propertyName?cap_first}.columnName;

https://github.com/greenrobot/greenDAO/blob/master/DaoGenerator/src-template/content-provider.ftl#L36

And how i can implement THIS:

<#if contentProvider.isReadOnly()> https://github.com/greenrobot/greenDAO/blob/master/DaoGenerator/src-template/content-provider.ftl#L80

Kozlov V
  • 146
  • 5
  • 17

2 Answers2

1

Each entity has its own ContentProvider for now, just call addContentProvider of your entities.

for example :

        Entity clientServer = schema.addEntity("ClientServer");
        clientServer.addIdProperty();
        clientServer.addIntProperty("tedadMorajeat");
        clientServer.addLongProperty("clientId");
        clientServer.addLongProperty("serverId");           
        clientServer.addContentProvider();
Jamali
  • 754
  • 10
  • 24
0

public static final String BASE_PATH = "${contentProvider.basePath}"; - it is TABLE NAME

private static final String PK = ${entity.classNameDao}.Properties.${entity.pkProperty.propertyName?cap_first}.columnName; 

- it is Primary Column Name, for example:

private static final String PK = MYTABLENAMEDao.Properties.Id.columnName;

I do it ContentProvider DAO and it work fine!

Kozlov V
  • 146
  • 5
  • 17