コード例 #1
1
ファイル: OtherIncome.java プロジェクト: runitmalik01/git
  @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
 public Member getMember(HstRequest request) {
   Member member = null;
   if (request.getSession() != null && request.getSession().getAttribute("user") != null) {
     member = (Member) request.getSession().getAttribute("user");
   }
   return member;
 }
コード例 #3
0
ファイル: OtherIncome.java プロジェクト: runitmalik01/git
 @Override
 protected boolean validate(HstRequest request, HstResponse response, FormMap formMap) {
   // TODO Auto-generated method stub
   boolean ret = super.validate(request, response, formMap);
   if (ret) {
     boolean con_exempt = true;
     String max_allowed_exempt =
         request.getRequestContext().getResolvedSiteMapItem().getParameter("max_allowed_exempt");
     String total_taxfree_income =
         getITRInitData(request).getFormMap().getField("Total_taxfree_income").getValue();
     MemberPersonalInformation personalinfo =
         (MemberPersonalInformation)
             request.getAttribute(MemberPersonalInformation.class.getSimpleName().toLowerCase());
     if (max_allowed_exempt != null) {
       if (personalinfo.getSelectedITRForm().toString().equals("ITR1")) {
         if (Integer.parseInt(total_taxfree_income) > Integer.parseInt(max_allowed_exempt)) {
           log.info("Exceed Over Limit For ITR1");
           eRROR_MAX_ALLOWED = "err.maxallowed.exceed";
           getITRInitData(request)
               .getFormMap()
               .addMessage("Total_taxfree_income", "err.maxallowed.exceed");
           con_exempt = false;
         } else {
           eRROR_MAX_ALLOWED = null;
         }
       }
     }
     return con_exempt;
   } else {
     return ret;
   }
 }
コード例 #4
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));
   }
 }
コード例 #5
0
  /**
   * This is an helper class to redirect the customer to another page
   *
   * @param request the HstRequest
   * @param response the HstResponse
   * @param refId the refId
   */
  public void redirectByRefId(HstRequest request, HstResponse response, String refId) {

    HstLinkCreator linkCreator = request.getRequestContext().getHstLinkCreator();

    HstLink link =
        linkCreator.createByRefId(refId, request.getRequestContext().getResolvedMount().getMount());

    HstResponseUtils.sendRedirectOrForward(request, response, link.getPath());
  }
コード例 #6
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);
  }
コード例 #7
0
  /**
   * Retrieve the current StoreConfig from the HstRequest The config has been set by the Konakart
   * Valve
   *
   * @param request the hst request
   * @return the Konakart store config.
   */
  @Nonnull
  public KKStoreConfig getKKStoreConfig(@Nonnull HstRequest request) {
    KKStoreConfig kkStoreConfig =
        (KKStoreConfig) request.getAttribute(KKStoreConfig.KK_STORE_CONFIG);

    return checkNotNull(kkStoreConfig);
  }
コード例 #8
0
  /**
   * Generate the breadcrumb.
   *
   * @param request
   * @return
   */
  public Breadcrumb getBreadcrumb(HstRequest request) {

    List<String> siteMenuNames = getSitemenuNames(request);

    // match deepest menu item for multiple configured menus
    int i = 0;
    HstSiteMenuItem deepestMenuItem = null;
    while ((i < siteMenuNames.size()) && (deepestMenuItem == null)) {
      HstSiteMenu menu =
          request.getRequestContext().getHstSiteMenus().getSiteMenu(siteMenuNames.get(i));
      deepestMenuItem = menu.getDeepestExpandedItem();

      i++;
    }

    // create items if a menu item is found
    List<BreadcrumbItem> finalList = new ArrayList<BreadcrumbItem>();
    if (deepestMenuItem != null) {
      List<BreadcrumbItem> menuBreadcrumbItems = getMenuBreadcrumbItems(request, deepestMenuItem);
      List<BreadcrumbItem> trailingBreadcrumbItems =
          getTrailingBreadcrumbItems(request, deepestMenuItem);

      finalList.addAll(menuBreadcrumbItems);
      finalList.addAll(trailingBreadcrumbItems);
    }

    return new Breadcrumb(finalList, getSeparator(request));
  }
コード例 #9
0
  @Override
  @Nullable
  public HstQuery build() {
    if (scope == null) {
      siteScope();
    }
    final HstRequestContext context = request.getRequestContext();
    final HstQueryManager manager = context.getQueryManager();
    try {
      @SuppressWarnings("unchecked")
      final Class<? extends HippoBean>[] classes = mappings.toArray(new Class[mappings.size()]);
      @SuppressWarnings("unchecked")
      final HstQuery query = manager.createQuery(scope, classes);
      query.setLimit(size);
      query.setOffset(size * (page - 1));
      if (filters != null && filters.size() > 0) {
        final Filter root = query.createFilter();
        for (Filter filter : filters) {
          root.addAndFilter(filter);
        }
        query.setFilter(root);
      }

      return query;
    } catch (QueryException e) {
      log.error("Error creating HST query", e);
    }
    return null;
  }
コード例 #10
0
 public String getResellerId(HstRequest request) {
   final Mount mount = request.getRequestContext().getResolvedMount().getMount();
   final WebsiteInfo info = mount.getChannelInfo();
   boolean isReseller = isReSeller(request);
   if (!isReseller) return null;
   return info.getResellerId();
 }
コード例 #11
0
  /**
   * Generate the trailing breadcrumb items. By default, the trailing items are derived from the
   * bean structure of the resolved sitemap item of the current request.
   *
   * @param request
   * @param deepestMenuItem
   * @return list of trailing breadcrumb items
   */
  protected List<BreadcrumbItem> getTrailingBreadcrumbItems(
      HstRequest request, HstSiteMenuItem menuItem) {

    List<BreadcrumbItem> items = new ArrayList<BreadcrumbItem>();

    ResolvedSiteMapItem currentSmi = request.getRequestContext().getResolvedSiteMapItem();
    HippoBean currentBean = getComponent().getBeanForResolvedSiteMapItem(request, currentSmi);

    if (currentBean != null) {

      if (addTrailingDocumentOnly) {
        if (currentBean instanceof HippoDocument) {
          items.add(getBreadcrumbItem(request, currentBean));
        }
      } else {
        ResolvedSiteMapItem menuItemSmi = menuItem.resolveToSiteMapItem(request);
        HippoBean menuItemBean = getComponent().getBeanForResolvedSiteMapItem(request, menuItemSmi);

        // parent steps based on ancestor bean
        if (menuItemBean != null && menuItemBean.isAncestor(currentBean)) {

          while (!currentBean.isSelf(menuItemBean)) {
            items.add(getBreadcrumbItem(request, currentBean));
            currentBean = currentBean.getParentBean();
          }
        }

        // try to determine parent steps based on path info in case the
        // menuItemBean is not an ancestor, which occurs for instance
        // when faceted navigation is used on the menu item
        else {
          String ancestorPath = menuItemSmi.getPathInfo();
          String currentPath = currentSmi.getPathInfo();

          if (currentPath.startsWith(ancestorPath)) {
            String trailingPath = currentPath.substring(ancestorPath.length());

            if (trailingPath.startsWith("/")) {
              trailingPath = trailingPath.substring(1);
            }

            int steps = trailingPath.split("/").length;

            for (int i = 0; i < steps; i++) {
              items.add(getBreadcrumbItem(request, currentBean));
              currentBean = currentBean.getParentBean();
            }
          }
        }

        Collections.reverse(items);
      }
    }

    return items;
  }
コード例 #12
0
ファイル: Home.java プロジェクト: runitmalik01/git
  @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);
  }
コード例 #13
0
ファイル: Search.java プロジェクト: snkhubcom/hippo
  @Override
  public void doBeforeRender(final HstRequest request, final HstResponse response)
      throws HstComponentException {

    SearchInfo info = getParametersInfo(request);
    HippoBean scope = getSiteContentBaseBean(request);

    String query = getPublicRequestParameter(request, "query");
    if (query == null) {
      // test namespaced query parameter
      query = request.getParameter("query");
    }
    createAndExecuteSearch(request, info, scope, query);
  }
コード例 #14
0
ファイル: AboutList.java プロジェクト: seungbeomi/development
  @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);
      }
    }
  }
コード例 #15
0
 public boolean isReSeller(HstRequest request) {
   final Mount mount = request.getRequestContext().getResolvedMount().getMount();
   final WebsiteInfo info = mount.getChannelInfo();
   if (info == null) {
     log.warn(
         "No channel info available for mount '{}'. No logo will be shown", mount.getMountPath());
     return false;
   }
   String isReseller = info.isReseller();
   String resellerId = info.getResellerId();
   if (info.isReseller() != null
       && Boolean.valueOf(info.isReseller())
       && info.getResellerId() != null
       && !"".equals(info.getResellerId())) {
     return true;
   }
   return false;
 }
コード例 #16
0
  @Override
  @Nonnull
  public final HstQueryBuilder documents(final String... primaryNodeTypes) {
    if (mappings == null) {
      mappings = new ArrayList<>();
    }
    final HstRequestContext context = request.getRequestContext();
    final ObjectConverter objectConverter = context.getContentBeansTool().getObjectConverter();
    int typeCounter = 0;
    for (String primaryNodeType : primaryNodeTypes) {
      final Class<? extends HippoBean> clazz =
          objectConverter.getAnnotatedClassFor(primaryNodeType);
      if (clazz != null) {
        mappings.add(clazz);
        typeCounter++;
      }
    }
    if (typeCounter != primaryNodeTypes.length) {
      log.warn(
          "Couldn't resolve all primary node types through object converter: {}", primaryNodeTypes);
    }

    return this;
  }
コード例 #17
0
 public String getPANFromRequestContext(HstRequest request) {
   String PAN = request.getRequestContext().getResolvedSiteMapItem().getParameter("pan");
   return PAN;
 }
コード例 #18
0
 public String getTheFolderContainingITRDocuments(HstRequest request) {
   return request.getRequestContext().getResolvedSiteMapItem().getParameter("itReturnType");
 }
コード例 #19
0
 public String getStrFinancialYear(HstRequest request) {
   String strFinancialYear =
       request.getRequestContext().getResolvedSiteMapItem().getParameter("financialYear");
   return strFinancialYear;
 }
コード例 #20
0
  /**
   * Retrieve the Konakart client from the HstRequest. The client has been set by the Konakart
   * Valve.
   *
   * @param request the hst request
   * @return the Konakart client.
   */
  @Nonnull
  public KKAppEng getKKAppEng(@Nonnull HstRequest request) {
    KKAppEng kkAppEng = (KKAppEng) request.getAttribute(KKAppEng.KONAKART_KEY);

    return checkNotNull(kkAppEng);
  }
コード例 #21
0
  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) {

    	}
    }
     */
  }
コード例 #22
0
 public String getParamValueFromRequestContext(HstRequest request, String paramName) {
   String theValue = request.getRequestContext().getResolvedSiteMapItem().getParameter(paramName);
   return theValue;
 }
コード例 #23
0
 /**
  * Creates a breadcrumb item belonging to a Hippo bean
  *
  * @param request
  * @param bean
  * @return breadcrumb item
  */
 protected BreadcrumbItem getBreadcrumbItem(HstRequest request, HippoBean bean) {
   HstRequestContext context = request.getRequestContext();
   return new BreadcrumbItem(context.getHstLinkCreator().create(bean, context), bean.getName());
 }
コード例 #24
0
 protected void setEditMode(final HstRequest request) {
   request.setAttribute(REQUEST_ATTR_CMS_EDIT, RequestContextProvider.get().isCmsRequest());
 }
コード例 #25
0
 @Nullable
 @Override
 public HippoBean getSiteScope() {
   final HstRequestContext context = request.getRequestContext();
   return context.getSiteContentBaseBean();
 }