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; // w ww .jav a2s . 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 // KEEP INCLUDES END /** * Entity mapped to table ATTRIBUTE. */ public class Attribute { private Long id; private String value; private String valueLocal; private Long attributableId; private String attributableType; private Long attributeTypeId; /** Used to resolve relations */ private transient DaoSession daoSession; /** Used for active entity operations. */ private transient AttributeDao myDao; private AttributeType attributeType; private Long attributeType__resolvedKey; // KEEP FIELDS - put your custom fields here public static final String ON = "ON"; public static final String OFF = "OFF"; // KEEP FIELDS END public Attribute() { } public Attribute(Long id) { this.id = id; } public Attribute(Long id, String value, String valueLocal, Long attributableId, String attributableType, Long attributeTypeId) { this.id = id; this.value = value; this.valueLocal = valueLocal; this.attributableId = attributableId; this.attributableType = attributableType; this.attributeTypeId = attributeTypeId; } /** called by internal mechanisms, do not call yourself. */ public void __setDaoSession(DaoSession daoSession) { this.daoSession = daoSession; myDao = daoSession != null ? daoSession.getAttributeDao() : null; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getValueLocal() { return valueLocal; } public void setValueLocal(String valueLocal) { this.valueLocal = valueLocal; } public Long getAttributableId() { return attributableId; } public void setAttributableId(Long attributableId) { this.attributableId = attributableId; } public String getAttributableType() { return attributableType; } public void setAttributableType(String attributableType) { this.attributableType = attributableType; } public Long getAttributeTypeId() { return attributeTypeId; } public void setAttributeTypeId(Long attributeTypeId) { this.attributeTypeId = attributeTypeId; } /** To-one relationship, resolved on first access. */ public AttributeType getAttributeType() { Long __key = this.attributeTypeId; if (attributeType__resolvedKey == null || !attributeType__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } AttributeTypeDao targetDao = daoSession.getAttributeTypeDao(); AttributeType attributeTypeNew = targetDao.load(__key); synchronized (this) { attributeType = attributeTypeNew; attributeType__resolvedKey = __key; } } return attributeType; } public void setAttributeType(AttributeType attributeType) { synchronized (this) { this.attributeType = attributeType; attributeTypeId = attributeType == null ? null : attributeType.getId(); attributeType__resolvedKey = attributeTypeId; } } /** 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 boolean getBool() { if (value == null) { return false; } return value.equals(ON); } public int getInt() { if (value == null) { return 0; } return Integer.parseInt(value); } public boolean isChanged() { return !(valueLocal == null || valueLocal.equals(value)); } public void onSync() { if (isChanged()) { value = valueLocal; valueLocal = null; } // TODO: move this under the if? update(); } public void setValueLocal(boolean on) { valueLocal = on ? ON : OFF; } public void setValueLocal(int value) { valueLocal = String.valueOf(value); } // KEEP METHODS END }