Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
May 2010
- 2 participants
- 37 discussions
Author: jpepin
Date: 2010-05-31 19:46:38 +0200 (Mon, 31 May 2010)
New Revision: 2918
Url: http://chorem.org/repositories/revision/lima/2918
Log:
Modification ajout notation ejb, servicefactory
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/RecordServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.List;
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.Account;
/**
@@ -32,6 +34,8 @@
* Last update : $Date$
* By : $Author$
*/
+
+@Remote
public interface AccountService {
List<Account> getAllAccounts() throws LimaException;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,38 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+/**
+ * Account service.
+ *
+ * @author chatellier
+ * @version $Revision: 2917 $
+ *
+ * Last update : $Date: 2010-05-31 15:11:26 +0200 (lun. 31 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Local
+public interface AccountServiceLocal extends AccountService{
+
+
+}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -18,10 +18,15 @@
*/
package org.chorem.lima.business;
+import java.util.List;
+
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.nuiton.topia.TopiaContext;
@@ -32,8 +37,6 @@
*
*/
public interface AccountingRules {
-
- public void register(Class clazz, Object object);
/**
* Accounts rules
@@ -59,7 +62,7 @@
* @param transaction
* @throws LimaException
*/
- public void createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException;
+ public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException;
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException;
/**
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.List;
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.EntryBook;
/**
@@ -33,6 +35,7 @@
* By : $Author$
*/
+@Remote
public interface EntryBookService {
List<EntryBook> getAllEntryBooks() throws LimaException;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,38 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+
+/**
+ * Entry book service.
+ *
+ * @author chatellier
+ * @version $Revision: 2889 $
+ *
+ * Last update : $Date: 2010-05-10 15:13:56 +0200 (lun. 10 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Local
+public interface EntryBookServiceLocal extends EntryBookService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -22,6 +22,8 @@
import java.util.Date;
import java.util.List;
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
@@ -36,19 +38,19 @@
* Last update : $Date$
* By : $Author$
*/
+
+@Remote
public interface FinancialPeriodService {
List<FinancialPeriod> getAllFinancialPeriods() throws LimaException;
List<FinancialPeriod> getUnblockedFinancialPeriods() throws LimaException;
- void createFinancialPeriod(FinancialPeriod financialPeriod) throws LimaException;
+ void createFinancialPeriods(List<FinancialPeriod> financialPeriods) throws LimaException;
- void createFinancialPeriodWithTransaction(FinancialPeriod financialPeriod, TopiaContext topiaContext) throws LimaException;
-
+ void createFinancialPeriodsWithTransaction(List<FinancialPeriod> financialPeriods, TopiaContext topiaContext) throws LimaException;
FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException;
-
/** Methodes for closedperiodicentrybook */
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,38 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+
+/**
+ * Financial period service.
+ *
+ * @author chatellier
+ * @version $Revision: 2913 $
+ *
+ * Last update : $Date: 2010-05-27 16:36:34 +0200 (jeu. 27 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Local
+public interface FinancialPeriodServiceLocal extends FinancialPeriodService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.List;
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
@@ -36,6 +38,8 @@
* Last update : $Date$
* By : $Author$
*/
+
+@Remote
public interface FinancialTransactionService {
/**
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,37 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Remote;
+
+/**
+ * Transaction service.
+ *
+ * @author chatellier
+ * @version $Revision: 2917 $
+ *
+ * Last update : $Date: 2010-05-31 15:11:26 +0200 (lun. 31 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Remote
+public interface FinancialTransactionServiceLocal extends FinancialTransactionService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.List;
+import javax.ejb.Remote;
+
import org.chorem.lima.entity.FiscalPeriod;
/**
@@ -32,6 +34,7 @@
* Last update : $Date$
* By : $Author$
*/
+@Remote
public interface FiscalPeriodService {
List<FiscalPeriod> getAllFiscalPeriods() throws LimaException;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,37 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+import org.chorem.lima.entity.FiscalPeriod;
+
+/**
+ * Fiscal period service.
+ *
+ * @author chatellier
+ * @version $Revision: 2910 $
+ *
+ * Last update : $Date: 2010-05-26 20:37:42 +0200 (mer. 26 mai 2010) $
+ * By : $Author: jpepin $
+ */
+@Local
+public interface FiscalPeriodServiceLocal extends FiscalPeriodService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -19,6 +19,8 @@
package org.chorem.lima.business;
+import javax.ejb.Remote;
+
/**
* Import export service.
*
@@ -30,6 +32,7 @@
* Last update : $Date$
* By : $Author$
*/
+@Remote
public interface ImportExportService {
/**
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,38 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+/**
+ * Import export service.
+ *
+ * Currently import and export as XML.
+ *
+ * @author chatellier
+ * @version $Revision: 2824 $
+ *
+ * Last update : $Date: 2010-04-02 18:55:19 +0200 (ven. 02 avril 2010) $
+ * By : $Author: echatellier $
+ */
+@Local
+public interface ImportExportServiceLocal extends ImportExportService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -19,6 +19,8 @@
package org.chorem.lima.business;
+import javax.ejb.Remote;
+
/**
* Fiscal period service.
*
@@ -28,6 +30,8 @@
* Last update : $Date$
* By : $Author$
*/
+
+@Remote
public interface RecordService {
//List<FiscalPeriod> getAllFiscalPeriods() throws LimaException;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/RecordServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/RecordServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/RecordServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,37 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+/**
+ * Fiscal period service.
+ *
+ * @author chatellier
+ * @version $Revision: 2902 $
+ *
+ * Last update : $Date: 2010-05-19 18:38:02 +0200 (mer. 19 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Local
+public interface RecordServiceLocal extends RecordService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.Date;
+import javax.ejb.Remote;
+
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.entity.Account;
@@ -41,6 +43,8 @@
* Last update : $Date$
* By : $Author$
*/
+
+@Remote
public interface ReportService {
/**
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -0,0 +1,44 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+
+/**
+ * Service de generation des rapports.
+ *
+ * Actuellement:
+ * <ul>
+ * <li>Balance</li>
+ * <li>Bilan</li>
+ * </ul>
+ *
+ * @author chatellier
+ * @version $Revision: 2902 $
+ *
+ * Last update : $Date: 2010-05-19 18:38:02 +0200 (mer. 19 mai 2010) $
+ * By : $Author: jpepin $
+ */
+
+@Local
+public interface ReportServiceLocal extends ReportService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,10 +21,7 @@
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -33,7 +30,6 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ejb.AccountServiceImpl;
-import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.Entry;
@@ -42,7 +38,6 @@
import org.chorem.lima.entity.EntryDAO;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FinancialTransactionDAO;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
@@ -55,20 +50,13 @@
*
*/
public class DefaultAccountingRules implements AccountingRules {
-
- private Map<Class, Object> map;
-
+
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
+
+ //TODO make methode getClosedPeriodicEntryBook from financialperiodservice to DAO
+ FinancialPeriodService financialPeriodService;
- public DefaultAccountingRules() {
- map = new HashMap<Class, Object>();
- }
-
- public void register(Class clazz, Object object){
- map.put(clazz, object);
- }
-
/**
* Rules to check before create accounts
*/
@@ -103,12 +91,13 @@
* Rules to check before create fiscals periods
*/
@Override
- public void createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
+ public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
//check if the enddate period is after the begindate period
if (fiscalPeriod.getEndDate().before(fiscalPeriod.getBeginDate())){
throw new LimaBusinessException(
"The enddate is before the begindate");
}
+ return null;
}
/**
@@ -126,12 +115,6 @@
throw new LimaBusinessException("1 - Can't update entry : The financial period is blocked");
}
try {
- //Get finacialperiodservice
- FinancialPeriodService financialPeriodService =
- (FinancialPeriodService) map.get(FinancialPeriodService.class);
- if (financialPeriodService == null){
- financialPeriodService = new FinancialPeriodServiceImpl();
- }
FinancialPeriod financialPeriod =
entry.getFinancialTransaction().getFinancialPeriod();
@@ -227,12 +210,6 @@
FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
for (EntryBook entryBook : entryBooks) {
- FinancialPeriodService financialPeriodService =
- (FinancialPeriodService) map.get(FinancialPeriodService.class);
- if (financialPeriodService == null){
- financialPeriodService = new FinancialPeriodServiceImpl();
- }
-
if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){
closedEntryBooks.add(entryBook);
}
@@ -321,12 +298,6 @@
FinancialPeriod oldFinancialPeriod = financialTransactionOld.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
for (EntryBook entryBook : entryBooks) {
- FinancialPeriodService financialPeriodService =
- (FinancialPeriodService) map.get(FinancialPeriodService.class);
- if (financialPeriodService == null){
- financialPeriodService = new FinancialPeriodServiceImpl();
- }
-
if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){
closedEntryBooks.add(entryBook);
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -1,32 +1,22 @@
package org.chorem.lima.business.accountingrules;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
-import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FinancialPeriodDAO;
import org.chorem.lima.entity.FinancialPeriodImpl;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FinancialTransactionDAO;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
@@ -39,18 +29,7 @@
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
- private TopiaContext rootContext;
- private Map<Class, Object> map;
-
- public FranceAccountingRules() {
- map = new HashMap<Class, Object>();
- }
-
- public void register(Class clazz, Object object){
- map.put(clazz, object);
- }
-
/**
* Règles de vérification de la création du PCG, appliquées à la comptabilité française
*
@@ -96,8 +75,9 @@
* Pas plus de deux exercices fiscaux ne peuvent-être ouvert en même temps
*
*/
- public void createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
+ public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
super.createFiscalPeriodRules(fiscalPeriod, transaction);
+ List<FinancialPeriod> financialPeriods = new ArrayList<FinancialPeriod>();
try {
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -130,11 +110,6 @@
}
}
- FinancialPeriodService financialPeriodService = (FinancialPeriodService) map.get(FinancialPeriodService.class);
- if (financialPeriodService == null){
- financialPeriodService = new FinancialPeriodServiceImpl();
- }
-
// FinancialPeriods of 1 month are created
Date endDate = fiscalPeriod.getEndDate();
Date loopDate = fiscalPeriod.getBeginDate();
@@ -152,7 +127,8 @@
}
//create it
fiscalPeriod.addFinancialPeriod(financialPeriod);
- financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
+ financialPeriods.add(financialPeriod);
+ //financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
//loop incremente
loopDate = DateUtils.addMilliseconds(loopDate, 1);
}
@@ -160,6 +136,7 @@
catch (TopiaException ex) {
doCatch(transaction, ex, log);
}
+ return financialPeriods;
}
/**
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -26,12 +26,15 @@
import java.util.List;
import java.util.ListIterator;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.AccountServiceLocal;
import org.chorem.lima.business.AccountingRules;
+import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
@@ -54,16 +57,13 @@
* @author Rémi Chapelet
*/
@Stateless
-public class AccountServiceImpl extends AbstractLimaService implements AccountService {
+public class AccountServiceImpl extends AbstractLimaService implements AccountService, AccountServiceLocal {
private static final Log log =
LogFactory.getLog(AccountServiceImpl.class);
private TopiaContext rootContext;
- protected FinancialTransactionServiceImpl financialTransactionService =
- new FinancialTransactionServiceImpl();
-
protected AccountingRules accountingRules;
public AccountServiceImpl() {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -24,12 +24,16 @@
import java.util.ArrayList;
import java.util.List;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.EntryBookServiceLocal;
+import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
@@ -52,17 +56,17 @@
* @author Rémi Chapelet
*/
@Stateless
-public class EntryBookServiceImpl extends AbstractLimaService implements EntryBookService {
+public class EntryBookServiceImpl extends AbstractLimaService implements EntryBookService, EntryBookServiceLocal {
private static final Log log = LogFactory.getLog(EntryBookServiceImpl.class);
private TopiaContext rootContext;
- protected FinancialTransactionServiceImpl financialTransactionService =
- new FinancialTransactionServiceImpl();
+ @EJB
+ FinancialTransactionService financialTransactionService;
- protected FinancialPeriodServiceImpl financialPeriodService =
- new FinancialPeriodServiceImpl();
+ @EJB
+ FinancialPeriodService financialPeriodService;
protected AccountingRules accountingRules;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -21,6 +21,8 @@
import java.util.List;
+import javax.ejb.EJB;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -19,21 +19,19 @@
package org.chorem.lima.business.ejb;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialPeriodServiceLocal;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
-import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookDAO;
import org.chorem.lima.entity.FinancialPeriod;
@@ -55,7 +53,7 @@
* @author Rémi Chapelet
*/
@Stateless
-public class FinancialPeriodServiceImpl extends AbstractLimaService implements FinancialPeriodService {
+public class FinancialPeriodServiceImpl extends AbstractLimaService implements FinancialPeriodService, FinancialPeriodServiceLocal {
/** log */
private static final Log log =
@@ -76,7 +74,6 @@
}
accountingRules = config.getAccountingRules();
- accountingRules.register(FinancialPeriodService.class, this);
}
/**
@@ -85,12 +82,12 @@
* @return
*/
@Override
- public void createFinancialPeriod(FinancialPeriod financialPeriod) throws LimaException {
+ public void createFinancialPeriods(List<FinancialPeriod> financialPeriods) throws LimaException {
TopiaContext topiaTransaction = null;
try {
topiaTransaction = beginTransaction();
- createFinancialPeriodWithTransaction(financialPeriod, topiaTransaction);
+ createFinancialPeriodsWithTransaction(financialPeriods, topiaTransaction);
}
catch (TopiaException ex) {
@@ -105,32 +102,35 @@
* @return
*/
@Override
- public void createFinancialPeriodWithTransaction(FinancialPeriod financialPeriod, TopiaContext topiaContext) throws LimaException {
+ public void createFinancialPeriodsWithTransaction(List<FinancialPeriod> financialPeriods, TopiaContext topiaContext) throws LimaException {
try {
FinancialPeriodDAO financialPeriodDAO =
LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
- //create ClosedPeriodicEntryBook for all entrybook
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
EntryBookDAO entryBookDAO =
LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
- for (EntryBook entryBook : entryBookDAO.findAll()) {
- //new closed periodic entrybook
- ClosedPeriodicEntryBook closedPeriodicEntryBook
- = new ClosedPeriodicEntryBookImpl();
- // set entrybook
- closedPeriodicEntryBook.setEntryBook(entryBook);
- // set financial period
- closedPeriodicEntryBook.setFinancialPeriod(financialPeriod);
- // create it
- closedPeriodicEntryBookDAO.create(closedPeriodicEntryBook);
- }
- //create financial period
- financialPeriodDAO.create(financialPeriod);
+ //create all financial period
+ for (FinancialPeriod financialPeriod : financialPeriods) {
+ //create ClosedPeriodicEntryBook for all entrybook
+ for (EntryBook entryBook : entryBookDAO.findAll()) {
+ //new closed periodic entrybook
+ ClosedPeriodicEntryBook closedPeriodicEntryBook
+ = new ClosedPeriodicEntryBookImpl();
+ // set entrybook
+ closedPeriodicEntryBook.setEntryBook(entryBook);
+ // set financial period
+ closedPeriodicEntryBook.setFinancialPeriod(financialPeriod);
+ // create it
+ closedPeriodicEntryBookDAO.create(closedPeriodicEntryBook);
+ }
+ //create financial period
+ financialPeriodDAO.create(financialPeriod);
+ }
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -24,14 +24,17 @@
import java.util.Date;
import java.util.List;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
+import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialTransactionService;
+import org.chorem.lima.business.FinancialTransactionServiceLocal;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -57,7 +60,7 @@
* @author Rémi Chapelet
*/
@Stateless
-public class FinancialTransactionServiceImpl extends AbstractLimaService implements FinancialTransactionService {
+public class FinancialTransactionServiceImpl extends AbstractLimaService implements FinancialTransactionService, FinancialTransactionServiceLocal {
private static final Log log =
LogFactory.getLog(FinancialTransactionServiceImpl.class);
@@ -66,8 +69,8 @@
protected AccountingRules accountingRules;
- protected FinancialPeriodServiceImpl financialPeriodService =
- new FinancialPeriodServiceImpl();
+ @EJB
+ FinancialPeriodService financialPeriodService;
public FinancialTransactionServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -28,7 +28,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
+import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.FiscalPeriodServiceLocal;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
@@ -51,13 +53,15 @@
* @author Rémi Chapelet
*/
@Stateless
-public class FiscalPeriodServiceImpl extends AbstractLimaService implements FiscalPeriodService {
+public class FiscalPeriodServiceImpl extends AbstractLimaService implements FiscalPeriodService, FiscalPeriodServiceLocal {
private static final Log log = LogFactory.getLog(FiscalPeriodServiceImpl.class);
private static TopiaContext rootContext;
protected AccountingRules accountingRules;
+
+ FinancialPeriodService financialPeriodService;
public FiscalPeriodServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -83,8 +87,10 @@
transaction = beginTransaction();
//check rules before create the account
- accountingRules.createFiscalPeriodRules(fiscalPeriod, transaction);
+ List<FinancialPeriod> financialPeriods = accountingRules.createFiscalPeriodRules(fiscalPeriod, transaction);
+ financialPeriodService.createFinancialPeriodsWithTransaction(financialPeriods, transaction);
+
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ImportExportService;
+import org.chorem.lima.business.ImportExportServiceLocal;
import org.chorem.lima.business.LimaException;
/**
@@ -43,7 +44,7 @@
* By : $Author$
*/
@Stateless
-public class ImportExportServiceImpl implements ImportExportService {
+public class ImportExportServiceImpl implements ImportExportService, ImportExportServiceLocal {
private static final Log log = LogFactory.getLog(ImportExportServiceImpl.class);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -29,6 +29,7 @@
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.RecordService;
+import org.chorem.lima.business.RecordServiceLocal;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.Record;
import org.chorem.lima.entity.RecordDAO;
@@ -45,7 +46,7 @@
* @author Rémi Chapelet
*/
@Stateless
-public class RecordServiceImpl implements RecordService {
+public class RecordServiceImpl implements RecordService, RecordServiceLocal {
/** log */
private static final Log log = LogFactory.getLog(RecordServiceImpl.class);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -23,6 +23,7 @@
import java.util.Date;
import java.util.List;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
@@ -31,9 +32,11 @@
import org.chorem.lima.beans.BalanceTrialImpl;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.beans.ReportsDatasImpl;
+import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.business.ReportServiceLocal;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -47,14 +50,14 @@
import org.nuiton.topia.framework.TopiaQuery;
@Stateless
-public class ReportServiceImpl extends AbstractLimaService implements ReportService {
+public class ReportServiceImpl extends AbstractLimaService implements ReportService, ReportServiceLocal {
private static final Log log = LogFactory.getLog(AccountServiceImpl.class);
private TopiaContext rootContext;
- protected AccountServiceImpl accountService =
- new AccountServiceImpl();
+ @EJB
+ AccountService accountService;
public ReportServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -22,7 +22,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaConfig;
-import org.chorem.lima.business.LimaException;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaNotFoundException;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -87,7 +87,7 @@
protected static LimaServiceFactory instance;
/** JNDI context used to look for EJB. */
- protected InitialContext ctx;
+ protected static InitialContext ctx;
/**
* Init openejb jndi context.
@@ -137,7 +137,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "AccountServiceImplLocal";
+ String lookupName = "AccountServiceImplRemote";
AccountService ejbHome = null;
try {
ejbHome = (AccountService)ctx.lookup(lookupName);
@@ -158,7 +158,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "FiscalPeriodServiceImplLocal";
+ String lookupName = "FiscalPeriodServiceImplRemote";
FiscalPeriodService ejbHome = null;
try {
ejbHome = (FiscalPeriodService)ctx.lookup(lookupName);
@@ -179,7 +179,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "FinancialPeriodServiceImplLocal";
+ String lookupName = "FinancialPeriodServiceImplRemote";
FinancialPeriodService ejbHome = null;
try {
ejbHome = (FinancialPeriodService)ctx.lookup(lookupName);
@@ -200,7 +200,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "FinancialTransactionServiceImplLocal";
+ String lookupName = "FinancialTransactionServiceImplRemote";
FinancialTransactionService ejbHome = null;
try {
ejbHome = (FinancialTransactionService)ctx.lookup(lookupName);
@@ -221,7 +221,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "EntryBookServiceImplLocal";
+ String lookupName = "EntryBookServiceImplRemote";
EntryBookService ejbHome = null;
try {
ejbHome = (EntryBookService)ctx.lookup(lookupName);
@@ -243,7 +243,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "ReportServiceImplLocal";
+ String lookupName = "ReportServiceImplRemote";
ReportService ejbHome = null;
try {
ejbHome = (ReportService)ctx.lookup(lookupName);
@@ -264,7 +264,7 @@
// TODO EC-20100410 put lookup name in configuration
// name should be fully configurable due to custom implementation used
- String lookupName = "RecordServiceImplLocal";
+ String lookupName = "RecordServiceImplRemote";
RecordService ejbHome = null;
try {
ejbHome = (RecordService)ctx.lookup(lookupName);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -44,7 +44,6 @@
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransaction.LetteringView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
-import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedViewHandler;
import org.chorem.lima.util.ErrorHelper;
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -26,21 +26,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
-import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.ui.account.model.AccountTreeTableModel;
import org.chorem.lima.ui.account.AccountForm;
import org.chorem.lima.ui.account.AccountView;
import org.chorem.lima.ui.account.SubLedgerForm;
import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaNotFoundException;
/**
* Handler associated with account view.
@@ -58,18 +52,8 @@
protected AccountView view;
- private TopiaContext rootContext;
-
protected AccountViewHandler(AccountView view) {
this.view = view;
- LimaConfig config = LimaConfig.getInstance();
- try {
- rootContext = TopiaContextFactory.getContext(config.getOptions());
- } catch (TopiaNotFoundException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't init topia context", ex);
- }
- }
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -27,7 +27,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
-import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.BalanceTrial;
-import org.chorem.lima.beans.BalanceTrialImpl;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -25,11 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.BalanceTrial;
-import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.FinancialTransactionService;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.Entry;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.ReportsHelper;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -18,8 +18,6 @@
package org.chorem.lima.ui.combobox;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.swing.ComboBoxModel;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -17,13 +17,9 @@
* ##%*/
package org.chorem.lima.ui.combobox;
-
-import java.util.ArrayList;
import java.util.List;
-
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -19,11 +19,8 @@
package org.chorem.lima.ui.combobox;
import java.util.List;
-
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;
-
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodService;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -22,8 +22,6 @@
import java.awt.Component;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -23,8 +23,6 @@
import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.FiscalPeriodDAO;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.service.LimaServiceFactory;
public class FiscalPeriodComboBoxModel implements ComboBoxModel{
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -20,14 +20,9 @@
import java.awt.Component;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-
-import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
public class FiscalPeriodComboBoxRenderer extends DefaultListCellRenderer {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -19,7 +19,6 @@
package org.chorem.lima.ui.combobox;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.swing.ComboBoxModel;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -22,9 +22,7 @@
import static org.nuiton.i18n.I18n._;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
import javax.swing.table.AbstractTableModel;
@@ -32,14 +30,10 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.beans.ReportsDatasImpl;
-import org.chorem.lima.business.EntryBookService;
-import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
-import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -23,10 +23,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
-
import javax.swing.table.AbstractTableModel;
-
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -27,7 +27,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
-import org.chorem.lima.util.ErrorHelper;
/**
* TODO add comment here.
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTable.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -28,8 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper;
import org.chorem.lima.ui.financialtransaction.FinancialTransactionViewHandler;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -42,11 +42,9 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryImpl;
import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FinancialPeriodImpl;
import org.chorem.lima.entity.FinancialTransactionImpl;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper;
import org.chorem.lima.util.ErrorHelper;
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -28,8 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedViewHandler;
import org.chorem.lima.ui.financialtransaction.table.AccountTableCellEditor;
import org.chorem.lima.ui.financialtransaction.table.DateTableCellEditor;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -33,7 +33,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.FinancialPeriodService;
-import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.business.utils.EntryComparator;
@@ -43,7 +42,6 @@
import org.chorem.lima.entity.EntryImpl;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialPeriodImpl;
-import org.chorem.lima.entity.FinancialTransactionImpl;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -97,12 +95,9 @@
*/
public FinancialTransactionUnbalancedTableModel() {
/* Services */
- financialTransactionService = LimaServiceFactory.getInstance()
- .getTransactionService();
- entryBookService = LimaServiceFactory.getInstance().
- getEntryBookService();
- financialPeriodService = LimaServiceFactory.getInstance().
- getFinancialPeriodService();
+ financialTransactionService = LimaServiceFactory.getInstance().getTransactionService();
+ entryBookService = LimaServiceFactory.getInstance().getEntryBookService();
+ financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService();
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -27,8 +27,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTable;
-import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTableModel;
/**
* Handler associated with financial transaction view.
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-31 17:46:38 UTC (rev 2918)
@@ -22,10 +22,7 @@
import java.text.SimpleDateFormat;
import java.util.List;
-
import javax.swing.table.AbstractTableModel;
-
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FiscalPeriodService;
1
0
31 May '10
Author: jpepin
Date: 2010-05-31 15:11:26 +0200 (Mon, 31 May 2010)
New Revision: 2917
Url: http://chorem.org/repositories/revision/lima/2917
Log:
Calcul des montants des transactions financi?\195?\168res dans le business
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -46,7 +46,7 @@
* @param account account
* @throws LimaException
*/
- void createAccount(Account masterAccount, Account account) throws LimaException;
+ void createAccount(Account masterAccount, Account account) throws LimaException, LimaBusinessException;
void createSubLedger(Account masterAccount, Account account) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -69,7 +69,7 @@
* @throws LimaException
*/
public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException;
-
+ public void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException;
/**
* Financialperiod/entrybook rules
* @param financialTransaction
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -73,7 +73,7 @@
void createFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
- void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
+ void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException, LimaBusinessException;
void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -20,6 +20,7 @@
package org.chorem.lima.business.accountingrules;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -43,6 +44,7 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionDAO;
import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.entity.FiscalPeriodDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
@@ -211,10 +213,13 @@
*/
@Override
public void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException {
+ //check financial period locked
if (financialTransaction.getFinancialPeriod().getLocked()){
throw new LimaBusinessException("The financial period is blocked");
}
+ //check all entrybook of his financial period are blocked
+ //FIXME Make this check by topia query ?
List<EntryBook> entryBooks = new ArrayList<EntryBook>();
List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>();
try {
@@ -269,5 +274,79 @@
// TODO Auto-generated method stub
}
+
+ /**
+ * Check :
+ * - if old financialtransaction date are on periodblocked
+ * - if new date are on fiscalperiod
+ * - new financialtransaction date are on periodunblocked
+ * - if all closedperiod are open
+ */
+ @Override
+ public void updateFinancialTransactionDateRules(
+ FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException {
+
+ //check old financial period locked
+ if (financialTransactionOld.getFinancialPeriod().getLocked()){
+ throw new LimaBusinessException("The financial period of this transaction is blocked");
+ }
+
+ //check new financial period locked
+ if (financialTransaction.getFinancialPeriod().getLocked()){
+ throw new LimaBusinessException("The financial period of the new date is blocked");
+ }
+
+ try {
+
+ //check if date are on fiscal period
+ FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
+ FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findContainsFinancialPeriod(financialTransaction.getFinancialPeriod());
+ Date beginDateFiscalPeriod = fiscalPeriod.getBeginDate();
+ Date endDateFiscalPeriod = fiscalPeriod.getEndDate();
+ Date financialTransactionDate = financialTransaction.getTransactionDate();
+ if (financialTransactionDate.before(beginDateFiscalPeriod)){
+ throw new LimaBusinessException("The date is before the fiscal period");
+ }
+ if (financialTransactionDate.after(endDateFiscalPeriod)){
+ throw new LimaBusinessException("The date is after the fiscal period");
+ }
+
+ //check all entrybook of old and new financial period are blocked
+ //FIXME Make this check by topia query ?
+ List<EntryBook> entryBooks = new ArrayList<EntryBook>();
+ List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>();
+ List<EntryBook> oldClosedEntryBooks = new ArrayList<EntryBook>();
+ EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
+ FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod();
+ FinancialPeriod oldFinancialPeriod = financialTransactionOld.getFinancialPeriod();
+ entryBooks = entryBookDAO.findAll();
+ for (EntryBook entryBook : entryBooks) {
+ FinancialPeriodService financialPeriodService =
+ (FinancialPeriodService) map.get(FinancialPeriodService.class);
+ if (financialPeriodService == null){
+ financialPeriodService = new FinancialPeriodServiceImpl();
+ }
+
+ if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){
+ closedEntryBooks.add(entryBook);
+ }
+ if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, oldFinancialPeriod).getLocked()){
+ oldClosedEntryBooks.add(entryBook);
+ }
+ }
+
+ if (oldClosedEntryBooks.size() >0){
+ throw new LimaBusinessException("All EntryBook of this financialperiod are not open");
+ }
+ if (closedEntryBooks.size() >0){
+ throw new LimaBusinessException("All EntryBook of old financialperiod are not open");
+ }
+
+
+ }
+ catch (TopiaException eee) {
+ doCatch(topiaContext, eee, log);
+ }
+ }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -43,6 +43,9 @@
* @throws LimaException
*/
protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException {
+ if (cause instanceof LimaException){
+ throw (LimaException) cause;
+ }
if (transaction != null) {
try {
transaction.rollbackTransaction();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -119,7 +119,7 @@
commitTransaction(transaction);
}
- catch (TopiaException ex) {
+ catch (Exception ex) {
doCatch(transaction, ex, log);
}
finally {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -208,9 +208,12 @@
TopiaQuery query = financialPeriodDAO.createQuery();
if (date != null){
- query.add("beginDate = :value").addParam("value", date);
+ query.addWhere("beginDate <= :value")
+ .addWhere("endDate >= :value")
+ .addParam("value", date);
}
- financialPeriod = financialPeriodDAO.findByQuery(query);
+ financialPeriod = financialPeriodDAO.findByQuery(query);
+ log.debug(financialPeriod);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -301,7 +304,7 @@
query.addFrom(FiscalPeriod.class, "F")
.addInElements("E." + ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
"F."+FiscalPeriod.FINANCIAL_PERIOD)
- .add("F."+FiscalPeriod.LOCKED, Boolean.FALSE)
+ .addEquals("F."+FiscalPeriod.LOCKED, Boolean.FALSE)
.addOrder(FiscalPeriod.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
//IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -21,7 +21,7 @@
import static org.nuiton.i18n.I18n._;
-import java.util.Collections;
+import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
@@ -29,13 +29,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountingRules;
-import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.FinancialTransactionService;
-import org.chorem.lima.business.utils.AccountComparator;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
@@ -44,7 +41,6 @@
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionDAO;
-import org.hsqldb.lib.Sort;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
@@ -69,6 +65,9 @@
private TopiaContext rootContext;
protected AccountingRules accountingRules;
+
+ protected FinancialPeriodServiceImpl financialPeriodService =
+ new FinancialPeriodServiceImpl();
public FinancialTransactionServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -97,8 +96,8 @@
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
financialtransaction, topiaContext);
- FinancialTransactionDAO financialtransactionDAO = LimaCallaoDAOHelper
- .getFinancialTransactionDAO(topiaContext);
+ FinancialTransactionDAO financialtransactionDAO =
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
financialtransactionDAO.create(financialtransaction);
@@ -130,7 +129,7 @@
TopiaQuery query = transactionDAO.createQuery();
// entryBook is not visible, but column "entryBook"
// exist in transaction table
- query.add("entryBook", entryBook);
+ query.addEquals("entryBook", entryBook);
FinancialTransaction result = transactionDAO.findByQuery(query);
@@ -152,7 +151,7 @@
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
//TODO marche pas
TopiaQuery query = entryDAO.createQuery();
- query.add("account", account);
+ query.addEquals("account", account);
Entry result = entryDAO.findByQuery(query);
@@ -208,11 +207,11 @@
TopiaQuery query = transactionDAO.createQuery();
if (entryBook != null) {
- query.add("entryBook", entryBook);
+ query.addEquals("entryBook", entryBook);
}
if (financialPeriod != null) {
- query.add("financialPeriod", financialPeriod);
+ query.addEquals("financialPeriod", financialPeriod);
}
financialTransactions = transactionDAO.findAllByQuery(query);
@@ -245,7 +244,8 @@
try {
topiaContext = beginTransaction();
- FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+ FinancialTransactionDAO financialTransactionDAO =
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
TopiaQuery query = financialTransactionDAO.createQuery("E");
query.add(FinancialTransaction.ENTRY);
result = query.execute();
@@ -261,31 +261,65 @@
return result;
}
+
@Override
public void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
-
- TopiaContext topiaTransaction = null;
- try {
- topiaTransaction = beginTransaction();
-
- //check if the financial period is blocked
- accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
- financialtransaction, topiaTransaction);
-
-
- FinancialTransactionDAO transactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
- transactionDAO.update(financialtransaction);
- commitTransaction(topiaTransaction);
+
+ TopiaContext topiaContext = null;
+ try {
+ topiaContext = beginTransaction();
+ updateFinancialTransactionWithTransaction(
+ financialtransaction, topiaContext);
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
- doCatch(topiaTransaction, ex, log);
+ doCatch(topiaContext, ex, log);
}
finally {
- doFinally(topiaTransaction, log);
+ doFinally(topiaContext, log);
}
}
+
+ public void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException{
+ try {
+ log.debug("updat");
+ log.debug(financialtransaction);
+ FinancialTransactionDAO transactionDAO =
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+ FinancialTransaction financialTransactionOld =
+ transactionDAO.findByTopiaId(financialtransaction.getTopiaId());
+
+ /* if update date change - check :
+ * - if old financialtransaction date are on periodblocked
+ * - if new date are on fiscalperiod
+ * - new financialtransaction date are on periodunblocked
+ * - if all closedperiod are open
+ */
+ Date oldDate = financialTransactionOld.getTransactionDate();
+ Date newDate = financialtransaction.getTransactionDate();
+ if (newDate.compareTo(oldDate) != 0){
+ financialTransactionOld.setTransactionDate(newDate);
+ //change financial period
+ FinancialPeriod financialPeriod =
+ financialPeriodService.getFinancialPeriodWithDate(newDate);
+ if (financialPeriod != null){
+ financialTransactionOld.setFinancialPeriod(financialPeriod);
+ }
+ accountingRules.updateFinancialTransactionDateRules(
+ financialtransaction, financialTransactionOld, topiaContext);
+ }
+
+ financialTransactionOld.setAmountDebit(
+ financialtransaction.getAmountDebit());
+ financialTransactionOld.setAmountCredit(
+ financialtransaction.getAmountCredit());
+ transactionDAO.update(financialTransactionOld);
+ }
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+ }
@Override
public void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
@@ -301,6 +335,7 @@
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
FinancialTransaction financialTransaction2 =
+ //patch : conflict object already instanciate
transactionDAO.findByTopiaId(financialtransaction.getTopiaId());
transactionDAO.delete(financialTransaction2);
commitTransaction(topiaTransaction);
@@ -327,9 +362,29 @@
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
entry.getFinancialTransaction(), topiaContext);
+ //get entry amounts
+ Double entryAmount = entry.getAmount();
+ Boolean entryAmountBool = entry.getDebit();
+ Double entryDebit = entryAmountBool ? entryAmount : 0;
+ Double entryCredit = entryAmountBool ? 0 : entryAmount;
+
+ //calculate financial transaction amounts
+ FinancialTransaction financialTransaction =
+ entry.getFinancialTransaction();
+ Double amountDebit = financialTransaction.getAmountDebit();
+ Double amountCredit = financialTransaction.getAmountCredit();
+ financialTransaction.setAmountDebit(amountDebit-entryDebit);
+ financialTransaction.setAmountCredit(amountCredit-entryCredit);
+
+ //update financial transaction
+ updateFinancialTransactionWithTransaction(
+ financialTransaction, topiaContext);
+
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext);
//delete
entryDAO.delete(entry);
+ // updateFinancialTransactionWithTransaction(entry.getFinancialTransaction(), topiaContext)
+ //commit
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
@@ -338,6 +393,8 @@
finally {
doFinally(topiaContext, log);
}
+ //update financial transaction
+ updateFinancialTransaction(entry.getFinancialTransaction());
}
@Override
@@ -354,17 +411,44 @@
//check rules
accountingRules.updateEntryRules(entry, entryOld, topiaContext);
+ //get new entry amounts
+ Double entryAmount = entry.getAmount();
+ Boolean entryAmountBool = entry.getDebit();
+ Double entryDebit = entryAmountBool ? entryAmount : 0;
+ Double entryCredit = entryAmountBool ? 0 : entryAmount;
+
+ //get old entry amounts
+ Double entryAmountOld = entryOld.getAmount();
+ Boolean entryAmountBoolOld = entryOld.getDebit();
+ Double entryDebitOld = entryAmountBoolOld ? entryAmountOld : 0;
+ Double entryCreditOld = entryAmountBoolOld ? 0 : entryAmountOld;
+
//TODO PEPIN 20100520 conflict object already instanciate
entryOld.setAccount(entry.getAccount());
- entryOld.setAmount(entry.getAmount());
- entryOld.setDebit(entry.getDebit());
+ entryOld.setAmount(entryAmount);
+ entryOld.setDebit(entryAmountBool);
entryOld.setDescription(entry.getDescription());
entryOld.setEntryBook(entry.getEntryBook());
entryOld.setFinancialTransaction(entry.getFinancialTransaction());
entryOld.setVoucher(entry.getVoucher());
entryOld.setPosition(entry.getPosition());
entryOld.setLettering(entry.getLettering());
- //update
+
+ //calculate financial transaction amounts
+ FinancialTransaction financialTransaction =
+ entryOld.getFinancialTransaction();
+ Double amountDebit = financialTransaction.getAmountDebit();
+ Double amountCredit = financialTransaction.getAmountCredit();
+ financialTransaction.setAmountDebit(
+ amountDebit-entryDebitOld+entryDebit);
+ financialTransaction.setAmountCredit(
+ amountCredit-entryCreditOld+entryCredit);
+
+ //update financial transaction
+ updateFinancialTransactionWithTransaction(
+ financialTransaction, topiaContext);
+
+ //update entry
entryDAO.update(entryOld);
commitTransaction(topiaContext);
}
@@ -375,7 +459,7 @@
doFinally(topiaContext, log);
}
}
-
+
/**
* Création d'une entrée comptable.
* La période ne doit PAS être bloquée.
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -282,8 +282,8 @@
String transactionDateProperty =
TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
FinancialTransaction.TRANSACTION_DATE);
- query.add(Entry.ENTRY_BOOK, entryBook)
- .add(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
+ query.addEquals(Entry.ENTRY_BOOK, entryBook)
+ .addWhere(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
.addParam("beginDate", beginDate)
.addParam("endDate", endDate);
/*String orderProperty =
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-05-31 13:11:26 UTC (rev 2917)
@@ -53,16 +53,6 @@
</cell>
</row>
<row>
- <cell fill="horizontal">
- <JLabel text="lima.account.type"/>
- </cell>
- <cell fill="horizontal">
- <JComboBox id="typeComboBox" model='{new org.chorem.lima.ui.account.model.AccountTypeListModel()}'
- selectedItem="{getAccount().getType()}"
- onActionPerformed="getAccount().setType((String)getTypeComboBox().getSelectedItem())"/>
- </cell>
- </row>
- <row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
</cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-31 13:11:26 UTC (rev 2917)
@@ -54,17 +54,6 @@
onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
</cell>
</row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.account.type"/>
- </cell>
- <cell fill="horizontal">
- <JComboBox id="typeComboBox"
- model='{new org.chorem.lima.ui.account.model.AccountTypeListModel()}'
- selectedItem="{getAccount().getType()}"
- onActionPerformed="getAccount().setType((String)getTypeComboBox().getSelectedItem())"/>
- </cell>
- </row>
<!-- Lien Fiche contact-->
<row>
<cell fill="horizontal">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-27 17:22:42 UTC (rev 2916)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-31 13:11:26 UTC (rev 2917)
@@ -243,6 +243,8 @@
if (result instanceof FinancialTransaction) {
FinancialTransaction currentRow = (FinancialTransaction)result;
+ Double amountDebit = currentRow.getAmountDebit();
+ Double amountCredit = currentRow.getAmountCredit();
switch (column) {
case 0:
@@ -264,14 +266,13 @@
result = null; // position
break;
case 6:
- result = FinancialTransactionHelper.getDebit(currentRow);
+ result = amountDebit;//FinancialTransactionHelper.getDebit(currentRow);
break;
case 7:
- result = FinancialTransactionHelper.getCredit(currentRow);
+ result = amountCredit;//FinancialTransactionHelper.getCredit(currentRow);
break;
case 8:
- result = FinancialTransactionHelper.getDebit(currentRow)
- - FinancialTransactionHelper.getCredit(currentRow);
+ result = amountDebit - amountCredit;
break;
}
}
@@ -426,12 +427,17 @@
(FinancialTransaction)currentRow;
switch (column) {
case 0:
- // Truncate the date - format 01-MM-YYYY
+ //update
+ currentFinancialTransaction.
+ setTransactionDate((Date)value);
+
+ /*// Truncate the date - format 01-MM-YYYY
Date dateCurrentFinancialTransaction = ((Date)value);
dateCurrentFinancialTransaction =
DateUtils.truncate(
dateCurrentFinancialTransaction, Calendar.MONTH);
+ //TODO add on rules
// Return the begin date of the current financial period
Date dateCurrentFinancialPeriod =
selectedFinancialPeriod.getBeginDate();
@@ -465,7 +471,7 @@
log.debug("Can't update on the new date");
}
}
- }
+ }*/
break;
}
@@ -511,6 +517,7 @@
}
try {
financialTransactionService.updateEntry(currentEntry);
+
} catch (LimaException e) {
if (log.isDebugEnabled()){
log.debug("Can't update entry", e);
1
0
r2916 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced lima-swing/src/main/resources/i18n
by jpepin@users.chorem.org 27 May '10
by jpepin@users.chorem.org 27 May '10
27 May '10
Author: jpepin
Date: 2010-05-27 19:22:42 +0200 (Thu, 27 May 2010)
New Revision: 2916
Url: http://chorem.org/repositories/revision/lima/2916
Log:
Ajout dans l'ui d'une vue des entr?\195?\169es non ?\195?\169quilibr?\195?\169es
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedHelper.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -25,6 +25,7 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
/**
* Transaction service.
@@ -68,6 +69,8 @@
List<FinancialTransaction> getAllFinancialTransactionsForEntryBookAndFinancialPeriod(
EntryBook entryBook, FinancialPeriod period) throws LimaException;
+ List<FinancialTransaction> getAllFinancialTransactionsUnbalanced(FiscalPeriod fiscalPeriod) throws LimaException;
+
void createFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -330,6 +330,10 @@
return result;
}
+ /**
+ * Just for debug
+ *TODO REMOVE
+ */
@Override
public List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException {
List<ClosedPeriodicEntryBook> result = null;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -40,6 +40,7 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionDAO;
@@ -213,6 +214,7 @@
if (financialPeriod != null) {
query.add("financialPeriod", financialPeriod);
}
+
financialTransactions = transactionDAO.findAllByQuery(query);
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
@@ -235,9 +237,31 @@
return financialTransactions;
}
-
@Override
+ public List<FinancialTransaction> getAllFinancialTransactionsUnbalanced(FiscalPeriod fiscalPeriod) throws LimaException {
+ TopiaContext topiaContext = null;
+ List<FinancialTransaction> result = null;
+ try {
+ topiaContext = beginTransaction();
+
+ FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+ TopiaQuery query = financialTransactionDAO.createQuery("E");
+ query.add(FinancialTransaction.ENTRY);
+ result = query.execute();
+ log.debug(result);
+
+ }
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+ finally {
+ doFinally(topiaContext, log);
+ }
+ return result;
+ }
+
+ @Override
public void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
TopiaContext topiaTransaction = null;
@@ -384,6 +408,7 @@
}
}
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
// TODO move it into JTA
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-05-27 17:22:42 UTC (rev 2916)
@@ -127,7 +127,7 @@
<JMenu text="lima.entries">
<JMenuItem text="lima.entries.addtransaction" onActionPerformed='getHandler().showTransactionView(this)'
actionIcon='transaction'/>
- <JMenuItem text="lima.entries.searchtransaction" onActionPerformed='getHandler().showSearchView(this)'
+ <JMenuItem text="lima.entries.searchunbalancedtransaction" onActionPerformed='getHandler().showTransactionUnbalancedView(this)'
actionIcon='search'/>
<JMenuItem text="lima.entries.lettering" onActionPerformed='getHandler().showLetteringView(this)'
actionIcon='lettering'/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -43,6 +43,8 @@
import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransaction.LetteringView;
+import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
+import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedViewHandler;
import org.chorem.lima.util.ErrorHelper;
/**
@@ -347,6 +349,12 @@
mainView.showTab(_("lima.tab.transaction"), transactionView);
}
+ public void showTransactionUnbalancedView(JAXXContext rootContext) {
+ MainView mainView = getUI(rootContext);
+ FinancialTransactionUnbalancedView searchResultView = new FinancialTransactionUnbalancedView(mainView);
+ mainView.showTab(_("lima.entries.searchunbalancedtransaction"), searchResultView);
+ }
+
public void showBalanceView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
BalanceView balanceView = new BalanceView(mainView);
@@ -381,12 +389,6 @@
mainView.showTab(_("lima.tab.lettering"), letteringView);
}
- public void showSearchResultView(JAXXContext rootContext) {
- /*MainView mainView = getUI(rootContext);
- SearchResultView searchResultView = new SearchResultView(mainView);
- mainView.showTab(_("lima.tab.search.result"), searchResultView);*/
- }
-
public void showSearchView(JAXXContext rootContext) {
/*if (!getSearchView().isEnabled()) {
getSearchView().setEnabled(true);
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedHelper.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedHelper.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -0,0 +1,84 @@
+/* *##% Lima Main
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.ui.financialtransactionunbalanced;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.ui.accountsreports.AccountsReportsTableModel;
+
+/**
+ * TODO add comment here.
+ *
+ * @author chatellier
+ * @version $Revision: 2901 $
+ *
+ * Last update : $Date: 2010-05-19 12:52:43 +0200 (mer. 19 mai 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialTransactionUnbalancedHelper {
+ /** log. */
+ private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class);
+
+ /**
+ * Get total credit for a transaction.
+ *
+ * @param transaction transaction to get credit
+ * @return total credit
+ */
+ public static double getCredit(FinancialTransaction financialtransaction) {
+ double credit = 0;
+ for (Entry entry : financialtransaction.getEntry()) {
+ // TODO EC-20100407 voir si le modele correspond (amount, credit,debit)
+ if (!entry.getDebit()) {
+ credit += entry.getAmount();
+ }
+ }
+ return credit;
+ }
+
+ /**
+ * Get total debit for a transaction.
+ *
+ * @param transaction transaction to get debit
+ * @return total debit
+ */
+ public static double getDebit(FinancialTransaction financialtransaction) {
+ double debit = 0;
+ for (Entry entry : financialtransaction.getEntry()) {
+ // TODO EC-20100407 voir si le modele correspond (amount, credit,debit)
+ if (entry.getDebit()) {
+ debit += entry.getAmount();
+ }
+ }
+ return debit;
+ }
+
+ /**
+ * Return true if transaction is balanced (credit == debit).
+ *
+ * @param transaction transaction to test
+ * @return {@code true} if transaction is balanced
+ */
+ public static boolean isBalanced(FinancialTransaction financialtransaction) {
+ boolean balanced = getDebit(financialtransaction) == getCredit(financialtransaction);
+ return balanced;
+ }
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -0,0 +1,199 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialtransactionunbalanced;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper;
+import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedViewHandler;
+import org.chorem.lima.ui.financialtransaction.table.AccountTableCellEditor;
+import org.chorem.lima.ui.financialtransaction.table.DateTableCellEditor;
+import org.chorem.lima.ui.financialtransaction.table.EntryBookTableCellEditor;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+
+
+/**
+ * Table des transaction qui ajoute des comportement (keys).
+ *
+ * @author ore
+ * @author Rémi Chapelet
+ */
+public class FinancialTransactionUnbalancedTable extends JXTable implements KeyListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3133690382049594727L;
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialTransactionUnbalancedTable.class);
+
+ protected FinancialTransactionUnbalancedViewHandler handler;
+
+ private Highlighter colorTransaction;
+
+ private ColorHighlighter colorBalance;
+
+ /**
+ */
+ public FinancialTransactionUnbalancedTable(FinancialTransactionUnbalancedViewHandler handler) {
+
+ this.handler = handler;
+
+ addKeyListener(this);
+
+ //Get new date editor
+ setDefaultEditor(Date.class, new DateTableCellEditor());
+ //Get new entry book editor
+ setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor());
+ //Get new account editor
+ setDefaultEditor(Account.class, new AccountTableCellEditor());
+
+ //highlight financial financial transactions
+ addColorTransaction();
+ // highlight unbalanced financial transactions
+ addColorNonBalancedTransaction();
+ }
+
+ /**
+ * Cette méthode permet de colorer toutes les transactions dans le tableau
+ * afin de bien distinguer les transactions et entrées comptables.
+ * On récupère la première cellule, on vérifie que c'est une date
+ */
+ protected void addColorTransaction() {
+ if (colorTransaction != null) {
+ removeHighlighter(colorTransaction);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ return adapter.getValueAt(adapter.row, 0) instanceof Date;
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(222,222,222), null);
+ addHighlighter(colorTransaction);
+ }
+
+
+
+ /**
+ * Permet de surligner une transaction dans le tableau lorsque
+ * cette dernière n'est pas équilibrée.
+ * On récupère la dernière cellule de la ligne
+ * et on vérifie si la valeur est différente de 0
+ */
+ protected void addColorNonBalancedTransaction() {
+ if (colorBalance != null) {
+ removeHighlighter(colorBalance);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ boolean isHighlighted = false;
+ Object value = adapter.getValueAt(adapter.row, 8);
+ if (value instanceof Double) {
+ Double currentBalance = (Double) value;
+ if (currentBalance != 0) {
+ isHighlighted = true;
+ }
+ }
+ return isHighlighted;
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ addHighlighter(colorTransaction);
+ }
+
+ /**
+ * for each action combination key are think
+ * for extend keyboard and laptop keyboard
+ */
+ @Override
+ public void keyPressed(KeyEvent e) {
+
+ //TODO combinaison de touches dans la config
+
+ // delete selected row with the key : delete or ctrl clear
+ // ou de l'entree
+ if ((e.getKeyCode() == KeyEvent.VK_DELETE )
+ || (e.getKeyCode() == KeyEvent.VK_CLEAR
+ && e.getModifiers() == KeyEvent.CTRL_MASK)){
+ handler.deleteSelectedRow();
+ }
+
+ // add entry with the key combination : insert or ctrl + enter
+ if ((e.getKeyCode() == KeyEvent.VK_INSERT )
+ || (e.getKeyCode() == KeyEvent.VK_ENTER
+ && e.getModifiers() == KeyEvent.CTRL_MASK)) {
+ handler.addEmptyEntry();
+ }
+
+ /**
+ * Touche tab
+ * Ajoute une entrée comptable si tab est sur
+ * la dernière cellule.
+ */
+ if (e.getKeyChar() == KeyEvent.VK_TAB) {
+ // Vérifie si la cellule sélectionnée est la dernière
+
+ int x = this.getSelectedColumn();
+ int y = this.getSelectedRow();
+ int max_x = this.getColumnCount() - 1;
+ int max_y = this.getRowCount() - 1;
+ if (x == max_x && y == max_y) {
+ handler.addEmptyEntry();
+ // positionne la sélection sur la nouvelle ligne créée
+ this.setColumnSelectionInterval(0, 0);
+ this.setRowSelectionInterval(max_y + 1, max_y + 1);
+ }
+ }
+
+ }
+
+ /*
+ * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
+ */
+ @Override
+ public void keyTyped(KeyEvent e) {
+
+ }
+
+ /*
+ * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
+ */
+ @Override
+ public void keyReleased(KeyEvent e) {
+
+ }
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -0,0 +1,532 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialtransactionunbalanced;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.FinancialTransactionService;
+import org.chorem.lima.business.utils.EntryComparator;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.EntryImpl;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FinancialPeriodImpl;
+import org.chorem.lima.entity.FinancialTransactionImpl;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.financialtransaction.FinancialTransactionHelper;
+import org.chorem.lima.util.ErrorHelper;
+
+/**
+ * Basic transaction table model.
+ *
+ * Le modele est filtré sur {@link #selectedEntryBook} et
+ * {@link #selectedFinancialPeriod} (montée en charge !).
+ *
+ * @author ore
+ * @author chatellier
+ * @version $Revision: 2897 $
+ *
+ * Last update : $Date: 2010-05-14 13:22:26 +0200 (ven. 14 mai 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialTransactionUnbalancedTableModel extends AbstractTableModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3914954536809622358L;
+
+ /** log. */
+ private static final Log log = LogFactory
+ .getLog(FinancialTransactionUnbalancedTableModel.class);
+
+ /** Transaction service. */
+ protected final FinancialTransactionService financialTransactionService;
+
+ /** EntryBook service. */
+ protected final EntryBookService entryBookService;
+
+ /** FinancialPeriod service. */
+ protected final FinancialPeriodService financialPeriodService;
+
+ /** selected financial period */
+ protected FiscalPeriod selectedFiscalPeriod;
+
+ /** data cache */
+ protected List<Object> cacheDataList;
+
+ /** collection
+
+
+ /**
+ * Model constructor.
+ *
+ * Just init service proxies.
+ */
+ public FinancialTransactionUnbalancedTableModel() {
+ /* Services */
+ financialTransactionService = LimaServiceFactory.getInstance()
+ .getTransactionService();
+ entryBookService = LimaServiceFactory.getInstance().
+ getEntryBookService();
+ financialPeriodService = LimaServiceFactory.getInstance().
+ getFinancialPeriodService();
+ }
+
+ /**
+ * Le model est une combinaison de Transaction/Entries.
+ *
+ *
+ * @return
+ */
+ protected List<Object> getDataList() {
+
+ List<Object> results = new ArrayList<Object>();
+ try {
+ List<FinancialTransaction> financialtransactions =
+ financialTransactionService.getAllFinancialTransactionsUnbalanced(selectedFiscalPeriod);
+ for (FinancialTransaction financialtransaction : financialtransactions) {
+ results.add(financialtransaction);
+ List<Entry> entries = (List<Entry>) financialtransaction.getEntry();
+ Collections.sort(entries, new EntryComparator());
+ results.addAll(entries);
+ }
+ }
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.debug("Can't update model", eee);
+ }
+
+ ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ }
+
+ return results;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 9;
+ }
+
+ @Override
+ public Class<?> getColumnClass(int column) {
+
+ Class<?> result = null;
+
+ switch (column) {
+ case 0:
+ result = Date.class;
+ break;
+ case 1:
+ result = EntryBook.class;
+ break;
+ case 2:
+ result = String.class;
+ break;
+ case 3:
+ result = Account.class;
+ break;
+ case 4:
+ result = String.class;
+ break;
+ case 5:
+ result = String.class;
+ break;
+ case 6:
+ result = Double.class;
+ break;
+ case 7:
+ result = Double.class;
+ break;
+ case 8:
+ result = Double.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ String result = "n/a";
+
+ switch (column) {
+ case 0:
+ result = _("lima.transaction.column.date");
+ break;
+ case 1:
+ result = _("lima.transaction.column.entrybook");
+ break;
+ case 2:
+ result = _("lima.transaction.column.voucher");
+ break;
+ case 3:
+ result = _("lima.transaction.column.account");
+ break;
+ case 4:
+ result = _("lima.transaction.column.description");
+ break;
+ case 5:
+ result = _("lima.transaction.column.position");
+ break;
+ case 6:
+ result = _("lima.transaction.column.debit");
+ break;
+ case 7:
+ result = _("lima.transaction.column.credit");
+ break;
+ case 8:
+ result = _("lima.transaction.column.balance");
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public int getRowCount() {
+ int result = 0;
+
+ // just prevent too much result
+ if (selectedFiscalPeriod != null) {
+ //cacheDataList = getDataList();
+ result = cacheDataList.size();
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("No fiscalPeriod selected skip table model update");
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public Object getValueAt(int row, int column) {
+ Object result = null;
+
+ // just prevent too much result
+ if (selectedFiscalPeriod != null) {
+ result = cacheDataList.get(row);
+
+ if (result instanceof FinancialTransaction) {
+ FinancialTransaction currentRow = (FinancialTransaction)result;
+
+ switch (column) {
+ case 0:
+ result = currentRow.getTransactionDate();
+ break;
+ case 1:
+ result = null; // voucher
+ break;
+ case 2:
+ result = null; //entrybook
+ break;
+ case 3:
+ result = null; // account
+ break;
+ case 4:
+ result = null; // description
+ break;
+ case 5 :
+ result = null; // position
+ break;
+ case 6:
+ result = FinancialTransactionHelper.getDebit(currentRow);
+ break;
+ case 7:
+ result = FinancialTransactionHelper.getCredit(currentRow);
+ break;
+ case 8:
+ result = FinancialTransactionHelper.getDebit(currentRow)
+ - FinancialTransactionHelper.getCredit(currentRow);
+ break;
+ }
+ }
+ else if (result instanceof Entry) {
+ Entry currentEntry = (Entry)result;
+ switch (column) {
+ case 0:
+ result = null; // date
+ break;
+ case 1 : // entry book
+ if (currentEntry.getEntryBook() != null){
+ result = currentEntry.getEntryBook().getCode();
+ }
+ else {
+ result = null;
+ }
+ break;
+ case 2:
+ result = currentEntry.getVoucher();
+ break;
+ case 3: // account
+ if (currentEntry.getAccount() != null){
+ result = currentEntry.getAccount().getAccountNumber();
+ }
+ else {
+ result = null;
+ }
+ break;
+ case 4:
+ result = currentEntry.getDescription();
+ break;
+ case 5 :
+ result = currentEntry.getPosition();
+ break;
+ case 6:
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : 0;
+ break;
+ case 7:
+ result = currentEntry.getDebit() ? 0 : currentEntry.getAmount();
+ break;
+ case 8:
+ result = null; // balance
+ break;
+ }
+
+ }
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("No fiscalPeriod selected skip table model update");
+ }
+ }
+
+ return result;
+ }
+
+ public void setFiscalPeriod(FiscalPeriod fiscalPeriod){
+
+ selectedFiscalPeriod = fiscalPeriod;
+ cacheDataList = getDataList();
+ fireTableDataChanged();
+ }
+
+ /**
+ * To set cells editable or not
+ * different condition for entry or financial transaction
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ boolean editableCell=false;
+ Object currentRow = cacheDataList.get(rowIndex);
+ // cells editable for the entry row, all cells exclude the date
+ if ((currentRow instanceof Entry) && !(columnIndex==0)) {
+ editableCell=true;
+ }
+ // cells editable for the financialtransaction row, no cells exclude the date
+ if ((currentRow instanceof FinancialTransaction) && (columnIndex==0)){
+ editableCell=true;
+ }
+ return editableCell;
+ }
+
+
+ /**
+ * @throws LimaException
+ */
+ public void addEmptyEntry(Object value, int row) throws LimaException {
+ FinancialTransaction currentTransaction = null;
+ Object currentRow = cacheDataList.get(row);
+ Entry entry = new EntryImpl();
+ //check if current row is a transaction or an entry
+ if (currentRow instanceof FinancialTransaction) {
+ currentTransaction = (FinancialTransaction)currentRow;
+ }
+ else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry)currentRow;
+ //get back the parent transaction of the entry
+ currentTransaction = currentEntry.getFinancialTransaction();
+ }
+ //create it
+ entry.setFinancialTransaction(currentTransaction);
+ financialTransactionService.createEntry(entry);
+ //on recharge la liste
+ cacheDataList = getDataList();
+ fireTableDataChanged();
+ }
+
+ /**
+ * to modifiy financialtransaction or entry
+ */
+ @Override
+ public void setValueAt(Object value, int row, int column) {
+ int financialTransactionRow=0;
+ // just prevent too much result
+ if (selectedFiscalPeriod != null) {
+ Object currentRow = cacheDataList.get(row);
+ if (currentRow instanceof FinancialTransaction) {
+ FinancialTransaction currentFinancialTransaction =
+ (FinancialTransaction)currentRow;
+ switch (column) {
+ case 0:
+ // Truncate the date - format 01-MM-YYYY
+ Date dateCurrentFinancialTransaction = ((Date)value);
+ dateCurrentFinancialTransaction =
+ DateUtils.truncate(
+ dateCurrentFinancialTransaction, Calendar.MONTH);
+
+ // Return the begin date of the current financial period
+ Date dateCurrentFinancialPeriod =
+ selectedFiscalPeriod.getBeginDate();
+
+ // Compare to the begindate of the current financial period
+ if (!dateCurrentFinancialPeriod.equals(dateCurrentFinancialTransaction)){
+ //methode get financialperiod dans le service
+ FinancialPeriod newFinancialPeriod =
+ new FinancialPeriodImpl();
+ try {
+ newFinancialPeriod =
+ financialPeriodService.getFinancialPeriodWithDate(
+ dateCurrentFinancialTransaction);
+ } catch (LimaException e) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't get new financialPeriodService");
+ }
+ }
+ //if the changed financial period is unlocked
+ if (newFinancialPeriod != null){
+ if (newFinancialPeriod.getLocked() == false){
+ //update
+ currentFinancialTransaction.
+ setTransactionDate((Date)value);
+ currentFinancialTransaction.
+ setFinancialPeriod(newFinancialPeriod);
+ }
+ }
+ else {
+ if (log.isDebugEnabled()){
+ log.debug("Can't update on the new date");
+ }
+ }
+ }
+
+ break;
+ }
+ // notify service for modification
+ try {
+ financialTransactionService.
+ updateFinancialTransaction(currentFinancialTransaction);
+ } catch (LimaException e) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't update financial transaction", e);
+ }
+ }
+ //update the financial transaction in entire
+ financialTransactionRow =
+ getDataList().indexOf(((FinancialTransaction) currentRow));
+ }
+ else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry)currentRow;
+ switch (column) {
+ case 1 :
+ currentEntry.setEntryBook((EntryBook)value);
+ break;
+ case 2 :
+ currentEntry.setVoucher((String)value);
+ break;
+ case 3:
+ currentEntry.setAccount((Account)value);
+ break;
+ case 4:
+ currentEntry.setDescription((String)value);
+ break;
+ case 5 :
+ currentEntry.setPosition((String)value);
+ break;
+ case 6:
+ currentEntry.setAmount((Double)value);
+ currentEntry.setDebit(true);
+ break;
+ case 7:
+ currentEntry.setAmount((Double)value);
+ currentEntry.setDebit(false);
+ break;
+ }
+ try {
+ financialTransactionService.updateEntry(currentEntry);
+ } catch (LimaException e) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't update entry", e);
+ }
+ }
+ //update the financial transaction in entire
+ financialTransactionRow =
+ getDataList().indexOf(((Entry) currentRow).
+ getFinancialTransaction());
+ }
+ //on recharge la liste
+ cacheDataList = getDataList();
+ fireTableRowsUpdated(financialTransactionRow, getRowCount()-1);
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("No fiscalPeriod selected skip table model update");
+ }
+ }
+ }
+
+ public Object getElementAt(int row){
+
+ Object currentRow = cacheDataList.get(row);
+ return currentRow;
+ }
+
+
+ /**
+ * Delete selected row in table (could be transaction or entry).
+ *
+ * Called by model.
+ * @param Object, int
+ * @throws LimaException
+ */
+ public void removeObject(Object object, int row) throws LimaException {
+ Object currentRow = cacheDataList.get(row);
+ if (currentRow instanceof FinancialTransaction) {
+ FinancialTransaction currentTransaction =
+ (FinancialTransaction)currentRow;
+ financialTransactionService.removeFinancialTransaction(currentTransaction);
+ }
+ else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry)currentRow;
+ financialTransactionService.removeEntry(currentEntry);
+ }
+ //on recharge la liste
+ cacheDataList = getDataList();
+ fireTableRowsDeleted(row, getRowCount());
+ }
+
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2010-05-27 17:22:42 UTC (rev 2916)
@@ -0,0 +1,74 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<Table>
+ <FinancialTransactionUnbalancedViewHandler id="handler" javaBean="new FinancialTransactionUnbalancedViewHandler(this)" />
+ <Boolean id="selectedRow" javaBean="false" />
+ <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/>
+ <script>
+ <![CDATA[
+
+ import org.chorem.lima.entity.FiscalPeriod;
+ import org.chorem.lima.entity.FinancialPeriod;
+
+ ]]>
+ </script>
+
+ <!-- <JPopupMenu id="MenuRightPanel">
+ <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/>
+ <JMenuItem text="lima.print"/>
+ </JPopupMenu>
+ <JPopupMenu id="MenuRightTransaction">
+ <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/>
+ <JMenuItem text="lima.print"/>
+ </JPopupMenu> -->
+
+ <row fill="horizontal" weightx="1" weighty="0" anchor="center">
+ <cell>
+ <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ </cell>
+ <cell>
+ <JComboBox id="fiscalPeriodComboBox"
+ model="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel()}"
+ renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}"
+ onItemStateChanged="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) event.getItem())"
+ editable="false"/>
+ </cell>
+ <cell>
+ <JButton text="lima.add.entry" onActionPerformed="getHandler().addEmptyEntry()"/>
+ </cell>
+ <cell>
+ <JButton text="lima.common.remove"
+ onActionPerformed="getHandler().deleteSelectedRow()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows="3" columns="7">
+ <JScrollPane>
+ <org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedTableModel
+ id="financialTransactionUnbalancedTableModel" />
+ <org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedTable
+ id="financialTransactionUnbalancedTable" sortable="false" rowHeight="22"
+ constructorParams="getHandler()" model="{getFinancialTransactionUnbalancedTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
+ <javax.swing.ListSelectionModel javaBean="getFinancialTransactionUnbalancedTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(financialTransactionUnbalancedTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2010-05-27 17:22:42 UTC (rev 2916)
@@ -0,0 +1,130 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialtransactionunbalanced;
+
+import static org.nuiton.i18n.I18n._;
+
+
+import javax.swing.JOptionPane;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTable;
+import org.chorem.lima.ui.financialtransaction.table.FinancialTransactionTableModel;
+
+/**
+ * Handler associated with financial transaction view.
+ *
+ * @author chatellier
+ * @version $Revision: 2901 $
+ *
+ * Last update : $Date: 2010-05-19 12:52:43 +0200 (mer. 19 mai 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialTransactionUnbalancedViewHandler {
+
+ /** log. */
+ private static final Log log =
+ LogFactory.getLog(FinancialTransactionUnbalancedViewHandler.class);
+
+ protected FinancialTransactionUnbalancedView view;
+
+ protected FinancialTransactionUnbalancedViewHandler(FinancialTransactionUnbalancedView view) {
+ this.view = view;
+ }
+
+ //implement new transaction button
+ //add a new entry to the selected transaction
+ public void addEmptyEntry(){
+
+ FinancialTransactionUnbalancedTable table =
+ (FinancialTransactionUnbalancedTable)view.getFinancialTransactionUnbalancedTable();
+ FinancialTransactionUnbalancedTableModel model =
+ (FinancialTransactionUnbalancedTableModel)table.getModel();
+
+ int indexSelectedRow = table.getSelectedRow();
+ if (indexSelectedRow != -1) {
+ Object selectedValue = model.getElementAt(indexSelectedRow);
+ try {
+ model.addEmptyEntry(selectedValue, indexSelectedRow);
+ } catch (LimaException ex){
+ if (log.isErrorEnabled()) {
+ log.error("Can't add emptyentry", ex);
+ }
+ JOptionPane.showMessageDialog(view,
+ _("lima.warning.entrybookscloded"));
+ }
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn("Call addentry selected transaction without selection");
+ }
+ }
+ }
+
+ /**
+ * Delete selected row in table (could be transaction or entry).
+ *
+ * Called by model.
+ * @throws LimaException
+ */
+ public void deleteSelectedRow(){
+
+ FinancialTransactionUnbalancedTable table =
+ (FinancialTransactionUnbalancedTable)view.getFinancialTransactionUnbalancedTable();
+ FinancialTransactionUnbalancedTableModel model =
+ (FinancialTransactionUnbalancedTableModel)table.getModel();
+
+ int indexSelectedRow = table.getSelectedRow();
+ if (indexSelectedRow != -1) {
+
+ Object selectedValue = model.getElementAt(indexSelectedRow);
+ String message = null;
+ if (selectedValue instanceof FinancialTransaction) {
+ message = _("lima.question.remove.transaction");
+ }
+ else {
+ message = _("lima.question.remove.entry");
+ }
+
+ int response = JOptionPane.showConfirmDialog(view, message,
+ _("lima.transaction.confirmdelete"), JOptionPane.YES_NO_OPTION);
+
+ if (response == JOptionPane.YES_OPTION) {
+
+ try {
+ model.removeObject(selectedValue, indexSelectedRow);
+ } catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't remove transaction or entry", ex);
+ }
+ JOptionPane.showMessageDialog(view,
+ _("lima.warning.entrybookscloded"));
+ }
+ }
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn("Call delete selected row without selection");
+ }
+ }
+ }
+}
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-05-27 17:22:42 UTC (rev 2916)
@@ -107,7 +107,7 @@
lima.entries=Entries
lima.entries.addtransaction=
lima.entries.lettering=
-lima.entries.searchtransaction=
+lima.entries.searchunbalancedtransaction=
lima.entrybook=Entry Book
lima.entrybook.add=Add Entry Book
lima.entrybook.code=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-05-27 15:16:22 UTC (rev 2915)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-05-27 17:22:42 UTC (rev 2916)
@@ -105,7 +105,7 @@
lima.entries=Traitement
lima.entries.addtransaction=Saisir des \u00E9critures
lima.entries.lettering=Ajouter une lettre
-lima.entries.searchtransaction=Recherche les transactions
+lima.entries.searchunbalancedtransaction=Entr\u00E9es non \u00E9quilibr\u00E9es
lima.entrybook=Journal
lima.entrybook.add=Ajouter un journal
lima.entrybook.code=Code
1
0
r2915 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by jpepin@users.chorem.org 27 May '10
by jpepin@users.chorem.org 27 May '10
27 May '10
Author: jpepin
Date: 2010-05-27 17:16:22 +0200 (Thu, 27 May 2010)
New Revision: 2915
Url: http://chorem.org/repositories/revision/lima/2915
Log:
Move begin transaction & commit in methods (bis)
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -379,21 +379,24 @@
}
}
- protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
try {
- transaction.commitTransaction();
+ topiaTransaction.commitTransaction();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
- protected TopiaContext beginTransaction() throws TopiaException {
- TopiaContext transaction;
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
- return transaction;
- }
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -219,21 +219,24 @@
}
}
- protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
try {
- transaction.commitTransaction();
+ topiaTransaction.commitTransaction();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
-
- protected TopiaContext beginTransaction() throws TopiaException {
- TopiaContext transaction;
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
- return transaction;
- }
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -357,22 +357,24 @@
return result;
}
- protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
try {
- transaction.commitTransaction();
+ topiaTransaction.commitTransaction();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
- protected TopiaContext beginTransaction() throws TopiaException {
- TopiaContext topiaTransaction;
- // basic check done, make check in database
- // TODO move it into JTA
- topiaTransaction = rootContext.beginTransaction();
- return topiaTransaction;
- }
-
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -384,21 +384,23 @@
}
}
- protected void commitTransaction(TopiaContext topiaContext) throws TopiaException {
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
try {
- topiaContext.commitTransaction();
+ topiaTransaction.commitTransaction();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
-
- protected TopiaContext beginTransaction() throws TopiaException {
- TopiaContext topiaContext;
- // basic check done, make check in database
- // TODO move it into JTA
- topiaContext = rootContext.beginTransaction();
- return topiaContext;
- }
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -276,20 +276,22 @@
}
protected TopiaContext beginTransaction() throws TopiaException {
- TopiaContext transaction;
// basic check done, make check in database
// TODO move it into JTA
- transaction = rootContext.beginTransaction();
- return transaction;
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
}
-
- protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
try {
- transaction.commitTransaction();
+ topiaTransaction.commitTransaction();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-27 15:16:22 UTC (rev 2915)
@@ -386,8 +386,11 @@
}
protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
TopiaContext topiaTransaction;
topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
return topiaTransaction;
}
@@ -398,6 +401,8 @@
if (log.isErrorEnabled()) {
log.error("Error during commit context", eee);
}
+ throw eee;
}
}
+
}
1
0
r2914 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by jpepin@users.chorem.org 27 May '10
by jpepin@users.chorem.org 27 May '10
27 May '10
Author: jpepin
Date: 2010-05-27 17:06:34 +0200 (Thu, 27 May 2010)
New Revision: 2914
Url: http://chorem.org/repositories/revision/lima/2914
Log:
Move begin transaction & commit in methods
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -95,9 +95,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// check if account number already exist
AccountDAO accountDAO =
@@ -119,8 +117,7 @@
accountDAO.update(masterAccount);
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -142,9 +139,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// check if the accountnumber already exist
AccountDAO accountDAO =
@@ -165,8 +160,7 @@
accountDAO.update(masterAccount);
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -191,7 +185,7 @@
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
@@ -218,7 +212,7 @@
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
@@ -256,7 +250,7 @@
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
@@ -299,7 +293,7 @@
public void removeAccount(Account account) throws LimaException {
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// Check rules
accountingRules.removeAccountRules(account, transaction);
@@ -313,8 +307,7 @@
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
accountDAO.delete(account);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
}
catch (TopiaException ex) {
@@ -333,7 +326,7 @@
public void removeAccountwithSubAccounts(Account account) throws LimaException{
TopiaContext transaction = null;
try{
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
List<Account> existingSubAccounts = getChildrenAccounts(account);
@@ -344,8 +337,7 @@
}
// remove account
accountDAO.delete(account);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -372,13 +364,12 @@
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// update account
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
accountDAO.update(account);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
if (log.isErrorEnabled()) {
@@ -387,4 +378,22 @@
throw new LimaException("Can't update account", ex);
}
}
+
+ protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ try {
+ transaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext transaction;
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+ return transaction;
+ }
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -89,9 +89,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// check if entrybook with is name already exist
EntryBookDAO entryBookDAO =
@@ -123,8 +121,7 @@
closedPeriodicEntryBookDAO.create(closedPeriodicEntryBook);
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -142,9 +139,7 @@
List<EntryBook> EntryBooksList = new ArrayList<EntryBook>();
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
// check if entrybook with is name already exist
EntryBookDAO EntryBookDAO =
@@ -152,8 +147,7 @@
List<EntryBook> EntryBooks = EntryBookDAO.findAll();
EntryBooksList.addAll(EntryBooks);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -174,9 +168,7 @@
public void updateEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
EntryBookDAO entryBookDAO =
LimaCallaoDAOHelper.getEntryBookDAO(transaction);
@@ -184,8 +176,7 @@
// creation du EntryBook
entryBookDAO.update(entryBook);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -208,9 +199,7 @@
TopiaContext topiaTransaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
//check
accountingRules.removeEntryBookRules(entryBook, topiaTransaction);
@@ -220,8 +209,7 @@
LimaCallaoDAOHelper.getEntryBookDAO(topiaTransaction);
EntryBookDAO.delete(entryBook);
- // commit
- topiaTransaction.commitTransaction();
+ commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
@@ -230,4 +218,22 @@
doFinally(topiaTransaction, log);
}
}
+
+ protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ try {
+ transaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext transaction;
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+ return transaction;
+ }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -89,9 +89,7 @@
TopiaContext topiaTransaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
createFinancialPeriodWithTransaction(financialPeriod, topiaTransaction);
}
@@ -110,9 +108,7 @@
public void createFinancialPeriodWithTransaction(FinancialPeriod financialPeriod, TopiaContext topiaContext) throws LimaException {
try {
- // basic check done, make check in database
- // TODO move it into JTA
-
+
FinancialPeriodDAO financialPeriodDAO =
LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
@@ -135,8 +131,7 @@
//create financial period
financialPeriodDAO.create(financialPeriod);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -153,16 +148,13 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.
getFinancialPeriodDAO(transaction);
result = financialPeriodDAO.findAll();
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -184,16 +176,13 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.
getFinancialPeriodDAO(transaction);
result = financialPeriodDAO.findAllByLocked(false);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -212,7 +201,7 @@
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FinancialPeriodDAO financialPeriodDAO =
LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
@@ -235,11 +224,12 @@
@Override
public ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod) throws LimaException {
- ClosedPeriodicEntryBook closedPeriodicEntryBook = new ClosedPeriodicEntryBookImpl();
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ new ClosedPeriodicEntryBookImpl();
TopiaContext topiaContext = null;
try {
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
@@ -269,7 +259,7 @@
TopiaContext topiaContext = null;
try {
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
//check rules before create the account
accountingRules.blockClosedPeriodicEntryBookRules(closedPeriodicEntryBook, topiaContext);
@@ -283,8 +273,7 @@
closedPeriodicEntryBook2.setLocked(true);
closedPeriodicEntryBookDAO.update(closedPeriodicEntryBook2);
- //commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -302,9 +291,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO
= LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction);
@@ -318,17 +305,20 @@
.addOrder(FiscalPeriod.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
//IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
- String loadEntryBookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK, EntryBook.LABEL);
+ String loadEntryBookProperty =
+ TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK,
+ EntryBook.LABEL);
query.addLoad(loadEntryBookProperty);
- String loadFinancialPeriodProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
+ String loadFinancialPeriodProperty =
+ TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
+ FinancialPeriod.BEGIN_DATE);
query.addLoad(loadFinancialPeriodProperty);
//call query
result = closedPeriodicEntryBookDAO.findAllByQuery(query);
log.debug(result);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -346,9 +336,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO
= LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction);
@@ -358,8 +346,7 @@
closedPeriodicEntryBook.getEntryBook().getLabel();
closedPeriodicEntryBook.getFinancialPeriod().getBeginDate();
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -369,7 +356,23 @@
}
return result;
}
+
+ protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ try {
+ transaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext topiaTransaction;
+ // basic check done, make check in database
+ // TODO move it into JTA
+ topiaTransaction = rootContext.beginTransaction();
+ return topiaTransaction;
+ }
-
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -90,9 +90,7 @@
TopiaContext topiaContext = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
//check if the financial period is blocked
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
@@ -103,8 +101,7 @@
financialtransactionDAO.create(financialtransaction);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -190,7 +187,6 @@
@Override
public List<FinancialTransaction> getAllFinancialTransactionsForFinancialPeriod(
FinancialPeriod period) throws LimaException {
- // TODO Auto-generated method stub
return getAllFinancialTransactionsForEntryBookAndFinancialPeriod(null, period);
}
@@ -203,7 +199,7 @@
List<FinancialTransaction> financialTransactions = null;
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
@@ -246,17 +242,17 @@
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
//check if the financial period is blocked
- accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction, topiaTransaction);
+ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
+ financialtransaction, topiaTransaction);
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
transactionDAO.update(financialtransaction);
- // commit
- topiaTransaction.commitTransaction();
+ commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
@@ -272,18 +268,18 @@
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
//check if the financial period is blocked
- accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction, topiaTransaction);
+ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
+ financialtransaction, topiaTransaction);
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
FinancialTransaction financialTransaction2 =
transactionDAO.findByTopiaId(financialtransaction.getTopiaId());
transactionDAO.delete(financialTransaction2);
- // commit
- topiaTransaction.commitTransaction();
+ commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
@@ -301,18 +297,16 @@
TopiaContext topiaContext = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
//check if the financial period is blocked
- accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(entry.getFinancialTransaction(), topiaContext);
+ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
+ entry.getFinancialTransaction(), topiaContext);
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext);
//delete
entryDAO.delete(entry);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -327,8 +321,7 @@
TopiaContext topiaContext = null;
try {
- // TODO move it into JTA
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext);
@@ -349,8 +342,7 @@
entryOld.setLettering(entry.getLettering());
//update
entryDAO.update(entryOld);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -372,19 +364,17 @@
TopiaContext topiaContext = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- topiaContext = rootContext.beginTransaction();
+ topiaContext = beginTransaction();
//check if the financial period is blocked
- accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(entry.getFinancialTransaction(), topiaContext);
+ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(
+ entry.getFinancialTransaction(), topiaContext);
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext);
entryDAO.create(entry);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -393,4 +383,22 @@
doFinally(topiaContext, log);
}
}
+
+ protected void commitTransaction(TopiaContext topiaContext) throws TopiaException {
+ try {
+ topiaContext.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext topiaContext;
+ // basic check done, make check in database
+ // TODO move it into JTA
+ topiaContext = rootContext.beginTransaction();
+ return topiaContext;
+ }
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -80,9 +80,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
//check rules before create the account
accountingRules.createFiscalPeriodRules(fiscalPeriod, transaction);
@@ -93,8 +91,7 @@
//create
fiscalPeriodDAO.create(fiscalPeriod);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -114,16 +111,13 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
result = fiscalPeriodDAO.findAll();
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -144,9 +138,7 @@
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -160,8 +152,7 @@
}
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -178,9 +169,7 @@
FiscalPeriod result = null;
TopiaContext transaction = null;
try {
- // basic check done, make check in database
- // TODO move it into JTA
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -215,7 +204,7 @@
//open transaction for check
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
if (fiscalPeriod.getLocked()==true){
throw new LimaBusinessException("Fiscal Period already blocked");
@@ -232,7 +221,7 @@
//open transaction for update
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -246,8 +235,7 @@
fiscalPeriodDAO.update(fiscalPeriod);
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
} catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -264,7 +252,7 @@
public void removeAllFiscalPeriods() throws LimaException{
TopiaContext transaction = null;
try {
- transaction = rootContext.beginTransaction();
+ transaction = beginTransaction();
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -277,8 +265,7 @@
fiscalPeriodDAO.delete(fiscalPeriod);
}
- // commit
- transaction.commitTransaction();
+ commitTransaction(transaction);
} catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -287,4 +274,23 @@
doFinally(transaction, log);
}
}
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext transaction;
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+ return transaction;
+ }
+
+ protected void commitTransaction(TopiaContext transaction) throws TopiaException {
+ try {
+ transaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-27 15:06:34 UTC (rev 2914)
@@ -73,7 +73,7 @@
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
reportsDatas =
generateAccountReportsWithTransaction(account, beginDate,
@@ -106,13 +106,16 @@
// First subaccount
List<Account> accounts = account.getSubAccounts();
if (accounts.size() == 0){
- reportsDatas = generateSubAccountReportsWithTransaction(account, beginDate, endDate, topiaContext);
+ reportsDatas = generateSubAccountReportsWithTransaction(account,
+ beginDate, endDate, topiaContext);
}
//Second many account
else {
List<Entry> entries = new ArrayList<Entry>();
for (Account subAccount : accounts) {
- ReportsDatas subReportsDatas = generateAccountReportsWithTransaction(subAccount, beginDate, endDate, topiaContext);
+ ReportsDatas subReportsDatas =
+ generateAccountReportsWithTransaction(subAccount,
+ beginDate,endDate, topiaContext);
debit += subReportsDatas.getAmountDebit();
credit += subReportsDatas.getAmountCredit();
entries.addAll(subReportsDatas.getListEntry());
@@ -196,8 +199,7 @@
reportsDatas.setAmountDebit(debit);
reportsDatas.setAmountSolde(solde);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -249,8 +251,7 @@
reportsDatas.setAmountDebit(debit);
reportsDatas.setAmountSolde(solde);
- // commit
- topiaContext.commitTransaction();
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -275,7 +276,7 @@
// Get all entries with a topia query
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
TopiaQuery query = entryDAO.createQuery("E");
String transactionDateProperty =
@@ -321,8 +322,7 @@
reportsDatas.setAmountDebit(debit);
reportsDatas.setAmountSolde(solde);
- // commit
- topiaTransaction.commitTransaction();
+ commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
doCatch(topiaTransaction, ex, log);
@@ -348,11 +348,13 @@
TopiaContext topiaTransaction = null;
try {
- topiaTransaction = rootContext.beginTransaction();
+ topiaTransaction = beginTransaction();
//for each account create a balance sheet with a ReportsDatas
for (Account account : accountService.getAllSubAccounts()) {
- ReportsDatas reportsDatas = generateSubAccountBalanceWithTransaction(account, beginDate, endDate, topiaTransaction);
+ ReportsDatas reportsDatas =
+ generateSubAccountBalanceWithTransaction(account, beginDate,
+ endDate, topiaTransaction);
reportsDatas.setAccount(account);
// add balance sheet to balance trial
balanceTrial.addReportsDatas(reportsDatas);
@@ -382,4 +384,20 @@
return balanceTrial;
}
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
+ try {
+ topiaTransaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ }
+ }
}
1
0
r2913 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/financialperiod
by jpepin@users.chorem.org 27 May '10
by jpepin@users.chorem.org 27 May '10
27 May '10
Author: jpepin
Date: 2010-05-27 16:36:34 +0200 (Thu, 27 May 2010)
New Revision: 2913
Url: http://chorem.org/repositories/revision/lima/2913
Log:
D?\195?\169boguage cr?\195?\169ation des p?\195?\169riodes financi?\195?\168res lors de la cr?\195?\169ation d'un exercice
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-05-27 10:42:24 UTC (rev 2912)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-05-27 14:36:34 UTC (rev 2913)
@@ -54,6 +54,8 @@
List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws LimaException;
+ List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException;
+
ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook,
FinancialPeriod financialPeriod) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-27 10:42:24 UTC (rev 2912)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-27 14:36:34 UTC (rev 2913)
@@ -129,9 +129,6 @@
"The ante fiscal period is not locked");
}
}
-
- Date beginDate = fiscalPeriod.getBeginDate();
- Date endDate = fiscalPeriod.getEndDate();
FinancialPeriodService financialPeriodService = (FinancialPeriodService) map.get(FinancialPeriodService.class);
if (financialPeriodService == null){
@@ -139,39 +136,26 @@
}
// FinancialPeriods of 1 month are created
- Date loopDate = beginDate;
- while (loopDate.before(endDate)) {
+ Date endDate = fiscalPeriod.getEndDate();
+ Date loopDate = fiscalPeriod.getBeginDate();
+ while(loopDate.before(endDate)){
FinancialPeriod financialPeriod = new FinancialPeriodImpl();
- Date periodBeginDate = new Date();
- Date periodEndDate = new Date();
- // if first period dd/mm/yy to 31/mm/yy
- if (loopDate.equals(beginDate)){
- //dd/mm/yy
- periodBeginDate = beginDate;
- //31/mm/yy
- periodEndDate = DateUtils.addMonths(loopDate, 1);
- periodEndDate = DateUtils.truncate(periodEndDate, Calendar.MONTH);
- periodEndDate = DateUtils.addMilliseconds(periodEndDate, -1);
- } else {
- //other period 01/mm/yy to 31/mm/yy
- periodBeginDate = DateUtils.truncate(loopDate, Calendar.MONTH);
- periodEndDate = DateUtils.addMonths(loopDate, 1);
- periodEndDate = DateUtils.truncate(periodEndDate, Calendar.MONTH);
- periodEndDate = DateUtils.addMilliseconds(periodEndDate, -1);
+ financialPeriod.setBeginDate(loopDate);
+ loopDate = DateUtils.addMonths(loopDate, 1);
+ loopDate = DateUtils.truncate(loopDate, Calendar.MONTH);
+ loopDate = DateUtils.addMilliseconds(loopDate, -1);
+ if (loopDate.after(endDate)){
+ financialPeriod.setEndDate(endDate);
}
- //set period
- financialPeriod.setBeginDate(periodBeginDate);
- financialPeriod.setEndDate(periodEndDate);
+ else {
+ financialPeriod.setEndDate(loopDate);
+ }
//create it
+ fiscalPeriod.addFinancialPeriod(financialPeriod);
financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
- //incremente loop
- loopDate = DateUtils.addMonths(loopDate, 1);
+ //loop incremente
+ loopDate = DateUtils.addMilliseconds(loopDate, 1);
}
- //create last period 01/mm/yy to dd/mm/yy
- FinancialPeriod financialPeriod = new FinancialPeriodImpl();
- financialPeriod.setBeginDate(DateUtils.truncate(loopDate, Calendar.MONTH));
- financialPeriod.setEndDate(endDate);
- financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 10:42:24 UTC (rev 2912)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 14:36:34 UTC (rev 2913)
@@ -311,18 +311,21 @@
//Get closedperiodicentrybook from unlocked fiscalperiod
TopiaQuery query = closedPeriodicEntryBookDAO.createQuery("E");
- //IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
- String loadEntryBookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK, EntryBook.LABEL);
- query.addLoad(loadEntryBookProperty);
- String loadFinancialPeriodProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
- query.addLoad(loadFinancialPeriodProperty);
query.addFrom(FiscalPeriod.class, "F")
.addInElements("E." + ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
"F."+FiscalPeriod.FINANCIAL_PERIOD)
.add("F."+FiscalPeriod.LOCKED, Boolean.FALSE)
.addOrder(FiscalPeriod.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
+ //IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
+ String loadEntryBookProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.ENTRY_BOOK, EntryBook.LABEL);
+ query.addLoad(loadEntryBookProperty);
+ String loadFinancialPeriodProperty = TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE);
+ query.addLoad(loadFinancialPeriodProperty);
+
+ //call query
result = closedPeriodicEntryBookDAO.findAllByQuery(query);
+ log.debug(result);
// commit
transaction.commitTransaction();
@@ -336,6 +339,36 @@
return result;
}
+
+ @Override
+ public List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException {
+ List<ClosedPeriodicEntryBook> result = null;
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO
+ = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction);
+
+ result=closedPeriodicEntryBookDAO.findAll();
+ for (ClosedPeriodicEntryBook closedPeriodicEntryBook : result) {
+ closedPeriodicEntryBook.getEntryBook().getLabel();
+ closedPeriodicEntryBook.getFinancialPeriod().getBeginDate();
+ }
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ return result;
+ }
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-27 10:42:24 UTC (rev 2912)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-27 14:36:34 UTC (rev 2913)
@@ -170,8 +170,8 @@
List<ClosedPeriodicEntryBook> results =
new ArrayList<ClosedPeriodicEntryBook>();
try {
- results = financialPeriodService.
- getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod();
+ results = financialPeriodService.//getAllClosedPeriodicEntryBooks();
+ getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod();
} catch (LimaException eee){
if (log.isDebugEnabled()){
log.debug("Can't get closedperiodicentrybook list", eee );
1
0
27 May '10
Author: jpepin
Date: 2010-05-27 12:42:24 +0200 (Thu, 27 May 2010)
New Revision: 2912
Url: http://chorem.org/repositories/revision/lima/2912
Log:
Correction cr?\195?\169ation des p?\195?\169riodes financi?\195?\168res lors de la cr?\195?\169ation d'un exercice.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -1,8 +1,10 @@
package org.chorem.lima.business.accountingrules;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -104,9 +106,7 @@
if (fiscalPeriodDAO.findAll().size()!=0){
TopiaQuery query = fiscalPeriodDAO.createQuery();
- fiscalPeriodDAO.findAllByQuery(query);
- query.addOrderDesc(FiscalPeriod.END_DATE);
-
+ query.addOrderDesc(FiscalPeriod.END_DATE);
//get the last fiscal period
FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.findByQuery(query);
@@ -138,18 +138,40 @@
financialPeriodService = new FinancialPeriodServiceImpl();
}
- // FinancialPeriod of 1 month are created
+ // FinancialPeriods of 1 month are created
Date loopDate = beginDate;
- while (loopDate.compareTo(endDate) <= 0) {
- Date loopUpperDate = DateUtils.addMonths(loopDate, 1);
- Date periodEndDate = DateUtils.addMilliseconds(loopUpperDate, -1);
+ while (loopDate.before(endDate)) {
FinancialPeriod financialPeriod = new FinancialPeriodImpl();
- financialPeriod.setBeginDate(loopDate);
+ Date periodBeginDate = new Date();
+ Date periodEndDate = new Date();
+ // if first period dd/mm/yy to 31/mm/yy
+ if (loopDate.equals(beginDate)){
+ //dd/mm/yy
+ periodBeginDate = beginDate;
+ //31/mm/yy
+ periodEndDate = DateUtils.addMonths(loopDate, 1);
+ periodEndDate = DateUtils.truncate(periodEndDate, Calendar.MONTH);
+ periodEndDate = DateUtils.addMilliseconds(periodEndDate, -1);
+ } else {
+ //other period 01/mm/yy to 31/mm/yy
+ periodBeginDate = DateUtils.truncate(loopDate, Calendar.MONTH);
+ periodEndDate = DateUtils.addMonths(loopDate, 1);
+ periodEndDate = DateUtils.truncate(periodEndDate, Calendar.MONTH);
+ periodEndDate = DateUtils.addMilliseconds(periodEndDate, -1);
+ }
+ //set period
+ financialPeriod.setBeginDate(periodBeginDate);
financialPeriod.setEndDate(periodEndDate);
- fiscalPeriod.addFinancialPeriod(financialPeriod);
- loopDate = loopUpperDate;
+ //create it
financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
+ //incremente loop
+ loopDate = DateUtils.addMonths(loopDate, 1);
}
+ //create last period 01/mm/yy to dd/mm/yy
+ FinancialPeriod financialPeriod = new FinancialPeriodImpl();
+ financialPeriod.setBeginDate(DateUtils.truncate(loopDate, Calendar.MONTH));
+ financialPeriod.setEndDate(endDate);
+ financialPeriodService.createFinancialPeriodWithTransaction(financialPeriod, transaction);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -185,7 +185,6 @@
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
TopiaQuery query = fiscalPeriodDAO.createQuery();
- fiscalPeriodDAO.findAllByQuery(query);
query.addOrderDesc(FiscalPeriod.END_DATE);
//get the last fiscal period
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxRenderer.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -21,6 +21,7 @@
import static org.nuiton.i18n.I18n._;
import java.awt.Component;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -40,21 +41,13 @@
boolean isSelected,
boolean cellHasFocus) {
// TODO Auto-generated method stub
-
- String[] monthName = {_("lima.date.january"), _("lima.date.february"),
- _("lima.date.march"), _("lima.date.april"), _("lima.date.may"),
- _("lima.date.june"), _("lima.date.july"), _("lima.date.august"),
- _("lima.date.september"), _("lima.date.october"),
- _("lima.date.november"), _("lima.date.december")};
JLabel label = new JLabel();
- FinancialPeriod financialperiod = (FinancialPeriod) value;
- if (financialperiod != null){
- Date d = financialperiod.getBeginDate();
- Calendar beginDate = Calendar.getInstance();
- beginDate.setTime(d);
- int year = beginDate.get(Calendar.YEAR);
- label.setText(monthName[beginDate.get(Calendar.MONTH)]+" "+String.valueOf(year));
+ FinancialPeriod financialPeriod = (FinancialPeriod) value;
+ if (financialPeriod != null){
+ SimpleDateFormat simpleDateFormat
+ = new SimpleDateFormat("dd MMM yy");
+ label.setText(simpleDateFormat.format(financialPeriod.getBeginDate())+" - "+simpleDateFormat.format(financialPeriod.getEndDate()));
}
return label;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxRenderer.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -19,6 +19,7 @@
package org.chorem.lima.ui.combobox;
import java.awt.Component;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -41,12 +42,11 @@
JLabel label = new JLabel();
FiscalPeriod fiscalPeriod = (FiscalPeriod) value;
- if (fiscalPeriod != null){
- Date d = fiscalPeriod.getBeginDate();
- Calendar beginDate = Calendar.getInstance();
- beginDate.setTime(d);
- int date = beginDate.get(Calendar.YEAR);
- label.setText(String.valueOf(date));
+ if (fiscalPeriod != null){
+ SimpleDateFormat simpleDateFormat =
+ new SimpleDateFormat("dd MMM yy");
+ label.setText(simpleDateFormat.format(fiscalPeriod.getBeginDate())
+ + " - " + simpleDateFormat.format(fiscalPeriod.getEndDate()));
}
return label;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -144,12 +144,11 @@
closedPeriodicEntryBook.getFinancialPeriod();
SimpleDateFormat simpleDateFormat
- = new SimpleDateFormat("MMMMM yyyy");
+ = new SimpleDateFormat("dd MMM yyyy");
switch (columnIndex) {
case 0:
- result = StringUtils.capitalize(simpleDateFormat.
- format(financialPeriod.getBeginDate()));
+ result = simpleDateFormat.format(financialPeriod.getBeginDate())+" - "+simpleDateFormat.format(financialPeriod.getEndDate());
break;
case 1:
result = entryBook.getCode()+" - "+entryBook.getLabel();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-05-27 10:42:24 UTC (rev 2912)
@@ -50,6 +50,7 @@
// get end date
Calendar calendarEnd = Calendar.getInstance();
endDate = DateUtils.addYears(beginDate, 1);
+ endDate = DateUtils.addDays(endDate, -1);
getEndDatePicker().setDate(endDate);
protected void performOk() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-27 09:26:39 UTC (rev 2911)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-27 10:42:24 UTC (rev 2912)
@@ -145,14 +145,14 @@
FiscalPeriod fiscalPeriod = periods.get(rowIndex);
if (fiscalPeriod != null){
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMMM yyyy");
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
switch (columnIndex) {
case 0:
- result = StringUtils.capitalize(simpleDateFormat.
- format(fiscalPeriod.getBeginDate()))
- + " - " + StringUtils.capitalize(simpleDateFormat.
- format(fiscalPeriod.getEndDate()));
+ result = simpleDateFormat.
+ format(fiscalPeriod.getBeginDate())
+ + " - " + simpleDateFormat.
+ format(fiscalPeriod.getEndDate());
break;
case 1:
if(fiscalPeriod.getLocked()){
1
0
Author: echatellier
Date: 2010-05-27 11:26:39 +0200 (Thu, 27 May 2010)
New Revision: 2911
Url: http://chorem.org/repositories/revision/lima/2911
Log:
Update jaxx (fix mvn3 compilation)
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-26 18:37:42 UTC (rev 2910)
+++ trunk/pom.xml 2010-05-27 09:26:39 UTC (rev 2911)
@@ -243,7 +243,7 @@
<nuiton-utils.version>1.2.2</nuiton-utils.version>
<eugene.version>2.0.2-SNAPSHOT</eugene.version>
<topia.version>2.4-SNAPSHOT</topia.version>
- <jaxx.version>2.0.1</jaxx.version>
+ <jaxx.version>2.0.2</jaxx.version>
<i18n.version>1.2.2</i18n.version>
<!--axis.version>1.4.1</axis.version-->
1
0
r2910 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model
by jpepin@users.chorem.org 26 May '10
by jpepin@users.chorem.org 26 May '10
26 May '10
Author: jpepin
Date: 2010-05-26 20:37:42 +0200 (Wed, 26 May 2010)
New Revision: 2910
Url: http://chorem.org/repositories/revision/lima/2910
Log:
Cr?\195?\169ation d'exercice : s?\195?\169lection de la date au jour pr?\195?\168s
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java 2010-05-26 15:14:58 UTC (rev 2909)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java 2010-05-26 18:37:42 UTC (rev 2910)
@@ -37,6 +37,8 @@
List<FiscalPeriod> getAllFiscalPeriods() throws LimaException;
List<FiscalPeriod> getAllUnblockedFiscalPeriods() throws LimaException;
+
+ FiscalPeriod getLastFiscalPeriod() throws LimaException;
void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-26 15:14:58 UTC (rev 2909)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-05-26 18:37:42 UTC (rev 2910)
@@ -41,6 +41,7 @@
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.framework.TopiaQuery;
/**
@@ -172,6 +173,35 @@
return result;
}
+ @Override
+ public FiscalPeriod getLastFiscalPeriod() throws LimaException {
+ FiscalPeriod result = null;
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ FiscalPeriodDAO fiscalPeriodDAO =
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+ TopiaQuery query = fiscalPeriodDAO.createQuery();
+ fiscalPeriodDAO.findAllByQuery(query);
+ query.addOrderDesc(FiscalPeriod.END_DATE);
+
+ //get the last fiscal period
+ result = fiscalPeriodDAO.findByQuery(query);
+
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return result;
+ }
+
/**
* to block a fiscal period
*
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-05-26 15:14:58 UTC (rev 2909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2010-05-26 18:37:42 UTC (rev 2910)
@@ -15,15 +15,42 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##% -->
<JDialog modal="true">
-
+ <org.chorem.lima.ui.fiscalperiod.model.FiscalPeriodTableModel id="modelFiscalPeriodTable"/>
<script>
<![CDATA[
- import org.nuiton.util.MonthEnum;
+ import org.chorem.lima.entity.FiscalPeriod;
+ import org.chorem.lima.business.FiscalPeriodService;
+ import org.chorem.lima.service.LimaServiceFactory;
+ import org.chorem.lima.business.LimaException;
+ import org.apache.commons.lang.time.DateUtils;
import org.chorem.lima.entity.FiscalPeriodImpl;
- import org.chorem.lima.ui.fiscalperiod.model.FiscalPeriodMonthComboBoxModel;
- import org.chorem.lima.ui.fiscalperiod.model.FiscalPeriodSplinnerModel;
- import org.apache.commons.lang.time.DateUtils;
- import java.util.Calendar;
+
+ protected FiscalPeriodService fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService();
+
+ // set begin date picker
+ Date endDate = null;
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.DATE);
+ try {
+ FiscalPeriod result = fiscalPeriodService.getLastFiscalPeriod();
+ if (result != null){
+ beginDate = result.getEndDate();
+ }
+ }
+ catch (LimaException eee){
+ if(log.isDebugEnabled()){
+ log.debug("Can't get last fiscal period", eee);
+ }
+ }
+ beginDate = DateUtils.addDays(beginDate, 1);
+ getBeginDatePicker().setDate(beginDate);
+
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ endDate = DateUtils.addYears(beginDate, 1);
+ getEndDatePicker().setDate(endDate);
protected void performOk() {
if (period == null) {
@@ -32,26 +59,17 @@
}
// get begin date
- Calendar calendarBegin = Calendar.getInstance();
- calendarBegin.set(Calendar.MONTH, ((MonthEnum)periodBeginMonth.getSelectedItem()).ordinal());
- calendarBegin.set(Calendar.YEAR, (Integer)periodBeginYear.getValue());
- // set begindate to 0:00.000
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.MONTH);
+ beginDate = beginDatePicker.getDate();
+ // set begindate to 0:00.000
+ beginDate = DateUtils.truncate(beginDate, Calendar.DATE);
// get end date
- Calendar calendarEnd = Calendar.getInstance();
- calendarEnd.set(Calendar.MONTH, ((MonthEnum)periodEndMonth.getSelectedItem()).ordinal());
- calendarEnd.set(Calendar.YEAR, (Integer)periodEndYear.getValue());
- //set end date to last day of month
- calendarEnd.set(Calendar.DAY_OF_MONTH, calendarEnd.getActualMaximum(Calendar.DAY_OF_MONTH));
+ endDate = endDatePicker.getDate();
//set time to max 23:59.999
- Date endDate = calendarEnd.getTime();
endDate = DateUtils.addDays(endDate, 1);
- endDate = DateUtils.truncate(endDate, Calendar.MONTH);
+ endDate = DateUtils.truncate(endDate, Calendar.DATE);
endDate = DateUtils.addMilliseconds(endDate,-1);
-
getPeriod().setBeginDate(beginDate);
getPeriod().setEndDate(endDate);
@@ -73,22 +91,16 @@
<JLabel text="lima.period.begindate"/>
</cell>
<cell>
- <JComboBox id="periodBeginMonth" model="{new FiscalPeriodMonthComboBoxModel(MonthEnum.JANUARY)}"/>
+ <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"/>
</cell>
- <cell>
- <JSpinner id="periodBeginYear" model="{new FiscalPeriodSplinnerModel()}"/>
- </cell>
</row>
<row>
<cell>
<JLabel text="lima.period.enddate"/>
</cell>
<cell>
- <JComboBox id="periodEndMonth" model="{new FiscalPeriodMonthComboBoxModel(MonthEnum.DECEMBER)}"/>
+ <org.jdesktop.swingx.JXDatePicker id="endDatePicker"/>
</cell>
- <cell>
- <JSpinner id="periodEndYear" model="{new FiscalPeriodSplinnerModel()}"/>
- </cell>
</row>
<row>
<cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2010-05-26 15:14:58 UTC (rev 2909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2010-05-26 18:37:42 UTC (rev 2910)
@@ -64,6 +64,7 @@
addPeriodDialog.setVisible(true);
FiscalPeriod fiscalPeriod = addPeriodDialog.getPeriod();
+ log.debug(fiscalPeriod);
// null = cancel
if (fiscalPeriod!= null) {
//check if fiscalperiod have 12 months, ask a confirmation
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-26 15:14:58 UTC (rev 2909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/model/FiscalPeriodTableModel.java 2010-05-26 18:37:42 UTC (rev 2910)
@@ -60,7 +60,7 @@
*/
@Override
public int getRowCount() {
-
+
int result = 0;
try {
result = fiscalPeriodService.getAllFiscalPeriods().size();
@@ -114,7 +114,6 @@
return result;
}
-
/*
* @see javax.swing.table.TableModel#getColumnClass(int)
*/
1
0
r2909 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/balance
by jpepin@users.chorem.org 26 May '10
by jpepin@users.chorem.org 26 May '10
26 May '10
Author: jpepin
Date: 2010-05-26 17:14:58 +0200 (Wed, 26 May 2010)
New Revision: 2909
Url: http://chorem.org/repositories/revision/lima/2909
Log:
Optimisation requ?\195?\170te cacul balance et ?\195?\169ditions journaux.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-26 12:59:22 UTC (rev 2908)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-26 15:14:58 UTC (rev 2909)
@@ -35,7 +35,6 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
@@ -54,6 +53,9 @@
private TopiaContext rootContext;
+ protected AccountServiceImpl accountService =
+ new AccountServiceImpl();
+
public ReportServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
try {
@@ -88,6 +90,7 @@
}
/**
+ * Recursiv
* List entries for a period and an account
* Calculate the amounts
* Two case:
@@ -128,7 +131,9 @@
return reportsDatas;
}
-
+ /**
+ * Query for find entries for accountsreports and balancereports
+ */
public TopiaQuery createEntryQuery(Account account, Date beginDate, Date endDate, EntryDAO entryDAO, String queryAlias) throws LimaException{
TopiaQuery query = entryDAO.createQuery(queryAlias);
@@ -143,55 +148,115 @@
return query;
}
+ /**
+ * Get list entries
+ * Calculate all credit, debit and solde amounts for the accounts reports
+ */
public ReportsDatas generateSubAccountReportsWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException {
ReportsDatas reportsDatas = new ReportsDatasImpl();
double credit = 0, debit = 0, solde = 0;
List<Object[]> results = new ArrayList<Object[]>();
String queryAlias = "E";
- try {
- EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaContext);
- TopiaQuery entriesQuery =
- createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
- //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entriesQuery.addLoad(Entry.ENTRY_BOOK, Entry.FINANCIAL_TRANSACTION);
- reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
-
- TopiaQuery amountsQuery =
- createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
- amountsQuery.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
- amountsQuery.addGroup("E."+Entry.DEBIT);
- results = amountsQuery.execute();
- int nbAmount = results.size();
- if(nbAmount==2){
- debit = (Double)results.get(0)[1];
- credit = (Double)results.get(1)[1];
+ if (beginDate != null && endDate != null){
+ try {
+ EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaContext);
+ TopiaQuery entriesQuery =
+ createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
+ //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
+ entriesQuery.addLoad(Entry.ENTRY_BOOK, Entry.FINANCIAL_TRANSACTION);
+ reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
+
+ TopiaQuery amountsQuery =
+ createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
+ amountsQuery.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
+ amountsQuery.addGroup("E."+Entry.DEBIT);
+ results = amountsQuery.execute();
+ int nbAmount = results.size();
+ if(nbAmount==2){
+ debit = (Double)results.get(0)[1];
+ credit = (Double)results.get(1)[1];
+ }
+ if (nbAmount==1){
+ if ((Boolean)results.get(0)[0]){
+ debit = (Double)results.get(0)[1];
+ }
+ else {
+ credit = (Double)results.get(0)[1];
+ }
+ }
+
+ // set the amounts and solde
+ solde = debit - credit;
+ if (solde > 0){
+ reportsDatas.setSoldeDebit(true);
+ }
+ solde = Math.abs(solde);
+
+ reportsDatas.setAmountCredit(credit);
+ reportsDatas.setAmountDebit(debit);
+ reportsDatas.setAmountSolde(solde);
+
+ // commit
+ topiaContext.commitTransaction();
}
- if (nbAmount==1){
- if ((Boolean)results.get(0)[0]){
- debit = (Double)results.get(0)[1];
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+ }
+
+ return reportsDatas;
+ }
+
+ /**
+ * Calculate all credit, debit and solde amounts for the balance
+ */
+ public ReportsDatas generateSubAccountBalanceWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException {
+ ReportsDatas reportsDatas = new ReportsDatasImpl();
+ double credit = 0, debit = 0, solde = 0;
+ List<Object[]> results = new ArrayList<Object[]>();
+ String queryAlias = "E";
+ if (beginDate != null && endDate != null){
+ try {
+ EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaContext);
+
+ TopiaQuery amountsQuery =
+ createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
+ amountsQuery.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
+ amountsQuery.addGroup("E."+Entry.DEBIT);
+ results = amountsQuery.execute();
+ int nbAmount = results.size();
+ if(nbAmount==2){
+ debit = (Double)results.get(0)[1];
+ credit = (Double)results.get(1)[1];
}
- else {
- credit = (Double)results.get(0)[1];
+ if (nbAmount==1){
+ if ((Boolean)results.get(0)[0]){
+ debit = (Double)results.get(0)[1];
+ }
+ else {
+ credit = (Double)results.get(0)[1];
+ }
}
+
+ // set the amounts and solde
+ solde = debit - credit;
+ if (solde > 0){
+ reportsDatas.setSoldeDebit(true);
+ }
+ solde = Math.abs(solde);
+
+ reportsDatas.setAmountCredit(credit);
+ reportsDatas.setAmountDebit(debit);
+ reportsDatas.setAmountSolde(solde);
+
+ // commit
+ topiaContext.commitTransaction();
}
-
- // set the amounts and solde
- solde = debit - credit;
- if (solde > 0){
- reportsDatas.setSoldeDebit(true);
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
}
- solde = Math.abs(solde);
-
- reportsDatas.setAmountCredit(credit);
- reportsDatas.setAmountDebit(debit);
- reportsDatas.setAmountSolde(solde);
-
- // commit
- topiaContext.commitTransaction();
}
- catch (TopiaException ex) {
- doCatch(topiaContext, ex, log);
- }
+
return reportsDatas;
}
@@ -205,64 +270,67 @@
public ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException {
ReportsDatas reportsDatas = new ReportsDatasImpl();
double credit = 0, debit = 0, solde = 0;
-
- // Get all entries with a topia query
- TopiaContext topiaTransaction = null;
- try {
- topiaTransaction = rootContext.beginTransaction();
- EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
- TopiaQuery query = entryDAO.createQuery();
-
- if (entryBook != null) {
- query
- .add(Entry.ENTRY_BOOK, entryBook);
- }
- if (beginDate != null && endDate != null){
+ List<Object[]> results = new ArrayList<Object[]>();
+ if (entryBook != null && beginDate != null && endDate != null){
+ // Get all entries with a topia query
+ TopiaContext topiaTransaction = null;
+ try {
+ topiaTransaction = rootContext.beginTransaction();
+ EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
+ TopiaQuery query = entryDAO.createQuery("E");
String transactionDateProperty =
TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
FinancialTransaction.TRANSACTION_DATE);
- query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
+ query.add(Entry.ENTRY_BOOK, entryBook)
+ .add(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
.addParam("beginDate", beginDate)
.addParam("endDate", endDate);
- String orderProperty =
+ /*String orderProperty =
TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
FinancialTransaction.TRANSACTION_DATE);
- query.addOrder(orderProperty);
- }
- reportsDatas.setListEntry(entryDAO.findAllByQuery(query));
-
- for (Entry entry : reportsDatas.getListEntry()) {
+ query.addOrder(orderProperty);*/
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entry.getAccount();
- entry.getFinancialTransaction().getTransactionDate();
- //calulate the amounts
- if (entry.getDebit()) {
- debit += entry.getAmount();
+ query.addLoad(Entry.ACCOUNT, Entry.FINANCIAL_TRANSACTION);
+ reportsDatas.setListEntry(entryDAO.findAllByQuery(query));
+
+ query.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
+ query.addGroup("E."+Entry.DEBIT);
+ results = query.execute();
+ int nbAmount = results.size();
+ if(nbAmount==2){
+ debit = (Double)results.get(0)[1];
+ credit = (Double)results.get(1)[1];
}
- else {
- credit += entry.getAmount();
+ if (nbAmount==1){
+ if ((Boolean)results.get(0)[0]){
+ debit = (Double)results.get(0)[1];
+ }
+ else {
+ credit = (Double)results.get(0)[1];
+ }
}
+
+ // set the amounts and solde
+ solde = debit - credit;
+ if (solde > 0){
+ reportsDatas.setSoldeDebit(true);
+ }
+ solde = Math.abs(solde);
+
+ reportsDatas.setAmountCredit(credit);
+ reportsDatas.setAmountDebit(debit);
+ reportsDatas.setAmountSolde(solde);
+
+ // commit
+ topiaTransaction.commitTransaction();
}
-
- // set the amounts and solde
- solde = debit - credit;
- if (solde > 0){
- reportsDatas.setSoldeDebit(true);
+ catch (TopiaException ex) {
+ doCatch(topiaTransaction, ex, log);
}
- solde = Math.abs(solde);
- reportsDatas.setAmountCredit(credit);
- reportsDatas.setAmountDebit(debit);
- reportsDatas.setAmountSolde(solde);
-
- // commit
- topiaTransaction.commitTransaction();
+ finally {
+ doFinally(topiaTransaction, log);
+ }
}
- catch (TopiaException ex) {
- doCatch(topiaTransaction, ex, log);
- }
- finally {
- doFinally(topiaTransaction, log);
- }
return reportsDatas;
}
@@ -270,29 +338,21 @@
/**
* Get balance trial
*
- * Calculate the amounts and the solde
+ * Calculate the amounts and the solde for all subaccounts
*/
@Override
public BalanceTrial generateBalanceTrial(Date beginDate, Date endDate) throws LimaException {
BalanceTrial balanceTrial = new BalanceTrialImpl();
balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>());
double credit = 0, debit = 0, solde = 0;
- List<Account> accountsList = new ArrayList<Account>();
TopiaContext topiaTransaction = null;
try {
topiaTransaction = rootContext.beginTransaction();
- //Get All account
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(topiaTransaction);
- List<Account> accounts = accountDAO.findAll();
- accountsList.addAll(accounts);
-
//for each account create a balance sheet with a ReportsDatas
- for (Account account : accounts) {
- ReportsDatas reportsDatas =
- generateAccountReportsWithTransaction(account, beginDate, endDate, topiaTransaction);
+ for (Account account : accountService.getAllSubAccounts()) {
+ ReportsDatas reportsDatas = generateSubAccountBalanceWithTransaction(account, beginDate, endDate, topiaTransaction);
reportsDatas.setAccount(account);
// add balance sheet to balance trial
balanceTrial.addReportsDatas(reportsDatas);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-05-26 12:59:22 UTC (rev 2908)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-05-26 15:14:58 UTC (rev 2909)
@@ -178,17 +178,13 @@
}
public void setBeginDate(Date date){
- log.debug("setBeginDate");
selectedBeginDate = date;
- log.debug(selectedBeginDate);
cacheDataList=getDataList();
fireTableDataChanged();
}
public void setEndDate(Date date){
- log.debug("setEndDate");
selectedEndDate = date;
- log.debug(selectedEndDate);
cacheDataList=getDataList();
fireTableDataChanged();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-05-26 12:59:22 UTC (rev 2908)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-05-26 15:14:58 UTC (rev 2909)
@@ -185,7 +185,7 @@
* @return
*/
public BalanceTrial getDataList(){
- BalanceTrial results = new BalanceTrialImpl();
+ BalanceTrial results = null;
try {
results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-05-26 12:59:22 UTC (rev 2908)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-05-26 15:14:58 UTC (rev 2909)
@@ -30,16 +30,16 @@
Calendar calendarBegin = Calendar.getInstance();
// set begindate to JAN 1 - 0:00.000 of this years
Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- getModelBalanceTable().setBeginDate(beginDate);
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
// get end date
Calendar calendarEnd = Calendar.getInstance();
Date endDate = calendarEnd.getTime();
- getModelBalanceTable().setEndDate(endDate);
getBeginDatePicker().setDate(beginDate);
getEndDatePicker().setDate(endDate);
+ getModelBalanceTable().setBeginDate(beginDate);
+ getModelBalanceTable().setEndDate(endDate);
void $afterCompleteSetup() {
getHandler().updateFooterLabel();
1
0