Back to project page EnklawaPlayer.
The source code is released under:
GNU General Public License
If you think the Android project EnklawaPlayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package macbury.pod.db.scopes; //from w w w. ja va 2 s. co m import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.QueryBuilder; import java.sql.SQLException; import macbury.pod.api.APIThread; import macbury.pod.db.models.ForumThread; /** * Created by macbury on 12.09.14. */ public class ThreadScope extends AbstractScope<ForumThread> { public ThreadScope(Dao<ForumThread, Integer> dao) { super(dao); } public ForumThread buildFromApi(APIThread apiObject) { ForumThread thread = new ForumThread(); thread.title = apiObject.title; thread.content = apiObject.content; thread.link = apiObject.link; thread.pubDate = apiObject.pub_date; return thread; } public ForumThread find(APIThread apiObject) { QueryBuilder<ForumThread, Integer> builder = dao.queryBuilder(); try { builder.where().eq("link", apiObject.link); return builder.queryForFirst(); } catch (SQLException e) { e.printStackTrace(); return null; } } @Override public void afterCreate(ForumThread model) { } @Override public void afterDestroy(ForumThread object) { } @Override public void afterSave(ForumThread object) { } }