public Vector getCiConsolidationOptions(String productSelectedIndex,Vector vtSugProducts,Vector vtExistingLoans)
throws FunctionalException,ProcessException,FatalException{ // LogProviderFactory.getLogInstance().info("Method --> appBO:getCiConsolidationOptions(productSelectedIndex, vtSugProducts, vtExistingLoans) Start--> : "+ new Date(System.currentTimeMillis())); HashMap hmTemp = null; HashMap hmOptions = null; HashMap hmPrevOptions = null; HashMap hmExistingProduct = null; HashMap hmSuggestedProducts = null; HashMap hmConsolidationInput = null; Vector vtConsolidationOption = null; try { LogProviderFactory.getLogInstance().info("ApplicationBo.getCiConsolidationOptions(yj63318) i/p productSelectedIndex -->"+productSelectedIndex); LogProviderFactory.getLogInstance().info("ApplicationBo.getCiConsolidationOptions(yj63318) i/p vtSugProducts -->"+vtSugProducts); LogProviderFactory.getLogInstance().info("ApplicationBo.getCiConsolidationOptions(yj63318) i/p vtExistingLoans -->"+vtExistingLoans); String repayModifyValue = CIUtils.getParamCodeFromGenericParam("EN","G015",RepayOrModify); String modifyValue = CIUtils.getParamCodeFromGenericParam("EN","G015",Modify); boolean conSolIndFound = false; if ((vtSugProducts!=null) && (vtSugProducts.size()>0)&&(vtExistingLoans!=null)&&(vtExistingLoans.size()>0)) { hmConsolidationInput = new HashMap(7,0.8f); //Details of the consolidating product int suggProdSize = vtSugProducts!=null ? vtSugProducts.size() : 0; //find the product to be consolidated for (int i=0;i< suggProdSize;i++){ HashMap hmSuggestedProd = (HashMap) vtSugProducts.get(i); String consolidationFlag = hmSuggestedProd!=null ? CIUtils.getStringVal(hmSuggestedProd.get(CONSOLIDATEIND)) : null; if (CIUtils.isEqualParamValue(consolidationFlag,YES_FLAG)){ hmConsolidationInput.put(SUGGESTEDPRODCD,CIUtils.getStringVal(hmSuggestedProd.get(PRODCD))); hmConsolidationInput.put(SUGGESTEDPRODUCTLINE,CIUtils.getStringVal(hmSuggestedProd.get(PRODUCTLINE))); String professionalUseVal = CIUtils.getStringVal(hmSuggestedProd.get(PROFESSIONAL_USE)); if (CIUtils.isNull(professionalUseVal)){ professionalUseVal = NO_FLAG; } hmConsolidationInput.put(SUGGESTEDPROFESSIONALUSE,professionalUseVal); conSolIndFound = true; } } if (CIUtils.isParamNotNull(productSelectedIndex)){ hmSuggestedProducts = (HashMap) vtSugProducts.get(Integer.parseInt(productSelectedIndex)); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) hmSuggestedProducts-"+productSelectedIndex+"-->"+hmSuggestedProducts); if ((hmSuggestedProducts!=null)&&(hmSuggestedProducts.size()>0)) { hmConsolidationInput.put(SUGGESTEDPRODCD,CIUtils.getStringVal(hmSuggestedProducts.get(PRODCD))); hmConsolidationInput.put(SUGGESTEDPRODUCTLINE,CIUtils.getStringVal(hmSuggestedProducts.get(PRODUCTLINE))); String professionalUse = CIUtils.getStringVal(hmSuggestedProducts.get(PROFESSIONAL_USE)); if (!CIUtils.isParamNotNull(professionalUse)) professionalUse = NO_FLAG; hmConsolidationInput.put(SUGGESTEDPROFESSIONALUSE,professionalUse); }else LogProviderFactory.getLogInstance().info("hmSuggestedProducts is null in vtSugProducts in Method getCiConsolidationOptions"); } //Details of the external products, set the close or repay option for (int j=0;j<vtExistingLoans.size();j++){ hmExistingProduct = (HashMap) vtExistingLoans.get(j); LogProviderFactory.getLogInstance().info("hmExistingProduct-"+j+"-->"+hmExistingProduct); if ((hmExistingProduct!=null)&&(hmExistingProduct.size()>0)) { String systemId = CIUtils.getStringVal(hmExistingProduct.get(SYSTEMID)); boolean rejectedProduct = CIUtils.getObjBooleanValue(hmExistingProduct.get(REJECTEDEXISTINGPRODUCTS)); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) productSelectedIndex -->"+productSelectedIndex); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) systemId -->"+systemId); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) rejectedProduct -->"+rejectedProduct); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) isConsolidatedProduct -->"+CIUtils.isConsolidatedProduct(productSelectedIndex,rejectedProduct,systemId)); if (CIUtils.isConsolidatedProduct(productSelectedIndex,rejectedProduct,systemId)){ hmPrevOptions = CIUtils.getHashMapObj(hmExistingProduct.get(CloseRepay)); hmConsolidationInput.put(PRODCD,CIUtils.getStringVal(hmExistingProduct.get(PRODCD))); hmConsolidationInput.put(PRODUCTLINE,CIUtils.getStringVal(hmExistingProduct.get(PRODUCTLINE))); String sourceType = CIUtils.getStringVal(hmExistingProduct.get(SOURCE)); if(!conSolIndFound){ hmConsolidationInput.put(SUGGESTEDPROFESSIONALUSE,""); } if (CIUtils.isEqualParamValue(sourceType,External)) hmConsolidationInput.put(SOURCE,EXTERNAL); else if (CIUtils.isEqualParamValue(sourceType,Internal)) hmConsolidationInput.put(SOURCE,INTERNAL); hmConsolidationInput.put(SYSTEMID,systemId); //Consolidation Option choosed before consolting the DB String defaultConsdOption = CIUtils.getStringVal(hmExistingProduct.get(CONSINDLOVVALUE));//CONSINDLOVVALUE: the pre-choosed option String lineModifiedProduct = CIUtils.getStringVal(hmExistingProduct.get(LINE_OR_CARD_MODIFY)); vtConsolidationOption = getConsolidationOptions(hmConsolidationInput); if ((vtConsolidationOption!=null)&&(vtConsolidationOption.size()>0)) { hmOptions = new HashMap(); boolean noDefaultFlag = true; boolean optionsFlag = false; for (int k=0;k<vtConsolidationOption.size();k++){ hmTemp = (HashMap)vtConsolidationOption.get(k);// LogProviderFactory.getLogInstance().info("Options-"+k+"-->"+hmTemp); if ((hmTemp!=null)&&(hmTemp.size()>0)) { optionsFlag = true; String consolidationOption = CIUtils.getStringVal(hmTemp.get(CONSO_OPTION)); hmOptions.put((CONSINDLOV+(k+1)),consolidationOption); String defaultFlag = CIUtils.getStringVal(hmTemp.get(DEFAULT_FLG)); if (CIUtils.isEqualParamValue(defaultFlag,YES_FLAG)){// set the default choosed option noDefaultFlag = false; hmExistingProduct.put(CONSINDLOVVALUE,consolidationOption); } //If MR is in options it should be added if ((CIUtils.isParamNotNull(productSelectedIndex))&&(hmPrevOptions!=null)&&(hmPrevOptions.size()>0)) { if ((hmPrevOptions.containsValue(repayModifyValue))&&(!hmOptions.containsValue(repayModifyValue))){ int closeRepaySize = hmOptions!= null ? hmOptions.size() : 0; closeRepaySize=closeRepaySize+1; hmOptions.put(CONSINDLOV+(closeRepaySize),repayModifyValue); } } //For Line Modified Product the default consolidation option to be selected if (CIUtils.isEqualParamValue(lineModifiedProduct,YES_FLAG)){ noDefaultFlag = false; //For Line Modified Product the default consolidation option to be selected in consolidating product available if (CIUtils.isParamNotNull(productSelectedIndex)){ hmExistingProduct.put(CONSINDLOVVALUE,defaultConsdOption); int closeRepaySize = hmOptions!= null ? hmOptions.size() : 0; if (!hmOptions.containsValue(defaultConsdOption)){ closeRepaySize=closeRepaySize+1; hmOptions.put(CONSINDLOV+(closeRepaySize),defaultConsdOption); } }else{ //For Line Modified Product the default consolidation option to be selected in consolidating product is not available if (hmOptions.containsValue(repayModifyValue)){ for (int i=0;i<hmOptions.size();i++){ String options = CIUtils.getStringVal(hmOptions.get(CONSINDLOV+i)); if (CIUtils.isEqualParamValue(options,repayModifyValue)) hmOptions.remove(CONSINDLOV+i); } if (!hmOptions.containsValue(modifyValue)){ int closeRepaySize = hmOptions!= null ? hmOptions.size() : 0; closeRepaySize=closeRepaySize+1; hmOptions.put(CONSINDLOV+(closeRepaySize),modifyValue); } hmExistingProduct.put(CONSINDLOVVALUE,modifyValue); } } } hmExistingProduct.put(CloseRepay,hmOptions); //R3-2008-TIL-398-FIX addMRApplicableExistProduct(hmExistingProduct); //hmExistingProduct.put(CloseRepay,removeDuplicateConslnOptions(hmOptions)); LogProviderFactory.getLogInstance().info("ApplicationBO.getCiConsolidationOptions(yj63318) New CloseRepay hmExistingProduct-"+j+"-->"+hmExistingProduct); }else LogProviderFactory.getLogInstance().info("hmTemp in "+k+"the index is null in vtConsolidationOption Vector"); hmTemp = null; } if (optionsFlag && noDefaultFlag){ // LogProviderFactory.getLogInstance().info("<-- No Default Flag present in Consolidation Options. Blank to be Defaulted -->"); hmExistingProduct.put(CONSINDLOVVALUE,BLANKLOV); } hmOptions=null; }else LogProviderFactory.getLogInstance().info("vtConsolidationOption is null in getCiConsolidationOptions"); }else if (rejectedProduct && (CIUtils.isALSECSNBB(systemId))) { //To remove the consolidation option for the External product greater than 100 hmExistingProduct.put(CloseRepay,hmOptions); } }else LogProviderFactory.getLogInstance().info("hmExistingProduct in "+j+"the index is null in vtExistingLoans Vector"); } }else LogProviderFactory.getLogInstance().info("vtSugProducts / vtExistingLoans is null in Method getCiConsolidationOptions"); // LogProviderFactory.getLogInstance().info("getCiConsolidationOptions Output hmConsolidateCNA -->"+vtExistingLoans); } catch (Exception e) { LogProviderFactory.getLogInstance().fatal("Exception in getCiConsolidationOptions--->"+e.getMessage(),e); throw new FatalException (e,"CICP","getCiConsolidationOptions"); }finally{ hmTemp = null; hmOptions = null; hmPrevOptions = null; hmExistingProduct = null; hmSuggestedProducts = null; hmConsolidationInput = null; vtSugProducts = null; vtConsolidationOption = null; } // LogProviderFactory.getLogInstance().info("Method --> appBO:getCiConsolidationOptions(productSelectedIndex, vtSugProducts, vtExistingLoans) End--> : "+ new Date(System.currentTimeMillis())); return vtExistingLoans; }