Back to project page blink.
The source code is released under:
Apache License
If you think the Android project blink 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 com.nashlincoln.blink.model; //from ww w . j av a 2 s . c o m import com.nashlincoln.blink.model.DaoSession; import de.greenrobot.dao.DaoException; // THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS // KEEP INCLUDES - put your custom includes here import com.nashlincoln.blink.app.BlinkApp; // KEEP INCLUDES END /** * Entity mapped to table GROUP_DEVICE. */ public class GroupDevice { private Long id; private Integer state; private Long groupId; private Long deviceId; /** Used to resolve relations */ private transient DaoSession daoSession; /** Used for active entity operations. */ private transient GroupDeviceDao myDao; private Device device; private Long device__resolvedKey; private Group group; private Long group__resolvedKey; // KEEP FIELDS - put your custom fields here // KEEP FIELDS END public GroupDevice() { } public GroupDevice(Long id) { this.id = id; } public GroupDevice(Long id, Integer state, Long groupId, Long deviceId) { this.id = id; this.state = state; this.groupId = groupId; this.deviceId = deviceId; } /** called by internal mechanisms, do not call yourself. */ public void __setDaoSession(DaoSession daoSession) { this.daoSession = daoSession; myDao = daoSession != null ? daoSession.getGroupDeviceDao() : null; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } public Long getGroupId() { return groupId; } public void setGroupId(Long groupId) { this.groupId = groupId; } public Long getDeviceId() { return deviceId; } public void setDeviceId(Long deviceId) { this.deviceId = deviceId; } /** To-one relationship, resolved on first access. */ public Device getDevice() { Long __key = this.deviceId; if (device__resolvedKey == null || !device__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } DeviceDao targetDao = daoSession.getDeviceDao(); Device deviceNew = targetDao.load(__key); synchronized (this) { device = deviceNew; device__resolvedKey = __key; } } return device; } public void setDevice(Device device) { synchronized (this) { this.device = device; deviceId = device == null ? null : device.getId(); device__resolvedKey = deviceId; } } /** To-one relationship, resolved on first access. */ public Group getGroup() { Long __key = this.groupId; if (group__resolvedKey == null || !group__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } GroupDao targetDao = daoSession.getGroupDao(); Group groupNew = targetDao.load(__key); synchronized (this) { group = groupNew; group__resolvedKey = __key; } } return group; } public void setGroup(Group group) { synchronized (this) { this.group = group; groupId = group == null ? null : group.getId(); group__resolvedKey = groupId; } } /** 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 public void setNominal() { switch (state) { case BlinkApp.STATE_REMOVED: delete(); getGroup().resetGroupDeviceList(); break; case BlinkApp.STATE_ADDED: state = BlinkApp.STATE_NOMINAL; update(); break; } } // KEEP METHODS END }