import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
static final String getOnlineBusinessFilingReportSQL = "Select TX_DOCUMENT from DOCUMENT_GEN where ID_BUS_FLNG = ? with UR ";
public SavedReportResult getOnlineBusinessFilingReport(String filingNumber)throws CRDException, SQLException {
PreparedStatement prepStat = null;
ResultSet rs = null;
Connection con = null ;
SavedReportResult savedReport = null;
boolean newManager = false;
try {
String busIdWithoutSpace = StringUtils.deleteWhitespace(filingNumber);
filingNumber = StringUtils.leftPad(busIdWithoutSpace, 10, '0');
} catch (NumberFormatException e) {
}
try {
con = DBManager.getConnection();
prepStat = con.prepareStatement(getOnlineBusinessFilingReportSQL);
prepStat.setString(1, filingNumber != null ? filingNumber.trim() : "");
rs = prepStat.executeQuery();
if(rs.next()){
InputStream is =
rs.getBinaryStream(1);
if(is != null){
BufferedReader reader =
new BufferedReader(new InputStreamReader(is));
try {
try {
savedReport =
(SavedReportResult) Unmarshaller.unmarshal(SavedReportResult.class, reader);
} catch (ValidationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MarshalException e) {
throw new CRDException(e.getMessage());
}
}
}
rs.close();
prepStat.close();
} finally {
if(rs != null)
rs.close();
if(prepStat != null)
prepStat.close();
if(con != null && newManager)
con.close();
rs = null;
prepStat = null;
con = null;
}
return savedReport;
}
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
static final String getOnlineBusinessFilingReportSQL = "Select TX_DOCUMENT from DOCUMENT_GEN where ID_BUS_FLNG = ? with UR ";
public SavedReportResult getOnlineBusinessFilingReport(String filingNumber)throws CRDException, SQLException {
PreparedStatement prepStat = null;
ResultSet rs = null;
Connection con = null ;
SavedReportResult savedReport = null;
boolean newManager = false;
try {
String busIdWithoutSpace = StringUtils.deleteWhitespace(filingNumber);
filingNumber = StringUtils.leftPad(busIdWithoutSpace, 10, '0');
} catch (NumberFormatException e) {
}
try {
con = DBManager.getConnection();
prepStat = con.prepareStatement(getOnlineBusinessFilingReportSQL);
prepStat.setString(1, filingNumber != null ? filingNumber.trim() : "");
rs = prepStat.executeQuery();
if(rs.next()){
InputStream is =
rs.getBinaryStream(1);
if(is != null){
BufferedReader reader =
new BufferedReader(new InputStreamReader(is));
try {
try {
savedReport =
(SavedReportResult) Unmarshaller.unmarshal(SavedReportResult.class, reader);
} catch (ValidationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MarshalException e) {
throw new CRDException(e.getMessage());
}
}
}
rs.close();
prepStat.close();
} finally {
if(rs != null)
rs.close();
if(prepStat != null)
prepStat.close();
if(con != null && newManager)
con.close();
rs = null;
prepStat = null;
con = null;
}
return savedReport;
}
No comments:
Post a Comment