示例#1
1
  @Override
  public void doBeforeRender(HstRequest request, HstResponse response) {
    // TODO Auto-generated method stub
    if (log.isInfoEnabled()) {
      log.info("This is Other Income page");
    }
    super.doBeforeRender(request, response);
    String whichITRForm =
        request.getRequestContext().getResolvedSiteMapItem().getParameter("whichITRForm");
    if (whichITRForm != null) {
      request.setAttribute("ITR2", whichITRForm);
    }

    if (log.isInfoEnabled()) {
      log.info(whichITRForm + " do before render whichITRForm");
    }
    request.setAttribute("Max_allowed_ITR1", eRROR_MAX_ALLOWED);
    // the following line of code is needed to add a field if the package is ITR3 or ITR4
    MemberPersonalInformation objMemberPersonalInformation =
        (MemberPersonalInformation)
            request.getAttribute(MemberPersonalInformation.class.getSimpleName().toLowerCase());
    if (objMemberPersonalInformation != null) {
      String packageName = objMemberPersonalInformation.getFlexField("flex_string_ITRForm", "");
      if ((!packageName.isEmpty()) && (packageName.equals("ITR3"))
          || (packageName.equals("ITR4"))) {
        request.setAttribute("ITR3_4", packageName);
      }
    }
  }
示例#2
0
  @Override
  public void doBeforeRender(HstRequest request, HstResponse response) {
    // TODO Auto-generated method stub
    super.doBeforeRender(request, response);
    log.error("This is Member Home Page");
    String status = getPublicRequestParameter(request, "status");
    if (status != null && status.equals("success")) {
      request.setAttribute(
          "status", "You have successfully submit the Personal &Contact Information");
    }
    String error = getPublicRequestParameter(request, "error");
    if (error != null && error.equals("assessyear")) {
      request.setAttribute("assess_year_error", "Please Enter the assessment year");
    }
    Member member = (Member) request.getSession().getAttribute("user");
    Collection<String> oldpan = member.getPAN();
    if (!oldpan.isEmpty()) {
      request.setAttribute("oldpan", oldpan.toArray(new String[oldpan.size()]));
    }
    ResolvedSiteMapItem resolvedSiteMapItem = request.getRequestContext().getResolvedSiteMapItem();

    log.error(
        "resolvedSiteMapItem.getRelativeContentPath():"
            + resolvedSiteMapItem.getRelativeContentPath());
    log.error(
        "resolvedSiteMapItem.getRelativeContentPath():"
            + resolvedSiteMapItem.getHstSiteMapItem().getRelativeContentPath());
    // String test=  getContentBean(request).getPath();
    // log.warn("path"+test);
    List<MemberPersonalInformation> mperinfo = new ArrayList<MemberPersonalInformation>();
    List<MemberContactInformation> mconinfo = new ArrayList<MemberContactInformation>();
    for (String t : oldpan) {
      try {
        log.warn("in try");
        MemberPersonalInformation pidocument =
            (MemberPersonalInformation)
                getObjectBeanManager(request)
                    .getObject(
                        "/content/documents/mootlywcm/members/pans/"
                            + t
                            + "/personalinformation/personalinformation");
        MemberContactInformation cidocument =
            (MemberContactInformation)
                getObjectBeanManager(request)
                    .getObject(
                        "/content/documents/mootlywcm/members/pans/"
                            + t
                            + "/contactinformation/contactinformation");
        mperinfo.add(pidocument);
        mconinfo.add(cidocument);
      } catch (ObjectBeanManagerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    request.setAttribute("mperinfo", mconinfo);
    request.setAttribute("mconinfo", mconinfo);
  }
示例#3
0
 /**
  * Sets content bean onto request. If no bean is found, *no* 404 response will be set. NOTE: Only
  * bean defined through component interface is used unlike within {@code setContentBean()} method
  *
  * @param documentPath document (content) path
  * @param request HstRequest
  * @param response HstResponse
  * @see #setContentBean(String, org.hippoecm.hst.core.component.HstRequest,
  *     org.hippoecm.hst.core.component.HstResponse)
  */
 public void setContentBeanForPath(
     final String documentPath, HstRequest request, final HstResponse response) {
   final HstRequestContext context = request.getRequestContext();
   if (!Strings.isNullOrEmpty(documentPath)) {
     final HippoBean root = context.getSiteContentBaseBean();
     request.setAttribute(REQUEST_ATTR_DOCUMENT, root.getBean(documentPath));
   }
 }
示例#4
0
  /**
   * Sets content bean onto request. If no bean is found, 404 response will be set.
   *
   * @param request HstRequest
   * @param response HstResponse
   */
  public void setContentBeanWith404(final HstRequest request, final HstResponse response) {
    final HstRequestContext context = request.getRequestContext();
    final HippoBean bean = context.getContentBean();

    if (bean == null) {
      pageNotFound(response);
      return;
    }

    request.setAttribute(REQUEST_ATTR_DOCUMENT, bean);
  }
示例#5
0
  @Override
  public void doBeforeRender(HstRequest request, HstResponse response) {
    super.doBeforeRender(request, response);

    HippoBean bean = getContentBean(request);

    if (bean == null) {
      redirectToNotFoundPage(response);
      throw new BeanNotFoundException("Cannot create document list: content bean is null");
    } else if (bean.isHippoDocumentBean()) {
      request.setAttribute("document", bean);
    } else if (bean.isHippoFolderBean()) {
      HippoFolderBean folder = (HippoFolderBean) bean;
      List<HippoDocumentBean> documents = folder.getDocuments();

      if (documents.size() == 1) {
        request.setAttribute("document", documents.get(0));
      } else {
        String folderName = RepoSiteMenuItem.retrieveLocalizedName(folder);
        request.setAttribute("folderName", folderName);
        request.setAttribute("documents", documents);
      }
    }
  }
示例#6
0
 protected void setEditMode(final HstRequest request) {
   request.setAttribute(REQUEST_ATTR_CMS_EDIT, RequestContextProvider.get().isCmsRequest());
 }
  public String getScriptName(
      HstRequest request, String selectedItrTabAttr, String selectedItrTabParam) {
    String pathInfo = request.getRequestContext().getResolvedSiteMapItem().getPathInfo();
    boolean isReseller = isReSeller(request);
    String resellerId = getResellerId(request);
    pathInfo = "r/" + resellerId + "/" + pathInfo;
    String scriptName = null;
    if (pathInfo != null && pathInfo.contains(".html")) {
      String[] parts = pathInfo.split("[/]");
      StringBuilder sb = new StringBuilder(request.getContextPath()).append("/");
      int depth = 1;
      for (String aPart : parts) {
        if (aPart.endsWith(".html")) {
          scriptName = aPart;
          break;
        } else {
          sb.append(aPart).append("/");
        }
        depth++;
      }
      sb.append(scriptName);
      // int remainderOFDepth = parts.length - depth;
      // String basePath = "./";
      // for (int ctr =0;ctr<remainderOFDepth;ctr++) {
      //	basePath += "../";
      // }
      // scriptName = basePath + scriptName;
      scriptName = sb.toString();
      if (scriptName.endsWith("/")) scriptName = scriptName.substring(0, scriptName.length() - 2);

      // one more loop just to capture the parts after the URL
      List<String> urlParts = new ArrayList<String>();
      boolean startCapturing = false;
      for (String aPart : parts) {
        if (startCapturing) {
          urlParts.add(aPart);
        }
        if (aPart.endsWith(".html")) {
          startCapturing = true;
        }
      }
      if (urlParts != null && urlParts.size() > 0) {
        String[] strParts = urlParts.toArray(new String[urlParts.size()]);
        ITRTab itrTab = ITRTab.getByAka(strParts);
        request.setAttribute("urlParts", urlParts);
        if (itrTab != null) request.setAttribute("selectedItrTab", itrTab);
      }
    }
    if (selectedItrTabAttr == null && selectedItrTabParam != null) {
      ITRTab itrTab = null;
      try {
        itrTab = ITRTab.valueOf(selectedItrTabParam);
        request.setAttribute("selectedItrTab", itrTab);
      } catch (IllegalArgumentException ie) {

      }
    }
    return scriptName;
    // Old Code
    /*
    if (request.getAttribute("selectedItrTab") == null && getPublicRequestParameter(request, "selectedItrTab") != null) {
    	ITRTab itrTab = null;
    	try {
    		itrTab= ITRTab.valueOf(getPublicRequestParameter(request, "selectedItrTab"));
    		request.setAttribute("selectedItrTab", itrTab);
    	}catch (IllegalArgumentException ie) {

    	}
    }
     */
  }