Exemple #1
0
  public ActionForward execute(
      ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse res) {
    ActionForward af = null;
    Configuration conf = getConfiguration(req);

    /*
    try {
    	String computerName = InetAddress.getLocalHost().getHostName();
    	System.out.println("name: " + computerName);
    } catch (UnknownHostException e) {
    	// TODO Auto-generated catch block
    	e.printStackTrace();
    }
    */

    System.out.println("B");

    if (conf == null) {
      af = map.findForward("noConfiguration");
      System.out.println("A");
    } else {

      boolean simRunning = isThereSimulationRunning(req);

      System.out.println("Changing server: " + simRunning);

      if (simRunning == true) af = map.findForward("running");
      else af = map.findForward("sucess");
    }

    return af;
  }
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   User user = LegacySpringUtils.getUserManager().getLoggedInUser();
   String suppliedOldPassword = BeanUtils.getProperty(form, "oldpassword");
   String actualOldPassword = user.getPassword();
   String hashedSuppliedOldPassword = LogonUtils.hashPassword(suppliedOldPassword);
   if (hashedSuppliedOldPassword.equals(actualOldPassword)) {
     user.setPassword(LogonUtils.hashPassword(BeanUtils.getProperty(form, "passwordPwd")));
     user.setFirstlogon(false);
     LegacySpringUtils.getUserManager().save(user);
     AddLog.addLog(
         user.getUsername(),
         AddLog.PASSWORD_CHANGE,
         user.getUsername(),
         "",
         UserUtils.retrieveUsersRealUnitcodeBestGuess(user.getUsername()),
         "");
     return mapping.findForward("success");
   } else {
     request.setAttribute("error", "incorrect current password");
     return mapping.findForward("input");
   }
 }
  /**
   * 處理確定更新學生選課內容之方法
   *
   * @param mapping org.apache.struts.action.ActionMapping object
   * @param form org.apache.struts.action.ActionForm object
   * @param request javax.servlet.http.HttpServletRequest object
   * @param response javax.servlet.http.HttpServletResponse object
   * @return org.apache.struts.action.ActionForward object
   * @exception java.lang.Exception
   */
  public ActionForward update(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm aForm = (DynaActionForm) form;
    ActionMessages messages = validateInputForUpdate(aForm, Toolket.getBundle(request));
    if (!messages.isEmpty()) {
      saveErrors(request, messages);
      return mapping.findForward(IConstants.ACTION_MAIN_NAME);
    } else {
      try {
        Short selectLimit = (Short) aForm.get("selectLimit");
        CourseManager cm = (CourseManager) getBean(COURSE_MANAGER_BEAN_NAME);
        cm.txUpdateDtimeSelLimit(aForm.getString("dtimeOid"), selectLimit);
        messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Message.ModifySuccessful"));
        saveMessages(request, messages);
        Toolket.resetCheckboxCookie(response, SELD_LIST_NAME);
        return mapping.findForward(IConstants.ACTION_SUCCESS_NAME);
      } catch (Exception e) {
        ActionMessages errors = new ActionMessages();
        errors.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Exception.generic", e.getMessage()));
        saveErrors(request, errors);
        return mapping.findForward(IConstants.ACTION_MAIN_NAME);
      }
    }
  }
  /** {@inheritDoc} */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm formIn,
      HttpServletRequest request,
      HttpServletResponse response) {

    RequestContext rc = new RequestContext(request);
    User user = rc.getLoggedInUser();

    Channel chan = ChannelManager.lookupByIdAndUser(rc.getRequiredParam(RequestContext.CID), user);

    try {
      ChannelManager.verifyChannelAdmin(user, chan.getId());
    } catch (InvalidChannelRoleException e) {
      addMessage(request, e.getMessage());
      return mapping.findForward("default");
    }

    ListRhnSetHelper helper =
        new ListRhnSetHelper(this, request, RhnSetDecl.ERRATA_TO_SYNC.createCustom(chan.getId()));

    helper.execute();
    if (helper.isDispatched()) {
      Map params = new HashMap();
      params.put(RequestContext.CID, chan.getId());
      return getStrutsDelegate().forwardParams(mapping.findForward("submit"), params);
    }

    request.setAttribute("channel_name", chan.getName());
    request.setAttribute(RequestContext.CID, chan.getId());
    return mapping.findForward("default");
  }
  /**
   * [UC0621] - Filtro para Curva ABC de Debitos
   *
   * @author: Ivan Sérgio
   * @date: 30/07/2007
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    // Seta o mapeamento de retorno
    ActionForward retorno = actionMapping.findForward("gerarCurvaAbcDebitos");

    ImovelCurvaAbcDebitosActionForm imovelCurvaAbcDebitosActionForm =
        (ImovelCurvaAbcDebitosActionForm) actionForm;

    /*
     * [FS0005 - Verificar preenchimento dos campos]
     * Campos obrigatórios: Referencia da cobranca (é validado antes);
     * 						Valor minimo do Debito;
     */

    if (imovelCurvaAbcDebitosActionForm.getValorMinimoDebito() == null) {
      retorno = actionMapping.findForward("filtrarImovelCurvaAbcDebitosDebito");

      httpServletRequest.setAttribute("msgValidacao", "Informe o Valor Mínimo do Débito.");

      FiltrarImovelCurvaAbcDebitosWizardAction filtrar =
          new FiltrarImovelCurvaAbcDebitosWizardAction();
      filtrar.exibirFiltrarImovelCurvaAbcDebitosDebito(
          actionMapping, actionForm, httpServletRequest, httpServletResponse);
    }

    return retorno;
  }
  /**
   * Method execute
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   */
  public ActionForward executeAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    String cNumeroReferencia = (String) request.getParameter(REFERENCIA_KEY);
    if (cNumeroReferencia == null) {
      return mapping.findForward(Constantes.ERROR_FORWARD);
    }

    String cFormulario = null;
    Liquidacion oLiquidacion = null;
    try {
      oLiquidacion =
          PagoElectronicoManagerHelper.obtenerDatosLiquidacion(request, cNumeroReferencia);
      String cXMLDatos =
          PagoElectronicoManagerHelper.obtenerDocumentoPago(request, cNumeroReferencia);
      cFormulario =
          FormCreator.crearFormularioLiquidacion(oLiquidacion.getTasa(), cXMLDatos, request);
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      request.setAttribute(ERROR_KEY, e.getMessage());
      return mapping.findForward(Constantes.ERROR_FORWARD);
    }
    request.setAttribute(FORMULARIO_KEY, cFormulario);

    if (ConfiguracionComun.usarPasarelaPagoExternaConRedireccion()) {
      return mapping.findForward(Constantes.PASARELA_FORWARD);
    }
    return mapping.findForward(Constantes.SUCCESS_FORWARD);
  }
 /**
  * Method execute
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return ActionForward
  */
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   String loginName = (String) request.getSession().getAttribute("loginName");
   String pwd = request.getParameter("pwd");
   String pwd1 = request.getParameter("pwd1");
   String pwd2 = request.getParameter("pwd2");
   String mail = request.getParameter("mail");
   Integer id = userLoginDao.findByNPM(loginName, pwd, mail);
   if (id == -1 || !pwd1.equals(pwd2)) {
     System.out.println("输入的信息不正确,不能修改密码");
     request.setAttribute("error", "输入的信息不正确,不能修改密码");
   } else {
     userLoginDao.updatePwd(id, pwd1);
     System.out.println("密码修改成功");
     request.setAttribute("error", "密码修改成功!");
   }
   if (request.getParameter("type").equals("m")) {
     System.out.println("m");
     return mapping.findForward("updatePwd");
   } else {
     System.out.println("u");
     return mapping.findForward("stuUpdatePwd");
   }
 }
Exemple #8
0
  @Override
  public ActionForward render(
      ActionMapping actionMapping,
      ActionForm actionForm,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getArticles(renderRequest);
      ActionUtil.getFolders(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass());

        return actionMapping.findForward("portlet.journal.error");
      } else {
        throw e;
      }
    }

    String forward = "portlet.journal.edit_entry";

    return actionMapping.findForward(getForward(renderRequest, forward));
  }
  protected ActionForward performAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    String forward = FWD_SUCCESS;

    DynaActionForm dynaForm = (DynaActionForm) form;
    // get selected qaEvents
    String[] selectedIDs = (String[]) dynaForm.get("selectedIDs");

    // get sysUserId from login module
    UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA);
    String sysUserId = String.valueOf(usd.getSystemUserId());

    List qaEvents = new ArrayList();

    for (int i = 0; i < selectedIDs.length; i++) {
      QaEvent qaEvent = new QaEvent();
      qaEvent.setId(selectedIDs[i]);
      qaEvent.setSysUserId(sysUserId);
      qaEvents.add(qaEvent);
    }
    ActionMessages errors = null;
    try {

      QaEventDAO qaEventDAO = new QaEventDAOImpl();
      qaEventDAO.deleteData(qaEvents);
      // System.out.println("Just deleted QaEvent");
      // initialize the form
      dynaForm.initialize(mapping);

    } catch (LIMSRuntimeException lre) {
      // bugzilla 2154
      LogEvent.logError("QaEventDeleteAction", "performAction()", lre.toString());
      request.setAttribute(IActionConstants.REQUEST_FAILED, true);

      errors = new ActionMessages();
      ActionError error = null;
      if (lre.getException() instanceof org.hibernate.StaleObjectStateException) {
        error = new ActionError("errors.OptimisticLockException", null, null);
      } else {
        error = new ActionError("errors.DeleteException", null, null);
      }
      errors.add(ActionMessages.GLOBAL_MESSAGE, error);
      saveErrors(request, errors);
      request.setAttribute(Globals.ERROR_KEY, errors);
      forward = FWD_FAIL;
    }
    if (forward.equals(FWD_FAIL)) return mapping.findForward(forward);

    if ("true".equalsIgnoreCase(request.getParameter("close"))) {
      forward = FWD_CLOSE;
    }

    request.setAttribute("menuDefinition", "QaEventMenuDefinition");
    return mapping.findForward(forward);
  }
 public ActionForward execute(
     ActionMapping actionMapping,
     ActionForm actionForm,
     HttpServletRequest httpServletRequest,
     HttpServletResponse httpServletResponse) {
   AcademybaseinfoForm form = new AcademybaseinfoForm();
   Integer abi_id = Integer.valueOf(httpServletRequest.getParameter("abi_id"));
   Academybaseinfo bean = new Academybaseinfo();
   if (httpServletRequest.getParameter("abi_id") != null) {
     abi_id = Integer.valueOf(httpServletRequest.getParameter("abi_id"));
     bean = academybaseinfoDAO.getAcademybaseinfo(abi_id);
   } else {
     abi_id = (Integer) httpServletRequest.getSession().getAttribute("abi_id");
     bean = academybaseinfoDAO.getAcademybaseinfo(abi_id);
   }
   try {
     org.apache.commons.beanutils.BeanUtils.copyProperties(form, bean);
   } catch (Exception ex) {
     return actionMapping.findForward("failure");
   }
   form.setTempregisterdate(DateUtil.getCalendarString(form.getRegisterdate(), "yyyy-MM-dd"));
   httpServletRequest.setAttribute("academybaseinfoForm", form);
   httpServletRequest.getSession().setAttribute("acadname", form.getAcadname());
   httpServletRequest.getSession().setAttribute("abi_id", abi_id);
   return actionMapping.findForward("success");
 }
  /**
   * This is the action called from the Struts framework.
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   * @throws java.lang.Exception
   * @return
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String defaultImage = "/images/profilepics/Chuirer.jpg";
    profile form2 = (profile) form;

    HttpSession ses = request.getSession();
    if (ses.getAttribute("usuarioLogueado") == null) {
      return mapping.findForward(NOEXISTE);
    }

    EnUsuario pro =
        (new DaUsuarios()).recuperaUsuario(ses.getAttribute("usuarioLogueado").toString());
    EnPeticiones peticiones = (new DaPeticiones()).recuperaPeticiones(pro.getUserName());
    form2.setUsername(pro.getUserName());
    form2.setDescripcion(pro.getDscripcion());
    form2.setRealname(pro.getNombreReal() + " " + pro.getApellidos());
    form2.setUrl(pro.getUrl());
    form2.setProtegida(pro.getPerfilPrivado());
    form2.setPeticiones(peticiones.getNumero_peticiones());
    form2.setImgUrl(
        (pro.getImgUrl() != null && !pro.getImgUrl().isEmpty()
            ? ".." + pro.getImgUrl()
            : ".." + defaultImage));
    return mapping.findForward(SUCCESS);
  }
Exemple #12
0
  /**
   * Process the specified HTTP request, and create the corresponding HTTP response (or forward to
   * another web component that will create it). Return an <code>ActionForward</code> instance
   * describing where and how control should be forwarded, or <code>null</code> if the response has
   * already been completed.
   *
   * @param mapping The ActionMapping used to select this instance
   * @param form The optional ActionForm bean for this request (if any)
   * @param request The HTTP request we are processing
   * @param response The HTTP response we are creating
   * @return Action to forward to
   * @exception Exception if an input/output error or servlet exception occurs
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // Extract attributes we will need
    HttpSession session = request.getSession();
    Locale locale = getLocale(request);
    MessageResources messages = getResources(request);
    TypeForm info = (TypeForm) form;
    String action = request.getParameter("action");

    // Was this transaction cancelled?
    if (isCancelled(request)) {
      if (log.isInfoEnabled()) {
        log.info(" " + mapping.getAttribute() + " - Type transaction was cancelled");
      }

      removeFormBean(mapping, request);

      return (mapping.findForward("success"));
    }

    return mapping.findForward("success");
  }
Exemple #13
0
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getNode(renderRequest);
      ActionUtil.getPage(renderRequest);

      compareVersions(renderRequest, renderResponse);
    } catch (Exception e) {
      if (e instanceof NoSuchPageException) {
        SessionErrors.add(renderRequest, e.getClass());

        return mapping.findForward("portlet.wiki.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward("portlet.wiki.compare_versions");
  }
Exemple #14
0
  /**
   * <br>
   * [機 能] 処理モードにより遷移先を取得する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マッピング
   * @param paramMdl パラメータ情報
   * @return ActionForward
   */
  public ActionForward getForward(ActionMapping map, Rng030ParamModel paramMdl) {

    ActionForward forward = null;

    if (paramMdl.getRng130searchFlg() == 1) {
      return map.findForward("search");
    }

    if (paramMdl.getRngApprMode() == RngConst.RNG_APPRMODE_DISCUSSING) {
      // 申請中案件管理画面へ遷移
      forward = map.findForward("rng050");
    } else if (paramMdl.getRngApprMode() == RngConst.RNG_APPRMODE_COMPLETE) {
      // 完了案件管理画面へ遷移
      forward = map.findForward("rng070");
    } else {
      if (paramMdl.getRngDspMode() == RngConst.RNG_MODE_MAIN) {
        // メインへ遷移
        forward = map.findForward("gf_main");
      } else {
        // 稟議一覧画面へ遷移
        forward = map.findForward("rng010");
      }
    }

    return forward;
  }
  public ActionForward fillCandidacyInformation(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {

    final IndividualCandidacyProcessBean bean = getIndividualCandidacyProcessBean();
    request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);

    if (!StringUtils.isEmpty(bean.getPersonBean().getSocialSecurityNumber())) {
      Party existingSocialSecurityNumberParty =
          Person.readByContributorNumber(bean.getPersonBean().getSocialSecurityNumber());

      if (existingSocialSecurityNumberParty != null
          && existingSocialSecurityNumberParty != bean.getPersonBean().getPerson()) {
        // found person with same contributor number
        addActionMessage(request, "error.party.existing.contributor.number");
        return mapping.findForward("fill-personal-information");
      }
    }

    try {
      DegreeOfficePublicCandidacyHashCode candidacyHashCode =
          DegreeOfficePublicCandidacyHashCodeOperations.getUnusedOrCreateNewHashCode(
              getProcessType(), getParentProcess(request), bean.getPersonBean().getEmail());
      bean.setPublicCandidacyHashCode(candidacyHashCode);
    } catch (HashCodeForEmailAndProcessAlreadyBounded e) {
      addActionMessage(request, "error.candidacy.hash.code.already.bounded");
      return mapping.findForward("fill-personal-information");
    }

    return mapping.findForward("fill-candidacy-information");
  }
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   ActionMessages messages = new ActionMessages();
   try {
     SecurityInfo securityInfo = (SecurityInfo) request.getSession().getAttribute("SecurityInfo");
     ILoanerlogoutBS loanerlogoutBS =
         (ILoanerlogoutBS)
             BSUtils.getBusinessService("loanerlogoutBS", this, mapping.getModuleConfig());
     String contractId = (String) request.getParameter("contractId");
     if (contractId != null && !"".equals(contractId.trim())) {
       contractId = (String) request.getParameter("contractId");
     }
     loanerlogoutBS.findLoanerlogouAvailable(contractId);
     loanerlogoutBS.saveLoanerlogouTa(contractId, securityInfo);
     request.setAttribute("save", "save");
   } catch (BusinessException be) {
     messages.add(
         ActionMessages.GLOBAL_MESSAGE, new ActionMessage(be.getLocalizedMessage(), false));
     saveErrors(request, messages);
     return mapping.findForward("loanerlogout_show");
   } catch (Exception e) {
     e.printStackTrace();
   }
   return mapping.findForward("loanerlogout_show");
 }
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    if (getUserView(request).getPerson().getCandidaciesSet().size() == 1) {
      final Candidacy candidacy =
          getUserView(request).getPerson().getCandidaciesSet().iterator().next();

      if (candidacy instanceof DegreeCandidacy || candidacy instanceof IMDCandidacy) {
        request.setAttribute("candidacyID", candidacy.getExternalId());
        final CandidacySituation activeCandidacySituation = candidacy.getActiveCandidacySituation();
        if (activeCandidacySituation != null
            && CandidacySituationType.STAND_BY
                == activeCandidacySituation.getCandidacySituationType()) {
          request.setAttribute(
              "operationType", CandidacyOperationType.FILL_PERSONAL_DATA.toString());
          return mapping.findForward("fillData");
        } else {
          return mapping.findForward("showCandidacyDetails");
        }
      }
    }
    return mapping.findForward("showWelcome");
  }
  @Override
  public ActionForward render(
      ActionMapping actionMapping,
      ActionForm actionForm,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getFileEntry(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchFileEntryException
          || e instanceof NoSuchFileVersionException
          || e instanceof NoSuchRepositoryEntryException
          || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass());

        return actionMapping.findForward("portlet.document_selector.error");
      } else {
        throw e;
      }
    }

    String forward = "portlet.document_selector.add_file_entry";

    return actionMapping.findForward(getForward(renderRequest, forward));
  }
  protected ActionForward executeInContext(
      UserContext uc,
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    if (isCancelled(request)) {
      return mapping.findForward(SUCCESS);
    }
    ReplicationPassPhraseForm form = (ReplicationPassPhraseForm) actionForm;

    IReplicationSecurityManager rsm =
        ManagementContainer.getInstance().getReplicationSecurityManager();
    boolean isOk;
    String operation;
    if (form.isChange()) {
      operation = "change";
      isOk =
          rsm.changePassPhrase(
              uc.getCurrentCustomer().getCustID(), form.getOriginal(), form.getNewPassPhrase());
    } else {
      operation = "set";
      isOk = rsm.createKeyPair(uc.getCurrentCustomer().getCustID(), true, form.getNewPassPhrase());
    }

    if (!isOk) {
      reportSingleError(
          request, ActionMessages.GLOBAL_MESSAGE, "error.sr.passphrase.change.failed", operation);
      return mapping.findForward(FAILURE);
    }

    return mapping.findForward(SUCCESS);
  }
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getNode(renderRequest);
      ActionUtil.getPage(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchNodeException
          || e instanceof NoSuchPageException
          || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());

        return mapping.findForward("portlet.wiki.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward(getForward(renderRequest, "portlet.wiki.edit_page_attachment"));
  }
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getStructure(renderRequest);
    } catch (NoSuchStructureException nsse) {

      // Let this slide because the user can manually input a structure
      // key for a new structure that does not yet exist

    } catch (Exception e) {
      if (e instanceof PrincipalException) {
        SessionErrors.add(renderRequest, e.getClass());

        return mapping.findForward("portlet.dynamic_data_mapping.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward(
        getForward(renderRequest, "portlet.dynamic_data_mapping.copy_structure"));
  }
 @Override
 public ActionForward process(
     ActionMapping pActionMapping,
     ActionForm pActionForm,
     HttpServletRequest pHttpServletRequest,
     HttpServletResponse pHttpServletResponse) {
   LoginForm lLoginForm = (LoginForm) pActionForm;
   String lSubmitAction = StringUtils.trimToNull(lLoginForm.getSubmitAction());
   if (lSubmitAction != null) {
     if (SubmitActions.LOGIN.toString().equals(lSubmitAction)) {
       String lLoginName = lLoginForm.getLoginName();
       String lPassword = lLoginForm.getPassword();
       if (!mLoginService.doesUserExist(lLoginName)) {
         ActionMessages lActionMessages = new ActionMessages();
         lActionMessages.add(
             ActionMessages.GLOBAL_MESSAGE,
             new ActionMessage(LOGIN_ERROR_KEY_PREFIX + ".loginname.notexists"));
         this.saveErrors(pHttpServletRequest, lActionMessages);
         lLoginForm.setNextPage(NavigateActions.DisplayLogin.toString());
         return pActionMapping.findForward(NavigateActions.DisplayLogin.toString());
       }
       boolean lAuthenticated = mLoginService.isUserAuthenticated(lLoginName, lPassword);
       if (lAuthenticated) {
         LOGGER.debug("Login Successful");
         User lUser = mLoginService.loadUserByLoginName(lLoginName);
         pHttpServletRequest.getSession().setAttribute(LOGGED_IN_USER, lUser);
         lLoginForm.setNextPage("DisplayHomePage");
       }
       lLoginForm.setNextPage(NavigateActions.DisplayHomePage.toString());
     }
   }
   return pActionMapping.findForward(NavigateActions.DisplayLogin.toString());
 }
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    String[] isSelected;
    ActionForward forward = null;
    ManageCustomersForm manageCust = (ManageCustomersForm) form;

    if (manageCust.getNewButton().isSelected()) {
      forward = mapping.findForward("add");
    } else if (manageCust.getDeleteButton().isSelected()) {

      CustomerDelegate delegate = new CustomerDelegate();
      isSelected = manageCust.getIdSelections();

      if (isSelected.length > 0 && isSelected != null) {

        for (int i = 0; i < isSelected.length; i++) {
          int id = Integer.parseInt(isSelected[i]);
          delegate.deleteCustomer(id);
        }
      }
      forward = mapping.findForward("deleteSuccess");
    }

    // TODO Auto-generated method stub
    return forward;
  }
  public ActionForward create(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ComplainForm cForm = (ComplainForm) form;

    if (cForm.getContent() == null || cForm.getContent().trim().length() < 1) {
      request.setAttribute("errMsg", "请输入投诉内容!");
      return mapping.findForward("error");
    }

    try {
      Userinfo info = getUser(request.getSession());
      Long uid = 0l;
      if (info != null) uid = info.getId();

      Complain city = getLogic().create(cForm, uid);
      request.setAttribute("errMsg", "投诉成功!");
      //			request.setAttribute("backUrl", "city.do?method=list");
      request
          .getRequestDispatcher("/feedback.jsp?id=" + request.getParameter("infoId"))
          .forward(request, response);
      return null;
    } catch (Exception e) {
      e.printStackTrace();
      request.setAttribute("errMsg", e.getMessage());
      return mapping.findForward("error");
    }

    //		return mapping.findForward("success");
  }
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getPasswordPolicy(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchPasswordPolicyException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());

        return mapping.findForward("portlet.password_policies_admin.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward(
        getForward(
            renderRequest,
            "portlet.password_policies_admin." + "edit_password_policy_assignments"));
  }
Exemple #26
0
  /**
   * This is the action called from the Struts framework.
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   * @throws java.lang.Exception
   * @return
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List listaRoles = new ArrayList();
    List listaPermisos = new ArrayList();
    List numPermisos = new ArrayList();

    listaRoles = PermisosBO.listarRoles();
    listaPermisos = PermisosBO.listarPermisosDefecto();
    numPermisos = PermisosBO.listarPermisos();

    request.setAttribute("lista", listaRoles);
    request.setAttribute("listaPermisos", listaPermisos);
    System.out.println("-------ListaRoles---------");
    System.out.println("Longitud lista roles: " + listaRoles.size());
    System.out.println("Longitud lista permidos defecto (28): " + listaPermisos.size());
    System.out.println("Numero de permisos (7): " + numPermisos.size());
    System.out.println("--------------------------");
    int tam = numPermisos.size();
    request.setAttribute("tam", tam);

    if (listaRoles != null && listaPermisos != null) return mapping.findForward(SUCCESS);
    else return mapping.findForward(FAILURE);
  }
  /**
   * 處理選擇修改學生選課內容之方法
   *
   * @param mapping org.apache.struts.action.ActionMapping object
   * @param form org.apache.struts.action.ActionForm object
   * @param request javax.servlet.http.HttpServletRequest object
   * @param response javax.servlet.http.HttpServletResponse object
   * @return org.apache.struts.action.ActionForward object
   * @exception java.lang.Exception
   */
  public ActionForward modify(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm aForm = (DynaActionForm) form;
    ActionMessages messages = validateInputForUpdate(aForm, Toolket.getBundle(request));
    if (!messages.isEmpty()) {
      saveErrors(request, messages);
      return mapping.findForward(IConstants.ACTION_MAIN_NAME);
    } else {
      String studentNo = aForm.getString("stdNo");
      ScoreManager sm = (ScoreManager) getBean(SCORE_MANAGER_BEAN_NAME);
      Student student = sm.findStudentByStudentNo(studentNo);
      aForm.set("stdName", student.getStudentName());
      aForm.set("stdClassName", Toolket.getClassFullName(student.getDepartClass()));
      SeldDataInfo sdi = getSeldDataInfoByIndex(request);
      if (sdi == null) {
        messages = new ActionMessages();
        messages.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("Course.onlineAddRemoveCourse.unselected"));
        saveErrors(request, messages);
        return mapping.findForward(IConstants.ACTION_MAIN_NAME);
      }
      request.setAttribute(SELD_DATA_INFO, sdi);
    }

    setContentPage(request.getSession(false), "course/ModifyCourse.jsp");
    return mapping.findForward(IConstants.ACTION_MAIN_NAME);
  }
  public ActionForward selectPersonForCandidacy(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {

    final IndividualCandidacyProcessBean bean = getIndividualCandidacyProcessBean();
    request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);

    if (!bean.hasChoosenPerson()) {
      addActionMessage(request, "error.candidacy.must.select.any.person");
      return mapping.findForward("prepare-create-new-process");
    }

    if (existsIndividualCandidacyProcessForDocumentId(
        request,
        bean.getChoosePersonBean().getPerson().getIdDocumentType(),
        bean.getChoosePersonBean().getPerson().getDocumentIdNumber())) {
      addActionMessage(request, "error.candidacy.already.exists.for.this.person");
      return mapping.findForward("prepare-create-new-process");
    }

    bean.setPersonBean(new PersonBean(bean.getChoosePersonBean().getPerson()));
    bean.removeChoosePersonBean();
    return mapping.findForward("fill-personal-information");
  }
  /**
   * 處理學生加選線上選課紀錄之方法
   *
   * @param mapping org.apache.struts.action.ActionMapping object
   * @param form org.apache.struts.action.ActionForm object
   * @param request javax.servlet.http.HttpServletRequest object
   * @param response javax.servlet.http.HttpServletResponse object
   * @return org.apache.struts.action.ActionForward object
   * @exception java.lang.Exception
   */
  public ActionForward addCourse(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm aForm = (DynaActionForm) form;
    ActionMessages messages = validateInputForUpdate(aForm, Toolket.getBundle(request));
    if (!messages.isEmpty()) {
      saveErrors(request, messages);
      return mapping.findForward(IConstants.ACTION_MAIN_NAME);
    } else {

      String stdNo = aForm.getString("stdNo");
      ScoreManager sm = (ScoreManager) getBean(SCORE_MANAGER_BEAN_NAME);
      Student student = sm.findStudentByStudentNo(stdNo);
      if (student != null) {
        aForm.set("stdName", student.getStudentName());
        aForm.set("stdClassName", Toolket.getClassFullName(student.getDepartClass()));
        aForm.set("sterm", "1");
        aForm.set("classNo", "");
        aForm.set("csCode", "");
      } else {
        messages.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Course.errorN1", "查無此人個人資料"));
        saveErrors(request, messages);
        return mapping.findForward(IConstants.ACTION_MAIN_NAME);
      }
    }

    setContentPage(request.getSession(false), "course/OnlineAddCourse.jsp");
    return mapping.findForward(IConstants.ACTION_MAIN_NAME);
  }
Exemple #30
0
  public ActionForward showTeacherCredits(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws NumberFormatException, FenixServiceException, ParseException {

    DynaActionForm teacherCreditsForm = (DynaActionForm) form;
    ExecutionSemester executionSemester =
        FenixFramework.getDomainObject((String) teacherCreditsForm.get("executionPeriodId"));

    Teacher requestedTeacher =
        FenixFramework.getDomainObject((String) teacherCreditsForm.get("teacherId"));

    User userView = Authenticate.getUser();
    Teacher loggedTeacher = userView.getPerson().getTeacher();

    if (requestedTeacher == null || loggedTeacher != requestedTeacher) {
      ActionMessages actionMessages = new ActionMessages();
      actionMessages.add("", new ActionMessage("message.invalid.teacher"));
      saveMessages(request, actionMessages);
      return mapping.findForward("teacher-not-found");
    }

    showLinks(request, executionSemester, RoleType.DEPARTMENT_MEMBER);
    getAllTeacherCredits(request, executionSemester, requestedTeacher);
    return mapping.findForward("show-teacher-credits");
  }