Esempio n. 1
0
 ActionForward getActionForwardHolydays() {
   String actionForwardURL = "/showCTCalendar.do?method=holydays";
   ActionForward ret = new ActionForward();
   ret.setPath(actionForwardURL);
   ret.setRedirect(false);
   return ret;
 }
  @Override
  public ActionForward start(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ActionForward returnForward = super.execute(mapping, form, request, response);

    String docHandler = returnForward.getPath();
    if (PROPOSAL_DEVELOPMENT_DOCUMENT.equals(request.getParameter(DOCUMENT_TYPE_NAME))) {
      docHandler =
          docHandler.replace(KRADConstants.DOC_HANDLER_METHOD, Constants.PROPOSAL_ACTIONS_PAGE);
    } else if (PROTOCOL_DOCUMENT.equals(request.getParameter(DOCUMENT_TYPE_NAME))
        || IACUC_PROTOCOL_DOCUMENT.equals(request.getParameter(DOCUMENT_TYPE_NAME))) {
      docHandler =
          docHandler.replace(KRADConstants.DOC_HANDLER_METHOD, Constants.MAPPING_PROTOCOL_ACTIONS);
    } else if (AWARD_DOCUMENT.equals(request.getParameter(DOCUMENT_TYPE_NAME))) {
      docHandler =
          docHandler.replace(
              KRADConstants.DOC_HANDLER_METHOD, Constants.MAPPING_AWARD_ACTIONS_PAGE);
    }

    returnForward = new ActionForward(docHandler, returnForward.getRedirect());
    return returnForward;
  }
Esempio n. 3
0
  /**
   * Need to suppress buttons here when 'Totals' tab is clicked.
   *
   * @see
   *     org.kuali.core.web.struts.action.KualiDocumentActionBase#execute(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final BudgetForm budgetForm = (BudgetForm) form;
    if (budgetForm.getMethodToCall().equals("close")) {
      setupDocumentExit();
    }
    ActionForward actionForward = null;

    actionForward = super.execute(mapping, budgetForm, request, response);

    if (actionForward != null) {
      if ("summaryTotals".equals(actionForward.getName())) {
        budgetForm.suppressButtonsForTotalPage();
      }
    }
    // check if audit rule check is done from PD
    if (budgetForm.isAuditActivated() && !"route".equals(((KualiForm) form).getMethodToCall())) {
      KraServiceLocator.getService(KualiRuleService.class)
          .applyRules(new DocumentAuditEvent(budgetForm.getDocument()));
    }

    return actionForward;
  }
Esempio n. 4
0
  public ActionForward deletePersonFunction(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final Integer personFunctionId = new Integer(request.getParameter("personFunctionID"));

    final PersonFunction personFunction =
        (PersonFunction) rootDomainObject.readAccountabilityByOID(personFunctionId);
    final Person person = personFunction.getPerson();

    personFunction.delete();

    final ActionForward actionForward =
        new ActionForward(
            "/functionsManagement/listPersonFunctions.faces?personID="
                + person.getIdInternal()
                + "&"
                + net.sourceforge
                    .fenixedu
                    .presentationTier
                    .servlets
                    .filters
                    .ContentInjectionRewriter
                    .CONTEXT_ATTRIBUTE_NAME
                + "=/conselho-cientifico/conselho-cientifico");
    actionForward.setRedirect(false);
    return actionForward;
  }
  public ActionForward show(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    SiteMapForm siteForm = (SiteMapForm) form;
    ActionMessages errors = new ActionMessages();
    ActionForward forward = new ActionForward(); // return value
    String next = "sitemap";
    String domContext = getDomainAndContext(request);

    siteForm.setContestsMainUrl(VCURLHelper.getContestsMainUrl(domContext));

    siteForm.setCreatePollUrl(VCURLHelper.getCreatePollUrl(domContext));

    siteForm.setHomePageUrl(VCURLHelper.getHomePageUrl(domContext));

    siteForm.setMyVCUrl(VCURLHelper.getMyVCMainUrl(domContext));
    siteForm.setEditAccountUrl(VCURLHelper.getMyRegInfoUrl(domContext));

    siteForm.setLoginUrl(VCURLHelper.getLoginUrl(domContext));
    siteForm.setForgotPswdUrl(VCURLHelper.getForgotPasswordUrl(domContext));
    siteForm.setRegUrl(VCURLHelper.getRegistrationUrl(domContext));

    siteForm.setSearchUrl(VCURLHelper.getSearchUrl(domContext));
    siteForm.setVacoWinnersUrl(VCURLHelper.getVacoWinnersUrl(domContext));

    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward(next);
    log.debug("forward:" + forward.getPath());
    // Finish with
    return (forward);
  }
Esempio n. 6
0
  /**
   * <br>
   * [機 能] 削除確認画面設定 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @return ActionForward
   */
  private ActionForward __doDeleteKnDsp(
      ActionMapping map, Ipk100Form form, HttpServletRequest req) {
    ActionForward forward = null;
    Cmn999Form cmn999Form = new Cmn999Form();
    ActionForward forwardOK = null;
    ActionForward forwardCancel = null;

    // トランザクショントークン設定
    this.saveToken(req);

    // スペック情報削除の削除確認画面パラメータの設定
    MessageResources msgRes = getResources(req);
    cmn999Form.setType(Cmn999Form.TYPE_OKCANCEL);
    cmn999Form.setIcon(Cmn999Form.ICON_INFO);
    cmn999Form.setWtarget(Cmn999Form.WTARGET_BODY);
    forwardOK = map.findForward("ipk100DeleteOk");
    cmn999Form.setUrlOK(forwardOK.getPath());
    forwardCancel = map.findForward("ipk100DeleteCancel");
    cmn999Form.setUrlCancel(forwardCancel.getPath());
    cmn999Form.setMessage(msgRes.getMessage("sakujo.kakunin.once", __getSpecKbn(form, req)));
    cmn999Form.addHiddenParam("backScreen", form.getBackScreen());
    cmn999Form.addHiddenParam("ismSid", form.getIsmSid());
    cmn999Form.addHiddenParam("editMode", form.getEditMode());
    cmn999Form.addHiddenParam("ipk100name", form.getIpk100name());
    cmn999Form.addHiddenParam("ipk100specLevel", form.getIpk100specLevel());
    cmn999Form.addHiddenParam("ipk100scroll", form.getIpk100scroll());
    cmn999Form.addHiddenParam("ipk100biko", form.getIpk100biko());
    cmn999Form.addHiddenParam("specKbn", form.getSpecKbn());
    req.setAttribute("cmn999Form", cmn999Form);
    forward = map.findForward("gf_msg");
    return forward;
  }
  public void processFormActionAndForward(
      final HttpServletRequest request,
      final HttpServletResponse response,
      final ActionMapping mapping)
      throws ServletException, IOException {
    ActionForm form = processActionForm(request, response, mapping);
    processPopulate(request, response, form, mapping);

    // Create or acquire the Action instance to process this request
    Action action = processActionCreate(request, response, mapping);

    if (action != null) {
      // Call the Action instance itself
      ActionForward forward = processActionPerform(request, response, action, form, mapping);

      if (forward != null) {
        if (forward.getRedirect()
            && forward.getName() != null
            && forward.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME)) {
          LOG.info("Attempt to open a document with a status of \"Initiated\" detected");
          return;
        }
        // ProcessDefinition the returned ActionForward instance
        processForwardConfig(request, response, forward);
      }
    }
  }
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    ManutencaoRegistroActionForm manutencaoRegistroActionForm =
        (ManutencaoRegistroActionForm) actionForm;

    String[] ids = manutencaoRegistroActionForm.getIdRegistrosRemocao();

    ActionForward retorno = actionMapping.findForward("telaSucesso");

    Fachada fachada = Fachada.getInstancia();

    if (ids == null || ids.length == 0) {
      throw new ActionServletException("atencao.registros.nao_selecionados");
    }

    fachada.remover(ids, FuncionarioCargo.class.getName(), null, null);

    if (retorno.getName().equalsIgnoreCase("telaSucesso")) {
      montarPaginaSucesso(
          httpServletRequest,
          ids.length + " Cargo(s) do(s) Funcionário(s) removido(s) com sucesso.",
          "Realizar outra Manutenção no Cargo do Funcionário",
          "exibirFiltrarCargoFuncionarioAction.do?menu=sim");
    }

    return retorno;
  }
Esempio n. 9
0
  public void testDisabledUser() {
    LoginAction action = new LoginAction();
    User u = UserTestUtils.findNewUser("testUser", "testOrg" + this.getClass().getSimpleName());
    UserManager.disableUser(u, u);

    ActionMapping mapping = new ActionMapping();
    mapping.addForwardConfig(new ActionForward("failure", "path", false));
    PxtCookieManager pcm = new PxtCookieManager();
    RhnMockDynaActionForm form = new RhnMockDynaActionForm("loginForm");
    RhnMockHttpServletRequest request = new RhnMockHttpServletRequest();
    RhnMockHttpServletResponse response = new RhnMockHttpServletResponse();

    RequestContext requestContext = new RequestContext(request);

    request.setSession(new MockHttpSession());
    request.setupServerName("mymachine.rhndev.redhat.com");
    WebSession s = requestContext.getWebSession();
    request.addCookie(pcm.createPxtCookie(s.getId(), request, 10));

    form.set("username", u.getLogin());
    /**
     * Since we know testUser's password is "password", just set that here. using u.getPassword()
     * will fail when we're using encrypted passwords.
     */
    form.set("password", "password");

    ActionForward rc = action.execute(mapping, form, request, response);

    assertEquals("failure", rc.getName());
  }
Esempio n. 10
0
  /**
   * <br>
   * [機 能] 完了画面設定 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @return ActionForward
   */
  private ActionForward __doCompDsp(
      ActionMapping map, Sml140knForm form, HttpServletRequest req, HttpServletResponse res) {

    ActionForward forward = null;
    Cmn999Form cmn999Form = new Cmn999Form();
    ActionForward urlForward = null;

    // 完了画面パラメータの設定
    MessageResources msgRes = getResources(req);
    cmn999Form.setType(Cmn999Form.TYPE_OK);
    cmn999Form.setIcon(Cmn999Form.ICON_INFO);
    cmn999Form.setWtarget(Cmn999Form.WTARGET_BODY);

    GsMessage gsMsg = new GsMessage();
    String smail = gsMsg.getMessage(req, "cmn.shortmail");

    urlForward = map.findForward("backToList");
    cmn999Form.setUrlOK(urlForward.getPath());
    cmn999Form.setMessage(msgRes.getMessage("sakujo.kanryo.object", smail));

    // hiddenパラメータ
    cmn999Form.addHiddenParam("backScreen", form.getBackScreen());
    cmn999Form.addHiddenParam("sml010ProcMode", form.getSml010ProcMode());
    cmn999Form.addHiddenParam("sml010Sort_key", form.getSml010Sort_key());
    cmn999Form.addHiddenParam("sml010Order_key", form.getSml010Order_key());
    cmn999Form.addHiddenParam("sml010PageNum", form.getSml010PageNum());
    cmn999Form.addHiddenParam("sml010SelectedSid", form.getSml010SelectedSid());
    cmn999Form.addHiddenParam("sml010DelSid", form.getSml010DelSid());
    req.setAttribute("cmn999Form", cmn999Form);

    forward = map.findForward("gf_msg");
    return forward;
  }
Esempio n. 11
0
 /**
  * Return a URL path that will return control to the current action. This path is generated by
  * adding the specified parameter to the path of the forward specified as the "input" forward for
  * the given mapping.
  *
  * @param mapping the ActionMapping describing the current action's forwards
  * @param param the name of the path parameter to add
  * @param value the value of the parameter to add
  * @exception ServletException if encoding the path parameter fails or input has not been set
  */
 public static String findReturnPath(ActionMapping mapping, Map params) throws Exception {
   ActionForward inputForward = mapping.getInputForward();
   if (inputForward.getPath() == null)
     throw new ServletException(
         "input cannot be null for returnPath on url: " + mapping.getPath());
   ActionForward returnForward = ActionUtils.changeForwardPath(inputForward, params);
   return returnForward.getPath();
 }
Esempio n. 12
0
 ActionForward getActionForwardShow(String entityId, String regId) {
   String actionForwardURL =
       "/showCTCalendar.do?method=show&entityId=" + entityId + "&regId=" + regId;
   ActionForward ret = new ActionForward();
   ret.setPath(actionForwardURL);
   ret.setRedirect(true);
   return ret;
 }
  /**
   * < <Descrição do método>>
   *
   * @param actionMapping Descrição do parâmetro
   * @param actionForm Descrição do parâmetro
   * @param httpServletRequest Descrição do parâmetro
   * @param httpServletResponse Descrição do parâmetro
   * @return Descrição do retorno
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    // Obtém o action form
    ManutencaoRegistroActionForm manutencaoRegistroActionForm =
        (ManutencaoRegistroActionForm) actionForm;

    // Obtém a instância da sessão
    HttpSession sessao = httpServletRequest.getSession(false);

    // Cria os objetos
    String pacoteNomeObjeto = null;

    // Obtém os ids de remoção
    String[] ids = manutencaoRegistroActionForm.getIdRegistrosRemocao();

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

    // Obtém a instância da fachada
    Fachada fachada = Fachada.getInstancia();

    // mensagem de erro quando o usuário tenta excluir sem ter selecionado
    // nenhum
    // registro
    if (ids == null || ids.length == 0) {
      throw new ActionServletException("erro.registros.nao_selecionados");
    }

    // Pega o path do pacote do objeto mais o tipo
    pacoteNomeObjeto = (String) sessao.getAttribute("pacoteNomeObjeto");
    // Remove o objeto
    fachada.removerTabelaAuxiliar(ids, pacoteNomeObjeto, null, null);

    // Monta a página de sucesso
    if (retorno.getName().equalsIgnoreCase("telaSucesso")) {
      montarPaginaSucesso(
          httpServletRequest,
          ((String) sessao.getAttribute("titulo")) + " removido(a)(s) com sucesso",
          "Realizar outra manutenção de " + ((String) sessao.getAttribute("titulo")),
          ((String) sessao.getAttribute("funcionalidadeTabelaAuxiliarIndicadorFiltrar")));
    }

    // Remove os objetos da sessão
    sessao.removeAttribute("funcionalidadeTabelaAuxiliarIndicadorManter");
    sessao.removeAttribute("titulo");
    sessao.removeAttribute("tabelaAuxiliarIndicador");
    sessao.removeAttribute("tamMaxCampoDescricao");
    sessao.removeAttribute("tamMaxCampoDescricaoAbreviada");
    sessao.removeAttribute("descricao");
    sessao.removeAttribute("descricaoAbreviada");

    // devolve o mapeamento de retorno
    return retorno;
  }
  /** Override super class method to perform additional population for Operation Context */
  @Override
  protected void processPreparedOperationContext(
      ActionContext actionContext, OperationContext opContext) throws GTClientException {
    try {
      IGTSchemaMappingFileEntity entity = null;
      String indexString = actionContext.getRequest().getParameter("index");
      opContext.setAttribute(INDEX_KEY, indexString); // so that when we save the entity,
      // we can differentiate whether we are saving
      // a new entity or an existing entity. (see detail in saveWithManager)

      if (indexString != null) {
        if (!indexString.equals("new")) {
          try {
            int index = Integer.parseInt(indexString);
            IGTImportSchemaEntity importSchema = getImportSchema(actionContext);
            ArrayList schemaMappingList =
                (ArrayList) importSchema.getFieldValue(IGTImportSchemaEntity.SCHEMA_MAPPING);
            if (schemaMappingList == null) {
              throw new NullPointerException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Null value for schemaMappingList.");
            }
            try {
              entity = (IGTSchemaMappingFileEntity) schemaMappingList.get(index);
            } catch (Throwable t) {
              throw new GTClientException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error retrieving schemaMappingFile entity from list at index "
                      + index,
                  t);
            }
            if (entity == null) {
              throw new java.lang.NullPointerException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Null entity object at index "
                      + index
                      + " of schemaMappingList list retrieved from ImportSchema entity "
                      + importSchema);
            }
          } catch (Throwable t) {
            throw new GTClientException(
                "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error retrieving schemaMappingFile entity object from"
                    + " importSchema entity in parent OperationContext",
                t);
          }
        } else {
          entity = (IGTSchemaMappingFileEntity) getRequestedEntity(actionContext);
        }
      } else {
        throw new GTClientException(
            "[SchemaMappingFileDispatchAction.processPreparedOperationContext]No index specified");
      }
      opContext.setAttribute(IOperationContextKeys.ENTITY, entity);
      ActionForward submitForward = actionContext.getMapping().findForward("submit");
      opContext.setAttribute(IOperationContextKeys.FORM_SUBMIT_URL, submitForward.getPath());
    } catch (Exception ex) {
      throw new GTClientException(
          "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error obtaining SchemaMappingFile entity object",
          ex);
    }
  }
Esempio n. 15
0
  public void testFilter() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.getRequest().setupAddParameter(RequestContext.FILTER_STRING, "zzzz");
    sah.setupClampListBounds();

    ActionForward forward = sah.executeAction("filter");
    verifyParam(forward.getPath(), RequestContext.FILTER_STRING, "zzzz");
  }
Esempio n. 16
0
  public void testUnselectAll() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    ActionForward forward = sah.executeAction("unselectall");

    verifyRhnSetData(sah.getUser().getId(), action.getSetDecl().getLabel(), 0);
    verifyParam(forward.getPath(), "setupdated", "true");
  }
Esempio n. 17
0
  protected String getSiteUrl(ActionMapping mapping, Unit sub) {
    ActionForward forward = mapping.findForward("view" + sub.getClass().getSimpleName() + "Site");

    if (forward == null) {
      forward = mapping.findForward("viewUnitSite");
    }

    return String.format(forward.getPath(), sub.getExternalId(), sub.getSite().getExternalId());
  }
Esempio n. 18
0
 ActionForward getActionForwardShowDelete(
     String entityId, String regId, String nombre, String diasSeleccionados) {
   String actionForwardURL =
       "/showCTCalendar.do?method=show&entityId=" + entityId + "&regId=" + regId;
   actionForwardURL += "&save=true&nombre=" + nombre + "&weekDaysSelect=" + diasSeleccionados;
   ActionForward ret = new ActionForward();
   ret.setPath(actionForwardURL);
   ret.setRedirect(true);
   return ret;
 }
Esempio n. 19
0
  public void testUnspecified() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    sah.getRequest().setupAddParameter("items_selected", new String[] {"10", "20", "30"});
    sah.getRequest().setupAddParameter("newset", (String) null);
    sah.getRequest().setupAddParameter("items_on_page", (String) null);
    ActionForward forward = sah.executeAction("unspecified");

    verifyParam(forward.getPath(), "newset", "[10, 20, 30]");
  }
  public void testExecute() throws Exception {

    ActionHelper ah = createActionHelper(RhnHelper.DEFAULT_FORWARD);
    ActionForward af = ah.executeAction();
    assertEquals(RhnHelper.DEFAULT_FORWARD, af.getName());
    assertNotNull(ah.getRequest().getAttribute("probe"));
    assertNotNull(ah.getRequest().getAttribute("probeSuite"));
    assertNotNull(ah.getRequest().getAttribute("intervals"));
    assertNotNull(ah.getRequest().getAttribute("contactGroups"));
    assertNotNull(ah.getRequest().getAttribute("paramValueList"));
    List pvalues = (List) ah.getRequest().getAttribute("paramValueList");
    assertTrue(pvalues.size() > 0);
  }
  /**
   * <Breve descrição sobre o caso de uso>
   *
   * <p><Identificador e nome do caso de uso>
   *
   * <p><Breve descrição sobre o subfluxo>
   *
   * <p><Identificador e nome do subfluxo>
   *
   * <p><Breve descrição sobre o fluxo secundário>
   *
   * <p><Identificador e nome do fluxo secundário>
   *
   * @author COMPESA
   * @date 08/07/2006
   * @param actionMapping
   * @param actionForm
   * @param httpServletRequest
   * @param httpServletResponse
   * @return
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    // Inicializando Variaveis
    ActionForward retorno = actionMapping.findForward("manterQuadra");
    HttpSession sessao = httpServletRequest.getSession(false);

    Collection colecaoQuadra = null;

    // Parte da verificação do filtro
    FiltroQuadra filtroQuadra = null;

    // Verifica se o filtro foi informado pela página de filtragem de Quadra
    if (sessao.getAttribute("filtroQuadra") != null) {
      filtroQuadra = (FiltroQuadra) sessao.getAttribute("filtroQuadra");
    }

    if ((retorno != null) && (retorno.getName().equalsIgnoreCase("manterQuadra"))) {

      Map resultado =
          controlarPaginacao(httpServletRequest, retorno, filtroQuadra, Quadra.class.getName());
      colecaoQuadra = (Collection) resultado.get("colecaoRetorno");
      retorno = (ActionForward) resultado.get("destinoActionForward");

      // [FS0004] Nenhum registro encontrado
      if (colecaoQuadra == null || colecaoQuadra.isEmpty()) {
        // Nenhuma Quadra cadastrada
        throw new ActionServletException("atencao.pesquisa.nenhumresultado");
      }

      String identificadorAtualizar = (String) sessao.getAttribute("indicadorAtualizar");

      if (colecaoQuadra.size() == 1 && identificadorAtualizar != null) {
        // caso o resultado do filtro só retorne um registro
        // e o check box Atualizar estiver selecionado
        // o sistema não exibe a tela de manter, exibe a de atualizar
        retorno = actionMapping.findForward("atualizarQuadra");
        Quadra quadra = (Quadra) colecaoQuadra.iterator().next();
        sessao.setAttribute("idRegistroAtualizar", new Integer(quadra.getId()).toString());
      } else {
        sessao.setAttribute("colecaoQuadra", colecaoQuadra);
      }
    }

    return retorno;
  }
Esempio n. 22
0
  public void testUpdateList() throws Exception {
    // TestAction action = new TestAction();
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    sah.getRequest().setRequestURL("foo");
    sah.getRequest().setupAddParameter("items_selected", new String[] {"10", "20", "30"});
    sah.getRequest().setupAddParameter("newset", (String) null);
    sah.getRequest().setupAddParameter("items_on_page", (String) null);
    ActionForward forward = sah.executeAction("updatelist");

    // let's go find the data
    verifyRhnSetData(sah.getUser().getId(), action.getSetDecl().getLabel(), 3);
    verifyParam(forward.getPath(), "setupdated", "true");
  }
  protected void processPreparedOperationContext(
      ActionContext actionContext, OperationContext opContext) throws GTClientException {
    IGTConnectionSetupResultEntity entity = null;
    IGTSession gtasSession = getGridTalkSession(actionContext);
    IGTConnectionSetupResultManager manager =
        (IGTConnectionSetupResultManager)
            gtasSession.getManager(IGTManager.MANAGER_CONNECTION_SETUP_RESULT);
    entity = manager.getConnectionSetupResult();
    if (entity == null) {
      throw new GTClientException("No connectionSetupResult entity to update");
    }

    opContext.setAttribute(IOperationContextKeys.ENTITY, entity);
    ActionForward submitForward = actionContext.getMapping().findForward("submit");
    opContext.setAttribute(IOperationContextKeys.FORM_SUBMIT_URL, submitForward.getPath());
  }
Esempio n. 24
0
 /** 删除版面 */
 public ActionForward del(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   ForumForm forumForm = (ForumForm) form;
   try {
     forumService.deleteForum(forumForm.getId());
     return mapping.findForward("showCategories");
   } catch (ItcastNotEmptyException e) {
     addError(request, "delete", "版面中含有主题, 不能删除.", false);
     ActionForward af = mapping.findForward("showCategories");
     return new ActionForward(af.getPath(), false); // 要转发
   }
 }
Esempio n. 25
0
  public ActionForward rate(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Throwable {

    String itemNaturalKey = (String) request.getParameter("itemNaturalKey");
    String value = (String) request.getParameter("rate");
    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String siteId = site.getSiteId();
    if (value != null) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Item item = ItemDAO.loadNatural(siteId, itemNaturalKey);
      int itemRatingCount = item.getItemRatingCount().intValue();
      float itemRating = item.getItemRating().floatValue();

      int rate = Integer.parseInt(value);
      if (itemRatingCount != 0) {
        itemRating = ((itemRating * itemRatingCount) + rate) / (itemRatingCount + 1);
        itemRatingCount += 1;
      } else {
        itemRatingCount = 1;
        itemRating = rate;
      }
      item.setItemRating(new Float(itemRating));
      item.setItemRatingCount(new Integer(itemRatingCount));
      em.persist(item);
    }
    ActionForward forward = actionMapping.findForward("success");
    forward =
        new ActionForward(
            forward.getPath()
                + contentSessionBean.getSiteDomain().getSiteDomainPrefix()
                + "/"
                + contentSessionBean
                    .getSiteProfile()
                    .getSiteProfileClass()
                    .getSiteProfileClassName()
                + "/item/"
                + itemNaturalKey,
            forward.getRedirect());
    return forward;
  }
Esempio n. 26
0
 public void testSelectAll() throws Exception {
   ActionHelper sah = new ActionHelper();
   TestActionWithData a =
       new TestActionWithData() {
         protected DataResult getDataResult(
             User user, ActionForm formIn, HttpServletRequest request) {
           List retval = new LinkedList();
           for (int i = 0; i < 10; i++) {
             retval.add(new TestIdObject(new Long(i)));
           }
           return new DataResult(retval);
         }
       };
   sah.setUpAction(a);
   sah.setupClampListBounds();
   ActionForward forward = sah.executeAction("selectall");
   verifyRhnSetData(sah.getUser().getId(), a.getSetDecl().getLabel(), 10);
   verifyParam(forward.getPath(), "setupdated", "true");
 }
  public ActionForward submitPoll(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    SubmitPollFormBean submitPollFormBean = (SubmitPollFormBean) form;
    ActionMessages errors = new ActionMessages();
    ActionForward forward = new ActionForward(); // return value
    String next = "submitPoll";
    String pollId = submitPollFormBean.getPollId();
    pollId = VCRequestHelper.getValueFromRequest(request, RequestParameterObjects.POLL_ID, pollId);
    PollTO pto = PollBO.getInstance().getPollByPollId(pollId);
    submitPollFormBean.setPollName(pto.getPollName());
    submitPollFormBean.setDisplayPollUrl(
        VCURLHelper.getDisplayPollUrl(getDomainAndContext(request), pollId));
    submitPollFormBean.setContestsMainUrl(
        VCURLHelper.getContestsMainUrl(getDomainAndContext(request)));
    submitPollFormBean.setCreateMorePollsUrl(
        VCURLHelper.getCreatePollUrl(getDomainAndContext(request)));
    submitPollFormBean.setHomePageUrl(VCURLHelper.getHomePageUrl(getDomainAndContext(request)));
    submitPollFormBean.setMyVCUrl(VCURLHelper.getMyVCMainUrl(getDomainAndContext(request)));
    submitPollFormBean.setTwitterUpdateUrl(
        VCURLHelper.getTwitterUpdateUrl(
            pto.getPollName(),
            BitlyService.getInstance()
                .shorten(
                    VCURLHelper.getDisplayPollUrl(getDomainAndContext(request), pto.getPollId()))));
    submitPollFormBean.setYahooBuzzUpUrl(
        VCURLHelper.getYahooBuzzUpUrl(
            VCURLHelper.getDisplayPollUrl(getDomainAndContext(request), pollId)));
    submitPollFormBean.setFacebookShareUrl(
        VCURLHelper.getFacebookShareUrl(
            VCURLHelper.getDisplayPollUrl(getDomainAndContext(request), pollId),
            pto.getPollName()));
    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward(next);
    log.debug("forward:" + forward.getPath());
    // Finish with
    return (forward);
  } /*
  public void testSubmitExecute() throws Exception {

    ActionHelper ah = createActionHelper("success");
    ah.getForm().set(ProbeEditAction.SUBMITTED, new Boolean(true));
    ah.getForm().set("description", probe.getDescription());
    ah.getForm().set("notification", new Boolean(true));
    Long intv = new Long(probe.getCheckIntervalMinutes().longValue());
    ah.getForm().set("check_interval_min", intv);
    ah.getForm().set("notification_interval_min", probe.getNotificationIntervalMinutes());

    MonitoringTestUtils.setupParamValues(ah, probe.getCommand(), 3);

    ActionForward af = ah.executeAction();
    assertEquals("success", af.getName());

    Probe edited = (Probe) reload(probe);
    assertTrue(edited.isNotifyCritical().booleanValue());
    MonitoringTestUtils.verifyParameters(edited, probe.getCommand());
    assertEquals(intv, edited.getCheckIntervalMinutes());
  }
Esempio n. 29
0
 /**
  * <br>
  * [機 能] 削除完了画面設定 <br>
  * [解 説] <br>
  * [備 考]
  *
  * @param map アクションマッピング
  * @param form アクションフォーム
  * @param req リクエスト
  * @return ActionForward
  */
 private ActionForward __doDeleteCompDsp(
     ActionMapping map, Ipk100Form form, HttpServletRequest req) {
   ActionForward forward = null;
   Cmn999Form cmn999Form = new Cmn999Form();
   ActionForward forwardOK = null;
   // スペック情報の削除確認画面パラメータの設定
   MessageResources msgRes = getResources(req);
   cmn999Form.setType(Cmn999Form.TYPE_OK);
   cmn999Form.setIcon(Cmn999Form.ICON_INFO);
   cmn999Form.setWtarget(Cmn999Form.WTARGET_BODY);
   forwardOK = map.findForward("ipk100DeleteComp");
   cmn999Form.setUrlOK(forwardOK.getPath());
   cmn999Form.setMessage(msgRes.getMessage("sakujo.kanryo.object", __getSpecKbn(form, req)));
   cmn999Form.addHiddenParam("backScreen", form.getBackScreen());
   req.setAttribute("cmn999Form", cmn999Form);
   forward = map.findForward("gf_msg");
   cmn999Form.addHiddenParam("ismSid", form.getIsmSid());
   cmn999Form.addHiddenParam("specKbn", form.getSpecKbn());
   return forward;
 }
  /**
   * <Breve descrição sobre o caso de uso>
   *
   * <p>[UC0287] - Efetuar Login
   *
   * @author Pedro Alexandre
   * @date 04/07/2006
   * @param actionMapping
   * @param actionForm
   * @param httpServletRequest
   * @param httpServletResponse
   * @return
   */
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    // Prepara o retorno da ação para a tela principal
    ActionForward retorno = actionMapping.findForward("telaSucesso");

    // Obtém a instância da Fachada
    Fachada fachada = Fachada.getInstancia();

    // Recupera uma instância da sessão
    HttpSession sessao = httpServletRequest.getSession(false);

    // Recupera o usuário que está solicitando o lembrete da senha
    Usuario usuarioLogado = (Usuario) sessao.getAttribute("usuarioLogado");

    // Recupera o ActionForm
    EfetuarAlteracaoSenhaActionForm efetuarAlteracaoSenhaActionForm =
        (EfetuarAlteracaoSenhaActionForm) actionForm;

    // Recupera todos os dados necessários para verificar se o usuário
    // pode ser lembrada sua senha
    String dataNascimentoString = efetuarAlteracaoSenhaActionForm.getDataNascimento();
    String cpf = efetuarAlteracaoSenhaActionForm.getCpf();
    String lembreteSenha = efetuarAlteracaoSenhaActionForm.getLembreteSenha();
    String novaSenha = efetuarAlteracaoSenhaActionForm.getNovaSenha();
    String confirmacaoNovaSenha = efetuarAlteracaoSenhaActionForm.getConfirmacaoNovaSenha();

    fachada.efetuarAlteracaoSenha(
        usuarioLogado, dataNascimentoString, cpf, lembreteSenha, novaSenha, confirmacaoNovaSenha);

    // Caso o mapeamento seja para a tela de sucesso do popup
    // monta a tela de sucesso indicando que o email foi enviado
    if (retorno.getName().equalsIgnoreCase("telaSucesso")) {
      montarPaginaSucesso(httpServletRequest, "Senha alterada com sucesso.", "", "");
    }

    return retorno;
  }