protected List populateHistoryList( HttpServletRequest request, List historyRecords, String rootNodeName, String xslMappingFileName) throws LIMSRuntimeException { List list = new ArrayList(); try { SystemUserDAO systemUserDAO = new SystemUserDAOImpl(); AuditTrailDAO auditTrailDAO = new AuditTrailDAOImpl(); for (int i = 0; i < historyRecords.size(); i++) { History historyRecord = (History) historyRecords.get(i); Timestamp date = historyRecord.getTimestamp(); String stringLocale = SystemConfiguration.getInstance().getDefaultLocale().toString(); String dateForDisplay = DateUtil.convertTimestampToStringDateAndTime(date, stringLocale); SystemUser systemUser = new SystemUser(); systemUser.setId(historyRecord.getSysUserId()); systemUserDAO.getData(systemUser); String blob = null; if (!historyRecord.getActivity().equals(AUDIT_TRAIL_INSERT)) { blob = auditTrailDAO.retrieveBlobData(historyRecord.getId()); } // this is temporary until 2593 has been completed if (historyRecord.getActivity().equals(IActionConstants.AUDIT_TRAIL_UPDATE)) { blob = "<" + rootNodeName + ">" + blob + "</" + rootNodeName + ">"; } if (!StringUtil.isNullorNill(blob)) { HistoryXmlHelper historyXmlHelper = new HistoryXmlHelper(); historyXmlHelper.setActivity(historyRecord.getActivity()); historyXmlHelper.setUserName(systemUser.getNameForDisplay()); String media = null, title = null, charset = null, xsldata = ""; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { // NOTE!!!! // in order to run this in oc4j I needed to do the following: // add this to OC4J startup: // -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl // to make sure that oc4j uses correct XSL processor (else it could not handle "function // extensions" used to bring in MessageResources labels // place xalan.jar, xml-apis.jar, XercesImpl.jar into the applib folder of the oc4j // installation TransformerFactory tFactory = TransformerFactory.newInstance(); HttpSession session = request.getSession(); ServletContext context = session.getServletContext(); File xslFile = new File(context.getRealPath("/WEB-INF/transformation/" + xslMappingFileName)); Source stylesheet = new StreamSource(xslFile); Transformer transformer = tFactory.newTransformer(stylesheet); System.out.println("This is blob " + blob); transformer.transform( new StreamSource(new StringReader(blob)), new StreamResult(outputStream)); } catch (TransformerConfigurationException tce) { tce.printStackTrace(); } catch (TransformerException te) { te.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } System.out.println("This is xml " + outputStream.toString()); historyXmlHelper.setChange(outputStream.toString()); historyXmlHelper.setDate(dateForDisplay); if (!StringUtil.isNullorNill(historyXmlHelper.getChange())) { historyXmlHelper.setChange(historyXmlHelper.getChange().trim()); } if (!StringUtil.isNullorNill(historyXmlHelper.getChange())) { list.add(historyXmlHelper); } } } } catch (Exception e) { throw new LIMSRuntimeException(e); } return list; }