Mercurial > hg > LGServices
diff src/main/java/de/mpiwg/web/jsp/SessionBean.java @ 0:3e62083dbcbf
First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
| author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
|---|---|
| date | Thu, 23 Apr 2015 15:46:01 +0200 |
| parents | |
| children | 8702aa85d0fb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/web/jsp/SessionBean.java Thu Apr 23 15:46:01 2015 +0200 @@ -0,0 +1,162 @@ +package de.mpiwg.web.jsp; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +import de.mpiwg.gazetteer.bo.LGBranch; +import de.mpiwg.gazetteer.dataverse.DataverseUtils; +import de.mpiwg.gazetteer.dataverse.bo.VDCUser; +import de.mpiwg.gazetteer.utils.DataProvider; + +public class SessionBean extends AbstractJSPPage { + + private static Logger logger = Logger.getLogger(SessionBean.class); + public static final String BEAN_NAME = "sessionBean"; + + private List<String> msgList = new ArrayList<String>(); + + + + private VDCUser user; + private String userName; + private String password; + + private String currentSectionId = "5190882"; + private SearchPage searchPage = new SearchPage(); + private HomePage homePage = new HomePage(); + private CreateFilePage createFilePage = new CreateFilePage(); + private BranchPage branchPage = new BranchPage(); + + public SessionBean(){ + logger.info("\n\n### SessionBean #####\n\n"); + } + + + public void loadParameters(HttpServletRequest request, HttpServletResponse response){ + this.request = request; + this.response = response; + + this.userName = getParameter("userName"); + this.password = getParameter("password"); + } + + public void reset(){ + this.user = null; + this.searchPage = new SearchPage(); + this.homePage = new HomePage(); + this.createFilePage = new CreateFilePage(); + this.branchPage = new BranchPage(); + this.userName = new String(); + this.password = new String(); + } + + public List<String> getMsgList() { + return msgList; + } + + public void setMsgList(List<String> msgList) { + this.msgList = msgList; + } + + public void resetMsgList(){ + this.msgList = null; + } + + public void logout(){ + this.reset(); + } + + public void login(){ + try { + this.user = DataverseUtils.login(userName, password); + if(user != null){ + this.user.setPassword(this.password); + this.homePage.loadParameters(request, response); + this.homePage.reloadBranches(); + + }else{ + addMsg("User account no found or userName and password do not match!"); + } + + } catch (Exception e) { + internalError(e); + } + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public VDCUser getUser() { + return user; + } + + public void setUser(VDCUser user) { + this.user = user; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getCurrentSectionId() { + return currentSectionId; + } + + public void setCurrentSectionId(String currentSectionId) { + this.currentSectionId = currentSectionId; + } + + public SearchPage getSearchPage() { + return searchPage; + } + + public void setSearchPage(SearchPage searchPage) { + this.searchPage = searchPage; + } + + + public HomePage getHomePage() { + return homePage; + } + + + public void setHomePage(HomePage homePage) { + this.homePage = homePage; + } + + + public CreateFilePage getCreateFilePage() { + return createFilePage; + } + + + public void setCreateFilePage(CreateFilePage createFilePage) { + this.createFilePage = createFilePage; + } + + + public BranchPage getBranchPage() { + return branchPage; + } + + + public void setBranchPage(BranchPage branchPage) { + this.branchPage = branchPage; + } + + +}
