API, DAO, TENANT templates + bugfixes

Change-Id: I3159b75baacb3336c70dde6e8e3650c0b4d0bc45
Signed-off-by: marco<apollo13@tin.it>