This is an automated email from the git hooks/post-receive script. New commit to branch feature/1184_Lima_ne_demarre_pas in repository lima. See http://git.chorem.org/lima.git commit 13e23b46f856afb5ac22997a2933dd6d8cb2bb41 Author: dcosse <cosse@codelutin.com> Date: Mon Mar 2 17:40:51 2015 +0100 fixes #1184 Ajout de commentaires et d'un fichier non précédement commité --- .../chorem/lima/business/LimaServiceConfig.java | 90 +++++++++++++++++----- .../src/main/java/org/chorem/lima/LimaMain.java | 6 +- .../org/chorem/lima/web/action/ReportBuilder.java | 8 ++ .../chorem/lima/web/service/DocumentService.java | 13 +--- .../chorem/lima/web/service/HttpServerService.java | 5 +- 5 files changed, 86 insertions(+), 36 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java b/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java index dc06d48..b71cb65 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java @@ -28,6 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.business.accountingrules.FranceAccountingRules; +import org.chorem.lima.business.utils.DocumentReportTypes; import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaFlywayServiceImpl; import org.nuiton.config.ApplicationConfig; @@ -70,9 +71,6 @@ public class LimaServiceConfig { protected static volatile LimaServiceConfig instance; - //TODO Remove - protected final static String ROOT_PATH = new File("").getAbsolutePath(); - private LimaServiceConfig(String configFileName) { try { ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME); @@ -280,9 +278,62 @@ public class LimaServiceConfig { config.saveForUser(); } - public URL getBalanceDocumentReportModelUrl() { + public URL getReportModelUrl(DocumentReportTypes documentType) { + URL mainReportBuilderPath = null; + switch (documentType) { + case ACCOUNT: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.ACCOUNT_DOCUMENT_REPORT_MODEL_PATH.key); + break; + + case BALANCE: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.BALANCE_DOCUMENT_REPORT_MODEL_PATH.key); + break; + case BALANCE_MAIN_ACCOUNTS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.BALANCE_ACCOUNT_REPORT_MODEL_PATH.key); + break; + case BALANCE_SUB_ACCOUNTS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.BALANCE_SUB_ACCOUNT_REPORT_MODEL_PATH.key); + break; + + case ENTRY_BOOKS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH.key); + break; + case ENTRY_BOOKS_ENTRY_BOOKS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.ENTRY_BOOK_ENTRY_BOOK_REPORT_MODEL_PATH.key); + break; + case ENTRY_BOOKS_FINANCIAL_PERIODS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_MODEL_PATH.key); + break; + case ENTRY_BOOKS_TRANSACTION: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.ENTRY_BOOK_TRANSACTION_REPORT_MODEL_PATH.key); + break; + + case GENERAL_ENTRY_BOOK: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH.key); + break; + case GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOKS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_ENTRY_BOOK_REPORT_MODEL_PATH.key); + break; + case GENERAL_ENTRY_BOOK_ENTRIES: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_ENTRY_BOOK_ENTRY_REPORT_MODEL_PATH.key); + break; + + case LEDGER: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_LEDGER_DOCUMENT_REPORT_MODEL_PATH.key); + break; + case LEDGER_GENERAL_LEDGERS: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_LEDGER_MODEL_PATH.key); + break; + case LEDGER_ENTRIES: + mainReportBuilderPath = getReportModelUrl(ServiceConfigOption.GENERAL_LEDGER_ENTRY_MODEL_PATH.key); + break; + } + return mainReportBuilderPath; + } + + protected URL getReportModelUrl(String documentReportKey) { - String optionValue = config.getOption(ServiceConfigOption.BALANCE_DOCUMENT_REPORT_MODEL_PATH.getKey()); + String optionValue = config.getOption(documentReportKey); File file = new File(optionValue); URL result; @@ -297,7 +348,7 @@ public class LimaServiceConfig { } if (result == null) { - throw new LimaTechnicalException("Could not find balanceDocumentReportModelUrl from option: " + optionValue); + throw new LimaTechnicalException(String.format("Could not find option: %s", documentReportKey)); } return result; @@ -456,25 +507,24 @@ public class LimaServiceConfig { REPORTS_MODEL_DIR("lima.reports.dir",n("lima.config.reports.dir.description"),"${lima.data.dir}/reports", File.class, false, false), - //TODO - ACCOUNT_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.account.documentReportModelPath", n("lima.config.documentReport.account.documentReportModelPath.description"), ROOT_PATH +"/lima-web/src/main/jasperreports/accounts/DocumentReport.jrxml",String.class, false, false), + ACCOUNT_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.account.documentReportModelPath", n("lima.config.documentReport.account.documentReportModelPath.description"), "/jasperreports/accounts/DocumentReport.jrxml",String.class, false, false), BALANCE_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.balance.documentReportModelPath", n("lima.config.documentReport.balance.documentReportModelPath.description"), "/jasperreports/balance/DocumentReport.jrxml", String.class, false, false), - BALANCE_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceAccountReportModelPath", n("lima.config.documentReport.balance.balanceAccountReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml", String.class, false, false), - BALANCE_SUB_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceSubAccountReportModelPath", n("lima.config.documentReport.balance.balanceSubAccountReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml", String.class, false, false), + BALANCE_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceAccountReportModelPath", n("lima.config.documentReport.balance.balanceAccountReportModelPath.description"), "/jasperreports/balance/BalanceReportAccountReport.jrxml", String.class, false, false), + BALANCE_SUB_ACCOUNT_REPORT_MODEL_PATH("lima.config.documentReport.balance.balanceSubAccountReportModelPath", n("lima.config.documentReport.balance.balanceSubAccountReportModelPath.description"), "/jasperreports/balance/BalanceSubAccountsReport.jrxml", String.class, false, false), - GENERAL_ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.documentReportModelPath", n("lima.config.documentReport.generalEntrybook.documentReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/DocumentReport.jrxml", String.class, false, false), - GENERAL_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath", n("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml", String.class, false, false), - GENERAL_ENTRY_BOOK_ENTRY_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath", n("blima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml", String.class, false, false), + GENERAL_ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.documentReportModelPath", n("lima.config.documentReport.generalEntrybook.documentReportModelPath.description"), "/jasperreports/generalEntryBook/DocumentReport.jrxml", String.class, false, false), + GENERAL_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath", n("lima.config.documentReport.generalEntrybook.generalEntryBookModelPath.description"), "/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml", String.class, false, false), + GENERAL_ENTRY_BOOK_ENTRY_REPORT_MODEL_PATH("lima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath", n("blima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath.description"), "/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml", String.class, false, false), - ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.documentReportModelPath", n("lima.config.documentReport.entrybook.documentReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/entryBook/DocumentReport.jrxml", String.class, false, false), - ENTRY_BOOK_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.entryBookModelPath", n("lima.config.documentReport.entrybook.entryBookModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/entryBook/EntryBookReport.jrxml", String.class, false, false), - ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.financialPeriodModelPath", n("lima.config.documentReport.entrybook.financialPeriodModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/entryBook/FinancialPeriodReport.jrxml", String.class, false, false), - ENTRY_BOOK_TRANSACTION_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.transactionReportModelPath", n("lima.config.documentReport.entrybook.transactionReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/entryBook/TransactionReport.jrxml", String.class, false, false), + ENTRY_BOOK_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.documentReportModelPath", n("lima.config.documentReport.entrybook.documentReportModelPath.description"), "/jasperreports/entryBook/DocumentReport.jrxml", String.class, false, false), + ENTRY_BOOK_ENTRY_BOOK_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.entryBookModelPath", n("lima.config.documentReport.entrybook.entryBookModelPath.description"), "/jasperreports/entryBook/EntryBookReport.jrxml", String.class, false, false), + ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.financialPeriodModelPath", n("lima.config.documentReport.entrybook.financialPeriodModelPath.description"), "/jasperreports/entryBook/FinancialPeriodReport.jrxml", String.class, false, false), + ENTRY_BOOK_TRANSACTION_REPORT_MODEL_PATH("lima.config.documentReport.entrybook.transactionReportModelPath", n("lima.config.documentReport.entrybook.transactionReportModelPath.description"), "/jasperreports/entryBook/TransactionReport.jrxml", String.class, false, false), - GENERAL_LEDGER_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalLedger.documentReportModelPath", n("lima.config.documentReport.generalLedger.documentReportModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalLedger/DocumentReport.jrxml", String.class, false, false), - GENERAL_LEDGER_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerModelPath", n("lima.config.documentReport.generalLedger.generalLedgerModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalLedger/GeneralLedgerReport.jrxml", String.class, false, false), - GENERAL_LEDGER_ENTRY_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath", n("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description"), ROOT_PATH + "/lima-web/src/main/jasperreports/generalLedger/GeneralLedgerEntryReport.jrxml", String.class, false, false), + GENERAL_LEDGER_DOCUMENT_REPORT_MODEL_PATH("lima.config.documentReport.generalLedger.documentReportModelPath", n("lima.config.documentReport.generalLedger.documentReportModelPath.description"), "/jasperreports/generalLedger/DocumentReport.jrxml", String.class, false, false), + GENERAL_LEDGER_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerModelPath", n("lima.config.documentReport.generalLedger.generalLedgerModelPath.description"), "/jasperreports/generalLedger/GeneralLedgerReport.jrxml", String.class, false, false), + GENERAL_LEDGER_ENTRY_MODEL_PATH("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath", n("lima.config.documentReport.generalLedger.generalLedgerEntryModelPath.description"), "/jasperreports/generalLedger/GeneralLedgerEntryReport.jrxml", String.class, false, false), SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), CURRENCY("lima.config.currency", "", "false", Boolean.class, false, false), diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java index c926d07..42a1c2a 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java @@ -207,9 +207,9 @@ public class LimaMain { LimaSwingConfig swingConfig = LimaSwingConfig.getInstance(); // TODO DCossé 02/03/15 Ceci ne devrait pas être fait ainsi - // ici sont poussés côté service les chemins vers les fichier source JASPER nécessaires à la compilation des rapports - // la configuration est pourssé dans les service afin de pouvoir être récupérée par la partie web ! - // dans la partie web ce fait la création (graphique) des rapport à partir des données remontées par la partie service. + // ici sont poussés côté service les chemins vers les fichiers source JASPER nécessaires à la compilation des rapports + // la configuration est pourssée dans les service afin de pouvoir être récupérée par la partie web ! + // dans la partie web ce fait la création (graphique) des rapports à partir des données remontées par la partie service. serviceConfig.setBalanceDocumentReportModelPath(swingConfig.getBalanceDocumentReportModelPath()); serviceConfig.setReportsModelDir(swingConfig.getReportsDir().getAbsolutePath()); serviceConfig.setAccountReportModelPath(swingConfig.getAccountDocumentReportModelPath()); diff --git a/lima-web/src/main/java/org/chorem/lima/web/action/ReportBuilder.java b/lima-web/src/main/java/org/chorem/lima/web/action/ReportBuilder.java index 0777feb..2a2ee93 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/action/ReportBuilder.java +++ b/lima-web/src/main/java/org/chorem/lima/web/action/ReportBuilder.java @@ -48,6 +48,10 @@ import java.util.Map; /** * Created by davidcosse on 02/10/14. */ + +/** + * Class that contains all JasperReport + */ public class ReportBuilder { private static final Log log = LogFactory.getLog(ReportBuilder.class); @@ -71,6 +75,9 @@ public class ReportBuilder { protected Map<DocumentsEnum, JasperReport> reportsByDocumentType; + /** + * Compile all report + */ public ReportBuilder() { LimaServiceConfig config = LimaServiceConfig.getInstance(); @@ -113,6 +120,7 @@ public class ReportBuilder { return jasperReport; } + public void generatePDFReport(DocumentsEnum reportType, String path, List<DocumentReport> reports) { try { diff --git a/lima-web/src/main/java/org/chorem/lima/web/service/DocumentService.java b/lima-web/src/main/java/org/chorem/lima/web/service/DocumentService.java index 3f68e73..8899260 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/service/DocumentService.java +++ b/lima-web/src/main/java/org/chorem/lima/web/service/DocumentService.java @@ -540,40 +540,35 @@ public class DocumentService { } //############## balance ############## - - public DocumentReport createBalanceDocuments(Date beginDate, Date endDate, String fromToAccount) { + public void createBalanceDocuments(Date beginDate, Date endDate, String fromToAccount) { JasperReport balanceMainAccountsReport = reportBuilder.getBalanceManAccountsReport(); JasperReport balanceSubAccountsReport = reportBuilder.getBalanceSubAccountsReport(); DocumentReport report = balanceReportService.getBalanceDocumentReport(beginDate, endDate, fromToAccount, BigDecimalToString.getDecimalFormat(), balanceMainAccountsReport, balanceSubAccountsReport); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.BALANCE, BALANCE_FILE_PATH, Lists.newArrayList(report)); - return report; } //############## EntryBook ############# - public DocumentReport createEntryBooksDocuments(Date beginDate, Date endDate, List<String> entryBookCodes) { + public void createEntryBooksDocuments(Date beginDate, Date endDate, List<String> entryBookCodes) { JasperReport entryBookEntryBooksReport = reportBuilder.getEntryBookEntryBooksReport(); JasperReport entryBookFinancialPeriodsReport = reportBuilder.getEntryBookFinancialPeriodsReport(); JasperReport entryBookTransactionsReport = reportBuilder.getEntryBookTransactionsReport(); DocumentReport report = entryBookReportService.getEntryBookDocumentReport(beginDate, endDate, entryBookCodes, BigDecimalToString.getDecimalFormat(), entryBookEntryBooksReport, entryBookFinancialPeriodsReport, entryBookTransactionsReport); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.ENTRY_BOOKS, ENTRY_BOOKS_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); - return report; } //############## General EntryBook ############# - public DocumentReport createGeneralEntryBooksDocuments(Date beginDate, Date endDate) { + public void createGeneralEntryBooksDocuments(Date beginDate, Date endDate) { JasperReport generalEntryBookGeneralEntryBooksReport = reportBuilder.getGeneralEntryBookGeneralEntryBooksReport(); JasperReport generalEntryBookEntriesReport = reportBuilder.getGeneralEntryBookEntriesReport(); DocumentReport report = generalEntryBookReportService.getGeneralEntryBookDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat(), generalEntryBookGeneralEntryBooksReport, generalEntryBookEntriesReport); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.GENERAL_ENTRY_BOOK, GENERAL_ENTRY_BOOK_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); - return report; } //############## Ledger ############# - public DocumentReport createLedgerDocuments(Date beginDate, Date endDate) { + public void createLedgerDocuments(Date beginDate, Date endDate) { JasperReport generalLedgerGeneralLedgersReport = reportBuilder.getGeneralLedgerGeneralLedgersReport(); JasperReport generalLedgerEntriesReport = reportBuilder.getGeneralLedgerEntriesReport(); DocumentReport report = ledgerReportService.getLedgerDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat(), generalLedgerGeneralLedgersReport, generalLedgerEntriesReport); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.LEDGER, LEDGER_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); - return report; } } diff --git a/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java index afd40ce..e4831ac 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java +++ b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java @@ -138,11 +138,9 @@ public class HttpServerService { //get all params String imageParam = req.getParameter("img"); String model = req.getParameter("model"); - //String format = req.getParameter("format"); String beginDate = req.getParameter("beginDate"); String endDate = req.getParameter("endDate"); - String autocomplete = req.getParameter("autocomplete"); - String account = (StringUtils.isBlank(req.getParameter("account"))?null:URLDecoder.decode(req.getParameter("account"), "UTF-8")); + String account = (StringUtils.isBlank(req.getParameter("account")) ? null : URLDecoder.decode(req.getParameter("account"), "UTF-8")); //if image if (imageParam != null) { @@ -155,7 +153,6 @@ public class HttpServerService { } } else if (model != null && beginDate != null && endDate != null) { - //FormatsEnum formatsEnum = FormatsEnum.valueOfExtension(format); String accountReport = null; String financialReport = null; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.