public void loginProcess() { MDC.put("reqId", ECTUtils.generateToken()); logger.info("loginProcess!!"); logger.info("userName : {} , passWord : {}", userName, "********"); if (!validateLongin()) { addError("loggin fial!!"); return; } /** * Authen Login */ try { String nPassWord = ECTUtils.encrypt(passWord); loginUser = getAuthenDao().loginUser(userName, nPassWord); } catch (Exception ex) { logger.error("Cannot Authen : ", ex); return; } if (loginUser == null) { addError(MessageUtils.getResourceBundleString("login.authen.fail")); logger.warn("Login {} fail!!", loginUser); return; } if (!loginUser.getIsActive()) { addError(MessageUtils.getResourceBundleString("login.authen.disabled")); logger.warn("Login {} block user was disbled!!", loginUser); return; } loggedIn = true; super.getRequest().getSession().setAttribute("userAuthen", loginUser); addInfo(MessageUtils.getResourceBundleString("login.loginprocess")); String path = JsfUtil.getContextPath(); logger.trace("path : {}", path); executeJavaScript( "setTimeout(function(){window.location='" + path + "/pages/form/index.xhtml?firstLogin=true';blockUI.show();},100);"); }
@Override public void save() { logger.trace( MessageUtils.PRINT_LINE_STAR() + "Save Report : {}", REPORT_014 + MessageUtils.PRINT_LINE_STAR()); calSum(); report014.setReport014DetailList(report014Details); report014.setCreatedDate(new Date()); report014.setCreatedUser(super.getUserAuthen().getUserId()); report014.setFlowStatusId(EctFlowStatus.FlowStatus.DRAFF.getStatus()); report014.setReportDesc(ectConfManager.getReportName(REPORT_014)); report014.setReportCode(REPORT_014); report014.setCreatedUserGroup(getUserAuthen().getUserGroupId()); if (!validateBeforeSave()) { return; } try { reportGennericService.create(report014); logger.trace("Save Success !! "); JsfUtil.alertJavaScript(MessageUtils.SAVE_SUCCESS()); goToClose(); } catch (Exception ex) { JsfUtil.alertJavaScript(MessageUtils.SAVE_NOT_SUCCESS() + " ข้อผิดพลาด :" + MDC.get("reqId")); logger.error("Cannot Save Data : ", ex); } finally { logger.trace("Save... {} ", report014); resetForm(); } }
private boolean validateBeforeSave() { String msg = ""; if (report014.getReport014DetailList() == null || report014.getReport014DetailList().isEmpty()) { msg += (MessageUtils.REQUIRE_ADD_REPORT_DETAIL()); } if (!StringUtils.isBlank(msg.toString())) { JsfUtil.alertJavaScript(msg.toString().trim()); return false; } return true; }