diff options
author | David Development <david-dev@live.de> | 2014-07-28 13:52:21 +0400 |
---|---|---|
committer | David Development <david-dev@live.de> | 2014-07-28 13:53:03 +0400 |
commit | d378e2bba063852a463c8a554afe1566043502ac (patch) | |
tree | 6b85c4b258ccdd86bfad718101df2bd704532951 /News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java | |
parent | bffef458cb3079ef928486ab7e7b2fb4ef454b15 (diff) |
Update Backend to ORM/Remove abs -> appcompat
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java new file mode 100644 index 00000000..ea5cf36d --- /dev/null +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Folder.java @@ -0,0 +1,116 @@ +package de.luhmer.owncloudnewsreader.database.model; + +import java.util.List; + +import de.greenrobot.dao.DaoException; + +// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS + +// KEEP INCLUDES - put your custom includes here +// KEEP INCLUDES END +/** + * Entity mapped to table FOLDER. + */ +public class Folder { + + private long id; + /** Not-null value. */ + private String label; + + /** Used to resolve relations */ + private transient DaoSession daoSession; + + /** Used for active entity operations. */ + private transient FolderDao myDao; + + private List<Feed> feedList; + + // KEEP FIELDS - put your custom fields here + // KEEP FIELDS END + + public Folder() { + } + + public Folder(long id) { + this.id = id; + } + + public Folder(long id, String label) { + this.id = id; + this.label = label; + } + + /** called by internal mechanisms, do not call yourself. */ + public void __setDaoSession(DaoSession daoSession) { + this.daoSession = daoSession; + myDao = daoSession != null ? daoSession.getFolderDao() : null; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + /** Not-null value. */ + public String getLabel() { + return label; + } + + /** Not-null value; ensure this value is available before it is saved to the database. */ + public void setLabel(String label) { + this.label = label; + } + + /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */ + public List<Feed> getFeedList() { + if (feedList == null) { + if (daoSession == null) { + throw new DaoException("Entity is detached from DAO context"); + } + FeedDao targetDao = daoSession.getFeedDao(); + List<Feed> feedListNew = targetDao._queryFolder_FeedList(id); + synchronized (this) { + if(feedList == null) { + feedList = feedListNew; + } + } + } + return feedList; + } + + /** Resets a to-many relationship, making the next get call to query for a fresh result. */ + public synchronized void resetFeedList() { + feedList = null; + } + + /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */ + public void delete() { + if (myDao == null) { + throw new DaoException("Entity is detached from DAO context"); + } + myDao.delete(this); + } + + /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */ + public void update() { + if (myDao == null) { + throw new DaoException("Entity is detached from DAO context"); + } + myDao.update(this); + } + + /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */ + public void refresh() { + if (myDao == null) { + throw new DaoException("Entity is detached from DAO context"); + } + myDao.refresh(this); + } + + // KEEP METHODS - put your custom methods here + // KEEP METHODS END + +} |