Wednesday 13 July 2011

Common CO which is used for across the page

package cisco.oracle.apps.xxcfi.ap.holdtel.webui;

import cisco.oracle.apps.xxcfi.ap.holdtel.common.xxcfiHoldtelConstants;
import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAFormattedTextBean;
import oracle.apps.fnd.framework.webui.beans.OARawTextBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;


/**
 * Controller for ...
 */
public class xxcfiHoldtelCommonCO extends OAControllerImpl implements xxcfiHoldtelConstants
{
  public String purchaseGroupText = null;
  public String managerText = null;
  public String buyerText = null;
  public String supplierText = null;
  public String invoiceText = null;
 
  public static final String RCS_ID="$Header: HoldtelCommonCO.java 1.0 kandkuma $";
  public static final boolean RCS_ID_RECORDED =
  VersionInfo.recordClassVersion(RCS_ID, "cisco.oracle.apps.xxcfi.ap.holdtel.webui");
 
  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    setWelcomePrompt(pageContext, webBean);
    addUserSelectedSearchCriteriaSection(pageContext, webBean);
    setReturnLinkText(pageContext, webBean);
  }

  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
  }

/**
   * procedure to set the user name for each page.
   * @param pageContext
   * @param webBean
   */
  private void setWelcomePrompt(OAPageContext pageContext, OAWebBean webBean)
  {
    if(addWelcomePrompt())
    {
      String userName = (String) pageContext.getSessionValue(HOLDTEL_USER_DISPLAY_NAME);
      if(userName == null || "".equals(userName))
      {
        OAApplicationModule holdtelAM = pageContext.getApplicationModule(webBean);
        userName = (String)holdtelAM.invokeMethod("getUserDisplayName");
        pageContext.putSessionValue(HOLDTEL_USER_DISPLAY_NAME, userName);
      }
     
      MessageToken[] tokens = {new MessageToken("USER_NAME", userName ) };
      StringBuffer newPrompt = new StringBuffer(100);
      newPrompt.append(pageContext.getMessage("XXCAP", "XXCFI_AP_HOLDTEL_USR_WLCM_MSG", tokens));
      newPrompt.append("         ");
      newPrompt.append("         ");
      newPrompt.append(pageContext.getCurrentDBDate().toString());
     
      OAFormattedTextBean userInfoBean = getPageStatusBean(pageContext, webBean);
      if(userInfoBean != null)
      {
        userInfoBean.setText(newPrompt.toString());
      }
    }
  }
  /**
   * procedure to set the welcome prompt for each page.
   * @param pageContext
   * @param webBean
   * @return
   */
  private OAFormattedTextBean getPageStatusBean(OAPageContext pageContext, OAWebBean webBean)
  {
    OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean();
    OAFormattedTextBean infoText = (OAFormattedTextBean)pageLayout.getUserInfo();
    if(infoText == null)
    {
      infoText = (OAFormattedTextBean)createWebBean(pageContext, OAWebBeanConstants.FORMATTED_TEXT_BEAN, null, "welcomePrompt");
      infoText.setCSSClass("OraPageStampText");
      pageLayout.setUserInfo(infoText);
  }
  return infoText;
}
/**
   * procedure to capture and set the user selected criteria to every page.
   * @param pageContext
   * @param webBean
   */
  private void addUserSelectedSearchCriteriaSection(OAPageContext pageContext, OAWebBean webBean)
  {
    if(addUserSelectedSearchCriteriaRN())
    {
      OAPageLayoutBean pageLayout = pageContext.getPageLayoutBean();
      OAWebBean searchCriteria = pageLayout.findIndexedChildRecursive("SearchCriteriaRN1");
      if(searchCriteria == null)
        searchCriteria = createWebBean(pageContext, "/cisco/oracle/apps/xxcfi/ap/holdtel/webui/SearchCriteriaRN", "SearchCriteriaRN1", true);
      if(searchCriteria != null)
      {
        OARawTextBean categoryInvoice = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Category-Invoice");
        OARawTextBean categorySupplier = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Category-Supplier");
        OARawTextBean categoryBuyer = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Category-Buyer");
        OARawTextBean categoryInvoiceDetails = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Category-InvoiceDetails");
        OARawTextBean categorySummarByPurchasingManager = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Category-SummarByPurchasingManager");
        OARawTextBean purchaseGroup = (OARawTextBean)searchCriteria.findIndexedChildRecursive("PurchaseGroup");
        OARawTextBean manager = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Manager");
        OARawTextBean buyer = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Buyer");
        OARawTextBean supplier = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Supplier");
        OARawTextBean invoice = (OARawTextBean)searchCriteria.findIndexedChildRecursive("Invoice");
        OARawTextBean linkHint = (OARawTextBean)searchCriteria.findIndexedChildRecursive("LinkHint");

        String reportType = pageContext.getParameter(HOLDTEL_REPORT_TYPE);
        if(HOLDTEL_SUMMARY_REPORT.equals(reportType))
        {
          hideItem(categoryInvoice);
          hideItem(categorySupplier);
          hideItem(categoryBuyer);
          hideItem(categoryInvoiceDetails);
          hideItem(invoice);

          String pGroupName = pageContext.getParameter(HOLDTEL_PURCHASE_GROUP);
          String mgrName = pageContext.getParameter(HOLDTEL_MANAGER_NAME);
          String buyerName = pageContext.getParameter(HOLDTEL_BUYER_NAME);
          String supplierName = pageContext.getParameter(HOLDTEL_SUPPLIER_NAME);
         
          if(isEmpty(pGroupName))
            hideItem(purchaseGroup);
          else
          {
            if(purchaseGroup != null)
            {
              if(purchaseGroupText == null)
                purchaseGroupText = purchaseGroup.getText();
              purchaseGroup.setText(purchaseGroupText+pGroupName);
            }
          }
           
          if(isEmpty(mgrName))
            hideItem(manager);
          else
          {
            if(manager != null)
            {
              if(managerText == null)
                managerText = manager.getText();
              manager.setText(managerText+mgrName);
            }
          }
         
          if(isEmpty(buyerName))
            hideItem(buyer);
          else
          {
            if(buyer != null)
            {
              if(buyerText == null)
                buyerText = buyer.getText();
              buyer.setText(buyerText+buyerName);
            }
          }
         
          if(isEmpty(supplierName))
            hideItem(supplier);
          else
          {
            if(supplier != null)
            {
              if(supplierText == null)
                supplierText = supplier.getText();
              supplier.setText(supplierText+supplierName);
            }
          }
        }
        else if(HOLDTEL_DETAIL_REPORT.equals(reportType))
        {
          hideItem(categorySummarByPurchasingManager);
          hideItem(purchaseGroup);
          hideItem(manager);

          String buyerName = pageContext.getParameter(HOLDTEL_DTL_BUYER_NAME);
          String supplierName = pageContext.getParameter(HOLDTEL_DTL_SUPPLIER_NAME);
          String invoiceNum = pageContext.getParameter(HOLDTEL_INVOICE_NUM);
         
          if(isEmpty(buyerName))
          {
            hideItem(buyer);
            hideItem(categoryBuyer);
          }
          else
          {
            if(buyer != null)
            {
              if(buyerText == null)
                buyerText = buyer.getText();
              buyer.setText(buyerText+buyerName);
            }
          }
         
          if(isEmpty(supplierName))
          {
            hideItem(supplier);
            hideItem(categorySupplier);
          }
          else
          {
            if(supplier != null)
            {
              if(supplierText == null)
                supplierText = supplier.getText();
              supplier.setText(supplierText+supplierName);
            }
          }
         
          if(isEmpty(invoiceNum))
          {
            hideItem(invoice);
            hideItem(categoryInvoice);
            hideItem(categoryInvoiceDetails);
          }
          else
          {
            if(invoice != null)
            {
              if(invoiceText == null)
                invoiceText = invoice.getText();
              invoice.setText(invoiceText+invoiceNum);
            }
          }
        }
        else if(HOLDTEL_EXECUTIVE_REPORT.equals(reportType))
        {
          hideItem(categoryInvoice);
          hideItem(categorySupplier);
          hideItem(categoryBuyer);
          hideItem(categorySummarByPurchasingManager);
          hideItem(purchaseGroup);
          hideItem(manager);
          hideItem(buyer);
          hideItem(supplier);
          hideItem(invoice);
        }
       
        if(linkHint != null)
        {
          String message = pageContext.getMessage("XXCAP", "XXCFI_AP_HOLDTEL_LINK_HINT", null);
          linkHint.setText(message);
        }
        pageLayout.addIndexedChild(searchCriteria);
      }
    }
  }

  protected boolean addUserSelectedSearchCriteriaRN()
  {
    return true;
  }
 
  protected boolean addWelcomePrompt()
  {
    return true;
  }

/**
   * procedure to handle the url parameters.
   * @param pageContext
   * @return
   */
  protected HashMap getURLParams(OAPageContext pageContext)
  {
    HashMap params = new HashMap(20);
    String pGroup = pageContext.getParameter(HOLDTEL_PURCHASE_GROUP);
    String mgrId = pageContext.getParameter(HOLDTEL_MANAGER_ID);
    String buyerId = pageContext.getParameter(HOLDTEL_BUYER_ID);
    String supplierId = pageContext.getParameter(HOLDTEL_SUPPLIER_ID);
    String dtlBuyerId = pageContext.getParameter(HOLDTEL_DTL_BUYER_ID);
    String dtlSupplierId = pageContext.getParameter(HOLDTEL_DTL_SUPPLIER_ID);
    String invoiceId = pageContext.getParameter(HOLDTEL_INVOICE_ID);
    String invoiceNum = pageContext.getParameter(HOLDTEL_INVOICE_NUM);
    String mgrName = pageContext.getParameter(HOLDTEL_MANAGER_NAME);
    String buyerName = pageContext.getParameter(HOLDTEL_BUYER_NAME);
    String supplierName = pageContext.getParameter(HOLDTEL_SUPPLIER_NAME);
    String dtlBuyerName = pageContext.getParameter(HOLDTEL_DTL_BUYER_NAME);
    String dtlSupplierName = pageContext.getParameter(HOLDTEL_DTL_SUPPLIER_NAME);
    String selPGroup = pageContext.getParameter(HOLDTEL_SELECTED_PURCHASE_GROUP);
    String selMgrId = pageContext.getParameter(HOLDTEL_SELECTED_MANAGER_ID);
    String selBuyerId = pageContext.getParameter(HOLDTEL_SELECTED_BUYER_ID);
    String selSupplierId = pageContext.getParameter(HOLDTEL_SELECTED_SUPPLIER_ID);
    String selInvoiceId = pageContext.getParameter(HOLDTEL_SELECTED_INVOICE_ID);
    String selInvoiceNum = pageContext.getParameter(HOLDTEL_SELECTED_INVOICE_NUM);
    String selInvoiceHoldLine = pageContext.getParameter(HOLDTEL_SELECTED_INVOICE_HOLDLINE);
    String selMgrName = pageContext.getParameter(HOLDTEL_SELECTED_MANAGER_NAME);
    String selBuyerName = pageContext.getParameter(HOLDTEL_SELECTED_BUYER_NAME);
    String selSupplierName = pageContext.getParameter(HOLDTEL_SELECTED_SUPPLIER_NAME);
    String selSupplierSumOfInv = pageContext.getParameter(HOLDTEL_SEL_SUPPLIER_SUMOFINVOICE);
    String reportType = pageContext.getParameter(HOLDTEL_REPORT_TYPE);
   
    //add report type
    if(pageContext.getParameter("getReportButton") != null)
    {
      reportType = HOLDTEL_SUMMARY_REPORT;
      params.put(HOLDTEL_REPORT_TYPE, HOLDTEL_SUMMARY_REPORT);
      pageContext.putTransactionValue(HOLDTEL_REPORT_TYPE, HOLDTEL_SUMMARY_REPORT);
     
      pageContext.putTransactionValue(HOLDTEL_PURCHASE_GROUP, pGroup);
      pageContext.putTransactionValue(HOLDTEL_MANAGER_ID, mgrId);
      pageContext.putTransactionValue(HOLDTEL_MANAGER_NAME, mgrName);
      pageContext.putTransactionValue(HOLDTEL_BUYER_ID, buyerId);
      pageContext.putTransactionValue(HOLDTEL_BUYER_NAME, buyerName);
      pageContext.putTransactionValue(HOLDTEL_SUPPLIER_ID, supplierId);
      pageContext.putTransactionValue(HOLDTEL_SUPPLIER_NAME, supplierName);

     
      //clear Detail Report params
      pageContext.removeTransactionValue(HOLDTEL_DTL_BUYER_ID);
      pageContext.removeTransactionValue(HOLDTEL_DTL_BUYER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_DTL_SUPPLIER_ID);
      pageContext.removeTransactionValue(HOLDTEL_DTL_SUPPLIER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_INVOICE_NUM);
    }
    else if(pageContext.getParameter("getInvoicesButton") != null)
    {
      reportType = HOLDTEL_DETAIL_REPORT;
      params.put(HOLDTEL_REPORT_TYPE, HOLDTEL_DETAIL_REPORT);
      pageContext.putTransactionValue(HOLDTEL_REPORT_TYPE, HOLDTEL_DETAIL_REPORT);

      pageContext.putTransactionValue(HOLDTEL_DTL_BUYER_ID, dtlBuyerId);
      pageContext.putTransactionValue(HOLDTEL_DTL_BUYER_NAME, dtlBuyerName);
      pageContext.putTransactionValue(HOLDTEL_DTL_SUPPLIER_ID, dtlSupplierId);
      pageContext.putTransactionValue(HOLDTEL_DTL_SUPPLIER_NAME, dtlSupplierName);
      pageContext.putTransactionValue(HOLDTEL_INVOICE_NUM, invoiceNum);
     
      //clear summary report params
      pageContext.removeTransactionValue(HOLDTEL_PURCHASE_GROUP);
      pageContext.removeTransactionValue(HOLDTEL_MANAGER_ID);
      pageContext.removeTransactionValue(HOLDTEL_MANAGER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_BUYER_ID);
      pageContext.removeTransactionValue(HOLDTEL_BUYER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_SUPPLIER_ID);
      pageContext.removeTransactionValue(HOLDTEL_SUPPLIER_NAME);
    }
    else if(pageContext.getParameter("getExecReportButton") != null)
    {
      reportType = HOLDTEL_EXECUTIVE_REPORT;
      params.put(HOLDTEL_REPORT_TYPE, HOLDTEL_EXECUTIVE_REPORT);
      pageContext.putTransactionValue(HOLDTEL_REPORT_TYPE, HOLDTEL_EXECUTIVE_REPORT);

      //clear summary report params
      pageContext.removeTransactionValue(HOLDTEL_PURCHASE_GROUP);
      pageContext.removeTransactionValue(HOLDTEL_MANAGER_ID);
      pageContext.removeTransactionValue(HOLDTEL_MANAGER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_BUYER_ID);
      pageContext.removeTransactionValue(HOLDTEL_BUYER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_SUPPLIER_ID);
      pageContext.removeTransactionValue(HOLDTEL_SUPPLIER_NAME);
     
      //clear Detail Report params
      pageContext.removeTransactionValue(HOLDTEL_DTL_BUYER_ID);
      pageContext.removeTransactionValue(HOLDTEL_DTL_BUYER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_DTL_SUPPLIER_ID);
      pageContext.removeTransactionValue(HOLDTEL_DTL_SUPPLIER_NAME);
      pageContext.removeTransactionValue(HOLDTEL_INVOICE_NUM);
    }
    else
    {
      if(isEmpty(reportType))
        reportType = (String)pageContext.getTransactionValue(HOLDTEL_REPORT_TYPE);
      if(isEmpty(pGroup))
        pGroup = (String)pageContext.getTransactionValue(HOLDTEL_PURCHASE_GROUP);
      if(isEmpty(mgrId))
        mgrId = (String)pageContext.getTransactionValue(HOLDTEL_MANAGER_ID);
      if(isEmpty(mgrName))
        mgrName = (String)pageContext.getTransactionValue(HOLDTEL_MANAGER_NAME);
      if(isEmpty(buyerId))
        buyerId = (String)pageContext.getTransactionValue(HOLDTEL_BUYER_ID);
      if(isEmpty(buyerName))
        buyerName = (String)pageContext.getTransactionValue(HOLDTEL_BUYER_NAME);
      if(isEmpty(supplierId))
        supplierId = (String)pageContext.getTransactionValue(HOLDTEL_SUPPLIER_ID);
      if(isEmpty(supplierName))
        supplierName = (String)pageContext.getTransactionValue(HOLDTEL_SUPPLIER_NAME);
     
      if(isEmpty(dtlBuyerId))
        dtlBuyerId = (String)pageContext.getTransactionValue(HOLDTEL_DTL_BUYER_ID);
      if(isEmpty(dtlBuyerName))
        dtlBuyerName = (String)pageContext.getTransactionValue(HOLDTEL_DTL_BUYER_NAME);
      if(isEmpty(dtlSupplierId))
        dtlSupplierId = (String)pageContext.getTransactionValue(HOLDTEL_DTL_SUPPLIER_ID);
      if(isEmpty(dtlSupplierName))
        dtlSupplierName = (String)pageContext.getTransactionValue(HOLDTEL_DTL_SUPPLIER_NAME);
      if(isEmpty(invoiceNum))
        invoiceNum = (String)pageContext.getTransactionValue(HOLDTEL_INVOICE_NUM);
    }
     
    String event = pageContext.getParameter(EVENT_PARAM);
    if("HomeReturnLinkClick".equals(event))
    {
      selMgrName = null;
      selMgrId = null;
      selBuyerName = null;
      selBuyerId = null;
      selSupplierName = null;
      selSupplierId = null;
      selInvoiceNum = null;
      selInvoiceId = null;
      selInvoiceHoldLine = null;
    }
    if("ManagerReturnLinkClick".equals(event))
    {
      selMgrName = null;
      selMgrId = null;
      selBuyerName = null;
      selBuyerId = null;
      selSupplierName = null;
      selSupplierId = null;
      selInvoiceNum = null;
      selInvoiceId = null;
      selInvoiceHoldLine = null;
    }
    if("BuyerReturnLinkClick".equals(event))
    {
      selBuyerName = null;
      selBuyerId = null;
      selSupplierName = null;
      selSupplierId = null;
      selInvoiceNum = null;
      selInvoiceId = null;
      selInvoiceHoldLine = null;
    }
    if("SupplierReturnLinkClick".equals(event))
    {
      selSupplierName = null;
      selSupplierId = null;
      selInvoiceNum = null;
      selInvoiceId = null;
      selInvoiceHoldLine = null;
    }  
    if("InvoiceReturnLinkClick".equals(event))
    {
      selInvoiceNum = null;
      selInvoiceId = null;
      selInvoiceHoldLine = null;
    }
   
    if(pGroup != null && !"".equals(pGroup))
      params.put(HOLDTEL_PURCHASE_GROUP, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(pGroup));
    if(mgrId != null && !"".equals(mgrId))
      params.put(HOLDTEL_MANAGER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(mgrId));
    if(buyerId != null && !"".equals(buyerId))
      params.put(HOLDTEL_BUYER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(buyerId));
    if(supplierId != null && !"".equals(supplierId))
      params.put(HOLDTEL_SUPPLIER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(supplierId));
    if(dtlBuyerId != null && !"".equals(dtlBuyerId))
        params.put(HOLDTEL_DTL_BUYER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(dtlBuyerId));
    if(dtlSupplierId != null && !"".equals(dtlSupplierId))
        params.put(HOLDTEL_DTL_SUPPLIER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(dtlSupplierId));
    if(invoiceId != null && !"".equals(invoiceId))
      params.put(HOLDTEL_INVOICE_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(invoiceId));
    if(invoiceNum != null && !"".equals(invoiceNum))
      params.put(HOLDTEL_INVOICE_NUM, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(invoiceNum));
    if(mgrName != null && !"".equals(mgrName))
      params.put(HOLDTEL_MANAGER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(mgrName));
    if(buyerName != null && !"".equals(buyerName))
      params.put(HOLDTEL_BUYER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(buyerName));
    if(supplierName != null && !"".equals(supplierName))
      params.put(HOLDTEL_SUPPLIER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(supplierName));
    if(dtlBuyerName != null && !"".equals(dtlBuyerName))
        params.put(HOLDTEL_DTL_BUYER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(dtlBuyerName));
    if(dtlSupplierName != null && !"".equals(dtlSupplierName))
        params.put(HOLDTEL_DTL_SUPPLIER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(dtlSupplierName));
    if(selPGroup != null && !"".equals(selPGroup))
      params.put(HOLDTEL_SELECTED_PURCHASE_GROUP, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selPGroup));
    if(selMgrId != null && !"".equals(selMgrId))
      params.put(HOLDTEL_SELECTED_MANAGER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selMgrId));
    if(selBuyerId != null && !"".equals(selBuyerId))
      params.put(HOLDTEL_SELECTED_BUYER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selBuyerId));
    if(selSupplierId != null && !"".equals(selSupplierId))
      params.put(HOLDTEL_SELECTED_SUPPLIER_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selSupplierId));
    if(selInvoiceId != null && !"".equals(selInvoiceId))
      params.put(HOLDTEL_SELECTED_INVOICE_ID, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selInvoiceId));
    if(selInvoiceNum != null && !"".equals(selInvoiceNum))
      params.put(HOLDTEL_SELECTED_INVOICE_NUM, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selInvoiceNum));
    if(selInvoiceHoldLine != null && !"".equals(selInvoiceHoldLine))
      params.put(HOLDTEL_SELECTED_INVOICE_HOLDLINE, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selInvoiceHoldLine));
    if(selMgrName != null && !"".equals(selMgrName))
      params.put(HOLDTEL_SELECTED_MANAGER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selMgrName));
    if(selBuyerName != null && !"".equals(selBuyerName))
      params.put(HOLDTEL_SELECTED_BUYER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selBuyerName));
    if(selSupplierName != null && !"".equals(selSupplierName))
      params.put(HOLDTEL_SELECTED_SUPPLIER_NAME, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(selSupplierName));
    if(reportType != null && !"".equals(reportType))
      params.put(HOLDTEL_REPORT_TYPE, HOLDTEL_ENCRYPT_PARAM+pageContext.encrypt(reportType));
   
    if(selSupplierSumOfInv != null && !"".equals(selSupplierSumOfInv))
         pageContext.putTransactionValue(HOLDTEL_SEL_SUPPLIER_SUMOFINVOICE, selSupplierSumOfInv);
     
    return params;
  }

  protected void redirectPage(OAPageContext pageContext, String url, String functionName)
  {
    pageContext.forwardImmediately(url, functionName, KEEP_MENU_CONTEXT, null, getURLParams(pageContext), true, ADD_BREAD_CRUMB_YES);
  }
 
  private void hideItem(OAWebBean item)
  {
    if(item != null)
      item.setRendered(false);
  }

  protected boolean isEmpty(String value)
  {
    return (value == null || value.equals(""));
  }
 
  /**
   * procedure to set the link text to every page.
   * @param pageContext
   * @param webBean
   */
  protected void setReturnLinkText(OAPageContext pageContext,  OAWebBean webBean)
  {
    String managerName = pageContext.getParameter(HOLDTEL_SELECTED_MANAGER_NAME);
    String buyerName = pageContext.getParameter(HOLDTEL_SELECTED_BUYER_NAME);
    String supplierName = pageContext.getParameter(HOLDTEL_SELECTED_SUPPLIER_NAME);
    String invoiceHoldLineNum = pageContext.getParameter(HOLDTEL_SELECTED_INVOICE_HOLDLINE); //newly added
    if(!isEmpty(managerName))
    {
      OAMessageStyledTextBean mgrNameBean = (OAMessageStyledTextBean)webBean.findChildRecursive(HOLDTEL_MANAGER_RETURN_LINK_ID);
      if(mgrNameBean != null)
        mgrNameBean.setText(managerName);
    }
   
    if(!isEmpty(buyerName))
    {
      OAMessageStyledTextBean buyerNameBean = (OAMessageStyledTextBean)webBean.findChildRecursive(HOLDTEL_BUYER_RETURN_LINK_ID);
      if(buyerNameBean != null)
        buyerNameBean.setText(buyerName);
    }
   
    if(!isEmpty(supplierName))
    {
      OAMessageStyledTextBean SupplierNameBean = (OAMessageStyledTextBean)webBean.findChildRecursive(HOLDTEL_SUPPLIER_RETURN_LINK_ID);
      if(SupplierNameBean != null)
        SupplierNameBean.setText(supplierName);
    }
   
   
    if(!isEmpty(invoiceHoldLineNum))
    {
      OAMessageStyledTextBean InvoiceNameBean1 = (OAMessageStyledTextBean)webBean.findChildRecursive(HOLDTEL_INVOICE_RETURN_LINK_ID);
      if(InvoiceNameBean1 != null)
        InvoiceNameBean1.setText(invoiceHoldLineNum);
    }
  }
}

No comments:

Post a Comment