Java tutorial
/*$Id: AnnualStatisticServiceHelper.java 14211 2009-11-06 21:51:51Z jens $*/ /* **************************************************************************** * * * (c) Copyright 2006 ABM-utvikling * * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * * * * This program is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * * Public License for more details. http://www.gnu.org/licenses/gpl.html * * * **************************************************************************** */ package no.abmu.abmstatistikk.annualstatistic.service.hibernate2; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.SortedSet; import no.abmu.abmstatistikk.annualstatistic.domain.Answer; import no.abmu.abmstatistikk.annualstatistic.domain.Report; import no.abmu.abmstatistikk.annualstatistic.service.ReportHelper; import no.abmu.common.browsing.OrganisationUnitForBrowsing; import no.abmu.common.constants.LocaleTypeNameConst; import no.abmu.common.constants.SchemaTypeNameConst; import no.abmu.common.jasperreports.SchemaList; import no.abmu.common.reporting.OrgUnitReport; import no.abmu.common.reporting.ReportStatus; import no.abmu.common.reporting.ReportStatusImpl; import no.abmu.common.reporting.SimpleOrgUnitReport; import no.abmu.organisationregister.util.ProgressStatistics; import no.abmu.util.string.StringUtil; import no.abmu.util.test.Assert; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.util.StopWatch; /** * Helper class to AnnualStatisticServiceImpl. * * * @author: Jens.Vindvad@abm-utvikling.no * @author $Author: jens $ * @version $Rev: 14211 $ * @date $Date: 2009-11-06 22:51:51 +0100 (Fri, 06 Nov 2009) $ * @since 2006-09-05 (rev. 3376) * copyright ABM-Utvikling * */ public class AnnualStatisticServiceHelper { private static final String COMMENT_POSTFIX = "Comment"; private static final String LASTYEAR_POSTFIX = "LastYear"; private static final String REPORT_EXIST = "Ja"; private static final String REPORT_IS_FINISH = "Ja"; private static final String REPORT_IS_NOT_FINISH = "Nei"; private static final String REPORT_ANSWER_JA = "Ja"; private static final String REPORT_ANSWER_NEI = "Nei"; private static final String REPORT_ANSWER_PARTLY = "Delvis"; private static final Log logger = (Log) LogFactory.getLog(AnnualStatisticServiceHelper.class); private AnnualStatisticService service; public AnnualStatisticServiceHelper(AnnualStatisticService annualStatisticService) { this.service = annualStatisticService; } protected ReportStatus[] getReportStatusBySchemaTypeAndYear( List<OrganisationUnitForBrowsing> orgUnitsForBrodwsing, String schemaTypeName, int reportYear) { StopWatch stopWatch = new StopWatch(); stopWatch.start(); List<ReportStatus> reportStatusAsList = new ArrayList<ReportStatus>(); String finishFieldNumber = getFinishFieldNumberForSchemaTypeAndReportYear(schemaTypeName, reportYear); for (OrganisationUnitForBrowsing orgForBrowse : orgUnitsForBrodwsing) { Report report = service.getReport(orgForBrowse.getOrganisationUnitId(), schemaTypeName, reportYear, false); reportStatusAsList.add(createReportStatus(orgForBrowse, report, finishFieldNumber)); } stopWatch.stop(); logger.info("Finish prosessing of reportStatus for schemaType:" + schemaTypeName + " with " + orgUnitsForBrodwsing.size() + " elements in " + stopWatch.getTotalTimeMillis() + " ms"); return reportStatusAsList.toArray(new ReportStatus[reportStatusAsList.size()]); } private ReportStatus createReportStatus(OrganisationUnitForBrowsing orgForBrowse, Report report, String finishFieldNumber) { if (report == null) { return new ReportStatusImpl(orgForBrowse); } ReportHelper reportHelper = new ReportHelper(report); Answer answer = reportHelper.getAnswerByFieldName(finishFieldNumber); if (answer == null) { return new ReportStatusImpl(orgForBrowse, REPORT_EXIST); } String reportFinishAnswer = answer.getValue(); if (reportFinishAnswer == null) { return new ReportStatusImpl(orgForBrowse, REPORT_EXIST); } if (reportFinishAnswer.equals("true")) { return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_FINISH); } else { return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_NOT_FINISH); } } private ReportStatus[] getReportStatusBySchemaTypeAndYear(ReportStatus[] reportStatusSurvey, String schemaTypeName, int reportYear) { StopWatch stopWatch = new StopWatch(); Long orgUnitId; ReportStatus reportStatus; String reportFinish; Report report; ReportHelper reportHelper; Answer answer; String reportFinishAnswer; int numberOfReports = reportStatusSurvey.length; String finishFieldNumber = getFinishFieldNumberForSchemaTypeAndReportYear(schemaTypeName, reportYear); if (numberOfReports > 1) { logger.info("Start prosessing of reportStatus for schemaType:" + schemaTypeName + " with " + numberOfReports + " elements"); } stopWatch.start("getReportStatusBySchemaTypeAndYear"); for (int row = 0; row < reportStatusSurvey.length; row++) { reportStatus = reportStatusSurvey[row]; orgUnitId = reportStatus.getOrganisationUnitId(); StopWatch stopWatchForGetReport = new StopWatch(); stopWatchForGetReport.start("test"); report = service.getReport(orgUnitId.longValue(), schemaTypeName, reportYear, false); stopWatchForGetReport.stop(); logger.info("Getting report for organisationUnitId: '" + orgUnitId + "' and schemaType: " + schemaTypeName + " tok [" + stopWatchForGetReport.getTotalTimeMillis() + "] ms"); if (report != null) { // reportStatus.setReport("Ja"); StopWatch stopWatchForCreatingReportHelper = new StopWatch(); stopWatchForCreatingReportHelper.start("ReportHelper"); reportHelper = new ReportHelper(report); answer = reportHelper.getAnswerByFieldName(finishFieldNumber); stopWatchForCreatingReportHelper.stop(); logger.info("Getting reportHelper and answer for organisationUnitId: '" + orgUnitId + "' and schemaType: " + schemaTypeName + " tok [" + stopWatchForCreatingReportHelper.getTotalTimeMillis() + "] ms"); if (answer != null) { reportFinishAnswer = answer.getValue(); if (reportFinishAnswer != null) { reportFinish = (reportFinishAnswer.equals("true") ? "Ja" : "Nei"); // reportStatus.setReportFinish(reportFinish); } } } if (((row + 1) % 100) == 0) { logger.info("Has processed reportStatus " + (row + 1) + " of " + numberOfReports + " for schemaType:" + schemaTypeName); } } stopWatch.stop(); if (numberOfReports > 1) { logger.info("Finish prosessing of reportStatus for schemaType:" + schemaTypeName + " with " + numberOfReports + " elements in " + stopWatch.getTotalTimeMillis() + " ms"); } return reportStatusSurvey; } public SchemaList getJasperReportDataForSchemaTypeAndYear(SchemaList jasperReportDataSource, String schemaTypeName, int year) { HashMap report; int numberOfReports = jasperReportDataSource.size(); ProgressStatistics ps = new ProgressStatistics(numberOfReports, schemaTypeName); Iterator iterator = jasperReportDataSource.iterator(); while (iterator.hasNext()) { report = (HashMap) iterator.next(); fillInReportValues(report, schemaTypeName, year); ps.increaseCountAndDumpStatus(); } if (numberOfReports > 1) { ps.dumpStatus(true); } return jasperReportDataSource; } protected SchemaList getReportDataBySchemaTypeAndYear(SortedSet<OrgUnitReport> orgSortedSet, String schemaTypeName, int year) { Assert.checkRequiredArgument("orgSortedSet", orgSortedSet); Assert.checkRequiredArgument("schemaTypeName", schemaTypeName); Assert.checkRequiredArgument("year", year); int numberOfReports = orgSortedSet.size(); SchemaList schemaList = new SchemaList(numberOfReports); ProgressStatistics ps = new ProgressStatistics(numberOfReports); for (OrgUnitReport orgUnitReport : orgSortedSet) { Map<String, Object> report = orgUnitReport.createReport(); fillInReportValues(report, schemaTypeName, year); schemaList.add(report); ps.increaseCountAndDumpStatus(); } ps.dumpStatus(true); return schemaList; } public SchemaList getCommentReportAndLastYearForSchemaTypeAndYear(SchemaList jasperReportDataSource, String schemaTypeName, int year) { HashMap report; int numberOfReports = jasperReportDataSource.size(); ProgressStatistics ps = new ProgressStatistics(numberOfReports); Iterator iterator = jasperReportDataSource.iterator(); while (iterator.hasNext()) { report = (HashMap) iterator.next(); fillInCommentReportAndLastYear(report, schemaTypeName, year); ps.increaseCountAndDumpStatus(); } ps.dumpStatus(true); return jasperReportDataSource; } public SchemaList getCommentReportAndLastYearForSchemaTypeAndYear( SortedSet<SimpleOrgUnitReport> simpleOrgSortedSet, String schemaTypeName, int year) { Assert.checkRequiredArgument("simpleOrgSortedSet", simpleOrgSortedSet); Assert.checkRequiredArgument("schemaTypeName", schemaTypeName); Assert.checkRequiredArgument("year", year); int numberOfReports = simpleOrgSortedSet.size(); SchemaList schemaList = new SchemaList(numberOfReports); ProgressStatistics ps = new ProgressStatistics(numberOfReports); for (SimpleOrgUnitReport simpleOrgUnitReport : simpleOrgSortedSet) { Map<String, Object> report = fillInCommentReportAndLastYear(simpleOrgUnitReport, schemaTypeName, year); schemaList.add(report); ps.increaseCountAndDumpStatus(); } ps.dumpStatus(true); return schemaList; } private Map<String, Object> fillInReportValues(Map<String, Object> jasperRow, String schemaType, int year) { if (logger.isDebugEnabled()) { logger.debug("Executing fillInValues"); } timeStampReport(jasperRow); if (logger.isDebugEnabled()) { logger.debug("[SchemaType]: " + schemaType + " year " + year); } if (schemaType.equals(SchemaTypeNameConst.FOLKEBIBLIOTEK_SHORT_NAME)) { if (year >= 2004 && year <= 2006) { return fillInFolkeBibValues(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2007) { return fillInFolkeBibValues2007(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2008) { return fillInFolkeBibValues2008(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2009) { return fillInFolkeBibValues2009(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else { logger.warn("[fillInReportValues] Unsupported combination of SchemaType: [" + schemaType + "] and year: [" + year + "]"); } } else if (schemaType.equals(SchemaTypeNameConst.FAGBIBLIOTEK_SHORT_NAME)) { if (year >= 2004 && year <= 2007) { return fillInFagBibValues(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2008) { return fillInFagBibValues2008(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2009) { return fillInFagBibValues2009(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else { logger.warn("[fillInReportValues] Unsupported combination of SchemaType: [" + schemaType + "] and year: [" + year + "]"); } } else if (schemaType.equals(SchemaTypeNameConst.MUSEUMS_SHORT_NAME)) { if (year == 2004) { return fillInMuseumValues2004(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2005) { return fillInMuseumValues2005(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2006) { return fillInMuseumValues2006(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2007) { return fillInMuseumValues2007(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2008) { return fillInMuseumValues2008(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else if (year == 2009) { return fillInMuseumValues2009(jasperRow, getReportHelper(jasperRow, schemaType, year)); } else { logger.warn("[fillInReportValues] Unsupported combination of SchemaType: [" + schemaType + "] and year: [" + year + "]"); } } else { logger.warn("[fillInReportValues] Unsupported combination of SchemaType: [" + schemaType + "] and year: [" + year + "]"); } return jasperRow; } private Map<String, Object> fillInCommentReportAndLastYear(Map<String, Object> jasperRow, String schemaType, int year) { if (logger.isDebugEnabled()) { logger.debug("Starting: fillInCommentReportAndLastYear"); } timeStampReport(jasperRow); if (schemaType.equals(SchemaTypeNameConst.FOLKEBIBLIOTEK_SHORT_NAME)) { return fillInFolkeBibCommentReportAndLastYearValues(jasperRow, getReportHelper(jasperRow, schemaType, year), getReportHelper(jasperRow, schemaType, year - 1)); } else if (schemaType.equals(SchemaTypeNameConst.FAGBIBLIOTEK_SHORT_NAME)) { return fillInFagBibCommentReportAndLastYearValues(jasperRow, getReportHelper(jasperRow, schemaType, year), getReportHelper(jasperRow, schemaType, year - 1)); } return jasperRow; } private Map<String, Object> fillInCommentReportAndLastYear(SimpleOrgUnitReport simpleOrgUnitReport, String schemaType, int year) { if (logger.isDebugEnabled()) { logger.debug("Starting: fillInCommentReportAndLastYear"); } Map<String, Object> jasperRow = simpleOrgUnitReport.createReport(); timeStampReport(jasperRow); Long organisationUnitId = simpleOrgUnitReport.getOrganisationUnitId(); ReportHelper reportHelper = getReportHelper(organisationUnitId, schemaType, year); ReportHelper reportHelperLastYear = getReportHelper(organisationUnitId, schemaType, year - 1); if (schemaType.equals(SchemaTypeNameConst.FOLKEBIBLIOTEK_SHORT_NAME)) { return fillInFolkeBibCommentReportAndLastYearValues(jasperRow, reportHelper, reportHelperLastYear); } else if (schemaType.equals(SchemaTypeNameConst.FAGBIBLIOTEK_SHORT_NAME)) { return fillInFagBibCommentReportAndLastYearValues(jasperRow, getReportHelper(jasperRow, schemaType, year), getReportHelper(jasperRow, schemaType, year - 1)); } return jasperRow; } private ReportHelper getReportHelper(Map<String, Object> jasperRow, String schemaTypeName, int year) { Report annualStatisticReport; ReportHelper reportHelper; Assert.assertTrue("Key organisationUnitId has to be in report map", jasperRow.containsKey("organisationUnitId")); Long organisationUnitId = (Long) jasperRow.get("organisationUnitId"); Assert.assertNotNull("Long: organisationUnitId can not be null", organisationUnitId); annualStatisticReport = service.getReport(organisationUnitId.longValue(), schemaTypeName, year, false); if (null == annualStatisticReport) { return null; } reportHelper = new ReportHelper(annualStatisticReport); if (null == reportHelper) { return null; } return reportHelper; } private ReportHelper getReportHelper(Long organisationUnitId, String schemaTypeName, int year) { if (organisationUnitId == null) { return null; } Report annualStatisticReport = service.getReport(organisationUnitId.longValue(), schemaTypeName, year, false); if (null == annualStatisticReport) { return null; } ReportHelper reportHelper = new ReportHelper(annualStatisticReport); if (null == reportHelper) { return null; } return reportHelper; } private void timeStampReport(Map<String, Object> report) { DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, LocaleTypeNameConst.BOKMAAL); report.put("timestamp", dateFormat.format(new Date())); } private Map<String, Object> fillInFolkeBibValues(Map<String, Object> m, ReportHelper reportHelper) { if (reportHelper == null) { return m; } integerFromReportHelperToJasperReport(m, reportHelper, 13, 86); trueFalseFromReportHelperToJasperReport(m, reportHelper, 87, 87); integerFromReportHelperToJasperReport(m, reportHelper, 88, 102); floatFromReportHelperToJasperReport(m, reportHelper, 103, 104); integerFromReportHelperToJasperReport(m, reportHelper, 105, 105); floatFromReportHelperToJasperReport(m, reportHelper, 106, 107); integerFromReportHelperToJasperReport(m, reportHelper, 108, 108); floatFromReportHelperToJasperReport(m, reportHelper, 109, 110); integerFromReportHelperToJasperReport(m, reportHelper, 111, 111); floatFromReportHelperToJasperReport(m, reportHelper, 112, 113); integerFromReportHelperToJasperReport(m, reportHelper, 114, 114); floatFromReportHelperToJasperReport(m, reportHelper, 115, 116); integerFromReportHelperToJasperReport(m, reportHelper, 117, 117); floatFromReportHelperToJasperReport(m, reportHelper, 118, 119); integerFromReportHelperToJasperReport(m, reportHelper, 120, 121); floatFromReportHelperToJasperReport(m, reportHelper, 122, 122); integerFromReportHelperToJasperReport(m, reportHelper, 123, 124); floatFromReportHelperToJasperReport(m, reportHelper, 125, 125); integerFromReportHelperToJasperReport(m, reportHelper, 126, 127); floatFromReportHelperToJasperReport(m, reportHelper, 128, 128); integerFromReportHelperToJasperReport(m, reportHelper, 129, 130); floatFromReportHelperToJasperReport(m, reportHelper, 131, 131); integerFromReportHelperToJasperReport(m, reportHelper, 132, 133); floatFromReportHelperToJasperReport(m, reportHelper, 134, 134); integerFromReportHelperToJasperReport(m, reportHelper, 135, 136); floatFromReportHelperToJasperReport(m, reportHelper, 137, 137); integerFromReportHelperToJasperReport(m, reportHelper, 138, 139); floatFromReportHelperToJasperReport(m, reportHelper, 140, 140); integerFromReportHelperToJasperReport(m, reportHelper, 141, 142); floatFromReportHelperToJasperReport(m, reportHelper, 143, 143); integerFromReportHelperToJasperReport(m, reportHelper, 144, 145); floatFromReportHelperToJasperReport(m, reportHelper, 146, 146); integerFromReportHelperToJasperReport(m, reportHelper, 147, 147); trueFalseFromReportHelperToJasperReport(m, reportHelper, 148, 148); integerFromReportHelperToJasperReport(m, reportHelper, 149, 149); trueFalseFromReportHelperToJasperReport(m, reportHelper, 150, 155); integerFromReportHelperToJasperReport(m, reportHelper, 156, 159); trueFalseFromReportHelperToJasperReport(m, reportHelper, 160, 160); stringFromReportHelperToJasperReport(m, reportHelper, 161, 161); trueFalseFromReportHelperToJasperReport(m, reportHelper, 162, 162); stringFromReportHelperToJasperReport(m, reportHelper, 163, 163); trueFalseFromReportHelperToJasperReport(m, reportHelper, 164, 164); integerFromReportHelperToJasperReport(m, reportHelper, 165, 169); stringFromReportHelperToJasperReport(m, reportHelper, 170, 170); integerFromReportHelperToJasperReport(m, reportHelper, 171, 171); stringFromReportHelperToJasperReport(m, reportHelper, 172, 172); integerFromReportHelperToJasperReport(m, reportHelper, 173, 174); stringFromReportHelperToJasperReport(m, reportHelper, 175, 175); integerFromReportHelperToJasperReport(m, reportHelper, 176, 179); stringFromReportHelperToJasperReport(m, reportHelper, 180, 181); trueFalseFromReportHelperToJasperReport(m, reportHelper, 182, 182); floatFromReportHelperToJasperReport(m, reportHelper, 183, 183); trueFalseFromReportHelperToJasperReport(m, reportHelper, 184, 185); floatFromReportHelperToJasperReport(m, reportHelper, 186, 187); integerFromReportHelperToJasperReport(m, reportHelper, 188, 188); trueFalseFromReportHelperToJasperReport(m, reportHelper, 189, 190); floatFromReportHelperToJasperReport(m, reportHelper, 191, 192); integerFromReportHelperToJasperReport(m, reportHelper, 193, 200); trueFalseFromReportHelperToJasperReport(m, reportHelper, 201, 201); skolebibliotekSkolensSamlingerFromReportHelperToJasperReport(m, reportHelper, 202, 204); integerFromReportHelperToJasperReport(m, reportHelper, 205, 225); trueFalseFromReportHelperToJasperReport(m, reportHelper, 226, 226); integerFromReportHelperToJasperReport(m, reportHelper, 227, 227); trueFalseFromReportHelperToJasperReport(m, reportHelper, 228, 229); integerFromReportHelperToJasperReport(m, reportHelper, 230, 257); trueFalseFromReportHelperToJasperReport(m, reportHelper, 258, 258); trueFalseFromReportHelperToJasperReport(m, reportHelper, 259, 265); stringFromReportHelperToJasperReport(m, reportHelper, 266, 266); integerFromReportHelperToJasperReport(m, reportHelper, 267, 364); stringFromReportHelperToJasperReport(m, reportHelper, 365, 365); trueFalseFromReportHelperToJasperReport(m, reportHelper, 366, 366); integerFromReportHelperToJasperReport(m, reportHelper, 367, 371); trueFalseFromReportHelperToJasperReport(m, reportHelper, 372, 372); integerFromReportHelperToJasperReport(m, reportHelper, 373, 375); floatFromReportHelperToJasperReport(m, reportHelper, 376, 376); trueFalseFromReportHelperToJasperReport(m, reportHelper, 377, 380); stringFromReportHelperToJasperReport(m, reportHelper, 381, 381); trueFalseFromReportHelperToJasperReport(m, reportHelper, 382, 383); integerFromReportHelperToJasperReport(m, reportHelper, 384, 384); return m; } private Map<String, Object> fillInFolkeBibValues2009(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInFolkeBibValues2009"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInFolkeBibValues2008(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 486, 486); return m; } private Map<String, Object> fillInFolkeBibValues2008(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInFolkeBibValues2008"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInFolkeBibValues2007(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 410, 429); trueFalseFromReportHelperToJasperReport(m, reportHelper, 430, 430); integerFromReportHelperToJasperReport(m, reportHelper, 431, 483); trueFalseFromReportHelperToJasperReport(m, reportHelper, 484, 484); integerFromReportHelperToJasperReport(m, reportHelper, 485, 485); return m; } private Map<String, Object> fillInFolkeBibValues2007(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInFolkeBibValues2007"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInFolkeBibValues(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 385, 390); trueFalseFromReportHelperToJasperReport(m, reportHelper, 391, 391); integerFromReportHelperToJasperReport(m, reportHelper, 392, 394); floatFromReportHelperToJasperReport(m, reportHelper, 395, 396); trueFalseFromReportHelperToJasperReport(m, reportHelper, 397, 397); integerFromReportHelperToJasperReport(m, reportHelper, 398, 404); trueFalseFromReportHelperToJasperReport(m, reportHelper, 405, 408); stringFromReportHelperToJasperReport(m, reportHelper, 409, 409); return m; } private Map<String, Object> fillInFolkeBibCommentReportAndLastYearValues(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear) { if ((reportHelper == null) && (reportHelperLastYear == null)) { return m; } integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 13, 86); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 87, 87); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 88, 102); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 103, 104); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 105, 105); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 106, 107); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 108, 108); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 109, 110); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 111, 111); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 112, 113); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 114, 114); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 115, 116); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 117, 117); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 118, 119); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 120, 121); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 122, 122); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 123, 124); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 125, 125); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 126, 127); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 128, 128); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 129, 130); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 131, 131); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 132, 133); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 134, 134); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 135, 136); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 137, 137); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 138, 139); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 140, 140); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 141, 142); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 143, 143); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 144, 145); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 146, 146); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 147, 147); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 148, 148); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 149, 149); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 150, 155); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 156, 159); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 160, 160); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 161, 161); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 162, 162); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 163, 163); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 164, 164); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 165, 169); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 170, 170); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 171, 171); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 172, 172); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 173, 174); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 175, 175); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 176, 179); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 180, 181); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 182, 182); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 183, 183); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 184, 185); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 186, 187); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 188, 188); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 189, 190); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 191, 192); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 193, 200); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 201, 201); skolebibliotekSkolensSamlingerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 202, 204); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 205, 225); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 226, 226); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 227, 227); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 228, 229); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 230, 257); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 258, 258); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 259, 265); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 266, 266); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 267, 364); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 365, 365); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 366, 366); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 367, 371); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 372, 372); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 373, 375); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 376, 376); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 377, 380); stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 381, 381); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 382, 383); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 384, 384); return m; } private Map<String, Object> fillInFagBibValues2009(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Executing fillInFagBibValues2009"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInFagBibValues2008(inMap, reportHelper); yesNoPartlyFromReportHelperToJasperReport(m, reportHelper, 155, 155); return m; } private Map<String, Object> fillInFagBibValues2008(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInFagBibValues2008"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInFagBibValues(inMap, reportHelper); trueFalseFromReportHelperToJasperReport(m, reportHelper, 149, 149); integerFromReportHelperToJasperReport(m, reportHelper, 150, 153); trueFalseFromReportHelperToJasperReport(m, reportHelper, 154, 154); return m; } private Map<String, Object> fillInFagBibValues(Map<String, Object> m, ReportHelper reportHelper) { if (reportHelper == null) { return m; } integerFromReportHelperToJasperReport(m, reportHelper, 2, 58); // Field 59, 60 and 61 is sum field integerFromReportHelperToJasperReport(m, reportHelper, 62, 113); floatFromReportHelperToJasperReport(m, reportHelper, 114, 116); // problem with number 116 should have been integer integerFromReportHelperToJasperReport(m, reportHelper, 117, 122); floatFromReportHelperToJasperReport(m, reportHelper, 123, 126); integerFromReportHelperToJasperReport(m, reportHelper, 127, 135); // Field 136 is sum field integerFromReportHelperToJasperReport(m, reportHelper, 137, 140); // Field 141 is sum field integerFromReportHelperToJasperReport(m, reportHelper, 142, 145); // Field 146 is sum field stringFromReportHelperToJasperReport(m, reportHelper, 147, 147); trueFalseFromReportHelperToJasperReport(m, reportHelper, 148, 148); return m; } private Map<String, Object> fillInFagBibCommentReportAndLastYearValues(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear) { if ((reportHelper == null) && (reportHelperLastYear == null)) { return m; } integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 2, 58); // Field 59, 60 and 61 is sum field integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 62, 113); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 114, 116); // problem with number 116 should have been integer integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 117, 122); floatFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 123, 126); integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 127, 135); // Field 136 is sum field integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 137, 140); // Field 141 is sum field integerFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 142, 145); // Field 146 is sum field stringFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 147, 147); trueFalseFromReportHelpersToCommentReport(m, reportHelper, reportHelperLastYear, 148, 148); return m; } private Map<String, Object> fillInMuseumValues2004(Map<String, Object> m, ReportHelper reportHelper) { if (reportHelper == null) { return m; } trueFalseFromReportHelperToJasperReport(m, reportHelper, 21, 21); trueFalseFromReportHelperToJasperReport(m, reportHelper, 41, 47); integerFromReportHelperToJasperReport(m, reportHelper, 48, 52); trueFalseFromReportHelperToJasperReport(m, reportHelper, 53, 53); integerFromReportHelperToJasperReport(m, reportHelper, 55, 88); trueFalseFromReportHelperToJasperReport(m, reportHelper, 89, 89); integerFromReportHelperToJasperReport(m, reportHelper, 91, 92); trueFalseFromReportHelperToJasperReport(m, reportHelper, 93, 93); trueFalseFromReportHelperToJasperReport(m, reportHelper, 95, 98); trueFalseFromReportHelperToJasperReport(m, reportHelper, 100, 100); trueFalseFromReportHelperToJasperReport(m, reportHelper, 102, 102); integerFromReportHelperToJasperReport(m, reportHelper, 104, 105); stringFromReportHelperToJasperReport(m, reportHelper, 106, 106); yesNoPartlyFromReportHelperToJasperReport(m, reportHelper, 107, 107); trueFalseFromReportHelperToJasperReport(m, reportHelper, 110, 110); floatFromReportHelperToJasperReport(m, reportHelper, 112, 113); trueFalseFromReportHelperToJasperReport(m, reportHelper, 114, 114); integerFromReportHelperToJasperReport(m, reportHelper, 116, 117); integerFromReportHelperToJasperReport(m, reportHelper, 119, 120); integerFromReportHelperToJasperReport(m, reportHelper, 123, 123); trueFalseFromReportHelperToJasperReport(m, reportHelper, 124, 127); trueFalseFromReportHelperToJasperReport(m, reportHelper, 128, 128); integerFromReportHelperToJasperReport(m, reportHelper, 130, 136); integerFromReportHelperToJasperReport(m, reportHelper, 138, 139); integerFromReportHelperToJasperReport(m, reportHelper, 141, 141); yesNoPartlyFromReportHelperToJasperReport(m, reportHelper, 142, 142); trueFalseFromReportHelperToJasperReport(m, reportHelper, 145, 145); trueFalseFromReportHelperToJasperReport(m, reportHelper, 147, 147); integerFromReportHelperToJasperReport(m, reportHelper, 149, 151); floatFromReportHelperToJasperReport(m, reportHelper, 152, 155); floatFromReportHelperToJasperReport(m, reportHelper, 157, 157); floatFromReportHelperToJasperReport(m, reportHelper, 159, 159); floatFromReportHelperToJasperReport(m, reportHelper, 160, 160); trueFalseFromReportHelperToJasperReport(m, reportHelper, 161, 161); trueFalseFromReportHelperToJasperReport(m, reportHelper, 163, 163); trueFalseFromReportHelperToJasperReport(m, reportHelper, 165, 165); trueFalseFromReportHelperToJasperReport(m, reportHelper, 167, 167); trueFalseFromReportHelperToJasperReport(m, reportHelper, 169, 169); trueFalseFromReportHelperToJasperReport(m, reportHelper, 171, 171); trueFalseFromReportHelperToJasperReport(m, reportHelper, 173, 173); integerFromReportHelperToJasperReport(m, reportHelper, 175, 175); trueFalseFromReportHelperToJasperReport(m, reportHelper, 176, 176); trueFalseFromReportHelperToJasperReport(m, reportHelper, 178, 178); trueFalseFromReportHelperToJasperReport(m, reportHelper, 180, 180); trueFalseFromReportHelperToJasperReport(m, reportHelper, 182, 182); integerFromReportHelperToJasperReport(m, reportHelper, 184, 186); integerFromReportHelperToJasperReport(m, reportHelper, 188, 191); integerFromReportHelperToJasperReport(m, reportHelper, 193, 194); integerFromReportHelperToJasperReport(m, reportHelper, 196, 196); integerFromReportHelperToJasperReport(m, reportHelper, 198, 205); integerFromReportHelperToJasperReport(m, reportHelper, 208, 211); integerFromReportHelperToJasperReport(m, reportHelper, 214, 215); integerFromReportHelperToJasperReport(m, reportHelper, 217, 218); stringFromReportHelperToJasperReport(m, reportHelper, 220, 220); trueFalseFromReportHelperToJasperReport(m, reportHelper, 221, 221); integerFromReportHelperToJasperReport(m, reportHelper, 224, 224); floatFromReportHelperToJasperReport(m, reportHelper, 225, 225); stringFromReportHelperToJasperReport(m, reportHelper, 227, 227); return m; } private Map<String, Object> fillInMuseumValues2005(Map<String, Object> m, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInMuseumValues2005"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return m; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } trueFalseFromReportHelperToJasperReport(m, reportHelper, 21, 21); museumOrganisationFromReportHelperToJasperReport(m, reportHelper, 26, 26); museumHovedomraadeFromReportHelperToJasperReport(m, reportHelper, 37, 37); trueFalseFromReportHelperToJasperReport(m, reportHelper, 41, 47); integerFromReportHelperToJasperReport(m, reportHelper, 48, 52); trueFalseFromReportHelperToJasperReport(m, reportHelper, 53, 53); integerFromReportHelperToJasperReport(m, reportHelper, 55, 88); trueFalseFromReportHelperToJasperReport(m, reportHelper, 89, 89); integerFromReportHelperToJasperReport(m, reportHelper, 91, 92); trueFalseFromReportHelperToJasperReport(m, reportHelper, 98, 98); trueFalseFromReportHelperToJasperReport(m, reportHelper, 100, 100); trueFalseFromReportHelperToJasperReport(m, reportHelper, 102, 102); integerFromReportHelperToJasperReport(m, reportHelper, 104, 105); stringFromReportHelperToJasperReport(m, reportHelper, 106, 106); yesNoPartlyFromReportHelperToJasperReport(m, reportHelper, 107, 107); trueFalseFromReportHelperToJasperReport(m, reportHelper, 110, 110); floatFromReportHelperToJasperReport(m, reportHelper, 112, 113); trueFalseFromReportHelperToJasperReport(m, reportHelper, 114, 114); integerFromReportHelperToJasperReport(m, reportHelper, 116, 117); integerFromReportHelperToJasperReport(m, reportHelper, 119, 120); integerFromReportHelperToJasperReport(m, reportHelper, 123, 123); trueFalseFromReportHelperToJasperReport(m, reportHelper, 124, 127); trueFalseFromReportHelperToJasperReport(m, reportHelper, 128, 128); integerFromReportHelperToJasperReport(m, reportHelper, 130, 136); integerFromReportHelperToJasperReport(m, reportHelper, 138, 139); integerFromReportHelperToJasperReport(m, reportHelper, 141, 141); yesNoPartlyFromReportHelperToJasperReport(m, reportHelper, 142, 142); trueFalseFromReportHelperToJasperReport(m, reportHelper, 145, 145); trueFalseFromReportHelperToJasperReport(m, reportHelper, 147, 147); integerFromReportHelperToJasperReport(m, reportHelper, 149, 151); floatFromReportHelperToJasperReport(m, reportHelper, 152, 155); floatFromReportHelperToJasperReport(m, reportHelper, 157, 157); floatFromReportHelperToJasperReport(m, reportHelper, 159, 159); floatFromReportHelperToJasperReport(m, reportHelper, 160, 160); trueFalseFromReportHelperToJasperReport(m, reportHelper, 161, 161); trueFalseFromReportHelperToJasperReport(m, reportHelper, 163, 163); trueFalseFromReportHelperToJasperReport(m, reportHelper, 165, 165); trueFalseFromReportHelperToJasperReport(m, reportHelper, 167, 167); trueFalseFromReportHelperToJasperReport(m, reportHelper, 169, 169); trueFalseFromReportHelperToJasperReport(m, reportHelper, 171, 171); trueFalseFromReportHelperToJasperReport(m, reportHelper, 173, 173); integerFromReportHelperToJasperReport(m, reportHelper, 175, 175); trueFalseFromReportHelperToJasperReport(m, reportHelper, 176, 176); trueFalseFromReportHelperToJasperReport(m, reportHelper, 178, 178); trueFalseFromReportHelperToJasperReport(m, reportHelper, 180, 180); trueFalseFromReportHelperToJasperReport(m, reportHelper, 182, 182); integerFromReportHelperToJasperReport(m, reportHelper, 184, 186); integerFromReportHelperToJasperReport(m, reportHelper, 188, 191); integerFromReportHelperToJasperReport(m, reportHelper, 193, 194); integerFromReportHelperToJasperReport(m, reportHelper, 198, 205); integerFromReportHelperToJasperReport(m, reportHelper, 208, 209); integerFromReportHelperToJasperReport(m, reportHelper, 214, 215); integerFromReportHelperToJasperReport(m, reportHelper, 217, 218); stringFromReportHelperToJasperReport(m, reportHelper, 220, 220); trueFalseFromReportHelperToJasperReport(m, reportHelper, 221, 221); integerFromReportHelperToJasperReport(m, reportHelper, 224, 224); floatFromReportHelperToJasperReport(m, reportHelper, 225, 225); stringFromReportHelperToJasperReport(m, reportHelper, 227, 227); integerFromReportHelperToJasperReport(m, reportHelper, 228, 234); floatFromReportHelperToJasperReport(m, reportHelper, 235, 239); integerFromReportHelperToJasperReport(m, reportHelper, 240, 244); return m; } private Map<String, Object> fillInMuseumValues2006(Map<String, Object> inMap, ReportHelper reportHelper) { if (logger.isDebugEnabled()) { logger.debug("Starting fillInMuseumValues2006"); } if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInMuseumValues2005(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 245, 245); floatFromReportHelperToJasperReport(m, reportHelper, 246, 253); integerFromReportHelperToJasperReport(m, reportHelper, 254, 265); return m; } private Map<String, Object> fillInMuseumValues2007(Map<String, Object> inMap, ReportHelper reportHelper) { logger.debug("Starting fillInMuseumValues2006"); if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInMuseumValues2006(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 266, 272); trueFalseFromReportHelperToJasperReport(m, reportHelper, 273, 276); integerFromReportHelperToJasperReport(m, reportHelper, 277, 280); return m; } private Map<String, Object> fillInMuseumValues2009(Map<String, Object> inMap, ReportHelper reportHelper) { logger.debug("Starting fillInMuseumValues2008"); if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInMuseumValues2008(inMap, reportHelper); integerFromReportHelperToJasperReport(m, reportHelper, 303, 313); return m; } private Map<String, Object> fillInMuseumValues2008(Map<String, Object> inMap, ReportHelper reportHelper) { logger.debug("Starting fillInMuseumValues2008"); if (reportHelper == null) { if (logger.isDebugEnabled()) { logger.debug("reportHelper == null"); } return inMap; } if (logger.isDebugEnabled()) { logger.debug("reportHelper != null"); } Map<String, Object> m = fillInMuseumValues2007(inMap, reportHelper); trueFalseFromReportHelperToJasperReport(m, reportHelper, 281, 285); floatFromReportHelperToJasperReport(m, reportHelper, 286, 295); trueFalseFromReportHelperToJasperReport(m, reportHelper, 296, 296); integerFromReportHelperToJasperReport(m, reportHelper, 297, 301); museumOrganisationFromReportHelperToJasperReport(m, reportHelper, 302, 302); return m; } protected void floatFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { String fieldName; Answer answer; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); // logger.debug("floatFromReportHelperToJasperReport: fieldName= " + fieldName); floatToMap(m, answer, fieldName); } } private void floatFromReportHelpersToCommentReport(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear, int startIndex, int stopIndex) { String fieldName; Answer answer; if (reportHelper != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); // logger.debug("floatFromReportHelperToJasperReport: fieldName= " + fieldName); answer = reportHelper.getAnswerByFieldName(fieldName); floatToMap(m, answer, fieldName); commentToMap(m, answer, fieldName); } } if (reportHelperLastYear != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelperLastYear.getAnswerByFieldName(fieldName); floatToMap(m, answer, fieldName + LASTYEAR_POSTFIX); } } } private void integerFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { String fieldName; Answer answer; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); // logger.debug("integerFromReportHelperToJasperReport: fieldName= " + fieldName); integerToMap(m, answer, fieldName); } } private void integerFromReportHelpersToCommentReport(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear, int startIndex, int stopIndex) { String fieldName; Answer answer; if (reportHelper != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); // logger.debug("integerFromReportHelpersToCommentReport: fieldName= " + fieldName); answer = reportHelper.getAnswerByFieldName(fieldName); integerToMap(m, answer, fieldName); commentToMap(m, answer, fieldName); } } if (reportHelperLastYear != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelperLastYear.getAnswerByFieldName(fieldName); integerToMap(m, answer, fieldName + LASTYEAR_POSTFIX); } } } private void floatToMap(Map<String, Object> m, Answer answer, String key) { String answerFloatValue; String newAnswerFloatValue; if (answer != null) { answerFloatValue = answer.getValue(); if (answerFloatValue != null && answerFloatValue.length() > 0) { newAnswerFloatValue = answerFloatValue.replace(',', '.'); m.put(key, new Float(newAnswerFloatValue)); } } } private void integerToMap(Map<String, Object> m, Answer answer, String key) { String answerIntValue; if (answer != null) { answerIntValue = answer.getValue(); if ((answerIntValue != null) && (answerIntValue.length() > 0)) { m.put(key, new Integer(answerIntValue)); } } } private void stringToMap(Map<String, Object> m, Answer answer, String key) { String answerStringValue; if (answer != null) { answerStringValue = answer.getValue(); // logger.debug("stringFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); if (answerStringValue != null && answerStringValue.length() > 0) { m.put(key, answerStringValue); } } } private void trueFalseToMap(Map<String, Object> m, Answer answer, String key) { String answerYesNoValue; if (answer != null) { answerYesNoValue = answer.getValue(); // logger.debug("trueFalseFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); if (answerYesNoValue != null && answerYesNoValue.length() > 0) { if (answerYesNoValue.equals("true")) { m.put(key, REPORT_ANSWER_JA); } else if (answerYesNoValue.equals("false")) { m.put(key, REPORT_ANSWER_NEI); } } } } private void commentToMap(Map<String, Object> m, Answer answer, String fieldName) { String answerCommentValue; if (answer != null) { answerCommentValue = answer.getComment(); if ((answerCommentValue != null) && answerCommentValue.length() > 0) { m.put(fieldName + COMMENT_POSTFIX, answerCommentValue); } } } private void skolebibliotekSkolensSamlingerToMap(Map<String, Object> m, Answer answer, String key) { String skoleBibliotekSamlingerValue; if (answer != null) { skoleBibliotekSamlingerValue = answer.getValue(); if (logger.isDebugEnabled()) { logger.debug("skolebibliotekSkolensSamlingerFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); } if (skoleBibliotekSamlingerValue != null) { if (skoleBibliotekSamlingerValue.equals("")) { m.put(key, "Ikke angitt"); } else if (skoleBibliotekSamlingerValue.equals("A")) { m.put(key, "er inkludert"); } else if (skoleBibliotekSamlingerValue.equals("B")) { m.put(key, "er delvis inkludert"); } else if (skoleBibliotekSamlingerValue.equals("C")) { m.put(key, "er ikke inkludert"); } else if (skoleBibliotekSamlingerValue.equals("D")) { m.put(key, "finnes ikke p skolen"); } } } } protected void skolebibliotekSkolensSamlingerFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { /* screen.folkebib.grunnskole.frame20.line01.select00 = Ikke angitt screen.folkebib.grunnskole.frame20.line01.select01 = er inkludert screen.folkebib.grunnskole.frame20.line01.select02 = er delvis inkludert screen.folkebib.grunnskole.frame20.line01.select03 = er ikke inkludert screen.folkebib.grunnskole.frame20.line01.select04 = finnes ikke p skolen */ String fieldName; Answer answer; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); skolebibliotekSkolensSamlingerToMap(m, answer, fieldName); } } private void skolebibliotekSkolensSamlingerFromReportHelpersToCommentReport(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear, int startIndex, int stopIndex) { String fieldName; Answer answer; if (reportHelper != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); skolebibliotekSkolensSamlingerToMap(m, answer, fieldName); commentToMap(m, answer, fieldName); } } if (reportHelperLastYear != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelperLastYear.getAnswerByFieldName(fieldName); skolebibliotekSkolensSamlingerToMap(m, answer, fieldName + LASTYEAR_POSTFIX); } } } private void stringFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { String fieldName; Answer answer; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); stringToMap(m, answer, fieldName); } } private void stringFromReportHelpersToCommentReport(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear, int startIndex, int stopIndex) { String fieldName; Answer answer; if (reportHelper != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); stringToMap(m, answer, fieldName); commentToMap(m, answer, fieldName); } } if (reportHelperLastYear != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelperLastYear.getAnswerByFieldName(fieldName); stringToMap(m, answer, fieldName + LASTYEAR_POSTFIX); } } } private void trueFalseFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { String fieldName; Answer answer; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); trueFalseToMap(m, answer, fieldName); } } private void trueFalseFromReportHelpersToCommentReport(Map<String, Object> m, ReportHelper reportHelper, ReportHelper reportHelperLastYear, int startIndex, int stopIndex) { String fieldName; Answer answer; if (reportHelper != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); trueFalseToMap(m, answer, fieldName); commentToMap(m, answer, fieldName); } } if (reportHelperLastYear != null) { for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelperLastYear.getAnswerByFieldName(fieldName); trueFalseToMap(m, answer, fieldName + LASTYEAR_POSTFIX); } } } protected void yesNoPartlyFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { String fieldName; Answer answer; String answerYesNoPartlyValue; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); if (logger.isDebugEnabled()) { logger.debug("yesNoPartlyFromReportHelperToJasperReport: fieldName= " + fieldName); } if (answer != null) { answerYesNoPartlyValue = answer.getValue(); if (logger.isDebugEnabled()) { logger.debug("yesNoPartlyFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); } if (answerYesNoPartlyValue != null) { if (answerYesNoPartlyValue.equals("yes")) { m.put(fieldName, REPORT_ANSWER_JA); } else if (answerYesNoPartlyValue.equals("no")) { m.put(fieldName, REPORT_ANSWER_NEI); } else if (answerYesNoPartlyValue.equals("partly")) { m.put(fieldName, REPORT_ANSWER_PARTLY); } } } } } protected void museumOrganisationFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { /* screen.museum.museum.frame27.line01.select00 = Ikke angitt screen.museum.museum.frame27.line01.select01 = Forening/lag/innretning screen.museum.museum.frame27.line01.select02 = Stiftelse # Line 3 are old value for Samvirke/andelslag # Last used year 2003. screen.museum.museum.frame27.line01.select04 = Aksjeselskap screen.museum.museum.frame27.line01.select05 = Enkeltpersonsforetak screen.museum.museum.frame27.line01.select06 = Ansvarlig selskap screen.museum.museum.frame27.line01.select07 = Interkommunalt selskap screen.museum.museum.frame27.line01.select08 = BA - selskap med begrenset ansvar screen.museum.museum.frame27.line01.select09 = Kommunal verksomhet screen.museum.museum.frame27.line01.select10 = Fylkeskommunal virksomhet screen.museum.museum.frame27.line01.select11 = Statlig virksomhet screen.museum.museum.frame27.line01.select12 = Anna */ String fieldName; Answer answer; String museumOrganisationValue; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); if (logger.isDebugEnabled()) { logger.debug("museumOrganisationFromReportHelperToJasperReport: fieldName= " + fieldName); } if (answer != null) { museumOrganisationValue = answer.getValue(); if (logger.isDebugEnabled()) { logger.debug("museumOrganisationFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); } if (museumOrganisationValue != null) { if (StringUtil.isEmpty(museumOrganisationValue)) { m.put(fieldName, "Ikkje angitt"); } else if (museumOrganisationValue.equals("00")) { m.put(fieldName, "Ikkje angitt"); } else if (museumOrganisationValue.equals("01")) { m.put(fieldName, "Foreining/lag/innretning"); } else if (museumOrganisationValue.equals("02")) { m.put(fieldName, "Stifting"); } else if (museumOrganisationValue.equals("04")) { m.put(fieldName, "Aksjeselskap"); } else if (museumOrganisationValue.equals("05")) { m.put(fieldName, "Enkeltpersonsforetak"); } else if (museumOrganisationValue.equals("06")) { m.put(fieldName, "ANS Ansvarlig selskap"); } else if (museumOrganisationValue.equals("07")) { m.put(fieldName, "IKS interkommunalt selskap"); } else if (museumOrganisationValue.equals("08")) { m.put(fieldName, "BA selskap med begrensa ansvar"); } else if (museumOrganisationValue.equals("09")) { m.put(fieldName, "Kommunal verksemd"); } else if (museumOrganisationValue.equals("10")) { m.put(fieldName, "Fylkeskommunal verksemd"); } else if (museumOrganisationValue.equals("11")) { m.put(fieldName, "Statleg verksemd"); } else if (museumOrganisationValue.equals("12")) { m.put(fieldName, "Anna"); } } } } } protected void museumHovedomraadeFromReportHelperToJasperReport(Map<String, Object> m, ReportHelper reportHelper, int startIndex, int stopIndex) { /* screen.museum.museum.frame28.line01.select00 = Ikke angitt screen.museum.museum.frame28.line01.select01 = Kunst- og kunstindustri screen.museum.museum.frame28.line01.select02 = Kulturhistorisk screen.museum.museum.frame28.line01.select03 = Naturhistorisk screen.museum.museum.frame28.line01.select04 = Blandet kultur- og naturhistorisk screen.museum.museum.frame23.line01.select05 = Blandet kunst- og kulturhistorisk */ String fieldName; Answer answer; String museumOrganisationValue; for (int i = startIndex; i <= stopIndex; i++) { fieldName = intTo3DigitString(i); answer = reportHelper.getAnswerByFieldName(fieldName); if (logger.isDebugEnabled()) { logger.debug("museumHovedomraadeFromReportHelperToJasperReport: fieldName= " + fieldName); } if (answer != null) { museumOrganisationValue = answer.getValue(); if (logger.isDebugEnabled()) { logger.debug("museumHovedomraadeFromReportHelperToJasperReport: fieldNameValue= " + answer.getValue()); } if (museumOrganisationValue != null) { if (museumOrganisationValue.equals("")) { m.put(fieldName, "Ikke angitt"); } else if (museumOrganisationValue.equals("01")) { m.put(fieldName, "Kunst- og kunstindustri"); } else if (museumOrganisationValue.equals("02")) { m.put(fieldName, "Kulturhistorisk"); } else if (museumOrganisationValue.equals("03")) { m.put(fieldName, "Naturhistorisk"); } else if (museumOrganisationValue.equals("04")) { m.put(fieldName, "Blandet kultur- og naturhistorisk"); } else if (museumOrganisationValue.equals("05")) { m.put(fieldName, "Blandet kunst- og kulturhistorisk"); } } } } } private String intTo3DigitString(int intNumber) { String number = String.valueOf(intNumber); return (number.length() == 3 ? number : (number.length() == 2 ? "0" + number : "00" + number)); } private String getFinishFieldNumberForSchemaTypeAndReportYear(String schemaType, int reportYear) { // This is just for first year has to be improved for later year by using version if (schemaType.equals(SchemaTypeNameConst.FOLKEBIBLIOTEK_SHORT_NAME)) { return "382"; } else if (schemaType.equals(SchemaTypeNameConst.FAGBIBLIOTEK_SHORT_NAME)) { return "148"; } else if (schemaType.equals(SchemaTypeNameConst.MUSEUMS_SHORT_NAME)) { return "221"; } else { throw new IllegalArgumentException("Unknown schemaType '" + schemaType + "'"); } } }