Commit cb08c1ec authored by Daniel Quadras's avatar Daniel Quadras

Update ITMUserAuditTrailBrow.jsp

parent 872ce409
......@@ -147,10 +147,13 @@ function showPreviousPage(){
dataNew = auditBean.getXMLStrBrow("EXCELDATA");
BaseLogger.log("3",userInfo,null, "datanew daniel in html from auditbean.getxmlstrbrow"+dataNew);
//DATANEW No data for audittrail data
boolean noDataCheck = dataNew.contains("<nodata>");
BaseLogger.log("3",userInfo,null, "daniel nodatacheckvalue"+noDataCheck);
sessiondata=itmuserauditbeantest.getSessionInfoDet(userStr, fromDateformat, toDateformat);
BaseLogger.log("3",userInfo,null, "datanew daniel sessiondata before if nodatacheck"+sessiondata);
//condition to handle no data in datanew i.e audittrail
if(noDataCheck)
{
String tagtoremove = "nodata";
......@@ -191,7 +194,81 @@ function showPreviousPage(){
}
//else { add the below code inside this else add below 10 lines in here }
//condition to check if sessiondata is empty and audtitrail has data
else if(noDataCheck==false && sessiondata.trim().length() == 0 || noDataCheck==false && sessiondata.equalsIgnoreCase(null) || noDataCheck==false && sessiondata.equalsIgnoreCase(""))
{
dataNew = dataNew.replaceAll("</DocumentRoot>", "");
dataNew = dataNew.replaceAll("</Header0>", "");
dataNew = dataNew.replaceAll("</group0>", "");
String xmlFrNoRecords = "<Detail1 dbID='' domID='' objName='' objContext=''> <attribute pkNames='' status='O' updateFlag='' selected='' /> <chg_id><![CDATA[]]></chg_id> <obj_name><![CDATA[]]></obj_name> <ref_id><![CDATA[]]></ref_id><action_prfrm><![CDATA[]]></action_prfrm><action_status><![CDATA[]]></action_status><chg_term><![CDATA[]]></chg_term><tran_id><![CDATA[]]></tran_id> <chg_user><![CDATA[]]></chg_user> <chg_date><![CDATA[27/12/93 11:11:11]]></chg_date> <descr><![CDATA[NO RECORDS FOUND FOR LOGIN TRACE]]></descr> </Detail1>";
String closingtags = "</Header0>"+"\r\n"+"</group0> "+"\r\n"+"</DocumentRoot>" ;
String tagtoremove = "nodata";
dataNew = dataNew.replaceAll("<" + tagtoremove + ">.*?</" + tagtoremove + ">", "");
BaseLogger.log("3",userInfo,null, "daniel data after remove tagtoremove first else if"+dataNew);
dataNew = dataNew+xmlFrNoRecords+closingtags;
BaseLogger.log("3",userInfo,null, "daniel finaldata first else if"+dataNew);
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
String xslFile = new E12GenericUtility().readFile(CommonConstants.APPLICATION_CONTEXT + CommonConstants.ITM_CONTEXT + File.separator+"xsl"+File.separator+"user_audit_trail11_en_US_V.xsl");
Transformer transformer = tFactory.newTransformer(new StreamSource(new ByteArrayInputStream(xslFile.getBytes())));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
transformer.transform( new DOMSource( new E12GenericUtility().parseString(dataNew)), new StreamResult(bos));
dataNew = bos.toString();
BaseLogger.log("3",userInfo,null, "daniel final html datanew converted into html data in first else if"+dataNew);
}
catch (Exception e) {
e.printStackTrace();
BaseLogger.log("3",userInfo,null, "daniel Exception is:::");
}
}
//condition to hanlde both sessiondata and datanew having no data
else if(sessiondata.trim().length() == 0 && noDataCheck)
{
String tagtoremove = "nodata";
BaseLogger.log("3",userInfo,null, "daniel tagtoremove elseif condition 2nd else if"+tagtoremove);
dataNew = dataNew.replaceAll("<" + tagtoremove + ">.*?</" + tagtoremove + ">", "");
BaseLogger.log("3",userInfo,null, "daniel datanew after removing <nodata> tag 2nd else if"+dataNew);
String closingtags = "</Header0>"+"\r\n"+"</group0> "+"\r\n"+"</DocumentRoot>" ;
dataNew = dataNew.replaceAll("</DocumentRoot>", "");
dataNew = dataNew.replaceAll("</Header0>", "");
dataNew = dataNew.replaceAll("</group0>", "");
BaseLogger.log("3",userInfo,null, "datanew daniel after remove closing tags in if nodatacheck in html 2nd else if"+dataNew);
String xmlFrNoRecords = "<Detail1 dbID='' domID='' objName='' objContext=''> <attribute pkNames='' status='O' updateFlag='' selected='' /> <chg_id><![CDATA[]]></chg_id> <obj_name><![CDATA[]]></obj_name> <ref_id><![CDATA[]]></ref_id><action_prfrm><![CDATA[]]></action_prfrm><action_status><![CDATA[]]></action_status><chg_term><![CDATA[]]></chg_term><tran_id><![CDATA[]]></tran_id> <chg_user><![CDATA[]]></chg_user> <chg_date><![CDATA[27/12/93 11:11:11]]></chg_date> <descr><![CDATA[NO RECORDS FOUND IN AUDIT TRAIL AND LOGINTRACE]]></descr> </Detail1>";
BaseLogger.log("3",userInfo,null, "datanew daniel final 2nd else if"+dataNew);
dataNew = dataNew + xmlFrNoRecords + closingtags;
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
String xslFile = new E12GenericUtility().readFile(CommonConstants.APPLICATION_CONTEXT + CommonConstants.ITM_CONTEXT + File.separator+"xsl"+File.separator+"user_audit_trail11_en_US_V.xsl");
Transformer transformer = tFactory.newTransformer(new StreamSource(new ByteArrayInputStream(xslFile.getBytes())));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
transformer.transform( new DOMSource( new E12GenericUtility().parseString(dataNew)), new StreamResult(bos));
dataNew = bos.toString();
BaseLogger.log("3",userInfo,null, "daniel final html datanew 2nd else if"+dataNew);
}
catch (Exception e) {
e.printStackTrace();
BaseLogger.log("3",userInfo,null, "daniel Exception is:::");
}
}
//else { add the below code inside this else add below 10 lines in here WHEn both tables have data}
else {
dataNew = dataNew.replaceAll("</DocumentRoot>", "");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment