Android Open Source - blink Attribute






From Project

Back to project page blink.

License

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.

Java Source Code

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

}




Java Source Code List

com.nashlincoln.blink.ApplicationTest.java
com.nashlincoln.blink.app.BlinkApp.java
com.nashlincoln.blink.app.FragmentPagerAdapter.java
com.nashlincoln.blink.app.NetworkReceiver.java
com.nashlincoln.blink.app.PreferenceUtils.java
com.nashlincoln.blink.content.Command.java
com.nashlincoln.blink.content.DeviceLoader.java
com.nashlincoln.blink.content.DeviceTypeLoader.java
com.nashlincoln.blink.content.GroupLoader.java
com.nashlincoln.blink.content.ModelLoader.java
com.nashlincoln.blink.content.SceneLoader.java
com.nashlincoln.blink.content.Syncro.java
com.nashlincoln.blink.event.Event.java
com.nashlincoln.blink.event.Status.java
com.nashlincoln.blink.event.Type.java
com.nashlincoln.blink.model.AttributeDao.java
com.nashlincoln.blink.model.AttributeTypeDao.java
com.nashlincoln.blink.model.AttributeType.java
com.nashlincoln.blink.model.Attribute.java
com.nashlincoln.blink.model.DaoMaster.java
com.nashlincoln.blink.model.DaoSession.java
com.nashlincoln.blink.model.DeviceDao.java
com.nashlincoln.blink.model.DeviceTypeDao.java
com.nashlincoln.blink.model.DeviceType.java
com.nashlincoln.blink.model.Device.java
com.nashlincoln.blink.model.GroupDao.java
com.nashlincoln.blink.model.GroupDeviceDao.java
com.nashlincoln.blink.model.GroupDevice.java
com.nashlincoln.blink.model.Group.java
com.nashlincoln.blink.model.SceneDao.java
com.nashlincoln.blink.model.SceneDeviceDao.java
com.nashlincoln.blink.model.SceneDevice.java
com.nashlincoln.blink.model.Scene.java
com.nashlincoln.blink.model.TimerDao.java
com.nashlincoln.blink.model.Timer.java
com.nashlincoln.blink.network.BlinkApiInterface.java
com.nashlincoln.blink.network.BlinkApi.java
com.nashlincoln.blink.nfc.NfcCommand.java
com.nashlincoln.blink.nfc.NfcUtils.java
com.nashlincoln.blink.ui.AddDeviceFragment.java
com.nashlincoln.blink.ui.BlinkActivity.java
com.nashlincoln.blink.ui.BlinkListFragment.java
com.nashlincoln.blink.ui.DeviceListFragment.java
com.nashlincoln.blink.ui.EditListActivity.java
com.nashlincoln.blink.ui.EditListFragment.java
com.nashlincoln.blink.ui.EditNameDialogFragment.java
com.nashlincoln.blink.ui.GroupListFragment.java
com.nashlincoln.blink.ui.SceneListFragment.java
com.nashlincoln.blink.ui.SettingsActivity.java
com.nashlincoln.blink.widget.DeviceSummary.java
com.nashlincoln.blink.widget.SlidingTabLayout.java
com.nashlincoln.blink.widget.SlidingTabStrip.java
com.nashlincoln.dao.Generator.java