/*
* Session.java
*
* Created on 2006��9��25��, ����5:15
*
* RealCix2.0
*/
package realcix20.sessions;
import realcix20.classes.basic.Cell;
import realcix20.classes.basic.Row;
import realcix20.utils.DAO;
import realcix20.utils.ObjectUtil;
import realcix20.utils.Resources;
/**
*
* @author JerryChen
*/
public class Session {
private static Session instance;
private LoginEntry loginEntry;
private Row currentUser;
private Object value;
public static Session getInstance(){
if (instance != null) {
return instance;
} else {
instance = new Session();
return instance;
}
}
private Session() {
}
public LoginEntry getLoginEntry() {
return loginEntry;
}
public void setLoginEntry(LoginEntry loginEntry) {
this.loginEntry = loginEntry;
}
public Row getCurrentUser() {
return currentUser;
}
public void setCurrentUser(Row currentUser) {
//will be modified
DAO dao = DAO.getInstance();
dao.update(Resources.UPDATE_GLOBALVAR_TABLE_SQL);
Cell userCell = ObjectUtil.findNewCell(currentUser, "LOGINENTRY", "RUSER");
dao.setObject(1, userCell.getColumnValue());
dao.setObject(2, "loginuser");
dao.executeUpdate();
this.currentUser = currentUser;
}
public void setValue(Object value) {
this.value = value;
}
public Object getValue() {
return value;
}
}