public String genBillLine(ArrayList finalArray,String caseId){
CaseMgtAMImpl caseAM = null;
FinanceAMImpl finAM=null;
String result=null;
try{
testAM = (testAMImpl)Configuration.createRootApplicationModule("og.dr.sm.mgt.model.am.testAMImpl","testAMLocal"); // getting AM
finAM = (FinanceAMImpl)Configuration.createRootApplicationModule("og.dr.finmgt.model.am.FinanceAMImpl","FinanceAMLocal");
ArrayList partyIds=getPartyIds(caseId);
ViewObject billVo=finAM.getFinBillLinesVO();
Iterator it=finalArray.iterator();
while(it.hasNext()){
HashMap map = (HashMap)it.next();
Object billcode=map.get("0");
Object desc=map.get("1")!=null ? map.get("1"):"";
Iterator pit=partyIds.iterator();
while(pit.hasNext()){
String partyId =pit.next().toString();
Object pamount = map.get(partyId);
Row billRow = billVo.createRow();
billRow.setAttribute("CaseId", caseId);
billRow.setAttribute("PartyId", partyId);
billRow.setAttribute("BillCode", billcode);
billRow.setAttribute("Description","katrina"); // hard coding value for test
billRow.setAttribute("Amount", pamount);
billVo.insertRow(billRow);
finAM.getDBTransaction().commit();
result="Bill Line Created Successfully";
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
Configuration.releaseRootApplicationModule(testAM, true); // closing the connection
Configuration.releaseRootApplicationModule(finAM, true);
}
return result;
}
CaseMgtAMImpl caseAM = null;
FinanceAMImpl finAM=null;
String result=null;
try{
testAM = (testAMImpl)Configuration.createRootApplicationModule("og.dr.sm.mgt.model.am.testAMImpl","testAMLocal"); // getting AM
finAM = (FinanceAMImpl)Configuration.createRootApplicationModule("og.dr.finmgt.model.am.FinanceAMImpl","FinanceAMLocal");
ArrayList partyIds=getPartyIds(caseId);
ViewObject billVo=finAM.getFinBillLinesVO();
Iterator it=finalArray.iterator();
while(it.hasNext()){
HashMap map = (HashMap)it.next();
Object billcode=map.get("0");
Object desc=map.get("1")!=null ? map.get("1"):"";
Iterator pit=partyIds.iterator();
while(pit.hasNext()){
String partyId =pit.next().toString();
Object pamount = map.get(partyId);
Row billRow = billVo.createRow();
billRow.setAttribute("CaseId", caseId);
billRow.setAttribute("PartyId", partyId);
billRow.setAttribute("BillCode", billcode);
billRow.setAttribute("Description","katrina"); // hard coding value for test
billRow.setAttribute("Amount", pamount);
billVo.insertRow(billRow);
finAM.getDBTransaction().commit();
result="Bill Line Created Successfully";
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
Configuration.releaseRootApplicationModule(testAM, true); // closing the connection
Configuration.releaseRootApplicationModule(finAM, true);
}
return result;
}
Comments
Post a Comment