Mercurial > hg > LGServices
comparison 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 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3e62083dbcbf |
|---|---|
| 1 package de.mpiwg.web.jsp; | |
| 2 | |
| 3 import java.util.ArrayList; | |
| 4 import java.util.List; | |
| 5 | |
| 6 import javax.servlet.http.HttpServletRequest; | |
| 7 import javax.servlet.http.HttpServletResponse; | |
| 8 | |
| 9 import org.apache.log4j.Logger; | |
| 10 | |
| 11 import de.mpiwg.gazetteer.bo.LGBranch; | |
| 12 import de.mpiwg.gazetteer.dataverse.DataverseUtils; | |
| 13 import de.mpiwg.gazetteer.dataverse.bo.VDCUser; | |
| 14 import de.mpiwg.gazetteer.utils.DataProvider; | |
| 15 | |
| 16 public class SessionBean extends AbstractJSPPage { | |
| 17 | |
| 18 private static Logger logger = Logger.getLogger(SessionBean.class); | |
| 19 public static final String BEAN_NAME = "sessionBean"; | |
| 20 | |
| 21 private List<String> msgList = new ArrayList<String>(); | |
| 22 | |
| 23 | |
| 24 | |
| 25 private VDCUser user; | |
| 26 private String userName; | |
| 27 private String password; | |
| 28 | |
| 29 private String currentSectionId = "5190882"; | |
| 30 private SearchPage searchPage = new SearchPage(); | |
| 31 private HomePage homePage = new HomePage(); | |
| 32 private CreateFilePage createFilePage = new CreateFilePage(); | |
| 33 private BranchPage branchPage = new BranchPage(); | |
| 34 | |
| 35 public SessionBean(){ | |
| 36 logger.info("\n\n### SessionBean #####\n\n"); | |
| 37 } | |
| 38 | |
| 39 | |
| 40 public void loadParameters(HttpServletRequest request, HttpServletResponse response){ | |
| 41 this.request = request; | |
| 42 this.response = response; | |
| 43 | |
| 44 this.userName = getParameter("userName"); | |
| 45 this.password = getParameter("password"); | |
| 46 } | |
| 47 | |
| 48 public void reset(){ | |
| 49 this.user = null; | |
| 50 this.searchPage = new SearchPage(); | |
| 51 this.homePage = new HomePage(); | |
| 52 this.createFilePage = new CreateFilePage(); | |
| 53 this.branchPage = new BranchPage(); | |
| 54 this.userName = new String(); | |
| 55 this.password = new String(); | |
| 56 } | |
| 57 | |
| 58 public List<String> getMsgList() { | |
| 59 return msgList; | |
| 60 } | |
| 61 | |
| 62 public void setMsgList(List<String> msgList) { | |
| 63 this.msgList = msgList; | |
| 64 } | |
| 65 | |
| 66 public void resetMsgList(){ | |
| 67 this.msgList = null; | |
| 68 } | |
| 69 | |
| 70 public void logout(){ | |
| 71 this.reset(); | |
| 72 } | |
| 73 | |
| 74 public void login(){ | |
| 75 try { | |
| 76 this.user = DataverseUtils.login(userName, password); | |
| 77 if(user != null){ | |
| 78 this.user.setPassword(this.password); | |
| 79 this.homePage.loadParameters(request, response); | |
| 80 this.homePage.reloadBranches(); | |
| 81 | |
| 82 }else{ | |
| 83 addMsg("User account no found or userName and password do not match!"); | |
| 84 } | |
| 85 | |
| 86 } catch (Exception e) { | |
| 87 internalError(e); | |
| 88 } | |
| 89 } | |
| 90 | |
| 91 public String getPassword() { | |
| 92 return password; | |
| 93 } | |
| 94 | |
| 95 public void setPassword(String password) { | |
| 96 this.password = password; | |
| 97 } | |
| 98 | |
| 99 public VDCUser getUser() { | |
| 100 return user; | |
| 101 } | |
| 102 | |
| 103 public void setUser(VDCUser user) { | |
| 104 this.user = user; | |
| 105 } | |
| 106 | |
| 107 public String getUserName() { | |
| 108 return userName; | |
| 109 } | |
| 110 | |
| 111 public void setUserName(String userName) { | |
| 112 this.userName = userName; | |
| 113 } | |
| 114 | |
| 115 public String getCurrentSectionId() { | |
| 116 return currentSectionId; | |
| 117 } | |
| 118 | |
| 119 public void setCurrentSectionId(String currentSectionId) { | |
| 120 this.currentSectionId = currentSectionId; | |
| 121 } | |
| 122 | |
| 123 public SearchPage getSearchPage() { | |
| 124 return searchPage; | |
| 125 } | |
| 126 | |
| 127 public void setSearchPage(SearchPage searchPage) { | |
| 128 this.searchPage = searchPage; | |
| 129 } | |
| 130 | |
| 131 | |
| 132 public HomePage getHomePage() { | |
| 133 return homePage; | |
| 134 } | |
| 135 | |
| 136 | |
| 137 public void setHomePage(HomePage homePage) { | |
| 138 this.homePage = homePage; | |
| 139 } | |
| 140 | |
| 141 | |
| 142 public CreateFilePage getCreateFilePage() { | |
| 143 return createFilePage; | |
| 144 } | |
| 145 | |
| 146 | |
| 147 public void setCreateFilePage(CreateFilePage createFilePage) { | |
| 148 this.createFilePage = createFilePage; | |
| 149 } | |
| 150 | |
| 151 | |
| 152 public BranchPage getBranchPage() { | |
| 153 return branchPage; | |
| 154 } | |
| 155 | |
| 156 | |
| 157 public void setBranchPage(BranchPage branchPage) { | |
| 158 this.branchPage = branchPage; | |
| 159 } | |
| 160 | |
| 161 | |
| 162 } |
