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
June 2010
- 4 participants
- 37 discussions
r2925 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by jpepin@users.chorem.org 02 Jun '10
by jpepin@users.chorem.org 02 Jun '10
02 Jun '10
Author: jpepin
Date: 2010-06-02 12:54:31 +0200 (Wed, 02 Jun 2010)
New Revision: 2925
Url: http://chorem.org/repositories/revision/lima/2925
Log:
Modification de l'UI : s?\195?\169lection automatique de ligne apr?\195?\168s ajout/suppression de transactions ou entr?\195?\169es.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-02 10:31:20 UTC (rev 2924)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-02 10:54:31 UTC (rev 2925)
@@ -22,6 +22,7 @@
import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -61,6 +62,11 @@
try {
model.addFinancialTransaction();
+ //select the new line
+ int numberRow = table.getRowCount();
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(numberRow-1, numberRow-1);
} catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't add financialtransaction", ex);
@@ -84,6 +90,10 @@
Object selectedValue = model.getElementAt(indexSelectedRow);
try {
model.addEmptyEntry(selectedValue, indexSelectedRow);
+ //select the new line
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(indexSelectedRow+1, indexSelectedRow+1);
} catch (LimaException ex){
if (log.isErrorEnabled()) {
log.error("Can't add emptyentry", ex);
@@ -131,6 +141,10 @@
try {
model.removeObject(selectedValue, indexSelectedRow);
+ //select the upper line
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(indexSelectedRow-1, indexSelectedRow-1);
} catch (LimaException ex) {
if (log.isErrorEnabled()) {
log.error("Can't remove transaction or entry", ex);
1
0
Author: tchemit
Date: 2010-06-02 12:31:20 +0200 (Wed, 02 Jun 2010)
New Revision: 2924
Url: http://chorem.org/repositories/revision/lima/2924
Log:
Utilisation de mavenpom4redmine 2.1.5
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-02 10:30:13 UTC (rev 2923)
+++ trunk/pom.xml 2010-06-02 10:31:20 UTC (rev 2924)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.1.3</version>
+ <version>2.1.5</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: jpepin
Date: 2010-06-02 12:30:13 +0200 (Wed, 02 Jun 2010)
New Revision: 2923
Url: http://chorem.org/repositories/revision/lima/2923
Log:
Ajout d'interface DAO sur account et financial period. Suppression de m?\195?\169thodes inutiles et nettoyage du code dans les services. Utilisation des nouveaux DAO. Modification de m?\195?\169thodes d?\195?\169preci?\195?\169es.
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountComparator.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.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/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/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
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
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/FinancialTransactionUnbalancedTableModel.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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,9 +20,7 @@
package org.chorem.lima.business;
import java.util.List;
-
import javax.ejb.Remote;
-
import org.chorem.lima.entity.Account;
/**
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,8 +20,6 @@
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;
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,9 +20,7 @@
package org.chorem.lima.business;
import java.util.List;
-
import javax.ejb.Remote;
-
import org.chorem.lima.entity.EntryBook;
/**
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -19,15 +19,11 @@
package org.chorem.lima.business;
-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;
-import org.nuiton.topia.TopiaContext;
/**
* Financial period service.
@@ -41,23 +37,17 @@
@Remote
public interface FinancialPeriodService {
-
- List<FinancialPeriod> getAllFinancialPeriods() throws LimaException;
List<FinancialPeriod> getUnblockedFinancialPeriods() throws LimaException;
void createFinancialPeriods(List<FinancialPeriod> financialPeriods) throws LimaException;
- FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException;
-
/** Methodes for closedperiodicentrybook */
ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod) throws LimaException;
List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws LimaException;
-
- List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException;
-
+
void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException;
}
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -42,24 +42,8 @@
@Remote
public interface FinancialTransactionService {
- /**
- * Find all transaction (use carefully, can return a lot of results).
- *
- * @return all transaction
- * @throws LimaException
- */
- List<FinancialTransaction> getAllFinancialTransactions() throws LimaException;
/**
- * Find all transaction for an entry book.
- *
- * @param entryBook entry book
- * @return all transaction for entry book
- * @throws LimaException
- */
- List<FinancialTransaction> getAllFinancialTransactionsForEntryBook(EntryBook entryBook) throws LimaException;
-
- /**
* Find all transaction for an entry book and a financial period.
*
* @param entryBook entry book
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -29,7 +29,6 @@
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
-
/**
* Règles de vérification de la création du PCG, appliquées à la comptabilité française
*
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -32,7 +32,7 @@
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.utils.AccountComparator;
+import org.chorem.lima.entity.AccountComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
@@ -198,12 +198,11 @@
/** Permet d'obtenir tout les comptes feuilles
- * TODO PEPIN 20100601 Move on a DAO for use this methode on report service
*/
@Override
public List<Account> getAllSubAccounts() throws LimaException {
- List<Account> accountsList = new ArrayList<Account>();
+ List<Account> accountsList = null;
TopiaContext transaction = null;
try {
@@ -211,15 +210,7 @@
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
- //FIXME use topia query
- List<Account> accounts = accountDAO.findAll();
- for (Account account : accounts) {
- //check if parentaccount have no subaccount and no subledgers
- if (account.getSubAccounts().size() == 0 && account.getSubLedgers().size() == 0){
- accountsList.add(account);
- }
- }
- Collections.sort(accountsList, new AccountComparator());
+ accountsList = accountDAO.findAllSubAccounts();
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -253,11 +244,11 @@
TopiaQuery query = accountDAO.createQuery();
if (masterAccount == null){
- query.add("masterAccount", masterAccount);
- query.add("generalLedger", TopiaQuery.Op.EQ, null);
+ query.addEquals("masterAccount", masterAccount);
+ query.addWhere("generalLedger", TopiaQuery.Op.EQ, null);
}
else {
- query.add("masterAccount = :value or generalLedger = :value")
+ query.addWhere("masterAccount = :value or generalLedger = :value")
.addParam("value", masterAccount);
}
accountsList.addAll(accountDAO.findAllByQuery(query));
@@ -274,6 +265,9 @@
return accountsList;
}
+ /**
+ * Get list of all subaccount and ledger of an account
+ */
@Override
public List<Account> getAllChildrenAccounts(Account masterAccount, List<Account> accounts) throws LimaException {
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,20 +20,14 @@
package org.chorem.lima.business.ejb;
import static org.nuiton.i18n.I18n._;
-
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;
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -19,7 +19,6 @@
package org.chorem.lima.business.ejb;
-import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
@@ -36,7 +35,6 @@
import org.chorem.lima.entity.EntryBookDAO;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialPeriodDAO;
-import org.chorem.lima.entity.FinancialPeriodImpl;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
@@ -139,34 +137,6 @@
doCatch(topiaContext, ex, log);
}
}
-
- /**
- * Return all financial periods
- */
- @Override
- public List<FinancialPeriod> getAllFinancialPeriods() throws LimaException {
-
- List<FinancialPeriod> result = null;
-
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
-
- FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.
- getFinancialPeriodDAO(transaction);
- result = financialPeriodDAO.findAll();
-
- commitTransaction(transaction);
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
-
- return result;
- }
/**
* Return all unblocked financial period
@@ -195,38 +165,7 @@
return result;
}
-
- @Override
- public FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException {
- FinancialPeriod financialPeriod= new FinancialPeriodImpl();
-
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
-
- FinancialPeriodDAO financialPeriodDAO =
- LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
-
- TopiaQuery query = financialPeriodDAO.createQuery();
- if (date != null){
- query.addWhere("beginDate <= :value")
- .addWhere("endDate >= :value")
- .addParam("value", date);
- }
- financialPeriod = financialPeriodDAO.findByQuery(query);
- log.debug(financialPeriod);
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
-
- return financialPeriod;
- }
-
@Override
public void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException {
@@ -329,36 +268,6 @@
return result;
}
- /**
- * Just for debug
- *TODO REMOVE
- */
- @Override
- public List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException {
- List<ClosedPeriodicEntryBook> result = null;
-
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
-
- ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO
- = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction);
-
- result=closedPeriodicEntryBookDAO.findAll();
- for (ClosedPeriodicEntryBook closedPeriodicEntryBook : result) {
- closedPeriodicEntryBook.getEntryBook().getLabel();
- closedPeriodicEntryBook.getFinancialPeriod().getBeginDate();
- }
- commitTransaction(transaction);
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
- return result;
- }
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,26 +20,21 @@
package org.chorem.lima.business.ejb;
import static org.nuiton.i18n.I18n._;
-
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.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FinancialPeriodDAO;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.FinancialTransaction;
@@ -68,9 +63,6 @@
private TopiaContext rootContext;
protected AccountingRules accountingRules;
-
- @EJB
- FinancialPeriodService financialPeriodService;
public FinancialTransactionServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -86,7 +78,7 @@
/**
* Permet de créer une transaction comptable contenant des entrées
- * @throws LimaException
+ *
*/
@Override
public void createFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
@@ -113,78 +105,8 @@
doFinally(topiaContext, log);
}
}
-
- /**
- * Permet de retrouver la premiere transaction associée au journal.
- *
- * Utilisé par entrybook service pour savoir si un journal a des transactions
- * associées et empecher la suppression.
- *
- * @param topiaTransaction context à utiliser
- * @param entryBook journal
- * @throws TopiaException
- */
- protected FinancialTransaction findByEntryBook(TopiaContext topiaTransaction, EntryBook entryBook) throws TopiaException {
-
- FinancialTransactionDAO transactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
-
- TopiaQuery query = transactionDAO.createQuery();
- // entryBook is not visible, but column "entryBook"
- // exist in transaction table
- query.addEquals("entryBook", entryBook);
-
- FinancialTransaction result = transactionDAO.findByQuery(query);
-
- return result;
- }
/**
- * Permet de retrouver la premiere transaction associée au compte.
- *
- * Utilisé par account service pour savoir si un compte a des transactions
- * associées et empecher la suppression.
- *
- * @param topiaTransaction context à utiliser
- * @param account compte
- * @throws TopiaException
- */
- protected Entry findByAccount(TopiaContext topiaTransaction, Account account) throws TopiaException {
-
- EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
- //TODO marche pas
- TopiaQuery query = entryDAO.createQuery();
- query.addEquals("account", account);
-
- Entry result = entryDAO.findByQuery(query);
-
- return result;
- }
-
-
- /**
- * Return the list of all financial transaction
- */
- @Override
- public List<FinancialTransaction> getAllFinancialTransactions() throws LimaException {
-
- // find all with null entry book filter
-
- return getAllFinancialTransactionsForEntryBook(null);
- }
- /**
- * Return the list of all financial transaction of an entrybook
- */
- @Override
- public List<FinancialTransaction> getAllFinancialTransactionsForEntryBook(
- EntryBook entryBook) throws LimaException {
-
- // find all with null period filter
-
- return getAllFinancialTransactionsForEntryBookAndFinancialPeriod(entryBook, null);
- }
-
- /**
* Return the list of all financial transaction of a financial period
*/
@Override
@@ -241,6 +163,7 @@
}
@Override
+ //TODO No terminated
public List<FinancialTransaction> getAllFinancialTransactionsUnbalanced(FiscalPeriod fiscalPeriod) throws LimaException {
TopiaContext topiaContext = null;
List<FinancialTransaction> result = null;
@@ -249,10 +172,8 @@
FinancialTransactionDAO financialTransactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
- TopiaQuery query = financialTransactionDAO.createQuery("E");
- query.add(FinancialTransaction.ENTRY);
- result = query.execute();
- log.debug(result);
+
+ //TODO
}
catch (TopiaException ex) {
@@ -264,7 +185,11 @@
return result;
}
-
+ /**
+ * update date and amount of a financial transaction
+ * call accounting rules
+ *
+ */
@Override
public void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
@@ -284,6 +209,9 @@
}
+ /**
+ * Method used by update entry and remove entry for update amounts
+ */
public void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException{
try {
FinancialTransactionDAO transactionDAO =
@@ -302,8 +230,9 @@
if (newDate.compareTo(oldDate) != 0){
financialTransactionOld.setTransactionDate(newDate);
//change financial period
- FinancialPeriod financialPeriod =
- financialPeriodService.getFinancialPeriodWithDate(newDate);
+ FinancialPeriodDAO financialPeriodDAO =
+ LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
+ FinancialPeriod financialPeriod = financialPeriodDAO.findByDate(newDate);
if (financialPeriod != null){
financialTransactionOld.setFinancialPeriod(financialPeriod);
}
@@ -322,6 +251,10 @@
}
}
+ /**
+ * delete financial period
+ * call accounting rules
+ */
@Override
public void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException {
@@ -351,10 +284,16 @@
}
+ /**
+ * Create new entry
+ * the period mus not be blocked, call accounting rules
+ *
+ * @return
+ */
@Override
- public void removeEntry(Entry entry) throws LimaException {
-
+ public void createEntry(Entry entry) throws LimaException {
+
TopiaContext topiaContext = null;
try {
topiaContext = beginTransaction();
@@ -362,29 +301,11 @@
//check if the financial period is blocked
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);
- //commit
+ entryDAO.create(entry);
+
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
@@ -392,9 +313,13 @@
}
finally {
doFinally(topiaContext, log);
- }
+ }
}
-
+
+
+ /**
+ * update entry, calculate amount of the financial transaction
+ */
@Override
public void updateEntry(Entry entry) throws LimaException {
@@ -421,7 +346,8 @@
Double entryDebitOld = entryAmountBoolOld ? entryAmountOld : 0;
Double entryCreditOld = entryAmountBoolOld ? 0 : entryAmountOld;
- //TODO PEPIN 20100520 conflict object already instanciate
+ //FIXME PEPIN 20100520 conflict object already instanciate
+ // Exist best solution ?
entryOld.setAccount(entry.getAccount());
entryOld.setAmount(entryAmount);
entryOld.setDebit(entryAmountBool);
@@ -458,16 +384,13 @@
}
}
+
/**
- * Création d'une entrée comptable.
- * La période ne doit PAS être bloquée.
- *
- * @return
+ * Remove entry, update amounts for the financial transaction
*/
-
@Override
- public void createEntry(Entry entry) throws LimaException {
-
+ public void removeEntry(Entry entry) throws LimaException {
+
TopiaContext topiaContext = null;
try {
topiaContext = beginTransaction();
@@ -475,11 +398,29 @@
//check if the financial period is blocked
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);
- entryDAO.create(entry);
-
+ //delete
+ entryDAO.delete(entry);
+ //commit
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
@@ -487,10 +428,11 @@
}
finally {
doFinally(topiaContext, log);
- }
+ }
}
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
// TODO move it into JTA
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -20,16 +20,12 @@
package org.chorem.lima.business.ejb;
import static org.nuiton.i18n.I18n._;
-
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.FinancialPeriodServiceLocal;
import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.FiscalPeriodServiceLocal;
@@ -158,6 +154,7 @@
//IMPORTANT : LOADING FINANCIAL PERIOD FOR NO LAZY EXCEPTION
for (FiscalPeriod fiscalPeriod : result) {
//FIXME besoin d'appeler une lecture bidon de toutes les financialperiod
+ //TODO make this by topiaquery ?
//sinon il pete tout de même une lazy exception
for (FinancialPeriod financialPeriod : fiscalPeriod.getFinancialPeriod()) {
}
@@ -205,15 +202,12 @@
* to block a fiscal period
*
* check localized rules before block it
- *
- * Two transaction are necessary for no object conflict
- * FIXME can found best solution ?!
*/
@Override
public void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException {
TopiaContext transaction = null;
- //open transaction for check
+ //open transaction for update
try {
transaction = beginTransaction();
@@ -223,28 +217,21 @@
//check rules
accountingRules.blockFiscalPeriodRules(fiscalPeriod, transaction);
- } catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
-
- //open transaction for update
- try {
- transaction = beginTransaction();
-
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+ // Get the old fiscal period instance for no object conflict
+ FiscalPeriod oldFiscalPeriod =
+ fiscalPeriodDAO.findByTopiaId(fiscalPeriod.getTopiaId());
+
// lock fiscalperiod
- fiscalPeriod.setLocked(true);
+ oldFiscalPeriod.setLocked(true);
// locked all financialperiod of the fiscalperiod
- for ( FinancialPeriod financialPeriod : fiscalPeriod.getFinancialPeriod()) {
+ for ( FinancialPeriod financialPeriod : oldFiscalPeriod.getFinancialPeriod()) {
financialPeriod.setLocked(true);
}
- fiscalPeriodDAO.update(fiscalPeriod);
+ fiscalPeriodDAO.update(oldFiscalPeriod);
commitTransaction(transaction);
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -22,22 +22,19 @@
import java.util.ArrayList;
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.beans.BalanceTrial;
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.AccountDAO;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
@@ -56,9 +53,6 @@
private TopiaContext rootContext;
- @EJB
- AccountService accountService;
-
public ReportServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
try {
@@ -146,10 +140,10 @@
String transactionDateProperty =
TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
FinancialTransaction.TRANSACTION_DATE);
- query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
+ query.addWhere(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
.addParam("beginDate", beginDate)
.addParam("endDate", endDate)
- .add(Entry.ACCOUNT, account);
+ .addEquals(Entry.ACCOUNT, account);
return query;
}
@@ -158,6 +152,7 @@
* Get list entries
* Calculate all credit, debit and solde amounts for the accounts reports
*/
+ @SuppressWarnings("unchecked")
protected ReportsDatas generateSubAccountReportsWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException {
ReportsDatas reportsDatas = new ReportsDatasImpl();
double credit = 0, debit = 0, solde = 0;
@@ -176,7 +171,7 @@
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
amountsQuery.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
amountsQuery.addGroup("E."+Entry.DEBIT);
- results = amountsQuery.execute();
+ results = amountsQuery.execute(topiaContext);
int nbAmount = results.size();
if(nbAmount==2){
debit = (Double)results.get(0)[1];
@@ -215,6 +210,7 @@
/**
* Calculate all credit, debit and solde amounts for the balance
*/
+ @SuppressWarnings("unchecked")
protected ReportsDatas generateSubAccountBalanceWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException {
ReportsDatas reportsDatas = new ReportsDatasImpl();
double credit = 0, debit = 0, solde = 0;
@@ -228,7 +224,7 @@
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
amountsQuery.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
amountsQuery.addGroup("E."+Entry.DEBIT);
- results = amountsQuery.execute();
+ results = amountsQuery.execute(topiaContext);
int nbAmount = results.size();
if(nbAmount==2){
debit = (Double)results.get(0)[1];
@@ -270,6 +266,7 @@
* Calculate the amounts and the solde
*
*/
+ @SuppressWarnings({ "unchecked" })
@Override
public ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException {
ReportsDatas reportsDatas = new ReportsDatasImpl();
@@ -299,7 +296,7 @@
query.setSelect("E."+Entry.DEBIT, "SUM(E."+Entry.AMOUNT+")");
query.addGroup("E."+Entry.DEBIT);
- results = query.execute();
+ results = query.execute(topiaTransaction);
int nbAmount = results.size();
if(nbAmount==2){
debit = (Double)results.get(0)[1];
@@ -353,8 +350,10 @@
try {
topiaTransaction = beginTransaction();
+ AccountDAO accountDAO =
+ LimaCallaoDAOHelper.getAccountDAO(topiaTransaction);
//for each account create a balance sheet with a ReportsDatas
- for (Account account : accountService.getAllSubAccounts()) {
+ for (Account account : accountDAO.findAllSubAccounts()) {
ReportsDatas reportsDatas =
generateSubAccountBalanceWithTransaction(account, beginDate,
endDate, topiaTransaction);
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2010-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -1,32 +0,0 @@
-/* *##% 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.business.utils;
-
-import java.util.Comparator;
-
-import org.chorem.lima.entity.Account;
-
-public class AccountComparator implements Comparator<Account>{
-
- @Override
- public int compare(Account o1, Account o2) {
- return o1.getAccountNumber().compareTo(o2.getAccountNumber());
- }
-
-}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountComparator.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountComparator.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountComparator.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -0,0 +1,35 @@
+/* *##% 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.entity;
+
+import java.util.Comparator;
+
+import org.chorem.lima.entity.Account;
+
+public class AccountComparator implements Comparator<Account>{
+
+ /**
+ * sort by accout number in lexicographical order
+ */
+ @Override
+ public int compare(Account o1, Account o2) {
+ return o1.getAccountNumber().compareTo(o2.getAccountNumber());
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -0,0 +1,32 @@
+package org.chorem.lima.entity;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.nuiton.topia.TopiaException;
+
+public class AccountDAOImpl <E extends Account> extends AccountDAOAbstract<E> {
+
+ /**
+ * List all subaccounts (no folderaccounts)
+ * Sort by accout number in lexicographical order
+ */
+ @Override
+ public List<Account> findAllSubAccounts() throws TopiaException {
+ List<Account> accountsList = new ArrayList<Account>();
+
+ //FIXME use topia query
+ List<Account> accounts = (List<Account>) findAll();
+ for (Account account : accounts) {
+ //check if parentaccount have no subaccount and no subledgers
+ if (account.getSubAccounts().size() == 0
+ && account.getSubLedgers().size() == 0){
+ accountsList.add(account);
+ }
+ }
+ Collections.sort(accountsList, new AccountComparator());
+ return accountsList;
+ }
+
+}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -9,6 +9,9 @@
public class ClosedPeriodicEntryBookDAOImpl <E extends ClosedPeriodicEntryBook> extends ClosedPeriodicEntryBookDAOAbstract<E>{
+ /**
+ * Return ClosedPeriodicEntryBook by EntryBook and FinancialPeriod
+ */
@Override
public ClosedPeriodicEntryBook findbyEntryBookAndFinancialPeriod(
EntryBook entryBook, FinancialPeriod financialPeriod)
@@ -16,10 +19,10 @@
TopiaQuery query = createQuery();
if (entryBook != null){
- query.add(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook);
+ query.addEquals(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook);
}
if (financialPeriod != null){
- query.add(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
+ query.addEquals(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
}
return findByQuery(query);
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -0,0 +1,26 @@
+package org.chorem.lima.entity;
+
+import java.util.Date;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+
+public class FinancialPeriodDAOImpl <E extends FinancialPeriod> extends FinancialPeriodDAOAbstract<E>{
+
+ /**
+ * Return FinancialPeriod by Date
+ * Date is include between financialperiod begin and end date
+ */
+ @Override
+ public FinancialPeriod findByDate(Date date) throws TopiaException {
+
+ TopiaQuery query = createQuery();
+ if (date != null){
+ query.addWhere("beginDate <= :value")
+ .addWhere("endDate >= :value")
+ .addParam("value", date);
+ }
+ return findByQuery(query);
+ }
+
+}
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -426,8 +426,7 @@
switch (column) {
case 0:
//update
- currentFinancialTransaction.
- setTransactionDate((Date)value);
+ currentFinancialTransaction.setTransactionDate((Date)value);
break;
}
// notify service for modification
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-06-01 16:36:05 UTC (rev 2922)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-02 10:30:13 UTC (rev 2923)
@@ -388,47 +388,8 @@
(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");
- }
- }
- }
-
+ //update
+ currentFinancialTransaction.setTransactionDate((Date)value);
break;
}
// notify service for modification
1
0
Author: jpepin
Date: 2010-06-01 18:36:05 +0200 (Tue, 01 Jun 2010)
New Revision: 2922
Url: http://chorem.org/repositories/revision/lima/2922
Log:
D?\195?\169bogage suite ?\195?\160 passage en notation EJB. Correction de la rules cr?\195?\169ation de p?\195?\169riode fiscal, n'utilise plus le service de cr?\195?\169ation de p?\195?\169riode financi?\195?\168re en parral?\195?\168le
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.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/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
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.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/SubAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -50,6 +50,7 @@
* @param account account
* @throws LimaException
*/
+ //EJB Remote
void createAccount(Account masterAccount, Account account) throws LimaException, LimaBusinessException;
void createSubLedger(Account masterAccount, Account account) throws LimaException;
@@ -57,8 +58,9 @@
void updateAccount(Account account) throws LimaException;
void removeAccount(Account account) throws LimaException;
-
- void removeAccountwithSubAccounts(Account account) throws LimaException;
-
+
+ List<Account> getAllChildrenAccounts(Account masterAccount, List<Account> accounts) throws LimaException;
+
+ //EJB Remote et local
List<Account> getChildrenAccounts(Account masterAccount) throws LimaException;
}
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -46,10 +46,9 @@
List<FinancialPeriod> getUnblockedFinancialPeriods() throws LimaException;
- void createFinancialPeriods(List<FinancialPeriod> financialPeriods) throws LimaException;
- void createFinancialPeriodsWithTransaction(List<FinancialPeriod> financialPeriods, TopiaContext topiaContext) throws LimaException;
-
+ void createFinancialPeriods(List<FinancialPeriod> financialPeriods) throws LimaException;
+
FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException;
/** Methodes for closedperiodicentrybook */
@@ -58,7 +57,7 @@
List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws LimaException;
- List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException;
+ List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException;
void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java 2010-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodServiceLocal.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -19,9 +19,14 @@
package org.chorem.lima.business;
+import java.util.List;
+
import javax.ejb.Local;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.nuiton.topia.TopiaContext;
+
/**
* Financial period service.
*
@@ -35,4 +40,7 @@
@Local
public interface FinancialPeriodServiceLocal extends FinancialPeriodService {
+ void createFinancialPeriodsWithTransaction(List<FinancialPeriod> financialPeriods, TopiaContext topiaContext) 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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -28,7 +28,6 @@
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.ejb.AccountServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
@@ -59,6 +58,7 @@
*/
@Override
public void createAccountRules(Account masterAccount, Account account) throws LimaException {
+
// Check if the numberaccount is not blank
if (StringUtils.isBlank(account.getAccountNumber())) {
throw new LimaBusinessException("Invalid AccountNumber : "
@@ -164,11 +164,6 @@
if (nbentries != 0) {
throw new LimaBusinessException("Can't delete Account with entries");
}
- //check if subaccount have entries
- AccountServiceImpl accountService = new AccountServiceImpl();
- for (Account childrenAccounts : accountService.getChildrenAccounts(account)) {
- removeAccountRules(childrenAccounts, transaction);
- }
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -20,21 +20,15 @@
package org.chorem.lima.business.ejb;
import static org.nuiton.i18n.I18n._;
-
import java.util.ArrayList;
import java.util.Collections;
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;
@@ -85,7 +79,7 @@
* mettre masterAccount à null.
*
* @param account account to create
- * @throws LimaException
+ * @throws LimaException
*/
@Override
public void createAccount(Account masterAccount, Account account) throws LimaException {
@@ -154,6 +148,7 @@
accountDAO.create(account);
+ log.debug(masterAccount+" "+account);
// check if the masteraccount exist;
if (masterAccount != null) {
masterAccount.addSubLedgers(account);
@@ -173,10 +168,7 @@
/**
- * Permet de convertir tous les comptes.
- *
- * @return
- * @throws LimaException
+ * Permet d'obtenir tous les comptes.
*/
@Override
public List<Account> getAllAccounts() throws LimaException {
@@ -205,6 +197,9 @@
}
+ /** Permet d'obtenir tout les comptes feuilles
+ * TODO PEPIN 20100601 Move on a DAO for use this methode on report service
+ */
@Override
public List<Account> getAllSubAccounts() throws LimaException {
@@ -216,12 +211,13 @@
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(transaction);
+ //FIXME use topia query
List<Account> accounts = accountDAO.findAll();
for (Account account : accounts) {
- //check if parentaccount have no subaccount
- if (account.getSubAccounts().size() == 0){
+ //check if parentaccount have no subaccount and no subledgers
+ if (account.getSubAccounts().size() == 0 && account.getSubLedgers().size() == 0){
accountsList.add(account);
- }
+ }
}
Collections.sort(accountsList, new AccountComparator());
}
@@ -278,13 +274,22 @@
return accountsList;
}
-
+ @Override
+ public List<Account> getAllChildrenAccounts(Account masterAccount, List<Account> accounts) throws LimaException {
+
+ List<Account> childAccounts = getChildrenAccounts(masterAccount);
+ accounts.addAll(childAccounts);
+ for (Account account : childAccounts) {
+ getAllChildrenAccounts(account, accounts);
+ }
+ return accounts;
+ }
+
/**
* Permet d'effacer un compte dans la base de données.
*
- * Il est vérifié dans un premier temps si le compte existe bien.
- * ATTENTION : si il existe une entrée comptable associée au numéro de
- * compte, il est alors impossible de supprimer le compte.
+ * Si il existe une entrée comptable associée au numéro de
+ * compte ou a un de ses sous-compte, il est alors impossible de supprimer le compte.
*
* @param account
* @throws LimaException
@@ -294,21 +299,31 @@
TopiaContext transaction = null;
try {
transaction = beginTransaction();
+ AccountDAO accountDAO =
+ LimaCallaoDAOHelper.getAccountDAO(transaction);
- // Check rules
+ // Check rules for account if have entries
accountingRules.removeAccountRules(account, transaction);
+
+ //get all subaccounts
+ List<Account> accounts = getAllChildrenAccounts(account, new ArrayList<Account>());
- //Check if the account have subaccount
- if (account.getSubAccounts().size() > 0){
- removeAccountwithSubAccounts(account);
+ //if account have sub accounts
+ if (accounts.size() > 0){
+ for (Account subAccount : accounts) {
+ // Check rules for subaccount if have entries
+ accountingRules.removeAccountRules(account, transaction);
+ accountDAO.delete(subAccount);
+ log.debug(subAccount);
+ }
}
- else {
// remove account
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
accountDAO.delete(account);
- commitTransaction(transaction);
- }
+ log.debug(account);
+
+ //commit
+ //commitTransaction(transaction);
+
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -317,35 +332,6 @@
doFinally(transaction, log);
}
}
-
- /**
- * Delete an account and all his subaccounts
- * @param account
- * @throws LimaException
- */
- public void removeAccountwithSubAccounts(Account account) throws LimaException{
- TopiaContext transaction = null;
- try{
- transaction = beginTransaction();
- AccountDAO accountDAO =
- LimaCallaoDAOHelper.getAccountDAO(transaction);
- List<Account> existingSubAccounts = getChildrenAccounts(account);
- ListIterator itr = existingSubAccounts.listIterator();
- while(itr.hasNext()){
- Account subaccount = (Account) itr.next();
- removeAccountwithSubAccounts(subaccount);
- }
- // remove account
- accountDAO.delete(account);
- commitTransaction(transaction);
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
- }
/**
* Permet de modifier un compte sur son label et son compte père.
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -43,6 +43,7 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookDAO;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FinancialPeriodDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
@@ -61,16 +62,9 @@
private static final Log log = LogFactory.getLog(EntryBookServiceImpl.class);
private TopiaContext rootContext;
-
- @EJB
- FinancialTransactionService financialTransactionService;
-
- @EJB
- FinancialPeriodService financialPeriodService;
protected AccountingRules accountingRules;
-
public EntryBookServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
try {
@@ -112,7 +106,10 @@
//create ClosedPeriodicEntryBook for all unblocked financial period
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction);
- for (FinancialPeriod financialPeriod : financialPeriodService.getUnblockedFinancialPeriods()) {
+ FinancialPeriodDAO financialPeriodDAO =
+ LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
+ // for all unblocked financialperiod
+ for (FinancialPeriod financialPeriod : financialPeriodDAO.findAllByLocked(false)) {
//new closed periodic entrybook
ClosedPeriodicEntryBook closedPeriodicEntryBook =
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -109,14 +109,15 @@
FinancialPeriodDAO financialPeriodDAO =
LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
-
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
EntryBookDAO entryBookDAO =
LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
-
//create all financial period
+ log.debug(financialPeriods);
for (FinancialPeriod financialPeriod : financialPeriods) {
+ log.debug(financialPeriod);
+
//create ClosedPeriodicEntryBook for all entrybook
for (EntryBook entryBook : entryBookDAO.findAll()) {
//new closed periodic entrybook
@@ -166,7 +167,7 @@
return result;
}
-
+
/**
* Return all unblocked financial period
*/
@@ -194,7 +195,7 @@
return result;
}
-
+
@Override
public FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException {
@@ -315,7 +316,6 @@
//call query
result = closedPeriodicEntryBookDAO.findAllByQuery(query);
- log.debug(result);
commitTransaction(transaction);
}
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -286,8 +286,6 @@
public void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException{
try {
- log.debug("updat");
- log.debug(financialtransaction);
FinancialTransactionDAO transactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
FinancialTransaction financialTransactionOld =
@@ -386,7 +384,6 @@
EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext);
//delete
entryDAO.delete(entry);
- // updateFinancialTransactionWithTransaction(entry.getFinancialTransaction(), topiaContext)
//commit
commitTransaction(topiaContext);
}
@@ -396,8 +393,6 @@
finally {
doFinally(topiaContext, log);
}
- //update financial transaction
- updateFinancialTransaction(entry.getFinancialTransaction());
}
@Override
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -23,12 +23,14 @@
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.FinancialPeriodServiceLocal;
import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.FiscalPeriodServiceLocal;
import org.chorem.lima.business.LimaBusinessException;
@@ -61,7 +63,8 @@
protected AccountingRules accountingRules;
- FinancialPeriodService financialPeriodService;
+ @EJB
+ FinancialPeriodServiceLocal financialPeriodService;
public FiscalPeriodServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -87,10 +90,12 @@
transaction = beginTransaction();
//check rules before create the account
- List<FinancialPeriod> financialPeriods = accountingRules.createFiscalPeriodRules(fiscalPeriod, transaction);
+ List<FinancialPeriod> financialPeriods =
+ accountingRules.createFiscalPeriodRules(fiscalPeriod, transaction);
+ log.debug("financialPeriods : "+financialPeriods);
+ financialPeriodService.
+ createFinancialPeriodsWithTransaction(financialPeriods, transaction);
- financialPeriodService.createFinancialPeriodsWithTransaction(financialPeriods, transaction);
-
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -103,11 +103,11 @@
protected ReportsDatas generateAccountReportsWithTransaction (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 (account != null){
// First subaccount
List<Account> accounts = account.getSubAccounts();
+ accounts.addAll(account.getSubLedgers());
+ log.debug(accounts);
if (accounts.size() == 0){
reportsDatas = generateSubAccountReportsWithTransaction(account,
beginDate, endDate, topiaContext);
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -217,6 +217,7 @@
accountService.createAccount(parentAccount, account);
int index = getIndexOfChild(path.getLastPathComponent(), account);
+ modelSupport.fireTreeStructureChanged(path);
modelSupport.fireChildAdded(path, index, account);
}
@@ -235,6 +236,7 @@
}
accountService.createSubLedger(parentAccount, account);
int index = getIndexOfChild(path.getLastPathComponent(), account);
+ modelSupport.fireTreeStructureChanged(path);
modelSupport.fireChildAdded(path, index, account);
}
@@ -267,10 +269,4 @@
modelSupport.fireChildRemoved(path.getParentPath(), index, account);
}
- public void removeAccountwithSubAccounts(TreePath path, Account account) throws LimaException {
- int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), account);
- accountService.removeAccountwithSubAccounts(account);
- modelSupport.fireChildRemoved(path.getParentPath(), index, account);
- }
}
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -88,7 +88,6 @@
result = accountService.getAllAccounts();
}
catch (LimaException eee) {
- // TODO Auto-generated catch block
if (log.isDebugEnabled()){
log.debug("Can't get list accounts", eee);
}
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/SubAccountComboBoxModel.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -42,10 +42,13 @@
protected Object selectedAccount;
+ protected List<Account> datasCache;
+
protected AccountService accountService;
public SubAccountComboBoxModel() {
accountService = LimaServiceFactory.getInstance().getAccountService();
+ datasCache = getDataList();
}
@Override
@@ -66,12 +69,12 @@
@Override
public Object getElementAt(int index) {
- return getDataList().get(index);
+ return datasCache.get(index);
}
@Override
public int getSize() {
- return getDataList().size();
+ return datasCache.size();
}
@Override
@@ -86,7 +89,6 @@
result = accountService.getAllSubAccounts();
}
catch (LimaException eee) {
- // TODO Auto-generated catch block
if (log.isDebugEnabled()){
log.debug("Can't get list subaccounts", eee);
}
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-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -145,7 +145,8 @@
switch (columnIndex) {
case 0:
- result = simpleDateFormat.format(financialPeriod.getBeginDate())+" - "+simpleDateFormat.format(financialPeriod.getEndDate());
+ 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/financialtransaction/table/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-06-01 10:37:35 UTC (rev 2921)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-06-01 16:36:05 UTC (rev 2922)
@@ -428,49 +428,6 @@
//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();
-
- // 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
1
0
Author: jpepin
Date: 2010-06-01 12:37:35 +0200 (Tue, 01 Jun 2010)
New Revision: 2921
Url: http://chorem.org/repositories/revision/lima/2921
Log:
Ajout m?\195?\169thode dans le DAO de ClosedPeriodicEntryBook
Added:
trunk/lima-callao/src/main/java/
trunk/lima-callao/src/main/java/org/
trunk/lima-callao/src/main/java/org/chorem/
trunk/lima-callao/src/main/java/org/chorem/lima/
trunk/lima-callao/src/main/java/org/chorem/lima/entity/
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.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/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-callao/pom.xml
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.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/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -53,13 +53,12 @@
FinancialPeriod getFinancialPeriodWithDate(Date date) throws LimaException;
/** Methodes for closedperiodicentrybook */
+
+ ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod) throws LimaException;
List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws LimaException;
List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooks() throws LimaException;
- ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook,
- FinancialPeriod financialPeriod) throws LimaException;
-
void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) 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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -26,12 +26,12 @@
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.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ejb.AccountServiceImpl;
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.EntryBookDAO;
@@ -53,9 +53,6 @@
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
-
- //TODO make methode getClosedPeriodicEntryBook from financialperiodservice to DAO
- FinancialPeriodService financialPeriodService;
/**
* Rules to check before create accounts
@@ -119,16 +116,21 @@
FinancialPeriod financialPeriod =
entry.getFinancialTransaction().getFinancialPeriod();
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
+
//second case
ClosedPeriodicEntryBook closedPeriodicEntryBook =
- financialPeriodService.getClosedPeriodicEntryBook(entryOld.getEntryBook(), financialPeriod);
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entryOld.getEntryBook(), financialPeriod);
if (closedPeriodicEntryBook.getLocked()){
throw new LimaBusinessException("2 - Can't update entry : financialperiod of this entrybook is closed");
}
//third case
ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- financialPeriodService.getClosedPeriodicEntryBook(entry.getEntryBook(), financialPeriod);
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entry.getEntryBook(), financialPeriod);
// Check 2 & 3 cases
if (closedPeriodicEntryBook2.getLocked()){
@@ -136,7 +138,7 @@
}
}
- catch (LimaException eee) {
+ catch (TopiaException eee) {
doCatch(topiaTransaction, eee, log);
}
}
@@ -206,11 +208,19 @@
List<EntryBook> entryBooks = new ArrayList<EntryBook>();
List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>();
try {
- EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
- FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod();
+ EntryBookDAO entryBookDAO =
+ LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+ FinancialPeriod financialPeriod =
+ financialTransaction.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
+
for (EntryBook entryBook : entryBooks) {
- if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entryBook, financialPeriod);
+ if(closedPeriodicEntryBook.getLocked()){
closedEntryBooks.add(entryBook);
}
}
@@ -223,28 +233,6 @@
}
}
- /**
- * Generic code used to rollback a transaction.
- *
- * TODO : replace this by JTA
- * @throws LimaException
- */
- protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException {
- if (transaction != null) {
- try {
- transaction.rollbackTransaction();
- } catch (TopiaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", eee);
- }
- }
- }
- if (log.isErrorEnabled()) {
- log.error("Exception during query", cause);
- }
- throw new LimaException("Exception during query", cause);
- }
-
@Override
public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext)
throws LimaException {
@@ -276,11 +264,15 @@
try {
//check if date are on fiscal period
- FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
- FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findContainsFinancialPeriod(financialTransaction.getFinancialPeriod());
+ FiscalPeriodDAO fiscalPeriodDAO =
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
+ FiscalPeriod fiscalPeriod =
+ fiscalPeriodDAO.findContainsFinancialPeriod(
+ financialTransaction.getFinancialPeriod());
Date beginDateFiscalPeriod = fiscalPeriod.getBeginDate();
Date endDateFiscalPeriod = fiscalPeriod.getEndDate();
- Date financialTransactionDate = financialTransaction.getTransactionDate();
+ Date financialTransactionDate =
+ financialTransaction.getTransactionDate();
if (financialTransactionDate.before(beginDateFiscalPeriod)){
throw new LimaBusinessException("The date is before the fiscal period");
}
@@ -293,15 +285,29 @@
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();
+
+ EntryBookDAO entryBookDAO =
+ LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+
+ FinancialPeriod financialPeriod =
+ financialTransaction.getFinancialPeriod();
+ FinancialPeriod oldFinancialPeriod =
+ financialTransactionOld.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
+
for (EntryBook entryBook : entryBooks) {
- if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entryBook, financialPeriod);
+ ClosedPeriodicEntryBook oldClosedPeriodicEntryBook =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entryBook, oldFinancialPeriod);
+ if(closedPeriodicEntryBook.getLocked()){
closedEntryBooks.add(entryBook);
}
- if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, oldFinancialPeriod).getLocked()){
+ if(oldClosedPeriodicEntryBook.getLocked()){
oldClosedEntryBooks.add(entryBook);
}
}
@@ -320,4 +326,28 @@
}
}
+
+
+ /**
+ * Generic code used to rollback a transaction.
+ *
+ * TODO : replace this by JTA
+ * @throws LimaException
+ */
+ protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException {
+ if (transaction != null) {
+ try {
+ transaction.rollbackTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during rollback context", eee);
+ }
+ }
+ }
+ if (log.isErrorEnabled()) {
+ log.error("Exception during query", cause);
+ }
+ throw new LimaException("Exception during query", cause);
+ }
+
}
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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -87,7 +87,8 @@
TopiaContext topiaTransaction = null;
try {
topiaTransaction = beginTransaction();
- createFinancialPeriodsWithTransaction(financialPeriods, topiaTransaction);
+ createFinancialPeriodsWithTransaction(
+ financialPeriods, topiaTransaction);
}
catch (TopiaException ex) {
@@ -226,26 +227,27 @@
}
@Override
- public ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod) throws LimaException {
- ClosedPeriodicEntryBook closedPeriodicEntryBook =
- new ClosedPeriodicEntryBookImpl();
+ public void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException {
TopiaContext topiaContext = null;
try {
topiaContext = beginTransaction();
+ //check rules before create the account
+ accountingRules.blockClosedPeriodicEntryBookRules(
+ closedPeriodicEntryBook, topiaContext);
+
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
- TopiaQuery query = closedPeriodicEntryBookDAO.createQuery();
- if (entryBook != null){
- query.add(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook);
- }
- if (financialPeriod != null){
- query.add(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
- }
- closedPeriodicEntryBook=closedPeriodicEntryBookDAO.findByQuery(query);
+ ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
+ closedPeriodicEntryBookDAO.findByTopiaId(
+ closedPeriodicEntryBook.getTopiaId());
+ closedPeriodicEntryBook2.setLocked(true);
+ closedPeriodicEntryBookDAO.update(closedPeriodicEntryBook2);
+
+ commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -253,30 +255,23 @@
finally {
doFinally(topiaContext, log);
}
-
- return closedPeriodicEntryBook;
+
}
@Override
- public void blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws LimaException {
+ public ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod) throws LimaException {
+ ClosedPeriodicEntryBook closedPeriodicEntryBook = null;
+
TopiaContext topiaContext = null;
try {
topiaContext = beginTransaction();
- //check rules before create the account
- accountingRules.blockClosedPeriodicEntryBookRules(closedPeriodicEntryBook, topiaContext);
-
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
- ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- closedPeriodicEntryBookDAO.findByTopiaId(closedPeriodicEntryBook.getTopiaId());
+ closedPeriodicEntryBook = closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(entryBook, financialPeriod);
- closedPeriodicEntryBook2.setLocked(true);
- closedPeriodicEntryBookDAO.update(closedPeriodicEntryBook2);
-
- commitTransaction(topiaContext);
}
catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
@@ -284,9 +279,10 @@
finally {
doFinally(topiaContext, log);
}
-
+
+ return closedPeriodicEntryBook;
}
-
+
@Override
public List<ClosedPeriodicEntryBook> getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws LimaException {
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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -100,7 +100,7 @@
* - for subaccount
* - for a foldaccounts, contains many accounts
*/
- public ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException{
+ protected ReportsDatas generateAccountReportsWithTransaction (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[]>();
@@ -158,7 +158,7 @@
* 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 {
+ protected 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[]>();
@@ -215,7 +215,7 @@
/**
* Calculate all credit, debit and solde amounts for the balance
*/
- public ReportsDatas generateSubAccountBalanceWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException {
+ protected 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[]>();
Modified: trunk/lima-callao/pom.xml
===================================================================
--- trunk/lima-callao/pom.xml 2010-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-callao/pom.xml 2010-06-01 10:37:35 UTC (rev 2921)
@@ -65,7 +65,7 @@
<phase>generate-sources</phase>
<configuration>
<inputs>zargo</inputs>
- <templates>org.nuiton.topia.generator.TopiaMetaTransformer, org.nuiton.topia.generator.BeanTransformer</templates>
+ <templates>org.nuiton.topia.generator.TopiaMetaTransformer, org.nuiton.eugene.java.JavaBeanTransformer</templates>
<defaultPackage>org.chorem.lima.entity</defaultPackage>
<fullPackagePath>org.chorem.lima</fullPackagePath>
</configuration>
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -0,0 +1,28 @@
+package org.chorem.lima.entity;
+
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+import org.chorem.lima.entity.ClosedPeriodicEntryBookDAOAbstract;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+
+public class ClosedPeriodicEntryBookDAOImpl <E extends ClosedPeriodicEntryBook> extends ClosedPeriodicEntryBookDAOAbstract<E>{
+
+ @Override
+ public ClosedPeriodicEntryBook findbyEntryBookAndFinancialPeriod(
+ EntryBook entryBook, FinancialPeriod financialPeriod)
+ throws TopiaException {
+
+ TopiaQuery query = createQuery();
+ if (entryBook != null){
+ query.add(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook);
+ }
+ if (financialPeriod != null){
+ query.add(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
+ }
+ return findByQuery(query);
+
+ }
+
+}
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -61,9 +61,9 @@
if (cacheDataList != null){
// set amounts credit and debit and solde
- view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit));
- view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit));
- Double amountSolde = cacheDataList.amountSolde;
+ view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit()));
+ view.amountDebitLabel.setText(String.valueOf(cacheDataList.getAmountDebit()));
+ Double amountSolde = cacheDataList.getAmountSolde();
view.amountSoldeLabel.setText(String.valueOf(amountSolde));
@@ -72,7 +72,7 @@
}
else {
// set label solde: credit or debit
- if (cacheDataList.soldeDebit) {
+ if (cacheDataList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.soldedebit"));
}
else {
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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -124,10 +124,10 @@
try {
switch (column) {
case 0:
- result = currentRow.account.getAccountNumber(); //account number
+ result = currentRow.getAccount().getAccountNumber(); //account number
break;
case 1:
- result = currentRow.account.getLabel(); //account label
+ result = currentRow.getAccount().getLabel(); //account label
break;
case 2:
result = currentRow.getAmountDebit(); // total debit
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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -71,9 +71,9 @@
if (cacheDataList != null){
// set amounts credit, debit and solde
- view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit));
- view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit));
- Double amountSolde = cacheDataList.amountSolde;
+ view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit()));
+ view.amountDebitLabel.setText(String.valueOf(cacheDataList.getAmountDebit()));
+ Double amountSolde = cacheDataList.getAmountSolde();
view.amountSoldeLabel.setText(String.valueOf(amountSolde));
@@ -82,7 +82,7 @@
}
else {
// set label solde: credit or debit
- if (cacheDataList.soldeDebit) {
+ if (cacheDataList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.soldedebit"));
}
else {
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-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -85,7 +85,7 @@
// just prevent too much result
if (selectedEntryBook != null) {
- result = cacheDataList.listEntry.size();
+ result = cacheDataList.getListEntry().size();
}
else {
if (log.isDebugEnabled()) {
@@ -131,7 +131,7 @@
public Object getValueAt(int row, int column) {
Object result = null;
if(selectedEntryBook != null) {
- Entry currentRow = cacheDataList.listEntry.get(row);
+ Entry currentRow = cacheDataList.getListEntry().get(row);
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("dd MMMMM yyyy");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-06-01 08:59:19 UTC (rev 2920)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-06-01 10:37:35 UTC (rev 2921)
@@ -62,9 +62,9 @@
if (cacheDataList != null){
// set amounts credit, debit and solde
- view.amountCreditLabel.setText(String.valueOf(cacheDataList.amountCredit));
- view.amountDebitLabel.setText(String.valueOf(cacheDataList.amountDebit));
- Double amountSolde = cacheDataList.amountSolde;
+ view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit()));
+ view.amountDebitLabel.setText(String.valueOf(cacheDataList.getAmountDebit()));
+ Double amountSolde = cacheDataList.getAmountSolde();
view.amountSoldeLabel.setText(String.valueOf(amountSolde));
@@ -73,7 +73,7 @@
}
else {
// set label solde: credit or debit
- if (cacheDataList.soldeDebit) {
+ if (cacheDataList.getSoldeDebit()) {
view.soldeLabel.setText(_("lima.soldedebit"));
}
else {
1
0
Author: fdesbois
Date: 2010-06-01 10:59:19 +0200 (Tue, 01 Jun 2010)
New Revision: 2920
Url: http://chorem.org/repositories/revision/lima/2920
Log:
correction dao stereotype
Modified:
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0
Author: jpepin
Date: 2010-06-01 10:56:22 +0200 (Tue, 01 Jun 2010)
New Revision: 2919
Url: http://chorem.org/repositories/revision/lima/2919
Log:
Add DAO Interface
Modified:
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0