package id.ac.itats.skripsi.orm;
import id.ac.itats.skripsi.orm.DaoSession;
import de.greenrobot.dao.DaoException;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table WAY.
*/
public class Way {
private Long id;
private String wayID;
private Long fk_sourceNode;
private Long fk_targetNode;
private Double weight;
/** Used to resolve relations */
private transient DaoSession daoSession;
/** Used for active entity operations. */
private transient WayDao myDao;
private Node sourceNode;
private Long sourceNode__resolvedKey;
private Node targetNode;
private Long targetNode__resolvedKey;
public Way() {
}
public Way(Long id) {
this.id = id;
}
public Way(Long id, String wayID, Long fk_sourceNode, Long fk_targetNode, Double weight) {
this.id = id;
this.wayID = wayID;
this.fk_sourceNode = fk_sourceNode;
this.fk_targetNode = fk_targetNode;
this.weight = weight;
}
/** called by internal mechanisms, do not call yourself. */
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getWayDao() : null;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWayID() {
return wayID;
}
public void setWayID(String wayID) {
this.wayID = wayID;
}
public Long getFk_sourceNode() {
return fk_sourceNode;
}
public void setFk_sourceNode(Long fk_sourceNode) {
this.fk_sourceNode = fk_sourceNode;
}
public Long getFk_targetNode() {
return fk_targetNode;
}
public void setFk_targetNode(Long fk_targetNode) {
this.fk_targetNode = fk_targetNode;
}
public Double getWeight() {
return weight;
}
public void setWeight(Double weight) {
this.weight = weight;
}
/** To-one relationship, resolved on first access. */
public Node getSourceNode() {
Long __key = this.fk_sourceNode;
if (sourceNode__resolvedKey == null || !sourceNode__resolvedKey.equals(__key)) {
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
NodeDao targetDao = daoSession.getNodeDao();
Node sourceNodeNew = targetDao.load(__key);
synchronized (this) {
sourceNode = sourceNodeNew;
sourceNode__resolvedKey = __key;
}
}
return sourceNode;
}
public void setSourceNode(Node sourceNode) {
synchronized (this) {
this.sourceNode = sourceNode;
fk_sourceNode = sourceNode == null ? null : sourceNode.getNodeID();
sourceNode__resolvedKey = fk_sourceNode;
}
}
/** To-one relationship, resolved on first access. */
public Node getTargetNode() {
Long __key = this.fk_targetNode;
if (targetNode__resolvedKey == null || !targetNode__resolvedKey.equals(__key)) {
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
NodeDao targetDao = daoSession.getNodeDao();
Node targetNodeNew = targetDao.load(__key);
synchronized (this) {
targetNode = targetNodeNew;
targetNode__resolvedKey = __key;
}
}
return targetNode;
}
public void setTargetNode(Node targetNode) {
synchronized (this) {
this.targetNode = targetNode;
fk_targetNode = targetNode == null ? null : targetNode.getNodeID();
targetNode__resolvedKey = fk_targetNode;
}
}
/** 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);
}
}