use of nodomain.freeyourgadget.gadgetbridge.entities.TagDao in project Gadgetbridge by Freeyourgadget.
the class DBHelper method getTag.
@NonNull
public static Tag getTag(@NonNull User user, @NonNull String name, @NonNull DaoSession session) {
TagDao tagDao = session.getTagDao();
QueryBuilder<Tag> qb = tagDao.queryBuilder();
Query<Tag> query = qb.where(TagDao.Properties.UserId.eq(user.getId()), TagDao.Properties.Name.eq(name)).build();
List<Tag> tags = query.list();
if (tags.size() > 0) {
return tags.get(0);
}
return createTag(user, name, null, session);
}