private void checkCollumns(ReportParams params) { List<String> all = Arrays.asList( StatsManager.T_SITE, StatsManager.T_USER, StatsManager.T_EVENT, StatsManager.T_TOOL, StatsManager.T_RESOURCE, StatsManager.T_RESOURCE_ACTION, StatsManager.T_DATE, StatsManager.T_DATEMONTH, StatsManager.T_DATEYEAR, StatsManager.T_LASTDATE, StatsManager.T_TOTAL, StatsManager.T_VISITS, StatsManager.T_UNIQUEVISITS, StatsManager.T_DURATION); List<String> totalsBy = params.getHowTotalsBy(); for (String c : all) { boolean containsColumn = M_rm.isReportColumnAvailable(params, c); boolean expected = totalsBy == null || totalsBy.contains(c) || (c.equals(StatsManager.T_TOTAL) && !ReportManager.WHAT_PRESENCES.equals(params.getWhat())) || (c.equals(StatsManager.T_DURATION) && ReportManager.WHAT_PRESENCES.equals(params.getWhat())); // System.out.println("containsColumn("+c+"): "+containsColumn+" expected: "+expected); assertEquals(expected, containsColumn); } }
private void setColumnDisplayInfo(ReportParams params) throws SAXException { if (handler == null) { throw new IllegalStateException("ContentHandler not set"); } handler.element("what", params.getWhat()); handler.element("who", params.getWho()); handler.element( "showSite", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_SITE))); handler.element( "showUser", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_USER))); handler.element( "showTool", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_TOOL))); handler.element( "showEvent", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_EVENT))); handler.element( "showResource", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_RESOURCE))); handler.element( "showResourceAction", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_RESOURCE_ACTION))); handler.element( "showDate", String.valueOf( M_rm.isReportColumnAvailable(params, StatsManager.T_DATE) || M_rm.isReportColumnAvailable(params, StatsManager.T_DATEMONTH) || M_rm.isReportColumnAvailable(params, StatsManager.T_DATEYEAR))); handler.element( "showLastDate", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_LASTDATE))); handler.element( "showTotal", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_TOTAL))); handler.element( "showTotalVisits", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_VISITS))); handler.element( "showTotalUnique", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_UNIQUEVISITS))); handler.element( "showDuration", String.valueOf(M_rm.isReportColumnAvailable(params, StatsManager.T_DURATION))); }