package com.pnc.tms.ach.reports;
import java.util.Vector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.pnc.tms.ach.ejb.ACHReportEJB;
import com.pnc.tms.ach.ejb.ACHReportEJBHome;
import com.pnc.tms.ach.ejb.ACHReportEJBKey;
import com.pnc.tms.ach.ejb.ACHSessConnectEJB;
import com.pnc.tms.ach.ejb.ACHSessConnectEJBHome;
import com.pnc.tms.ir.constants.IREJBConstants;
import com.pnc.tms.isc.inforeports.Utils;
import com.pnc.tms.isc.system.EJBFactory;
import com.pnc.tms.isc.system.ISCException;
/**
* @author PP15895
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public final class EJBACHReportsML implements IISCACHReports {
private static Log log = LogFactory.getLog(EJBACHReportsML.class);
ACHReportEJB custReport = null;
ACHReportEJBHome custRepHome = null;
ACHReportEJBKey custRptKey = null;
ACHSessConnectEJBHome sessConnEJBHome = null;
ACHSessConnectEJB sessConnEJB = null;
String tempShortName = null;
String tempToken = null;
/**
* Constructor for EJBACHReportML.
*/
public EJBACHReportsML() {
super();
}
public void ReportsProcessing(ACHRptObjects rptObjs) throws ISCException {
if(log.isDebugEnabled())
log.debug("OAE4403" + ": " + "EJBACHReportsML.ReportsProcessing() entered.");
Integer seqNum;
//int seqNum = 10;
boolean error = false;
try {
try {
//sessConnEJB = ((ACHSessConnectEJBHome)EJBFactory.getEJBHome(IREJBConstants.ACHSessConnectEJBHome_ref)).create();
//Getting seqNum from SRS_ACH_ORIG_TEMP table...
//If table is empty, seqNum defaults to 1. Otherwise, max seqNum
//should be returned.
//seqNum = sessConnEJB.getSeqNum();
//if (seqNum != null) {
// rptObjs.setSeqNum(seqNum);
//}
//System.out.println("seqNum is ... " + rptObjs.getSeqNum());
Vector acctNames = Utils.parseStringToVector(rptObjs.getSelAccounts(), ",");
for(int i = 0;i < acctNames.size(); i++) {
//System.out.println("Names is ... " + acctNames.elementAt(i));
//Parsing each short name from list for processing to SRS_ACH_ORIG_TEMP table....
String [] weAreYourTokens = ((String)acctNames.elementAt(i)).split("%5B");
//String x = (String)acctNames.elementAt(i);
//Locating first occurrance of [ or %5B...
//int y = x.indexOf("%5B",0);
//Locating first occurrance of ] or %5D...
//int z = x.indexOf("%5D",0);
//Removing %5B from x (y+3) and obtaining shortname...
//tempShortName = x.substring((y+3),z);
System.out.println("******ShortName is ... " + tempShortName);
rptObjs.setShortName(tempShortName);
custRepHome = (ACHReportEJBHome)EJBFactory.getEJBHome(IREJBConstants.ACHReportEJBHome_ref);
custReport = custRepHome.create(rptObjs.getSeqNum(), rptObjs.getCompanyID(), rptObjs.getShortName(),
rptObjs.getReportID(), rptObjs.getRelDateFrom(), rptObjs.getRelDateTo(), rptObjs.getEffDateFrom(),
rptObjs.getEffDateTo(), rptObjs.getAmtFrom(), rptObjs.getAmtTo(), rptObjs.getRecrAcctNbr(), rptObjs.getIndivID());
}
} catch(Exception e) {
error = true;
String errorMsg = "EJBACHReportsML.ReportsProcessing() Exception caught: " + e.getMessage();
log.error("OAX4403" + ": " + errorMsg, e);
throw new ISCException("OAX4403");
}
} finally {
custReport = null;
custRepHome = null;
sessConnEJBHome = null;
sessConnEJB = null;
if(!error)
if(log.isDebugEnabled())
log.debug("OAE4403" + ": " + "EJBACHReportsML.ReportsProcessing() exited.");
}
}
}