Lima-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
April 2012
- 2 participants
- 49 discussions
r3397 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 14:49:56 +0200 (Wed, 25 Apr 2012)
New Revision: 3397
Url: http://chorem.org/repositories/revision/lima/3397
Log:
Fix transaction entry book modification
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-25 12:25:38 UTC (rev 3396)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-25 12:49:56 UTC (rev 3397)
@@ -247,7 +247,7 @@
boolean editableCell = false;
Object currentRow = transactionAndEntries.get(rowIndex);
// cells editable for the financialtransaction row, no cells exclude the date
- if (currentRow instanceof FinancialTransaction && (columnIndex == 0 /*|| columnIndex == 1*/)) {
+ if (currentRow instanceof FinancialTransaction && (columnIndex == 0 || columnIndex == 1)) {
editableCell = true;
}
// cells editable for the entry row, all cells exclude the date
@@ -309,14 +309,13 @@
//update
currentFinancialTransaction.setTransactionDate((Date) value);
break;
- /* FIXME echatellier 20120413 : ca devrait carrement pas être editable
case 1:
- if (selectedEntryBook != null) {
+ if (currentFinancialTransaction.getEntry() != null) {
// not authorized to change the value
return;
}
currentFinancialTransaction.setEntryBook((EntryBook) value);
- break;*/
+ break;
}
// update transaction
1
0
r3396 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 14:25:38 +0200 (Wed, 25 Apr 2012)
New Revision: 3396
Url: http://chorem.org/repositories/revision/lima/3396
Log:
Begin unbalanced transaction refactoring
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2012-04-25 11:39:33 UTC (rev 3395)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2012-04-25 12:25:38 UTC (rev 3396)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -48,7 +48,6 @@
import java.math.BigDecimal;
import java.util.Date;
-
/**
* Table des transaction qui ajoute des comportement (keys).
*
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 2012-04-25 11:39:33 UTC (rev 3395)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-25 12:25:38 UTC (rev 3396)
@@ -49,7 +49,6 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.DialogHelper;
/**
* Basic transaction table model.
@@ -388,10 +387,7 @@
financialTransactionService.
updateFinancialTransaction(currentFinancialTransaction);
} catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't update financial transaction", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
+ throw new LimaRuntimeException("Can't update financial transaction", eee);
}
//update the financial transaction in entire
// financialTransactionRow =
@@ -423,10 +419,7 @@
try {
financialTransactionService.updateEntry(currentEntry);
} catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't update entry", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
+ throw new LimaRuntimeException("Can't update entry", eee);
}
//update the financial transaction in entire
// financialTransactionRow =
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2012-04-25 11:39:33 UTC (rev 3395)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2012-04-25 12:25:38 UTC (rev 3396)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -28,7 +28,6 @@
javax.swing.ListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel
- org.chorem.lima.ui.LimaRendererUtil
</import>
<FinancialTransactionUnbalancedViewHandler id="handler"
javaBean="new FinancialTransactionUnbalancedViewHandler(this)"/>
@@ -42,26 +41,17 @@
]]>
</script>
- <!-- <JPopupMenu id="MenuRightPanel">
- <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/>
- <JMenuItem text="lima.print"/>
- </JPopupMenu>
- <JPopupMenu id="MenuRightTransaction">
- <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/>
- <JMenuItem text="lima.print"/>
- </JPopupMenu> -->
-
<row weightx="1" weighty="0" anchor="center">
<cell anchor="west">
- <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/>
+ <JButton text="lima.ui.common.refresh" onActionPerformed="getHandler().refresh()"/>
</cell>
<cell anchor="east">
- <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/>
+ <JLabel id="fiscalPeriodLabel" text="lima.ui.financialtransaction.fiscalyear"/>
</cell>
<cell anchor="west">
<JComboBox id="fiscalPeriodComboBox"
model="{modelFiscalPeriod}"
- renderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
+ renderer="{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"
onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem());
getHandler().refresh()"
editable="false"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2012-04-25 11:39:33 UTC (rev 3395)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2012-04-25 12:25:38 UTC (rev 3396)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -25,18 +25,18 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.util.DialogHelper;
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with financial transaction view.
*
@@ -54,12 +54,6 @@
protected FinancialTransactionUnbalancedView view;
- protected FinancialTransactionUnbalancedTable table;
-
- protected FinancialTransactionUnbalancedTableModel tableModel;
-
- protected FiscalPeriodComboBoxModel comboBoxModel;
-
protected FinancialTransactionUnbalancedViewHandler(FinancialTransactionUnbalancedView view) {
this.view = view;
}
@@ -68,8 +62,8 @@
//add a new entry to the selected transaction
public void addEmptyEntry() {
- table = view.getFinancialTransactionUnbalancedTable();
- tableModel = view.getFinancialTransactionUnbalancedTableModel();
+ FinancialTransactionUnbalancedTable table = view.getFinancialTransactionUnbalancedTable();
+ FinancialTransactionUnbalancedTableModel tableModel = view.getFinancialTransactionUnbalancedTableModel();
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
@@ -86,11 +80,7 @@
table.changeSelection(index, 1, false, false);
table.requestFocusInWindow();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add emptyentry", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
-
+ throw new LimaRuntimeException("Can't add emptyentry", eee);
}
} else {
if (log.isWarnEnabled()) {
@@ -103,13 +93,11 @@
* Delete selected row in table (could be transaction or entry).
* <p/>
* Called by tableModel.
- *
- * @throws LimaException
*/
public void deleteSelectedRow() {
- table = view.getFinancialTransactionUnbalancedTable();
- tableModel = view.getFinancialTransactionUnbalancedTableModel();
+ FinancialTransactionUnbalancedTable table = view.getFinancialTransactionUnbalancedTable();
+ FinancialTransactionUnbalancedTableModel tableModel = view.getFinancialTransactionUnbalancedTableModel();
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
@@ -134,10 +122,7 @@
table.getSelectionModel();
selectionModel.setSelectionInterval(indexSelectedRow - 1, indexSelectedRow - 1);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't remove transaction or entry", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
+ throw new LimaRuntimeException("Can't remove transaction or entry", eee);
}
}
} else {
@@ -148,10 +133,10 @@
}
public void refresh() {
- tableModel = view.getFinancialTransactionUnbalancedTableModel();
+ FinancialTransactionUnbalancedTableModel tableModel = view.getFinancialTransactionUnbalancedTableModel();
tableModel.refresh();
- comboBoxModel = view.getModelFiscalPeriod();
+ FiscalPeriodComboBoxModel comboBoxModel = view.getModelFiscalPeriod();
comboBoxModel.refresh();
}
}
1
0
r3395 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/importexport java/org/chorem/lima/ui/opening resources/i18n
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 13:39:33 +0200 (Wed, 25 Apr 2012)
New Revision: 3395
Url: http://chorem.org/repositories/revision/lima/3395
Log:
Update init database wizard
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-25 11:39:33 UTC (rev 3395)
@@ -54,20 +54,27 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.api.ExportService;
import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.utils.ImportExportEntityEnum;
import org.chorem.lima.enums.EncodingEnum;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.account.AccountViewHandler;
-import org.chorem.lima.util.DialogHelper;
import org.jdesktop.swingx.painter.BusyPainter;
+/**
+ * Import export helper.
+ * Calling service with specified file to import and displaying wait view to user.
+ *
+ * @author echatellier
+ * Date : 24 avr. 2012
+ */
public class ImportExport {
- private static final Log log = LogFactory.getLog(AccountViewHandler.class);
+ private static final Log log = LogFactory.getLog(ImportExport.class);
+ /** Parent view. */
protected Component viewComponent;
protected EncodingEnum encodingEnum;
@@ -95,13 +102,13 @@
}
/**
- * Call the appropriate methode in business service.
+ * Call the appropriate method in business service.
*
* @param importExportMethode
* @param file
* @param verbose
*/
- public void importExport(ImportExportEnum importExportMethode, String file, Boolean verbose) {
+ public void importExport(ImportExportEnum importExportMethode, String file, boolean verbose) {
final ImportExportEnum importExportMethodeF = importExportMethode;
encodingEnum = EncodingEnum.UTF8;
if (file.equals("")) {
@@ -199,28 +206,30 @@
if (verboseMode) {
String result = get();
if (!result.equals("")) {
- DialogHelper.showReportDialog(result, _("lima.importexport.import"), viewComponent);
+ JOptionPane.showMessageDialog(viewComponent, _("lima.ui.importexport.importerror"),
+ _("lima.ui.importexport.importtitle"), JOptionPane.ERROR_MESSAGE);
+
} else {
if (importMode) {
//special message when importing a VAT PDF
if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) {
JOptionPane.showMessageDialog(
waitView,
- _("lima.importexport.import.vatpdfimport"),
- _("lima.importexport.import"),
+ _("lima.ui.importexport.import.vatpdfimport"),
+ _("lima.ui.importexport.import"),
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(
waitView,
- _("lima.importexport.import.terminated"),
- _("lima.importexport.import"),
+ _("lima.ui.importexport.import.terminated"),
+ _("lima.ui.importexport.import"),
JOptionPane.INFORMATION_MESSAGE);
}
} else {
JOptionPane.showMessageDialog(
waitView,
- _("lima.importexport.export.terminated"),
- _("lima.importexport.export"),
+ _("lima.ui.importexport.export.terminated"),
+ _("lima.ui.importexport.export"),
JOptionPane.INFORMATION_MESSAGE);
}
}
@@ -229,11 +238,8 @@
if (log.isErrorEnabled()) {
log.error("Can't get result message", eee);
}
- } catch (ExecutionException eee) {
- DialogHelper.showErrorMessageDialog(viewComponent, eee.getCause());
- if (log.isErrorEnabled()) {
- log.error("Error on import", eee);
- }
+ } catch (ExecutionException ex) {
+ throw new LimaRuntimeException("Error during import", ex);
}
}
}.execute();
@@ -281,32 +287,38 @@
}
- /** Get csv datas in string and write file
+ /**
+ * Get csv datas in string and write file.
+ *
* @param filePath
* @param charset
- * @param datas*/
+ * @param datas
+ */
public void createFile(String filePath, String charset, String datas) {
File file = new File(filePath);
+ BufferedWriter out = null;
try {
- BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
- try {
- out.write(datas);
- out.flush();
- out.close();
- } finally {
- out.close();
- }
+ out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
+ out.write(datas);
+ out.flush();
+ out.close();
} catch (IOException eee) {
if (log.isErrorEnabled()) {
log.error("Can't write file " + filePath, eee);
}
+ } finally {
+ IOUtils.closeQuietly(out);
}
+
}
- /** Open csv file and get his datas on a string.
+ /**
+ * Open csv file and get his datas on a string.
+ *
* @param filePath
* @param charset
- * @return*/
+ * @return
+ */
public String extractFile(String filePath, String charset) {
StringWriter sw = new StringWriter();
BufferedReader in = null;
@@ -322,11 +334,7 @@
}
in = new BufferedReader(new InputStreamReader(is, charset));
- try {
- IOUtils.copy(in, sw);
- } finally {
- in.close();
- }
+ IOUtils.copy(in, sw);
in.close();
} catch (IOException eee) {
if (log.isErrorEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExportWaitView.jaxx 2012-04-25 11:39:33 UTC (rev 3395)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -23,22 +23,15 @@
#L%
-->
-<JDialog modal="true" id="waitDialog">
-
- <script>
- <![CDATA[
-
- ]]>
- </script>
-
+<JDialog modal="true" id="waitDialog" title="lima.ui.importexport.waittitle">
<Table>
<row>
<cell>
<org.jdesktop.swingx.JXBusyLabel id='busylabel' busy='true'/>
</cell>
<cell>
- <JLabel text='lima.importexport.wait'/>
+ <JLabel text='lima.ui.importexport.wait'/>
</cell>
</row>
</Table>
-</JDialog>
\ No newline at end of file
+</JDialog>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateAccountsPanel.jaxx 2012-04-25 11:39:33 UTC (rev 3395)
@@ -32,7 +32,7 @@
<Table>
<row>
<cell>
- <JLabel text='lima.opening.accounts'/>
+ <JLabel text='lima.ui.opening.accounts'/>
</cell>
</row>
<row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateEntryBookPanel.jaxx 2012-04-25 11:39:33 UTC (rev 3395)
@@ -26,13 +26,13 @@
<Table>
<row>
<cell>
- <JLabel text='lima.opening.entrybook'/>
+ <JLabel text='lima.ui.opening.entrybook'/>
</cell>
</row>
<row>
<cell>
<JCheckBox id='importEntryBook'
- text='lima.importexport.defaultentrybooks' selected='true'/>
+ text='lima.ui.importexport.defaultentrybooks' selected='true'/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx 2012-04-25 11:39:33 UTC (rev 3395)
@@ -22,9 +22,8 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
+<JDialog modal="true" title="lima.ui.opening.title">
-<JDialog modal="true">
-
<import>
javax.swing.BorderFactory
javax.swing.ImageIcon
@@ -56,8 +55,8 @@
</cell>
<cell weightx="0.9" rows="4" fill="both">
<JPanel id='panel'>
- <JLabel text='lima.opening.welcome'/>
- <JButton text='lima.opening.import'
+ <JLabel text='lima.ui.opening.welcome'/>
+ <JButton text='lima.ui.opening.import'
onActionPerformed="handler.importSave()"/>
</JPanel>
</cell>
@@ -85,10 +84,10 @@
<JLabel text=''/>
</cell>
<cell weightx="0.1" fill="none">
- <JButton text="lima.common.close" onActionPerformed="performCancel()"/>
+ <JButton text="lima.ui.opening.close" onActionPerformed="performCancel()"/>
</cell>
<cell weightx="0.1" fill="none">
- <JButton id="ok" text="lima.common.next"
+ <JButton id="ok" text="lima.ui.opening.next"
onActionPerformed="handler.next()"/>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-25 11:39:33 UTC (rev 3395)
@@ -182,7 +182,7 @@
view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2));
panel.add(fsPanel);
panel.validate();
- view.getOk().setText(_("lima.common.fin"));
+ view.getOk().setText(_("lima.ui.opening.end"));
view.repaint();
step++;
break;
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-25 11:39:33 UTC (rev 3395)
@@ -183,24 +183,8 @@
lima.identity.phoneNumber=Phone number
lima.identity.vatNumber=VAT number
lima.identity.zipCode=Zip code
-lima.importexport.accountcharts=Accounts chart
-lima.importexport.all=All
-lima.importexport.choiceencoding=Choice encoding
-lima.importexport.csv=Import/Export CSV
-lima.importexport.defaultentrybooks=Defaults entrybooks
-lima.importexport.ebp=Import/Export EBP
-lima.importexport.entries=Entries
-lima.importexport.export=Export
-lima.importexport.export.terminated=Export terminated
-lima.importexport.financialstatements=FinancialStatements chart
-lima.importexport.import=Import
-lima.importexport.import.terminated=Import terminated
-lima.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory
-lima.importexport.importcsv=Import CSV
-lima.importexport.importebp=Import EBP
-lima.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ?
-lima.importexport.vatstatements=VAT chart
-lima.importexport.wait=Job in progress…
+lima.importexport.importcsv=
+lima.importexport.importebp=
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=Error during Lima close
lima.ledger.documentcreationerror=Enable to create document
@@ -216,10 +200,6 @@
lima.message.help.usage=Options (set with --option <key> <value>\:
lima.misc.supportemail.description=Support email
lima.openejb.remotemode.description=
-lima.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html>
-lima.opening.entrybook=<html>Tick box to import default accounts chart\:<br/> Achats, Ventes, Trésorerie, Opération diverses</html>
-lima.opening.import=Import a CSV Save
-lima.opening.welcome=<html><center>Welcome to Lima<br/>this assistant help you to start your business accounting in the blink of an eye<br/>OR import instantanly your already existing save in CSV format<br/><br/><br/><br/></center></html>
lima.preferences=Preferences
lima.refresh=↻
lima.reports=Reports
@@ -354,9 +334,32 @@
lima.ui.home.transaction.modifiy.unbalanced=
lima.ui.home.transaction.nothing=
lima.ui.home.transaction.unbalanced=
+lima.ui.importexport.accountcharts=Accounts chart
+lima.ui.importexport.all=All
+lima.ui.importexport.choiceencoding=Choice encoding
+lima.ui.importexport.csv=Import/Export CSV
+lima.ui.importexport.defaultentrybooks=Defaults entrybooks
+lima.ui.importexport.ebp=Import/Export EBP
+lima.ui.importexport.entries=Entries
+lima.ui.importexport.export=Export
+lima.ui.importexport.export.terminated=Export terminated
+lima.ui.importexport.financialstatements=FinancialStatements chart
lima.ui.importexport.import=
+lima.ui.importexport.import.terminated=Import terminated
+lima.ui.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
+lima.ui.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ?
+lima.ui.importexport.vatstatements=VAT chart
+lima.ui.importexport.wait=Job in progress…
+lima.ui.importexport.waittitle=
+lima.ui.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html>
+lima.ui.opening.close=
+lima.ui.opening.entrybook=<html>Tick box to import default accounts chart\:<br/> Achats, Ventes, Trésorerie, Opération diverses</html>
+lima.ui.opening.import=Import a CSV Save
+lima.ui.opening.next=
+lima.ui.opening.title=
+lima.ui.opening.welcome=<html><center>Welcome to Lima<br/>this assistant help you to start your business accounting in the blink of an eye<br/>OR import instantanly your already existing save in CSV format<br/><br/><br/><br/></center></html>
lima.vatreport.listerror=Can't get entries list
lima.vatstatement.accounts=List of accounts
lima.vatstatement.boxname=PDF BoxName
@@ -366,4 +369,3 @@
lima.vatstatement.movement.add=Add movement
lima.warning.nimbus.landf=Could not find Numbus Look&Feel
limma.config.thousandseparator.description=
-nuitonutil.error.applicationconfig.save=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-25 10:18:26 UTC (rev 3394)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-25 11:39:33 UTC (rev 3395)
@@ -163,24 +163,8 @@
lima.identity.phoneNumber=n° Tel
lima.identity.vatNumber=n° TVA
lima.identity.zipCode=Code Postal
-lima.importexport.accountcharts=Plan des comptes
-lima.importexport.all=Tout
-lima.importexport.choiceencoding=Choisir encodage \:
-lima.importexport.csv=Import/Export CSV
-lima.importexport.defaultentrybooks=Journaux par défaut
-lima.importexport.ebp=Import/Export EBP
-lima.importexport.entries=Écritures
-lima.importexport.export=Export
-lima.importexport.export.terminated=Export terminé
-lima.importexport.financialstatements=Plan BCR
-lima.importexport.import=Import
-lima.importexport.import.terminated=Import terminé
-lima.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima
-lima.importexport.importcsv=Import CSV
-lima.importexport.importebp=Import EBP
-lima.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ?
-lima.importexport.vatstatements=Plan TVA
-lima.importexport.wait=Traitement en cours …
+lima.importexport.importcsv=
+lima.importexport.importebp=
lima.init.closed=Lima fermé à %1$s
lima.init.errorclosing=Erreur lors de la fermeture
lima.ledger.documentcreationerror=Erreur lors de la création du document
@@ -196,10 +180,6 @@
lima.message.help.usage=Options (set with --option <key> <value>\:
lima.misc.supportemail.description=Adresse email de support
lima.openejb.remotemode.description=
-lima.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
-lima.opening.entrybook=<html>Cochez la case pour importer les journaux par défaut \:<br/> Achats, Ventes, Trésorerie, Opération diverses</html>
-lima.opening.import=Importer une sauvegarde CSV
-lima.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour démarrer votre comptabilité en quelques instants
<br/>Ou bien importer directement une ancienne sauvegarde de LIMA au format CSV<br/><br/><br/><br/></center></html>
lima.preferences=Préférences
lima.refresh=↻
lima.reports=Rapports
@@ -333,9 +313,32 @@
lima.ui.home.transaction.modifiy.unbalanced=Modifier les écritures incorrectes
lima.ui.home.transaction.nothing=Aucune écriture
lima.ui.home.transaction.unbalanced=transactions ne sont pas équilibrées \!
+lima.ui.importexport.accountcharts=Plan des comptes
+lima.ui.importexport.all=Tout
+lima.ui.importexport.choiceencoding=Choisir encodage \:
+lima.ui.importexport.csv=Import/Export CSV
+lima.ui.importexport.defaultentrybooks=Journaux par défaut
+lima.ui.importexport.ebp=Import/Export EBP
+lima.ui.importexport.entries=Écritures
+lima.ui.importexport.export=Export
+lima.ui.importexport.export.terminated=Export terminé
+lima.ui.importexport.financialstatements=Plan BCR
lima.ui.importexport.import=Importer
+lima.ui.importexport.import.terminated=Import terminé
+lima.ui.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
+lima.ui.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ?
+lima.ui.importexport.vatstatements=Plan TVA
+lima.ui.importexport.wait=Traitement en cours…
+lima.ui.importexport.waittitle=Traitement en cours
+lima.ui.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
+lima.ui.opening.close=Fermer
+lima.ui.opening.entrybook=<html>Cochez la case pour importer les journaux par défaut \:<br/> Achats, Ventes, Trésorerie, Opération diverses</html>
+lima.ui.opening.import=Importer une sauvegarde CSV
+lima.ui.opening.next=Suivant
+lima.ui.opening.title=Initialisation
+lima.ui.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour démarrer votre comptabilité en quelques instants
<br/>Ou bien importer directement une ancienne sauvegarde de LIMA au format CSV<br/><br/><br/><br/></center></html>
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
lima.vatstatement.accounts=Liste des comptes
lima.vatstatement.boxname=PDF BoxName
@@ -345,4 +348,3 @@
lima.vatstatement.movement.add=Ajouter un regrouprement
lima.warning.nimbus.landf=Le look and feel nymbus n'a pas été trouvé
limma.config.thousandseparator.description=
-nuitonutil.error.applicationconfig.save=
1
0
r3394 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 12:18:26 +0200 (Wed, 25 Apr 2012)
New Revision: 3394
Url: http://chorem.org/repositories/revision/lima/3394
Log:
Corrections dans la saisie des transactions (maj de l'ui)
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
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/FinancialTransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-04-25 10:04:03 UTC (rev 3393)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-04-25 10:18:26 UTC (rev 3394)
@@ -51,7 +51,6 @@
import java.math.BigDecimal;
import java.util.Date;
-
/**
* Table des transaction qui ajoute des comportement (keys).
*
@@ -113,9 +112,6 @@
addHighlighter(colorTransaction);
// highlight unbalanced financial transactions
-// if (colorBalance != null) {
-// removeHighlighter(colorBalance);
-// }
predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-25 10:04:03 UTC (rev 3393)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-04-25 10:18:26 UTC (rev 3394)
@@ -300,9 +300,10 @@
try {
Object currentRow = transactionAndEntries.get(row);
-
+
+ FinancialTransaction currentFinancialTransaction = null;
if (currentRow instanceof FinancialTransaction) {
- FinancialTransaction currentFinancialTransaction = (FinancialTransaction) currentRow;
+ currentFinancialTransaction = (FinancialTransaction) currentRow;
switch (column) {
case 0:
//update
@@ -323,8 +324,7 @@
} else if (currentRow instanceof Entry) {
Entry currentEntry = (Entry) currentRow;
- FinancialTransaction financialTransaction =
- currentEntry.getFinancialTransaction();
+ currentFinancialTransaction = currentEntry.getFinancialTransaction();
boolean updateTransaction = false;
switch (column) {
case 2:
@@ -336,7 +336,7 @@
// let's update the voucher of all entries of
// the transaction
- for (Entry entry : financialTransaction.getEntry()) {
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
entry.setVoucher(voucher);
}
updateTransaction = true;
@@ -356,7 +356,7 @@
// let's update the description of all entries of
// the transaction
- for (Entry entry : financialTransaction.getEntry()) {
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
entry.setDescription(description1);
}
updateTransaction = true;
@@ -373,7 +373,7 @@
// let's update the description of all entries of
// the transaction
- for (Entry entry : financialTransaction.getEntry()) {
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
entry.setDescription(description);
}
updateTransaction = true;
@@ -400,7 +400,7 @@
// first row modification update following rows
if (updateTransaction) {
// FIXME echatellier 20120413 make a single service call
- for (Entry entry : financialTransaction.getEntry()) {
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
financialTransactionService.updateEntry(entry);
}
} else {
@@ -410,7 +410,8 @@
// FIXME echatellier 20120413 une modification des dates fait que l'ordre
// devient faux
- fireTableRowsUpdated(row, row);
+ int trIndex = indexOf(currentFinancialTransaction);
+ fireTableRowsUpdated(trIndex, trIndex + currentFinancialTransaction.getEntry().size() - 1);
} catch (LimaException ex) {
throw new LimaRuntimeException("Can't propagate data modification to service", ex);
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 2012-04-25 10:04:03 UTC (rev 3393)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-04-25 10:18:26 UTC (rev 3394)
@@ -360,18 +360,18 @@
int firstentryBookrow = tableModel.getFirstEntry(indexSelectedRow);
String defaultVoucher = null;
- String dafaultDescription = null;
+ String defaultDescription = null;
if (firstentryBookrow != -1) {
// there is no first entry, grab the voucher and
defaultVoucher = (String) tableModel.getValueAt(firstentryBookrow, 2);
- dafaultDescription = (String) tableModel.getValueAt(firstentryBookrow, 4);
+ defaultDescription = (String) tableModel.getValueAt(firstentryBookrow, 4);
}
try {
// creates the new entry
Entry entry = new EntryImpl();
entry.setVoucher(defaultVoucher);
- entry.setDescription(dafaultDescription);
+ entry.setDescription(defaultDescription);
// check if current row is a transaction or an entry
FinancialTransaction currentTransaction = null;
Object currentRow = tableModel.getElementAt(indexSelectedRow);
@@ -388,13 +388,15 @@
currentTransaction.addEntry(newEntry);
// add it in ui
- tableModel.addRow(newEntry, indexSelectedRow + currentTransaction.getEntry().size());
+ int addIndex = tableModel.indexOf(currentTransaction) +
+ currentTransaction.getEntry().size();
+ tableModel.addRow(newEntry, addIndex);
//select the new line
ListSelectionModel selectionModel = table.getSelectionModel();
selectionModel.setSelectionInterval(
- indexSelectedRow + 1, indexSelectedRow + 1);
- table.changeSelection(indexSelectedRow + 1, 1, false, false);
+ addIndex, addIndex);
+ table.changeSelection(addIndex, 1, false, false);
} catch (LimaException ex) {
throw new LimaRuntimeException("Can't add emptyentry", ex);
@@ -442,6 +444,7 @@
} else if (selectedValue instanceof Entry) {
Entry currentEntry = (Entry) selectedValue;
financialTransactionService.removeEntry(currentEntry);
+ currentEntry.getFinancialTransaction().removeEntry(currentEntry);
}
tableModel.deleteRow(indexSelectedRow);
1
0
r3393 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 12:04:03 +0200 (Wed, 25 Apr 2012)
New Revision: 3393
Url: http://chorem.org/repositories/revision/lima/3393
Log:
Fix bigdecimal addition
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2012-04-25 09:14:11 UTC (rev 3392)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2012-04-25 10:04:03 UTC (rev 3393)
@@ -45,12 +45,15 @@
*/
@Override
public BigDecimal getAmountDebit() {
- BigDecimal result = new BigDecimal(0);
- for (Entry entryFT : getEntry()) {
- if (entryFT.isDebit()) {
- result.add(entryFT.getAmount());
+ BigDecimal result = BigDecimal.ZERO;
+ if (getEntry() != null) {
+ for (Entry entryFT : getEntry()) {
+ if (entryFT.isDebit()) {
+ result = result.add(entryFT.getAmount());
+ }
}
}
+
return result;
}
@@ -59,10 +62,12 @@
*/
@Override
public BigDecimal getAmountCredit() {
- BigDecimal result = new BigDecimal(0);
- for (Entry entryFT : getEntry()) {
- if (!entryFT.isDebit()) {
- result.add(entryFT.getAmount());
+ BigDecimal result = BigDecimal.ZERO;
+ if (getEntry() != null) {
+ for (Entry entryFT : getEntry()) {
+ if (!entryFT.isDebit()) {
+ result = result.add(entryFT.getAmount());
+ }
}
}
return result;
1
0
r3392 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 11:14:11 +0200 (Wed, 25 Apr 2012)
New Revision: 3392
Url: http://chorem.org/repositories/revision/lima/3392
Log:
Move queries to dao
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.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-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java
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 2012-04-25 08:28:20 UTC (rev 3391)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2012-04-25 09:14:11 UTC (rev 3392)
@@ -95,5 +95,12 @@
*/
void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException;
+ /**
+ * Check if a financial period can be closed.
+ *
+ * @param closedPeriodicEntryBook
+ * @param topiaContext
+ * @throws LimaException
+ */
void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, 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 2012-04-25 08:28:20 UTC (rev 3391)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-04-25 09:14:11 UTC (rev 3392)
@@ -68,9 +68,6 @@
protected static final Log log =
LogFactory.getLog(DefaultAccountingRules.class);
- /** DAO helper not injected by EJB. */
- protected LimaDaoHelper daoHelper = new LimaDaoHelper();
-
/**
* Rules to check before create accounts.
*/
@@ -117,7 +114,7 @@
@Override
public void removeAccountRules(Account account) throws LimaException {
try {
- EntryDAO entryDAO = daoHelper.getEntryDAO();
+ EntryDAO entryDAO = LimaDaoHelper.getEntryDAO();
// Check if account have entries
int nbentries = entryDAO.findAllByAccount(account).size();
if (nbentries != 0) {
@@ -192,72 +189,33 @@
@Override
public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext)
throws LimaException {
- List<FinancialTransaction> result = null;
- // Check if all financial transactions of closedperiodicentrybook are equilibrate
try {
FinancialTransactionDAO financialTransactionDAO =
LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
- TopiaQuery query = financialTransactionDAO.createQuery("E");
- query.addWhere("E.amountCredit != E.amountDebit")
- .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK,
- closedPeriodicEntryBook.getEntryBook())
- .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD,
- closedPeriodicEntryBook.getFinancialPeriod());
- result = financialTransactionDAO.findAllByQuery(query);
-
+ // Check if all financial transactions of closedperiodicentrybook are equilibrate
+ List<FinancialTransaction> result = financialTransactionDAO.getAllUnbalancedTransaction(closedPeriodicEntryBook.getFinancialPeriod(),
+ closedPeriodicEntryBook.getEntryBook());
if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.blockerrorequillibrate"));
}
- } catch (TopiaException ex) {
- doCatch(topiaContext, ex, log);
- }
- result = null;
+
+ // Check if all financial transactions of this closedperiodicentrybook/financialPeriod are well filled in
+ result = financialTransactionDAO.getAllUnfilledTransaction(closedPeriodicEntryBook.getFinancialPeriod(),
+ closedPeriodicEntryBook.getEntryBook());
- // Check if all financial transactions of this closedperiodicentrybook/financialPeriod are well filled in
- try {
- FinancialTransactionDAO financialTransactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
-
- TopiaQuery query = financialTransactionDAO.createQuery("T");
- query.addDistinct()
- .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
- .addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
- .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
- .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK,
- closedPeriodicEntryBook.getEntryBook())
- .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD,
- closedPeriodicEntryBook.getFinancialPeriod());
- result = financialTransactionDAO.findAllByQuery(query);
-
if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingelements"));
}
- } catch (TopiaException ex) {
- doCatch(topiaContext, ex, log);
- }
+
+ // Check if all financial transactions have EntryBooks
+ result = financialTransactionDAO.getAllTransactionWithoutEntryBook();
- result = null;
-
- // Check if all financial transactions have EntryBooks
- try {
- FinancialTransactionDAO financialTransactionDAO =
- LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
-
- TopiaQuery query = financialTransactionDAO.createQuery("T");
- query.addDistinct()
- .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
- .addFrom(FiscalPeriod.class, "F")
- .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
- .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
- .addNull(FinancialTransaction.PROPERTY_ENTRY_BOOK);
- result = financialTransactionDAO.findAllByQuery(query);
-
if (result.size() > 0) {
throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingentrybook"));
}
+
} catch (TopiaException ex) {
doCatch(topiaContext, ex, log);
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2012-04-25 08:28:20 UTC (rev 3391)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2012-04-25 09:14:11 UTC (rev 3392)
@@ -210,19 +210,19 @@
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
try {
- //check rules before create the account
+ // check rules before create the account
accountingRules.blockClosedPeriodicEntryBookRules(
closedPeriodicEntryBook, topiaContext);
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
- ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- closedPeriodicEntryBookDAO.findByTopiaId(
- closedPeriodicEntryBook.getTopiaId());
+ //ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
+ // closedPeriodicEntryBookDAO.findByTopiaId(
+ // closedPeriodicEntryBook.getTopiaId());
- closedPeriodicEntryBook2.setLocked(true);
- closedPeriodicEntryBookDAO.update(closedPeriodicEntryBook2);
+ closedPeriodicEntryBook.setLocked(true);
+ closedPeriodicEntryBookDAO.update(closedPeriodicEntryBook);
commitTransaction(topiaContext);
} catch (TopiaException ex) {
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java 2012-04-25 08:28:20 UTC (rev 3391)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAO.java 2012-04-25 09:14:11 UTC (rev 3392)
@@ -25,7 +25,10 @@
package org.chorem.lima.entity;
+import java.util.List;
+
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
/**
* Ajout de requetes specifiques aux financial transaction sur le DAO.
@@ -51,4 +54,65 @@
return count.longValue();
}
+ /**
+ * Find all unbalanced transactions.
+ *
+ * @param period period
+ * @param entryBook entry book
+ * @return unbalanced transactions
+ * @throws TopiaException
+ */
+ public List<FinancialTransaction> getAllUnbalancedTransaction(FinancialPeriod period,
+ EntryBook entryBook) throws TopiaException {
+ TopiaQuery query = createQuery("E");
+ query.addWhere("E.amountCredit != E.amountDebit")
+ .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK, entryBook)
+ .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD, period);
+ List<FinancialTransaction> result = findAllByQuery(query);
+ return result;
+ }
+
+ /**
+ * Find all transaction where some field are not filled in.
+ *
+ * @param period period
+ * @param entryBook entry book
+ * @return unfilled transaction
+ * @throws TopiaException
+ */
+ public List<FinancialTransaction> getAllUnfilledTransaction(FinancialPeriod period,
+ EntryBook entryBook) throws TopiaException {
+ TopiaQuery query = createQuery("T");
+ query.addDistinct()
+ .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
+ .addFrom(FiscalPeriod.class, "F")
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
+ .addEquals(FinancialTransaction.PROPERTY_ENTRY_BOOK, entryBook)
+ .addEquals(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD, period);
+ List<FinancialTransaction> result = findAllByQuery(query);
+ return result;
+ }
+
+ /**
+ * Find all transaction without entry book.
+ *
+ * TODO echatellier 20120425 same method as getAllUnfilledTransaction ?
+ * doesn't concern a period ?
+ *
+ * @return
+ * @throws TopiaException
+ */
+ public List<FinancialTransaction> getAllTransactionWithoutEntryBook() throws TopiaException {
+ TopiaQuery query = createQuery("T");
+ query.addDistinct()
+ .addOrder("T." + FinancialTransaction.TOPIA_CREATE_DATE)
+ .addFrom(FiscalPeriod.class, "F")
+ .addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true)
+ .addWhere("T.amountCredit != T.amountDebit OR E.account = null OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = ''")
+ .addNull(FinancialTransaction.PROPERTY_ENTRY_BOOK);
+ List<FinancialTransaction> result = findAllByQuery(query);
+ return result;
+ }
+
} //FinancialTransactionDAO
1
0
r3391 - trunk/lima-business/src/test/java/org/chorem/lima/business
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 10:28:20 +0200 (Wed, 25 Apr 2012)
New Revision: 3391
Url: http://chorem.org/repositories/revision/lima/3391
Log:
Fix import, exceptions
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -31,7 +31,6 @@
import org.junit.Before;
import org.junit.Test;
-import java.text.ParseException;
import java.util.List;
/**
@@ -47,7 +46,7 @@
public class AccountServiceImplTest extends AbstractLimaTest {
@Before
- public void initTest() throws LimaException, ParseException {
+ public void initTest() throws Exception {
initTestDatabase();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -25,18 +25,12 @@
package org.chorem.lima.business;
-import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import java.text.ParseException;
-
-import javax.ejb.TransactionAttribute;
-
/**
* Tests pour la gestion des journaux.
* <p/>
@@ -50,7 +44,7 @@
protected static final String JOURNAL_DES_VENTES = "Journal des ventes";
@Before
- public void initTest() throws LimaException, ParseException {
+ public void initTest() throws Exception {
initTestDatabase();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -25,17 +25,13 @@
package org.chorem.lima.business;
-import java.text.ParseException;
-
-import junit.framework.Assert;
-
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Tests pour la gestion des timespans
@@ -52,7 +48,7 @@
public class FinancialPeriodServiceImplTest extends AbstractLimaTest {
@Before
- public void initTest() throws LimaException, ParseException {
+ public void initTest() throws Exception {
initTestDatabase();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -27,18 +27,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.ejb.FiscalPeriodServiceImpl;
import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaNotFoundException;
-import java.text.ParseException;
-
/**
* Tests pour la gestion des périodes
* <p/>
@@ -56,31 +48,11 @@
private static final Log log = LogFactory
.getLog(FiscalPeriodServiceImplTest.class);
- private static FiscalPeriodServiceImpl instance;
-
- private TopiaContext rootContext;
-
@Before
- public void initTest() throws LimaException, ParseException {
+ public void initTest() throws Exception {
initTestDatabase();
}
- public FiscalPeriodServiceImplTest() {
- LimaConfig config = LimaConfig.getInstance();
- try {
- rootContext = TopiaContextFactory.getContext(config.getOptions());
- } catch (TopiaNotFoundException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't init topia context", ex);
- }
- }
- }
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- //LimaConfigTest.getInstance();
- }
-
/**
* On nettoie la base de données
*
@@ -303,14 +275,4 @@
// Nombre 12 timeSpans mensuels
Assert.assertEquals(12, listTimeSpanDTO.size());*/
}
-
- protected TopiaContext beginTransaction() throws TopiaException {
- // basic check done, make check in database
- // TODO move it into JTA
- TopiaContext topiaTransaction;
- topiaTransaction = rootContext.beginTransaction();
- log.trace("beginTransaction" + topiaTransaction);
- return topiaTransaction;
- }
-
}
\ No newline at end of file
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -25,10 +25,11 @@
package org.chorem.lima.business;
-import org.apache.commons.io.FileUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
+
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.pdfbox.util.StringUtil;
import org.chorem.lima.business.utils.ImportExportEntityEnum;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FiscalPeriod;
@@ -36,10 +37,6 @@
import org.junit.Assert;
import org.junit.Test;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.ParseException;
-
/**
* Test du service d'import en faisant des import/export EBP et xml.
*
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-25 08:28:20 UTC (rev 3391)
@@ -39,7 +39,6 @@
import org.junit.Test;
import java.math.BigDecimal;
-import java.text.ParseException;
import java.util.Date;
/**
@@ -52,18 +51,17 @@
public class ReportServiceImplTest extends AbstractLimaTest {
@Before
- public void initTest() throws LimaException, ParseException {
+ public void initTest() throws Exception {
initTestDatabase();
}
/**
* Test de génération du rapport des comptes.
*
- * @throws LimaException
- * @throws ParseException
+ * @throws Exception
*/
@Test
- public void testGenerateAccountsReports() throws LimaException, ParseException {
+ public void testGenerateAccountsReports() throws Exception {
Account accountBefa = accountService.getAccountByNumber("51");
Assert.assertNotNull(accountBefa);
@@ -84,11 +82,10 @@
* Test de génération du rapport des comptes, en verifiant que les transactions
* non équilibrées ne sont pas présentes (modification 0.6).
*
- * @throws LimaException
- * @throws ParseException
+ * @throws Exception
*/
@Test
- public void testGenerateAccountsReportsUnlalanced() throws LimaException, ParseException {
+ public void testGenerateAccountsReportsUnlalanced() throws Exception {
EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv");
Account accountVmpVae = accountService.getAccountByNumber("511");
1
0
r3390 - trunk/lima-business/src/test/java/org/chorem/lima/business
by echatellier@users.chorem.org April 25, 2012
by echatellier@users.chorem.org April 25, 2012
April 25, 2012
Author: echatellier
Date: 2012-04-25 10:23:08 +0200 (Wed, 25 Apr 2012)
New Revision: 3390
Url: http://chorem.org/repositories/revision/lima/3390
Log:
Add test to block financial period (failing test)
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2012-04-24 16:25:00 UTC (rev 3389)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2012-04-25 08:23:08 UTC (rev 3390)
@@ -25,11 +25,18 @@
package org.chorem.lima.business;
+import java.text.ParseException;
+
+import junit.framework.Assert;
+
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.junit.Before;
import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
-import java.text.ParseException;
-
/**
* Tests pour la gestion des timespans
* <p/>
@@ -50,39 +57,29 @@
}
/**
- * Permet de tester l'ajout d'un timespan.
+ * Test de la fermeture d'une periode comptable pour un journal donné.
+ *
+ * @throws Exception
*/
@Test
- public void createTimeSpanTest() {
- /*// debut 1 janvier 2011
- Date beginTimeSpan = df.parse("Junary 1, 2011");
- // fin 15 janvier 2011
- Date endTimeSpan = df.parse("Junary 15, 2011");
+ public void blockClosedPeriodicEntryBookTest() throws Exception {
- // Création du timespan du 1 janvier au 31 janvier.
- // Malgre la date de fin du 15 janvier, elle ne prend en compte que la
- // date de début. La période a pour valeur nulle, et le timepsan est
- // non bloqué.
- result = financialPerdiodService.createTimeSpan(beginTimeSpan, endTimeSpan, null,
- false);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);*/
- }
+ // find one closed to close
+ TopiaContext context = getTestContext().beginTransaction();
+ ClosedPeriodicEntryBookDAO dao = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(context);
+ ClosedPeriodicEntryBook closedPeriodic = dao.findAll().get(0);
+ context.closeContext();
- /**
- * Permet de tester la fonction rechercher pour un timespan. Si ce dernier
- * n'est pas trouvé, l'objet de retour est nul.
- */
- @Test
- public void findTimeSpanByMonthYearTest() {
- /*// Il existe déja une période du 1 jan 2011 au 31 jan 2011 (createTimeSpanTest)
- // debut 1 janvier 2011
- Date dateSearch = new Date(111, 0, 1);
- TimeSpan timespan = instance.searchTimeSpanByDate(dateSearch);
- assertTrue(timespan != null); // Trouve bien le timespan
- // debut 1 mai 2011
- dateSearch = new Date(111, 4, 1);
- timespan = instance.searchTimeSpanByDate(dateSearch);
- assertTrue(timespan == null); // Ne le trouve pas */
+ // block it
+ Assert.assertFalse(closedPeriodic.isLocked());
+ financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodic);
+
+ // check it's blocked
+ context = getTestContext().beginTransaction();
+ dao = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(context);
+ closedPeriodic = dao.findAll().get(0);
+ context.closeContext();
+ Assert.assertFalse(closedPeriodic.isLocked());
}
}
1
0
r3389 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/test/java/org/chorem/lima/business lima-business/src/test/java/org/chorem/lima/business/accountingrules lima-business/src/test/java/org/chorem/lima/entity lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 18:25:00 +0200 (Tue, 24 Apr 2012)
New Revision: 3389
Url: http://chorem.org/repositories/revision/lima/3389
Log:
Test may be now fixed, but styll unstable between maven and IDE :(
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java
trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -66,13 +66,13 @@
String accountNumber = account.getAccountNumber();
// ledger account must be located in 411 account
- if (!StringUtils.isNumeric(accountNumber) && accountNumber.startsWith("4")) {
+ if (!StringUtils.isNumeric(accountNumber) && !accountNumber.startsWith("4")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotnumeric",
account.getAccountNumber()));
}
// Check root account starts with 1 to 8
- if (accountNumber.length() == 1 && accountNumber.matches("[1-8]")) {
+ if (accountNumber.length() == 1 && !accountNumber.matches("[1-8]")) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror",
account.getAccountNumber()));
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -35,6 +35,7 @@
import org.chorem.lima.entity.FinancialTransactionImpl;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import java.math.BigDecimal;
@@ -43,7 +44,11 @@
/**
* Test le service de génération des reports.
+ *
+ * FIXME echatellier 20120424 les tests sont désactivés car le code qui genere
+ * les rapports dans ReportService est commenté.
*/
+@Ignore
public class ReportServiceImplTest extends AbstractLimaTest {
@Before
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -67,10 +67,9 @@
* @throws LimaException
*/
@Test(expected=LimaException.class)
- @Override
- public void testCreateAccountWrongNumber() throws LimaException {
+ public void testCreateAccountWrongStart() throws LimaException {
Account myAccount = new AccountImpl();
- myAccount.setAccountNumber("42");
+ myAccount.setAccountNumber("10TEST");
accountService.createAccount(myAccount);
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -27,6 +27,7 @@
import org.chorem.lima.business.ReportServiceImplTest;
import org.junit.Assert;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -41,7 +42,10 @@
*
* Last update : $Date$
* By : $Author$
+ *
+ * FIXME echatellier 20120424 fix parent test first
*/
+@Ignore
public class ReportServiceRuleFrTest extends ReportServiceImplTest {
@BeforeClass
Modified: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -27,7 +27,9 @@
import org.chorem.lima.business.AbstractLimaTest;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import java.util.List;
@@ -43,18 +45,30 @@
*/
public class AccountDAOTest extends AbstractLimaTest {
+ @Before
+ public void initTest() throws Exception {
+ initTestDatabase();
+ }
+
/**
* Test la recherche de compte par interval.
* @throws TopiaException
*/
@Test
public void testStringToListAccounts() throws TopiaException {
- AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(getTestContext());
+ TopiaContext tx = getTestContext().beginTransaction();
+ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(tx);
+
List<Account> accounts = accountDAO.stringToListAccounts("50..511", false);
- Assert.assertEquals(3, accounts.size());
+ for (Account account : accounts) {
+ System.out.println(account.getAccountNumber());
+ }
+ Assert.assertEquals(5, accounts.size());
accounts = accountDAO.stringToListAccounts("60..99", false);
Assert.assertEquals(0, accounts.size());
+
+ tx.closeContext();
}
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 14:50:09 UTC (rev 3388)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 16:25:00 UTC (rev 3389)
@@ -88,8 +88,9 @@
*/
protected List<Account> findIntervalAccountByNumber(String accountNumberLow,
String accountNumberHigh) throws TopiaException {
- String query = "FROM " + Account.class.getName() + " WHERE ? < accountNumber AND accountNumber > ?";
- return (List<Account>) context.find(query, accountNumberLow, accountNumberHigh);
+ String query = "FROM " + Account.class.getName() + " WHERE :accountNumberLow <= accountNumber AND accountNumber <= :accountNumberHigh";
+ return (List<Account>) context.find(query, "accountNumberLow",
+ accountNumberLow, "accountNumberHigh", accountNumberHigh);
}
/**
1
0
r3388 - trunk/lima-business/src/test/java/org/chorem/lima/business
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 16:50:09 +0200 (Tue, 24 Apr 2012)
New Revision: 3388
Url: http://chorem.org/repositories/revision/lima/3388
Log:
Fix all account service tests
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-24 14:49:48 UTC (rev 3387)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-24 14:50:09 UTC (rev 3388)
@@ -185,12 +185,11 @@
public void removeAccountTest() throws LimaException {
Account accountToRemove = accountService.getAccountByNumber("50");
- // On souhaite supprimer le compte 51. Ce compte existe bien. Il possede
- // des fils. La suppression se déroule bien.
+ // On souhaite supprimer le compte 51. Ce compte existe bien.
accountService.removeAccount(accountToRemove);
- // Il ne doit rester que 4 compte (5, 51, 511, 512)
- Assert.assertEquals(4, accountService.getAllAccounts().size());
+ // Il ne doit rester que 6 compte
+ Assert.assertEquals(6, accountService.getAllAccounts().size());
}
/**
1
0
r3387 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/test/java/org/chorem/lima/business lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 16:49:48 +0200 (Tue, 24 Apr 2012)
New Revision: 3387
Url: http://chorem.org/repositories/revision/lima/3387
Log:
Fix delete entry book test
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java
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 2012-04-24 14:22:38 UTC (rev 3386)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2012-04-24 14:49:48 UTC (rev 3387)
@@ -185,12 +185,20 @@
try {
- //check
+ // check rule
accountingRules.removeEntryBookRules(entryBook, topiaTransaction);
- //delete
- EntryBookDAO entryBookDAO =
- LimaCallaoDAOHelper.getEntryBookDAO(topiaTransaction);
+ // delete all ClosedPeriodicEntryBook from this EntryBook
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
+ List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks =
+ closedPeriodicEntryBookDAO.findAllByEntryBook(entryBook);
+ for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBooks) {
+ closedPeriodicEntryBookDAO.delete(closedPeriodicEntryBook);
+ }
+
+ // delete entry book
+ EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaTransaction);
entryBookDAO.delete(entryBook);
commitTransaction(topiaTransaction);
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-24 14:22:38 UTC (rev 3386)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-24 14:49:48 UTC (rev 3387)
@@ -25,14 +25,18 @@
package org.chorem.lima.business;
+import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookImpl;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.text.ParseException;
+import javax.ejb.TransactionAttribute;
+
/**
* Tests pour la gestion des journaux.
* <p/>
@@ -83,7 +87,8 @@
}
/**
- * Un journal tout juste créé doit pouvoir être supprimé.
+ * Un journal tout juste créé doit pouvoir être supprimé, y compris
+ * les closed qui sont lié entre le journal et les periodes.
*
* @throws LimaException
*/
@@ -94,7 +99,8 @@
myEntryBook.setLabel("MyJournal");
myEntryBook = entryBookService.createEntryBook(myEntryBook);
entryBookService.removeEntryBook(myEntryBook);
+
+ Assert.assertEquals(1, entryBookService.getAllEntryBooks().size());
- Assert.assertEquals(1, entryBookService.getAllEntryBooks().size());
}
}
\ No newline at end of file
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java 2012-04-24 14:22:38 UTC (rev 3386)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAO.java 2012-04-24 14:49:48 UTC (rev 3387)
@@ -38,6 +38,16 @@
private static final Log log = LogFactory.getLog(ClosedPeriodicEntryBookDAO.class);
+ /**
+ * Find all ClosedPeriodicEntryBook with common EntryBook.
+ *
+ * @param entryBook entry book property
+ * @return ClosedPeriodicEntryBook list
+ * @throws TopiaException
+ */
+ public List<ClosedPeriodicEntryBook> findAllByEntryBook(EntryBook entryBook) throws TopiaException {
+ return findAllByProperties(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, entryBook);
+ }
/** Return ClosedPeriodicEntryBook by EntryBook and FinancialPeriod */
public ClosedPeriodicEntryBook findByEntryBookAndFinancialPeriod(
1
0
r3386 - trunk/lima-business/src/test/java/org/chorem/lima/business
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 16:22:38 +0200 (Tue, 24 Apr 2012)
New Revision: 3386
Url: http://chorem.org/repositories/revision/lima/3386
Log:
Fix all import tests
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 14:19:58 UTC (rev 3385)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 14:22:38 UTC (rev 3386)
@@ -151,7 +151,7 @@
String pcg = IOUtils.toString(ImportServiceImplTest.class.getResourceAsStream("/import/pcg_base.csv"));
importService.importAsCSV(pcg, ImportExportEntityEnum.ACCOUNT);
- Assert.assertEquals(50, accountService.getAccountCount());
+ Assert.assertEquals(460, accountService.getAccountCount());
}
/**
@@ -164,6 +164,6 @@
String pcg = IOUtils.toString(ImportServiceImplTest.class.getResourceAsStream("/import/eb_default.csv"));
importService.importAsCSV(pcg, ImportExportEntityEnum.ENTRYBOOK);
- Assert.assertEquals(50, entryBookService.getAllEntryBooks().size());
+ Assert.assertEquals(5, entryBookService.getAllEntryBooks().size());
}
}
1
0
r3385 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/test/java/org/chorem/lima/business lima-business-api/src/main/java/org/chorem/lima/business/api
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 16:19:58 +0200 (Tue, 24 Apr 2012)
New Revision: 3385
Url: http://chorem.org/repositories/revision/lima/3385
Log:
Fix import entry book from ebp test
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 13:14:37 UTC (rev 3384)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 14:19:58 UTC (rev 3385)
@@ -50,6 +50,7 @@
import javax.ejb.Remote;
import javax.ejb.Stateless;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -117,6 +118,7 @@
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementDAO;
import org.chorem.lima.entity.VatStatementImpl;
+import org.hsqldb.lib.ArrayUtil;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
@@ -372,6 +374,52 @@
return result.toString();
}
+ @Override
+ public String importEntryBookFromEbp(String datas) throws LimaException {
+ long before = System.currentTimeMillis();
+
+ StringBuilder result = new StringBuilder();
+ TopiaContext topiaContext = beginTransaction(rootContext);
+
+ try {
+ CSVReader csvReader = new CSVReader(new StringReader(datas));
+
+ // check if file have a good header
+ String[] headers = csvReader.readNext();
+ if (!headers[0].equals("Code") || !headers[2].equals("Libelle")) {
+ throw new LimaBusinessException(
+ _("lima-business.import.noaccount"));
+ }
+
+ // create entry book for each line
+ int count = 0;
+ String[] line = csvReader.readNext();
+ while (line != null) {
+ EntryBook entryBook = new EntryBookImpl();
+ entryBook.setCode(line[0]);
+ entryBook.setLabel(line[2]);
+ entryBookService.createEntryBook(entryBook);
+ result.append(_("lima-business.import.accountadded", entryBook.getCode(), entryBook.getLabel()));
+ count++;
+
+ line = csvReader.readNext();
+ }
+
+ if (log.isInfoEnabled()) {
+ long after = System.currentTimeMillis();
+ log.info("Imported form EBP : " + count + " accounts in " + (after-before) + " ms");
+ }
+
+ } catch (Exception ex) {
+ doCatch(topiaContext, ex);
+ } finally {
+ doFinally(topiaContext);
+ }
+
+ return result.toString();
+ }
+
+
// ################ IMPORT ################
/** Remote methode to call all entities import from UI */
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 13:14:37 UTC (rev 3384)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 14:19:58 UTC (rev 3385)
@@ -80,7 +80,7 @@
entryBookStream = ImportServiceImplTest.class.getResourceAsStream("/ebp/journaux.txt");
String entryBookData = IOUtils.toString(entryBookStream, "ISO-8859-1");
- //importService.importAccountsChartFromEbp(entryBookData);
+ importService.importEntryBookFromEbp(entryBookData);
entryBookStream.close();
entriesStream = ImportServiceImplTest.class.getResourceAsStream("/ebp/ecritures.txt");
@@ -137,7 +137,7 @@
public void testImportEntryBookEBP() throws Exception {
importEBPData();
- Assert.assertNotNull(entryBookService.getEntryBookByCode("EV"));
+ Assert.assertNotNull(entryBookService.getEntryBookByCode("AN"));
Assert.assertNotNull(entryBookService.getEntryBookByCode("BQ"));
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2012-04-24 13:14:37 UTC (rev 3384)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2012-04-24 14:19:58 UTC (rev 3385)
@@ -44,6 +44,15 @@
String importAccountsChartFromEbp(String data) throws LimaException;
/**
+ * Import entry books as EBP import.
+ *
+ * @param datas
+ * @return
+ * @throws LimaException
+ */
+ String importEntryBookFromEbp(String datas) throws LimaException;
+
+ /**
* Import entries as EBP import.
*
* @param data import file content as string (remote service can't take File)
@@ -81,4 +90,6 @@
String importAsPDF(String data,
ImportExportEntityEnum importExportEntityEnum,
boolean saveMode) throws LimaException;
+
+
}
1
0
Author: echatellier
Date: 2012-04-24 15:14:37 +0200 (Tue, 24 Apr 2012)
New Revision: 3384
Url: http://chorem.org/repositories/revision/lima/3384
Log:
Update h2, jdom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-04-24 13:14:14 UTC (rev 3383)
+++ trunk/pom.xml 2012-04-24 13:14:37 UTC (rev 3384)
@@ -103,7 +103,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.165</version>
+ <version>1.3.166</version>
<scope>runtime</scope>
</dependency>
@@ -166,7 +166,7 @@
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
- <version>1.1</version>
+ <version>2.0.0</version>
<scope>compile</scope>
</dependency>
1
0
r3383 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/test/java/org/chorem/lima/business lima-business/src/test/resources lima-business/src/test/resources/import lima-business-api/src/main/java/org/chorem/lima/business/api lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 15:14:14 +0200 (Tue, 24 Apr 2012)
New Revision: 3383
Url: http://chorem.org/repositories/revision/lima/3383
Log:
Fix account service removing method without implementation not used in lima UI.
Fix import csv tests.
Added:
trunk/lima-business/src/test/resources/import/
trunk/lima-business/src/test/resources/import/eb_default.csv
trunk/lima-business/src/test/resources/import/pcg_base.csv
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-24 13:06:38 UTC (rev 3382)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-04-24 13:14:14 UTC (rev 3383)
@@ -181,65 +181,6 @@
}
/**
- * Permet de recuperer la liste des comptes fils d'un compte en particulier.
- *
- * @param masterAccount (can be null)
- * @return
- * @throws LimaException
- */
- @Override
- public List<Account> getChildrenAccounts(Account masterAccount) throws LimaException {
-
- List<Account> accountsList = null;
-
- try {
- AccountDAO accountDAO = LimaDaoHelper.getAccountDAO();
-
- //TopiaQuery query = accountDAO.createQuery();
- //tchemit 2011-09-21 Only consider account childs from the master account
- // link otherwise account can be found from different masterAccount
- //query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
-// if (masterAccount == null) {
-// query.addEquals(Account.PROPERTY_MASTER_ACCOUNT, masterAccount);
-// query.addWhere(Account.PROPERTY_GENERAL_LEDGER, TopiaQuery.Op.EQ, null);
-// } else {
-// query.addWhere(Account.PROPERTY_MASTER_ACCOUNT +
-// " = :value or " +
-// Account.PROPERTY_GENERAL_LEDGER + " = :value")
-// .addParam("value", masterAccount);
-// }
- //accountsList.addAll(accountDAO.findAllByQuery(query));
- //Collections.sort(accountsList, new AccountComparator());
-
- // sort of bug fix 2011.09.10 vsalaun (+ bleny)
- // do NOT delete these lines unless you find a better way to
- // prevent lazy exception when updating account from the account chart
- /*for (Account t : accountsList) {
- if (t.getMasterAccount() != null) {
- t.getMasterAccount().getTopiaId();
- }
- t.sizeSubAccounts();
- t.sizeSubLedgers();
- t.getGeneralLedger();
- }*/
-
- accountsList = accountDAO.getSubAccounts(masterAccount);
-
- } catch (Exception ex) {
- throw new LimaException("Can't get children accounts", ex);
- }
-
- return accountsList;
- }
-
- /** Get list of all subaccount and ledger of an account */
- @Override
- public List<Account> getAllChildrenAccounts(Account masterAccount) throws LimaException {
-
- return null;
- }
-
- /**
* Permet d'effacer un compte dans la base de données.
* <p/>
* Si il existe une entrée comptable associée au numéro de
@@ -268,14 +209,6 @@
}
}
- @Override
- public void removeAllAccount() throws LimaException {
- List<Account> accounts = getChildrenAccounts(null);
- for (Account account : accounts) {
- removeAccount(account);
- }
- }
-
/**
* Permet de modifier un compte sur son label.
* <p/>
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-24 13:06:38 UTC (rev 3382)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2012-04-24 13:14:14 UTC (rev 3383)
@@ -155,18 +155,6 @@
}
/**
- * Permet de tester le nombre d'enfants renvoyés appartenant à un père.
- * @throws LimaException
- */
- @Test
- public void getChildrenAccountsTest() throws LimaException {
- // On recherche le compte 5 - COMPTES FINANCIERS
- Account account = accountService.getAccountByNumber("5");
- List<Account> listAccount = accountService.getChildrenAccounts(account);
- Assert.assertEquals(2, listAccount.size());
- }
-
- /**
* Permet de tester la méthode recherchant tous les comptes.
*
* @throws LimaException
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 13:06:38 UTC (rev 3382)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-04-24 13:14:14 UTC (rev 3383)
@@ -25,7 +25,11 @@
package org.chorem.lima.business;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pdfbox.util.StringUtil;
+import org.chorem.lima.business.utils.ImportExportEntityEnum;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodImpl;
@@ -102,8 +106,7 @@
Assert.assertEquals(571, accountService.getAllAccounts().size());
Assert.assertEquals("Créances", accountService.getAccountByNumber("78174000").getLabel());
- Assert.assertEquals(14, accountService.getChildrenAccounts(accountService.getAccountByNumber("1")).size());
-
+
// test employe and client
Assert.assertNotNull(accountService.getAccountByNumber("401TEEMP"));
Assert.assertNotNull(accountService.getAccountByNumber("411TECLI"));
@@ -137,4 +140,30 @@
Assert.assertNotNull(entryBookService.getEntryBookByCode("EV"));
Assert.assertNotNull(entryBookService.getEntryBookByCode("BQ"));
}
+
+ /**
+ * Test que les import csv fourni avec lima s'import bien.
+ * @throws Exception
+ */
+ @Test
+ public void testImportCSVPCG() throws Exception {
+ clearService.clearDatabase();
+
+ String pcg = IOUtils.toString(ImportServiceImplTest.class.getResourceAsStream("/import/pcg_base.csv"));
+ importService.importAsCSV(pcg, ImportExportEntityEnum.ACCOUNT);
+ Assert.assertEquals(50, accountService.getAccountCount());
+ }
+
+ /**
+ * Test que les import csv fourni avec lima s'import bien.
+ * @throws Exception
+ */
+ @Test
+ public void testImportCSVEb() throws Exception {
+ clearService.clearDatabase();
+
+ String pcg = IOUtils.toString(ImportServiceImplTest.class.getResourceAsStream("/import/eb_default.csv"));
+ importService.importAsCSV(pcg, ImportExportEntityEnum.ENTRYBOOK);
+ Assert.assertEquals(50, entryBookService.getAllEntryBooks().size());
+ }
}
Added: trunk/lima-business/src/test/resources/import/eb_default.csv
===================================================================
--- trunk/lima-business/src/test/resources/import/eb_default.csv (rev 0)
+++ trunk/lima-business/src/test/resources/import/eb_default.csv 2012-04-24 13:14:14 UTC (rev 3383)
@@ -0,0 +1,5 @@
+"ENBK";"ACH";"Journal des achats"
+"ENBK";"VTE";"Journal des ventes"
+"ENBK";"ODT";"Journal des opérations diverses"
+"ENBK";"BQE";"Journal de trésorerie"
+"ENBK";"CSE";"Journal de caisse"
Added: trunk/lima-business/src/test/resources/import/pcg_base.csv
===================================================================
--- trunk/lima-business/src/test/resources/import/pcg_base.csv (rev 0)
+++ trunk/lima-business/src/test/resources/import/pcg_base.csv 2012-04-24 13:14:14 UTC (rev 3383)
@@ -0,0 +1,461 @@
+"ACCN";"101";"Capital";"";"10";""
+"ACCN";"104";"Primes liées au capital social";"";"10";""
+"ACCN";"105";"Ecarts de réévaluation";"";"10";""
+"ACCN";"1061";"Réserve légale";"";"106";""
+"ACCN";"1062";"Réserves indisponibles";"";"106";""
+"ACCN";"1063";"Réserves statutaires ou contractuelles";"";"106";""
+"ACCN";"1064";"Réserves réglementées";"";"106";""
+"ACCN";"106";"Réserves";"";"10";""
+"ACCN";"1068";"Autres réserves";"";"106";""
+"ACCN";"107";"Ecart d'équivalence";"";"10";""
+"ACCN";"108";"Compte de l'exploitant";"";"10";""
+"ACCN";"10";"CAPITAL ET RESERVE";"";"1";""
+"ACCN";"109";"Actionnaires : capital souscrit - non appelé";"";"10";""
+"ACCN";"110";"Report à nouveau (solde créditeur)";"";"11";""
+"ACCN";"11";"REPORT A NOUVEAU (solde créditeur ou débiteur)";"";"1";""
+"ACCN";"119";"Report à nouveau (solde débiteur)";"";"11";""
+"ACCN";"120";"Résultat de l'exercice (bénéfice)";"";"12";""
+"ACCN";"12";"RESULTAT DE L'EXERCICE (bénéfice ou perte)";"";"1";""
+"ACCN";"129";"Résultat de l'exercice (perte)";"";"12";""
+"ACCN";"131";"Subvention d'équipement";"";"13";""
+"ACCN";"138";"Autres subventions d'investissement";"";"13";""
+"ACCN";"13";"SUBVENTION D'NVESTISSEMENT";"";"1";""
+"ACCN";"1391";"Subventions d'équipement";"";"139";""
+"ACCN";"139";"Subventions d'investissement inscrites au compte de résultat";"";"13";""
+"ACCN";"1398";"Autres subventions d'investissement";"";"139";""
+"ACCN";"142";"Provisions réglementées relatives aux immobilisations";"";"14";""
+"ACCN";"143";"Provisions réglementées relatives aux stocks";"";"14";""
+"ACCN";"144";"Provisions réglementées relatives aux autres éléments de l'actif";"";"14";""
+"ACCN";"145";"Amortissements dérogatoires";"";"14";""
+"ACCN";"146";"Provision spéciale de réévaluation";"";"14";""
+"ACCN";"147";"Plus-values réinvesties";"";"14";""
+"ACCN";"14";"PROVISIONS REGLEMENTEES";"";"1";""
+"ACCN";"148";"Autres provisions réglementées";"";"14";""
+"ACCN";"151";"Provisions pour risques";"";"15";""
+"ACCN";"153";"Provisions pour pensions et obligations similaires";"";"15";""
+"ACCN";"154";"Provisions pour restructurations";"";"15";""
+"ACCN";"155";"Provisions pour impôts";"";"15";""
+"ACCN";"156";"Provisions pour renouvellement des immobilisations (entreprises concessionnaires)";"";"15";""
+"ACCN";"157";"Provisions pour charges à répartir sur plusieurs exercices";"";"15";""
+"ACCN";"15";"PROVlSlONS POUR RISQUES ET CHARGES";"";"1";""
+"ACCN";"158";"Autres provisions pour charges";"";"15";""
+"ACCN";"161";"Emprunt obligataires convertibles";"";"16";""
+"ACCN";"163";"Autres emprunts obligataires";"";"16";""
+"ACCN";"164";"Emprunts auprès des établissements de crédit";"";"16";""
+"ACCN";"165";"Dépôts et cautionnements reçus";"";"16";""
+"ACCN";"166";"Participation des salariés aux résultats";"";"16";""
+"ACCN";"16";"EMPRUNTS ET DETTES ASSIMILEES";"";"1";""
+"ACCN";"169";"Primes de remboursement des obligations";"";"16";""
+"ACCN";"171";"Dettes rattachées à des participations (groupe)";"";"17";""
+"ACCN";"174";"Dettes rattachées à des participations (hors groupe)";"";"17";""
+"ACCN";"17";"DETTES RATTACHÉES À DES PARTICIPATIONS";"";"1";""
+"ACCN";"178";"Dettes rattachées à des sociétés en participation";"";"17";""
+"ACCN";"1";"COMPTES DE CAPITAUX";"";"";""
+"ACCN";"201";"Frais d'établissement";"";"20";""
+"ACCN";"203";"Frais de recherche et de développement";"";"20";""
+"ACCN";"205";"Concessions et droits similaires";"";"20";""
+"ACCN";"206";"Droit au bail";"";"20";""
+"ACCN";"207";"Fonds commercial";"";"20";""
+"ACCN";"20";"IMMOBILISATIONS INCORPORELLES";"";"2";""
+"ACCN";"208";"Autres immobilisations incorporelles";"";"20";""
+"ACCN";"211";"Terrains";"";"21";""
+"ACCN";"212";"Agencements et aménagements de terrains";"";"21";""
+"ACCN";"213";"Constructions";"";"21";""
+"ACCN";"214";"Constructions sur sol d'autrui";"";"21";""
+"ACCN";"215";"Installations techniques; matériel et outillage industriels";"";"21";""
+"ACCN";"21";"IMMOBlLlSATIONS CORPORELLES";"";"2";""
+"ACCN";"218";"Autres immobilisations corporelles";"";"21";""
+"ACCN";"231";"Immobilisations corporelles en cours";"";"23";""
+"ACCN";"232";"Immobilisations incorporelles en cours";"";"23";""
+"ACCN";"237";"Avances et acomptes versés sur immobilisations incorporelles";"";"23";""
+"ACCN";"23";"IMMOBILlSATlONS EN COURS";"";"2";""
+"ACCN";"238";"Avances et acomptes versés sur immobilisations corporelles";"";"23";""
+"ACCN";"261";"Titres de participation";"";"26";""
+"ACCN";"266";"Autres formes de participation";"";"26";""
+"ACCN";"267";"Créances rattachées à des participations";"";"26";""
+"ACCN";"268";"Créances rattachées à des sociétés en participation";"";"26";""
+"ACCN";"26";"PARTICIPATIONS ET CRÉANCES RATTACHÉES À DES PARTICIPATIONS";"";"2";""
+"ACCN";"269";"Versements restant à effectuer sur titres de participation non libérés";"";"26";""
+"ACCN";"271";"Titres immobilisés autres que les titres immobilisés de l'activité portefeuille (droit de propriété)";"";"27";""
+"ACCN";"272";"Titres immobilisés (droits de créance)";"";"27";""
+"ACCN";"273";"Titres immobilisés de l'activité portefeuille";"";"27";""
+"ACCN";"274";"Prêts";"";"27";""
+"ACCN";"275";"Dépôts et cautionnements versés";"";"27";""
+"ACCN";"27";"AUTRES IMMOBILISATIONS FINANCIERES";"";"2";""
+"ACCN";"279";"Versements restant à effectuer sur titres immobilisés non libérés";"";"27";""
+"ACCN";"28";"AMORTISSEMENTS DES IMMOBILISATIONS";"";"2";""
+"ACCN";"2";"COMPTES D'IMMOBILISATIONS";"";"";""
+"ACCN";"29";"PROVISIONS POUR DEPRECIATION DES IMMOBILISATIONS";"";"2";""
+"ACCN";"311";"Matière (ou groupe) A";"";"31";""
+"ACCN";"312";"Matières (ou groupe) B";"";"31";""
+"ACCN";"31";"MATIERES PREMIERES (et fournitures)";"";"3";""
+"ACCN";"317";"Fournitures A, B, C...";"";"31";""
+"ACCN";"321";"Matières consommables";"";"32";""
+"ACCN";"322";"Fournitures consommables";"";"32";""
+"ACCN";"32";"AUTRES APPROVISIONNEMENTS";"";"3";""
+"ACCN";"326";"Emballages";"";"32";""
+"ACCN";"331";"Produits en cours";"";"33";""
+"ACCN";"33";"EN-COURS DE PRODUCTION DE BIENS";"";"3";""
+"ACCN";"335";"Travaux en cours";"";"33";""
+"ACCN";"341";"Etudes en cours";"";"34";""
+"ACCN";"34";"EN-COURS DE PRODUCTION DE SERVICES";"";"3";""
+"ACCN";"345";"Prestations de services en cours";"";"34";""
+"ACCN";"351";"Produits intermédiaires";"";"35";""
+"ACCN";"355";"Produits finis";"";"35";""
+"ACCN";"35";"STOCKS DE PRODUITS";"";"3";""
+"ACCN";"358";"Produits résiduels (ou matières de récupérations)";"";"35";""
+"ACCN";"371";"Marchandise (ou groupe) A";"";"37";""
+"ACCN";"37";"STOCKS DE MARCHANDISES";"";"3";""
+"ACCN";"372";"Marchandise (ou groupe) B";"";"37";""
+"ACCN";"3";"COMPTES DE STOCKS ET D'EN-COURS";"";"";""
+"ACCN";"391";"Provisions pour dépréciation des stocks d'approvisionnement";"";"39";""
+"ACCN";"392";"Provisions pour dépréciation des autres approvisionnements";"";"39";""
+"ACCN";"393";"Provisions pour dépréciation en-cours de production de biens";"";"39";""
+"ACCN";"394";"Provisions pour dépréciation en-cours de prod. de services";"";"39";""
+"ACCN";"395";"Provisions pour dépréciation des stocks de produits";"";"39";""
+"ACCN";"39";"PROVISIONS POUR DEPRECIATION DES STOCKS ET EN-COURS";"";"3";""
+"ACCN";"397";"Provisions pour dépréciation des stocks de marchandises";"";"39";""
+"ACCN";"400";"Fournisseurs et comptes rattachés";"";"40";""
+"ACCN";"401";"Fournisseurs";"";"40";""
+"ACCN";"403";"Fournisseurs - Effets à payer";"";"40";""
+"ACCN";"404";"Fournisseurs d'immobilisations";"";"40";""
+"ACCN";"405";"Fournisseurs d'immobilisations - Effets à payer";"";"40";""
+"ACCN";"40";"FOURNISSEURS ET COMPTES RATTACHES";"";"4";""
+"ACCN";"410";"Clients et comptes rattachés";"";"41";""
+"ACCN";"411";"Clients";"";"41";""
+"ACCN";"413";"Clients - Effets a recevoir";"";"41";""
+"ACCN";"416";"Clients douteux ou litigieux";"";"41";""
+"ACCN";"417";"Créances sur travaux non encore facturables";"";"41";""
+"ACCN";"418";"Clients - Produits non encore facturés";"";"41";""
+"ACCN";"41";"CLIENTS ET COMPTES RATTACHES";"";"4";""
+"ACCN";"421";"Personnel - Rémunérations dues";"";"42";""
+"ACCN";"422";"Comités d'entreprise, d'établissement...";"";"42";""
+"ACCN";"424";"Participations des salariés aux résultats";"";"42";""
+"ACCN";"425";"Personnel - Avances et acomptes";"";"42";""
+"ACCN";"426";"Personnel - Dépôts";"";"42";""
+"ACCN";"427";"Personnel - Oppositions";"";"42";""
+"ACCN";"42";"PERSONNEL ET COMPTES RATTACHES";"";"4";""
+"ACCN";"431";"Sécurité sociale";"";"43";""
+"ACCN";"437";"Autres organismes sociaux";"";"43";""
+"ACCN";"43";"SECURITE SOCIALE - AUTRES ORGANISMES SOCIAUX";"";"4";""
+"ACCN";"438";"Organismes sociaux - Charges à payer et produits à recevoir";"";"43";""
+"ACCN";"441";"État - Subventions à recevoir";"";"44";""
+"ACCN";"442";"État - Impôts et taxes recouvrables sur des tiers";"";"44";""
+"ACCN";"443";"Opérations particulières avec l'état, les collectivités publiques, les organismes internationaux";"";"44";""
+"ACCN";"444";"Etat - Impôts sur les bénéfices";"";"44";""
+"ACCN";"4452";"TVA due intracommunautaire";"";"445";""
+"ACCN";"4455";"Taxes sur le chiffre d'affaires à décaisser";"";"445";""
+"ACCN";"44551";"TVA à décaisser";"";"4455";""
+"ACCN";"44562";"TVA sur immobilisations";"";"4456";""
+"ACCN";"445661";"TVA sur autres biens et services 19;6% débits";"";"44566";""
+"ACCN";"445662";"TVA sur autres biens et services 5;5% débits";"";"44566";""
+"ACCN";"445664";"TVA sur autres biens et services 19;6% encaissements";"";"44566";""
+"ACCN";"44566";"TVA sur autres biens et services";"";"4456";""
+"ACCN";"445665";"TVA sur autres biens et services 5;5% encaissements";"";"44566";""
+"ACCN";"4456";"Taxes sur le chiffre d'affaires déductible";"";"445";""
+"ACCN";"44567";"Crédit de TVA à reporter";"";"4456";""
+"ACCN";"4457";"Taxes sur le chiffre d'affaires collectées par l'entreprise";"";"445";""
+"ACCN";"445711";"TVA collectée 19;6 % débits";"";"44571";""
+"ACCN";"445712";"TVA collectée 5;5 % débits";"";"44571";""
+"ACCN";"445714";"TVA collectée 19;6 % encaissements";"";"44571";""
+"ACCN";"44571";"TVA collectée";"";"4457";""
+"ACCN";"445715";"TVA collectée 5;5 % encaissements";"";"44571";""
+"ACCN";"445";"Etat - Taxes sur le chiffre d'affaires";"";"44";""
+"ACCN";"44583";"Remboursement de taxes sur le chiffre d'affaires demandé";"";"4458";""
+"ACCN";"44584";"TVA récupérée d'avance";"";"4458";""
+"ACCN";"44586";"Taxes sur le chiffre d'affaires sur factures non parvenues";"";"4458";""
+"ACCN";"4458";"Taxes sur le chiffre d'affaires à régulariser ou en attente";"";"445";""
+"ACCN";"44587";"Taxes sur le chiffre d'affaires sur factures à établir";"";"4458";""
+"ACCN";"446";"Obligations cautionnées";"";"44";""
+"ACCN";"44";"ETAT ET AUTRES COLLECTIVITES PUBLIQUES";"";"4";""
+"ACCN";"447";"Autres impôts; taxes et versements assimilés";"";"44";""
+"ACCN";"451";"Groupe";"";"45";""
+"ACCN";"455";"Associés - Comptes courants";"";"45";""
+"ACCN";"456";"Associés - Opérations sur le capital";"";"45";""
+"ACCN";"457";"Associés - Dividendes à payer";"";"45";""
+"ACCN";"45";"GROUPES ET ASSOCIES";"";"4";""
+"ACCN";"458";"Associés - Opérations faites en commun et en G.I.E.";"";"45";""
+"ACCN";"462";"Créances sur cessions d'immobilisations";"";"46";""
+"ACCN";"464";"Dettes sur acquisitions de valeurs mobilières de placement";"";"46";""
+"ACCN";"465";"Créances sur cessions de valeurs mobilières de placement";"";"46";""
+"ACCN";"467";"Autres comptes débiteurs ou créditeurs";"";"46";""
+"ACCN";"46";"DEBITEURS ET CREDITEURS DIVERS";"";"4";""
+"ACCN";"4686";"Charges à payer";"";"468";""
+"ACCN";"468";"Divers - Charges à payer et Produits à recevoir";"";"46";""
+"ACCN";"4687";"Produits à recevoir";"";"468";""
+"ACCN";"470";"Compte d'attente";"";"47";""
+"ACCN";"476";"Différence de conversion - Actif";"";"47";""
+"ACCN";"477";"Différences de conversion - Passif";"";"47";""
+"ACCN";"47";"COMPTES TRANSITOIRES OU D'ATTENTE";"";"4";""
+"ACCN";"478";"Autres comptes transitoires";"";"47";""
+"ACCN";"481";"Charges à repartir sur plusieurs exercices";"";"48";""
+"ACCN";"486";"Charges constatées d'avance";"";"48";""
+"ACCN";"487";"Produits constatés d'avance";"";"48";""
+"ACCN";"48";"COMPTE DE REGULARISATION";"";"4";""
+"ACCN";"488";"Comptes de répartition périodique des charges et des produits";"";"48";""
+"ACCN";"4";"COMPTES DE TIERS";"";"";""
+"ACCN";"491";"Provisions pour dépréciation des comptes de clients";"";"49";""
+"ACCN";"495";"Dépréciations des comptes du groupe et des associés";"";"49";""
+"ACCN";"49";"PROVISIONS POUR DEPRECIATION DES COMPTES DE TIERS";"";"4";""
+"ACCN";"496";"Provisions pour dépréciation des comptes de débiteurs divers";"";"49";""
+"ACCN";"501";"Parts dans des entreprises liées";"";"50";""
+"ACCN";"502";"Actions propres";"";"50";""
+"ACCN";"503";"Actions";"";"50";""
+"ACCN";"504";"Autres titres conférant un droit de propriété";"";"50";""
+"ACCN";"505";"Obligations et bons émis par la société et rachetés par elle";"";"50";""
+"ACCN";"506";"Obligations";"";"50";""
+"ACCN";"507";"Bons du Trésor et bons de caisse à court terme";"";"50";""
+"ACCN";"508";"Autres valeurs mobilières de placement et autres créances assimilées";"";"50";""
+"ACCN";"50";"VALEURS MOBILIERES DE PLACEMENT";"";"5";""
+"ACCN";"509";"Versements restant à effectuer sur valeurs mobilières de placement non libérées";"";"50";""
+"ACCN";"5111";"Espèces";"";"511";""
+"ACCN";"5112";"Chèques";"";"511";""
+"ACCN";"5113";"Cartes bancaires";"";"511";""
+"ACCN";"511";"Valeurs à I'encaissement";"";"51";""
+"ACCN";"5114";"Autres paiements";"";"511";""
+"ACCN";"5121";"Banque principale";"";"512";""
+"ACCN";"512";"Banques";"";"51";""
+"ACCN";"5122";"Banque secondaire";"";"512";""
+"ACCN";"514";"Chèques postaux";"";"51";""
+"ACCN";"515";"“ Caisses ” du Trésor et des établissements publics";"";"51";""
+"ACCN";"516";"Sociétés de bourse";"";"51";""
+"ACCN";"517";"Autres organismes financiers";"";"51";""
+"ACCN";"518";"Intérêts courus";"";"51";""
+"ACCN";"51";"BANQUES; ETABLISSEMENTS FINANCIERS ET ASSIMILES";"";"5";""
+"ACCN";"519";"Concours bancaires courants";"";"51";""
+"ACCN";"52";"INSTRUMENTS DE TRÉSORIE";"";"5";""
+"ACCN";"53";"CAISSE";"";"5";""
+"ACCN";"530";"Caisse";"";"53";""
+"ACCN";"54";"REGIES D'AVANCES ET ACCREDITIFS";"";"5";""
+"ACCN";"540";"Régies d'avances et accréditifs";"";"54";""
+"ACCN";"58";"VIREMENTS INTERNES";"";"5";""
+"ACCN";"580";"Virements internes";"";"58";""
+"ACCN";"5";"COMPTES FINANCIERS";"";"";""
+"ACCN";"59";"PROVISION POUR DÉPRÉCIATION DES COMPTES FINANCIERS";"";"5";""
+"ACCN";"590";"Provisions pour dépréciation valeurs mobilières de placement";"";"59";""
+"ACCN";"601";"Achats stockés - Matières premières (et fournitures)";"";"60";""
+"ACCN";"604";"Achats d'études et prestations de services";"";"60";""
+"ACCN";"605";"Achats de matériel, équipements et travaux";"";"60";""
+"ACCN";"606";"Achats non stockés de matières et fournitures";"";"60";""
+"ACCN";"607";"Achats de marchandises";"";"60";""
+"ACCN";"608";"Frais accessoires d'achat";"";"60";""
+"ACCN";"60";"ACHATS (sauf 603)";"";"6";""
+"ACCN";"611";"Sous-traitance générale";"";"61";""
+"ACCN";"612";"Redevances de crédit-bail";"";"61";""
+"ACCN";"613";"Locations";"";"61";""
+"ACCN";"614";"Charges locatives et de copropriété";"";"61";""
+"ACCN";"615";"Entretien et réparations";"";"61";""
+"ACCN";"616";"Primes d'assurance";"";"61";""
+"ACCN";"617";"Études et recherches";"";"61";""
+"ACCN";"618";"Divers";"";"61";""
+"ACCN";"61";"SERVICES EXTERIEURS";"";"6";""
+"ACCN";"619";"Rabais, remises et ristournes obtenus sur services extérieurs";"";"61";""
+"ACCN";"621";"Personnel extérieur à l'entreprise";"";"62";""
+"ACCN";"622";"Rémunérations d'intermédiaires et honoraires";"";"62";""
+"ACCN";"623";"Publicité; publications; relations publiques";"";"62";""
+"ACCN";"624";"Transports de biens et transports collectifs du personnel";"";"62";""
+"ACCN";"625";"Déplacements; missions et réceptions";"";"62";""
+"ACCN";"626";"Frais postaux et frais de télécommunications";"";"62";""
+"ACCN";"627";"Services bancaires et assimiles";"";"62";""
+"ACCN";"628";"Divers";"";"62";""
+"ACCN";"62";"AUTRES SERVICES EXTERIEURS";"";"6";""
+"ACCN";"629";"Rabais, remises et ristournes obtenus sur autres services extérieurs";"";"62";""
+"ACCN";"631";"Impôts, taxes et versements assimilés sur rémunérations (administrations des impôts)";"";"63";""
+"ACCN";"633";"Impôts; taxes et versements sur rémunérations (autres org.)";"";"63";""
+"ACCN";"635";"Autres impôts; taxes et versements (administration)";"";"63";""
+"ACCN";"637";"Autres impôts, taxes et versements assimilés (autres organismes)";"";"63";""
+"ACCN";"63";"IMPOTS; TAXES ET VERSEMENTS";"";"6";""
+"ACCN";"6371";"Contribution sociale de solidarité à la charge des sociétés";"";"63";""
+"ACCN";"6411";"Salaires";"";"641";""
+"ACCN";"6412";"Congés payes";"";"641";""
+"ACCN";"6413";"Primes et gratifications";"";"641";""
+"ACCN";"641";"Rémunérations du personnel";"";"64";""
+"ACCN";"6414";"Indemnités et avantages divers";"";"641";""
+"ACCN";"644";"Rémunération du travail de l'exploitant";"";"64";""
+"ACCN";"6451";"Cotisations à l'URSSAF";"";"645";""
+"ACCN";"6452";"Cotisations aux mutuelles";"";"645";""
+"ACCN";"6453";"Cotisations aux caisses de retraites";"";"645";""
+"ACCN";"645";"Charges de sécurité sociale et de prévoyance";"";"64";""
+"ACCN";"6454";"Cotisations aux ASSEDIC";"";"645";""
+"ACCN";"646";"Cotisations sociales personnelles de l'exploitant";"";"64";""
+"ACCN";"647";"Autres charges sociales";"";"64";""
+"ACCN";"64";"CHARGES DE PERSONNEL";"";"6";""
+"ACCN";"648";"Autres charges de personnel";"";"64";""
+"ACCN";"651";"Redevances pour concessions; brevets; licences; etc.";"";"65";""
+"ACCN";"653";"Jetons de présence";"";"65";""
+"ACCN";"654";"Pertes sur créances irrécouvrables";"";"65";""
+"ACCN";"655";"Quote-part de résultat sur opérations faites en commun";"";"65";""
+"ACCN";"65";"AUTRES CHARGES DE GESTION COURANTE";"";"6";""
+"ACCN";"658";"Autres charges de gestion courante";"";"65";""
+"ACCN";"661";"Charges d'intérêt";"";"66";""
+"ACCN";"664";"Pertes sur créances liées à des participations";"";"66";""
+"ACCN";"665";"Escomptes accordés";"";"66";""
+"ACCN";"667";"Charges nettes sur cessions de valeurs mobilières de placement";"";"66";""
+"ACCN";"66";"CHARGES FINANCIERES";"";"6";""
+"ACCN";"668";"Autres charges financières";"";"66";""
+"ACCN";"6688";"Pertes de change ou de conversion";"";"668";""
+"ACCN";"671";"Charges exceptionnelles sur opérations de gestion";"";"67";""
+"ACCN";"672";"Compte à la disposition des entités pour enregistrer, en cours d'exercice, les charges sur exercices antérieurs";"";"67";""
+"ACCN";"675";"Valeurs comptables des éléments d'actif cédés";"";"67";""
+"ACCN";"67";"CHARGES EXCEPTIONNELLES";"";"6";""
+"ACCN";"678";"Autres charges exceptionnelles";"";"67";""
+"ACCN";"68111";"Dotations aux amort. immobilisations incorporelles";"";"681";""
+"ACCN";"68112";"Dotations aux amort. immobilisations corporelles";"";"681";""
+"ACCN";"68161";"Dotations provisions dépréc. immos incorporelles";"";"681";""
+"ACCN";"681";"Dotations aux amortissements - Charges d'exploitation";"";"68";""
+"ACCN";"68162";"Dotations provisions dépréc. immos corporelles";"";"681";""
+"ACCN";"686";"Dotations aux amort. et provisions - Charges financières";"";"68";""
+"ACCN";"68";"DOTATIONS AUX AMORTISSEMENTS ET AUX PROVISIONS";"";"6";""
+"ACCN";"687";"Dotations aux amort. et provisions - Charges exceptionnelles";"";"68";""
+"ACCN";"68725";"Dotations provisions réglementées - Amort. dérogatoires";"";"687";""
+"ACCN";"6";"COMPTES DE CHARGES";"";"";""
+"ACCN";"691";"Participation des salaries aux résultats de l'entreprise";"";"69";""
+"ACCN";"695";"Impôts sur les bénéfices";"";"69";""
+"ACCN";"696";"Suppléments d'impôt sur les sociétés, liés aux distributions";"";"69";""
+"ACCN";"697";"Imposition forfaitaire annuelle des sociétés";"";"69";""
+"ACCN";"698";"Contribution additionnelle";"";"69";""
+"ACCN";"69";"PARTICIPATION DES SALARIES - IMPOTS SUR LES BENEFICES";"";"6";""
+"ACCN";"699";"Produits - Reports en arrière des déficits";"";"69";""
+"ACCN";"701";"Ventes de produits finis";"";"70";""
+"ACCN";"702";"Ventes de produits intermédiaires";"";"70";""
+"ACCN";"703";"Ventes de produits résiduels";"";"70";""
+"ACCN";"704";"Travaux";"";"70";""
+"ACCN";"705";"études";"";"70";""
+"ACCN";"706";"Travaux et prestations de services";"";"70";""
+"ACCN";"707";"Ventes de marchandises";"";"70";""
+"ACCN";"708";"Produits des activités annexes";"";"70";""
+"ACCN";"70";"VENTES DE PRODUITS; PRESTATIONS DE SERVICES; MARCHANDISES";"";"7";""
+"ACCN";"709";"Rabais; remises et ristournes accordées par l'entreprise";"";"70";""
+"ACCN";"71";"PRODUCTION STOCKEE (ou déstockage)";"";"7";""
+"ACCN";"7133";"Variation des en-cours de production de biens";"";"713";""
+"ACCN";"7134";"Variation des en-cours de production de services";"";"713";""
+"ACCN";"713";"VARIATION DES STOCKS (en-cours de production; produits)";"";"71";""
+"ACCN";"7135";"Variation des stocks de produits";"";"713";""
+"ACCN";"721";"Immobilisations incorporelles";"";"72";""
+"ACCN";"72";"PRODUCTION IMMOBILISEE";"";"7";""
+"ACCN";"722";"Immobilisations corporelles";"";"72";""
+"ACCN";"74";"SUBVENTlONS D'EXPLOITATION";"";"7";""
+"ACCN";"740";"Subventions d'exploitation";"";"74";""
+"ACCN";"751";"Redevances pour concessions, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires";"";"75";""
+"ACCN";"752";"Revenus des immeubles non affectés à des activités professionnelles";"";"75";""
+"ACCN";"753";"Jetons de présence et rémunérations d'administrateurs, gérants";"";"75";""
+"ACCN";"754";"Ristournes perçues des coopératives (provenant des excédents)";"";"75";""
+"ACCN";"755";"Quotes-parts de résultat sur opérations faites en commun";"";"75";""
+"ACCN";"75";"AUTRES PRODUITS DE GESTION COURANTE";"";"7";""
+"ACCN";"758";"Produits divers de gestion courante";"";"75";""
+"ACCN";"761";"Produits de participations";"";"76";""
+"ACCN";"762";"Produits des autres immobilisations financières";"";"76";""
+"ACCN";"763";"Revenus des autres créances";"";"76";""
+"ACCN";"764";"Revenus des valeurs mobilières de placement";"";"76";""
+"ACCN";"765";"Escomptes obtenus";"";"76";""
+"ACCN";"766";"Gains de change";"";"76";""
+"ACCN";"767";"Produits nets sur cessions de valeurs mobilières de placement";"";"76";""
+"ACCN";"768";"Autres produits financiers";"";"76";""
+"ACCN";"76";"PRODUITS FINANCIERS";"";"7";""
+"ACCN";"7688";"Gains de change ou de conversion";"";"76";""
+"ACCN";"771";"Produits exceptionnels sur opérations de gestion";"";"77";""
+"ACCN";"772";"Compte à la disposition des entités pour enregistrer, en cours d'exercice, les produits sur exercices antérieurs";"";"77";""
+"ACCN";"775";"Produits des cessions d'éléments d'actif";"";"77";""
+"ACCN";"777";"Quote-part des subventions d'investissement virée au résultat de l'exercice";"";"77";""
+"ACCN";"77";"PRODUITS EXCEPTIONNELS";"";"7";""
+"ACCN";"778";"Autres produits exceptionnels";"";"77";""
+"ACCN";"78161";"Reprises prov. dépréc. immos incorporelles";"";"781";""
+"ACCN";"781";"Reprises sur amortissements et provisions";"";"78";""
+"ACCN";"78162";"Reprises prov. dépréc. immos corporelles";"";"781";""
+"ACCN";"786";"Reprises sur provisions pour risques";"";"78";""
+"ACCN";"78";"REPRISES SUR AMORTISSEMENTS ET PROVISIONS";"";"7";""
+"ACCN";"787";"Reprises sur provisions";"";"78";""
+"ACCN";"78725";"Reprises sur provisions - Amort. dérogatoires";"";"787";""
+"ACCN";"7";"COMPTES DE PRODUITS";"";"";""
+"ACCN";"791";"Transfert de charges d'exploitation";"";"79";""
+"ACCN";"79";"TRANSFERTS DE CHARGES";"";"7";""
+"ACCN";"796";"Transfert de charges financières";"";"79";""
+"ACCN";"801";"Engagements donnés par l'entreprise";"";"80";""
+"ACCN";"802";"Engagements reçus par l'entreprise";"";"80";""
+"ACCN";"80";"ENGAGEMENTS";"";"8";""
+"ACCN";"809";"Contrepartie des engagements";"";"80";""
+"ACCN";"88";"RESULTAT EN INSTANCE D'AFFECTATION";"";"8";""
+"ACCN";"8";"COMPTES SPECIAUX";"";"";""
+"ACCN";"890";"Bilan d'ouverture";"";"89";""
+"ACCN";"89";"BILAN";"";"8";""
+"ACCN";"891";"Bilan de clôture";"";"89";""
+"ACCN";"6031";"Variation des stocks de matières premières (et fournitures)";;"603";""
+"ACCN";"6032";"Variation des stocks des autres approvisionnements";;"603";""
+"ACCN";"603";"Variation des stocks (approvisionnements et marchandises)";"";"60";""
+"ACCN";"2761";"Créances diverses";;"276";""
+"ACCN";"276";"Autres créances immobilisées";"";"27";""
+"ACCN";"27682";"Sur titres immobilisés (droits de créance)";;"2768";""
+"ACCN";"27684";"Sur prêts";;"2768";""
+"ACCN";"27685";"Sur dépôts et cautionnements";;"2768";""
+"ACCN";"27688";"Sur créances diverses";;"2768";""
+"ACCN";"2768";"Intérêts courus";;"276";""
+"ACCN";"2801";"Frais d'établissement (même ventilation que celle du compte 201)";;"280";""
+"ACCN";"2803";"Frais de recherche et développement";;"280";""
+"ACCN";"2805";"Concessions et droits similaires, brevets, licences, logiciels, droits et valeurs similaires";;"280";""
+"ACCN";"2807";"Fonds commercial";;"280";""
+"ACCN";"2808";"Autres immobilisations incorporelles";;"280";""
+"ACCN";"280";"Amortissements des immobilisations incorporelles";"";"28";""
+"ACCN";"2811";"Terrains de gisement";;"281";""
+"ACCN";"2812";"Agencements, aménagements de terrains (même ventilation que celle du compte 212)";;"281";""
+"ACCN";"2813";"Constructions (même ventilation que celle du compte 213)";;"281";""
+"ACCN";"2814";"Constructions sur sol d'autrui (même ventilation que celle du compte 214)";;"281";""
+"ACCN";"2815";"Installations techniques, matériel et outillage industriels (même ventilation que celle du compte 215)";;"281";""
+"ACCN";"2818";"Autres immobilisations corporelles (même ventilation que celle du compte 218)";;"281";""
+"ACCN";"281";"Amortissements des immobilisations corporelles";"";"28";""
+"ACCN";"2905";"Marques, procédés, droits, et valeurs similaires";;"290";""
+"ACCN";"2906";"Droit au bail";;"290";""
+"ACCN";"2907";"Fonds commercial";;"290";""
+"ACCN";"2908";"Autres immobilisations incorporelles";;"290";""
+"ACCN";"290";"Provisions pour dépréciation immobilisations incorporelles";"";"29";""
+"ACCN";"2911";"Terrains (autres que terrains de gisement)";;"291";""
+"ACCN";"291";"Provisions pour dépréciation immobilisations corporelles";"";"29";""
+"ACCN";"2931";"Immobilisations corporelles en cours";;"293";""
+"ACCN";"2932";"Immobilisations incorporelles en cours";;"293";""
+"ACCN";"293";"Dépréciations des immobilisations en cours";"";"29";""
+"ACCN";"2961";"Titres de participation";;"296";""
+"ACCN";"2966";"Autres formes de participation";;"296";""
+"ACCN";"2967";"Créances rattachées à des participations (même ventilation que celle du compte 267)";;"296";""
+"ACCN";"2968";"Créances rattachées à des sociétés en participation (même ventilation que celle du compte 268)";;"296";""
+"ACCN";"296";" Dépréciations des participations et créances rattachées à des participations";"";"29";""
+"ACCN";"2971";"Titres immobilisés autres que les titres immobilisés de l'activité portefeuille - droit de propriété (même ventilation que celle du compte 271)";;"297";""
+"ACCN";"2972";"Titres immobilisés - droit de créance (même ventilation que celle du compte 272)";;"297";""
+"ACCN";"2973";"Titres immobilisés de l'activité portefeuille";;"297";""
+"ACCN";"2974";"Prêts (même ventilation que celle du compte 274)";;"297";""
+"ACCN";"2975";"Dépôts et cautionnements versés (même ventilation que celle du compte 275)";;"297";""
+"ACCN";"2976";"Autres créances immobilisées (même ventilation que celle du compte 276)";;"297";""
+"ACCN";"297";"Provisions pour dépréciation des immobilisations financières";"";"29";""
+"ACCN";"1671";"Émissions de titres participatifs";;"167";""
+"ACCN";"1674";"Avances conditionnées de l'État";;"167";""
+"ACCN";"1675";"Emprunts participatifs";;"167";""
+"ACCN";"167";"Emprunts et dettes assortis de conditions particulières";"";"16";""
+"ACCN";"168";"Autres emprunts et dettes assimilées";"";"16";""
+"ACCN";"4081";"Fournisseurs";;"408";""
+"ACCN";"4084";"Fournisseurs d'immobilisations";;"408";""
+"ACCN";"4088";"Fournisseurs - Intérêts courus";;"408";""
+"ACCN";"408";"Fournisseurs - Factures non parvenues";"";"40";""
+"ACCN";"4091";"Fournisseurs - Avances et acomptes versés sur commandes";;"409";""
+"ACCN";"4096";"Fournisseurs - Créances pour emballages et matériel à rendre";;"409";""
+"ACCN";"4097";"Fournisseurs - Autres Avoirs";;"409";""
+"ACCN";"4098";"Rabais, remises, ristournes à obtenir et autres avoirs non encore reçus";;"409";""
+"ACCN";"409";"Fournisseurs débiteurs";"";"40";""
+"ACCN";"4191";"Clients - Avances et acomptes reçus sur commandes";;"419";""
+"ACCN";"4196";"Clients - Dettes pour emballages et matériels consignés";;"419";""
+"ACCN";"4197";"Clients - Autres avoirs";;"419";""
+"ACCN";"4198";"Rabais, remises, ristournes à accorder et autres avoirs à établir";;"419";""
+"ACCN";"419";"Clients créditeurs";"";"41";""
+"ACCN";"4282";"Dettes provisionnées pour congés à payer";;"428";""
+"ACCN";"4284";"Dettes provisionnées pour participation des salariés aux résultats";;"428";""
+"ACCN";"4286";"Autres charges à payer";;"428";""
+"ACCN";"4287";"Produits à recevoir";;"428";""
+"ACCN";"428";"Personnel - Charges à payer et produits à recevoir";"";"42";""
+"ACCN";"6022";"Fournitures consommables";;"602";""
+"ACCN";"602";"Achats stockés - Autres approvisionnements";"";"60";""
+"ACCN";"6026";"Emballages";;"602";""
+"ACCN";"6091";"de matières premières (et fournitures)";;"609";""
+"ACCN";"6092";"d'autres approvisionnements stockés";;"609";""
+"ACCN";"6094";"d'études et de prestations de services";;"609";""
+"ACCN";"6095";"de matériel, équipements et travaux";;"609";""
+"ACCN";"6096";"d'approvisionnements non stockés";;"609";""
+"ACCN";"6097";"de marchandises";;"609";""
+"ACCN";"6098";"Rabais, remises et ristournes non affectés";;"609";""
+"ACCN";"609";"Rabais; remises et ristournes obtenus sur achats";"";"60";""
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2012-04-24 13:06:38 UTC (rev 3382)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2012-04-24 13:14:14 UTC (rev 3383)
@@ -86,10 +86,4 @@
Account updateAccount(Account account) throws LimaException;
void removeAccount(Account account) throws LimaException;
-
- void removeAllAccount() throws LimaException;
-
- List<Account> getAllChildrenAccounts(Account masterAccount) throws LimaException;
-
- List<Account> getChildrenAccounts(Account masterAccount) throws LimaException;
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 13:06:38 UTC (rev 3382)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 13:14:14 UTC (rev 3383)
@@ -172,45 +172,4 @@
}
return new ArrayList(accounts);
}
-
- /*
- * @see org.chorem.lima.entity.AccountDAOAbstract#getSubAccounts(org.chorem.lima.entity.Account)
- */
- public List<Account> getSubAccounts(Account account) throws TopiaException {
-
- List<Account> accountsResult = null;
-
- /*String query = "FROM " + Account.class.getName() + " a WHERE a.accountNumber LIKE :like" +
- " ORDER BY a.accountNumber";
-
-
- // FIXME echatellier 20120321 remove hard coded 8 here
- // usefull for efficient tree loading but not beautiful code
- String likeSuffix = "";
- while (CollectionUtils.isEmpty(accountsResult) && likeSuffix.length() < 8) {
- likeSuffix += "_";
- if (account != null) {
- accountsResult = getContext().find(query, "like", account.getAccountNumber() + likeSuffix);
- } else {
- accountsResult = getContext().find(query, "like", likeSuffix);
- }
- }*/
-
- // on recherche les sous comptes de account
- // qui ne sont pas eux meme des sous comptes intermediaire
- // autrement dir, les fils directs
- /*String query = "FROM " + Account.class.getName() + " a" +
- " WHERE a.accountNumber LIKE :like" +
- " AND a not in (FROM " + Account.class.getName() + " b" +
- " WHERE b.accountNumber like concat(a.accountNumber,'%'))" +
- " ORDER BY a.accountNumber";
-
- if (account != null) {
- accountsResult = getContext().find(query, "like", account.getAccountNumber() + "%");
- } else {
- accountsResult = getContext().find(query, "like", "%");
- }*/
-
- return accountsResult;
- }
}
1
0
r3382 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 15:06:38 +0200 (Tue, 24 Apr 2012)
New Revision: 3382
Url: http://chorem.org/repositories/revision/lima/3382
Log:
Fix ebp account import
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 12:41:53 UTC (rev 3381)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 13:06:38 UTC (rev 3382)
@@ -44,7 +44,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.TreeMap;
import javax.ejb.EJB;
import javax.ejb.Local;
@@ -60,8 +59,6 @@
import org.chorem.lima.FinancialStatementWayEnum;
import org.chorem.lima.beans.AccountEBP;
import org.chorem.lima.beans.AccountEBPImpl;
-import org.chorem.lima.beans.AccountImport;
-import org.chorem.lima.beans.AccountImportImpl;
import org.chorem.lima.beans.ClosedPeriodicEntryBookImport;
import org.chorem.lima.beans.ClosedPeriodicEntryBookImportImpl;
import org.chorem.lima.beans.EntryEBP;
@@ -229,8 +226,7 @@
for (EntryEBP entryEBP : list) {
// create entry
Entry entry = new EntryImpl();
- Account account = accountDAO.findByAccountNumber(entryEBP
- .getCompte());
+ Account account = accountDAO.findByAccountNumber(entryEBP.getCompte());
Date date = epbDateFormat.parse(entryEBP.getDatEcr());
Date beginDate = fiscalPeriods.get(0).getBeginDate();
@@ -340,6 +336,8 @@
_("lima-business.import.noaccount"));
}
+ // FIXME echatellier 20120424 read csv line by line without
+ // creating beans instance
CsvToBean<AccountEBPImpl> csv = new CsvToBean<AccountEBPImpl>();
List<AccountEBPImpl> list = csv.parse(strat, csvReader);
Collections.sort(list, new AccountEBPComparator());
@@ -355,42 +353,8 @@
Account account = new AccountImpl();
account.setAccountNumber(accountNumber);
account.setLabel(label);
-
- // if is thirdPart account
- if (!StringUtils.isNumeric(accountNumber)) {
- Account masterAccount = null;
- int i = 1;
- while (masterAccount == null) {
- String masterAccountNumber = accountNumber
- .substring(0, accountNumber.length() - i);
- masterAccount = accountDAO
- .findByAccountNumber(masterAccountNumber);
- i++;
- }
- accountService.createAccount(account);
- result.append(_("lima-business.import.accountadded", accountNumber, label));
- }
- // else if account and exclude account start with 0 (fix from error on EBP)
- else if (!accountNumber.startsWith("0")) {
- // if account is class account : 1, 2, 3, 4, 5, 6, 7,…
- int nbCharAccountNumber = accountNumber.length();
- if (nbCharAccountNumber == 1) {
- accountService.createAccount(account);
- result.append(_("lima-business.import.accountadded", accountNumber, label));
- } else {
- Account masterAccount = null;
- int i = 1;
- while (masterAccount == null) {
- String masterAccountNumber = accountNumber
- .substring(0, accountNumber.length() - i);
- masterAccount = accountDAO
- .findByAccountNumber(masterAccountNumber);
- i++;
- }
- accountService.createAccount(account);
- result.append(_("lima-business.import.accountadded", accountNumber, label));
- }
- }
+ accountService.createAccount(account);
+ result.append(_("lima-business.import.accountadded", accountNumber, label));
}
}
1
0
r3381 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by echatellier@users.chorem.org April 24, 2012
by echatellier@users.chorem.org April 24, 2012
April 24, 2012
Author: echatellier
Date: 2012-04-24 14:41:53 +0200 (Tue, 24 Apr 2012)
New Revision: 3381
Url: http://chorem.org/repositories/revision/lima/3381
Log:
Fix accounts import
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-18 14:24:21 UTC (rev 3380)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 12:41:53 UTC (rev 3381)
@@ -399,8 +399,8 @@
log.info("Imported form EBP : " + list.size() + " accounts in " + (after-before) + " ms");
}
- } catch (Exception eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (Exception ex) {
+ doCatch(topiaContext, ex);
} finally {
doFinally(topiaContext);
}
@@ -415,8 +415,6 @@
public String importAllAsCSV(String datas) throws LimaException {
StringBuilder result = new StringBuilder();
- Map<String, AccountImport> accounts = new TreeMap<String, AccountImport>();
-
LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements =
new LinkedHashMap<String, ArrayList<FinancialStatementImport>>();
@@ -446,7 +444,7 @@
if (importExportEntityEnum != null) {
switch (importExportEntityEnum) {
case ACCOUNT:
- result.append(importAccountsChartsCSV(nextLine, accounts,
+ result.append(importAccountsChartsCSV(nextLine,
topiaContext));
break;
case ENTRYBOOK:
@@ -483,8 +481,6 @@
}
}
- // create accounts
- result.append(createAccounts(accounts, topiaContext));
// create financialStatements
result.append(createFinancialStatements(financialStatements,
topiaContext));
@@ -503,8 +499,8 @@
commitTransaction(topiaContext);
- } catch (Exception eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (Exception ex) {
+ doCatch(topiaContext, ex);
} finally {
doFinally(topiaContext);
}
@@ -522,15 +518,10 @@
// FinancialStatements
LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements = null;
- // Accounts
- Map<String, AccountImport> accounts = null;
// VatStatement
LinkedHashMap<String, ArrayList<VatStatementImport>> vatStatements = null;
switch (importExportEntityEnum) {
- case ACCOUNT:
- accounts = new TreeMap<String, AccountImport>();
- break;
case FINANCIALSTATEMENT:
financialStatements = new LinkedHashMap<String, ArrayList<FinancialStatementImport>>();
break;
@@ -552,7 +543,7 @@
result.append(importEntryBooksChartCSV(nextLine, topiaContext));
break;
case ACCOUNT:
- result.append(importAccountsChartsCSV(nextLine, accounts,
+ result.append(importAccountsChartsCSV(nextLine,
topiaContext));
break;
case FINANCIALSTATEMENT:
@@ -569,9 +560,6 @@
//create entity
switch (importExportEntityEnum) {
- case ACCOUNT:
- result.append(createAccounts(accounts, topiaContext));
- break;
case FINANCIALSTATEMENT:
result.append(createFinancialStatements(financialStatements,
topiaContext));
@@ -582,8 +570,8 @@
break;
}
- } catch (Exception eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (Exception ex) {
+ doCatch(topiaContext, ex);
} finally {
doFinally(topiaContext);
}
@@ -632,39 +620,33 @@
LimaConfig.getInstance().setVatPDFUrl(datas);
}
doc.close();
- } catch (IOException eee) {
- log.error("Can't read vat pdf", eee);
+ } catch (IOException ex) {
+ log.error("Can't read vat pdf", ex);
result.append("Can't read vat pdf");
- } catch (COSVisitorException eee) {
- log.error("Can't save vat pdf", eee);
+ } catch (COSVisitorException ex) {
+ log.error("Can't save vat pdf", ex);
result.append("Can't save vat pdf");
}
return result.toString();
}
-
- // ################ Import entities an put to lists ################
-
/**
* Import and create accounts Structure : TYPE | accountNumber | label
* | thirdparty | masterAccountNumber | generalLedgerNumber
*
* @param nextLine
- * @param accounts
* @param topiaContext
* @return
* @throws LimaException
*/
protected String importAccountsChartsCSV(String[] nextLine,
- Map<String, AccountImport> accounts,
TopiaContext topiaContext)
throws LimaException {
+
StringBuilder result = new StringBuilder();
String accountNumber = nextLine[1];
String label = nextLine[2];
String thirdParty = nextLine[3];
- String masterAccountNumber = nextLine[4];
- String generalLedgerNumber = nextLine[5];
try {
AccountDAO accountDAO = LimaCallaoDAOHelper
@@ -672,20 +654,21 @@
// if not exist, create it
if (accountDAO.findByAccountNumber(accountNumber) == null) {
- // create it
- AccountImport accountImport = new AccountImportImpl();
- accountImport.setAccountNumber(accountNumber);
- accountImport.setLabel(label);
- accountImport.setThirdParty(thirdParty);
- accountImport.setMasterAccount(masterAccountNumber);
- accountImport.setGeneralLedger(generalLedgerNumber);
- // put it in hashset
- accounts.put(accountNumber, accountImport);
+
+ Account account = new AccountImpl();
+ account.setAccountNumber(accountNumber);
+ account.setLabel(label);
+ account.setThirdParty(thirdParty);
+
+ accountDAO.create(account);
+ result.append(_("lima-business.import.accountadded",
+ account.getAccountNumber(),
+ account.getLabel()));
} else {
result.append(_("lima-business.import.accountalreadyexist", accountNumber));
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -722,10 +705,10 @@
} else {
result.append(_("lima-business.import.fiscalperiodalreadyexist", beginDate, endDate));
}
- } catch (ParseException eeePE) {
- log.error("Can't parse date", eeePE);
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (ParseException ex) {
+ log.error("Can't parse date", ex);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -738,8 +721,7 @@
* @return
* @throws LimaException
*/
- protected String importEntryBooksChartCSV(String[] nextLine,
- TopiaContext topiaContext) throws LimaException {
+ protected String importEntryBooksChartCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException {
StringBuilder result = new StringBuilder();
try {
@@ -758,8 +740,8 @@
entryBookService.createEntryBook(entryBook);
result.append(_("lima-business.import.financialstatementadded", entryBook.getLabel()));
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -853,8 +835,8 @@
} else {
result.append(_("lima-business.import.financialstatementalreadyexist", label));
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -908,8 +890,8 @@
} else {
result.append(_("lima-business.import.vatstatementalreadyexist", label));
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -978,6 +960,10 @@
// ################ CREATE ENTITY IN DB FOR IMPORT ################
+ /**
+ * @deprecated do only one method import without bean use (and remove beans)
+ */
+ @Deprecated
protected String createFinancialStatements(Map<String, ArrayList<FinancialStatementImport>> financialStatements,
TopiaContext topiaContext) throws LimaException {
StringBuilder result = new StringBuilder();
@@ -1056,12 +1042,16 @@
}
}
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
+ /**
+ * @deprecated do only one method import without bean use (and remove beans)
+ */
+ @Deprecated
protected String createVatStatements(Map<String, ArrayList<VatStatementImport>> vatStatements,
TopiaContext topiaContext) throws LimaException {
@@ -1121,8 +1111,8 @@
}
}
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
}
return result.toString();
}
@@ -1145,58 +1135,10 @@
return result.toString();
}
- protected String createAccounts(Map<String, AccountImport> accounts,
- TopiaContext topiaContext) throws LimaException {
- StringBuilder result = new StringBuilder();
-
- try {
- AccountDAO accountDAO = LimaCallaoDAOHelper
- .getAccountDAO(topiaContext);
-
- while (accounts.size() > 0) {
- for (Iterator<AccountImport> itr = accounts.values().iterator(); itr
- .hasNext(); ) {
- AccountImport accountImport = itr.next();
- String masterAccountNumber = accountImport
- .getMasterAccount();
- String generalLedgerNumber = accountImport
- .getGeneralLedger();
- Account masterAccount = accountDAO
- .findByAccountNumber(masterAccountNumber);
- Account generalLedger = accountDAO
- .findByAccountNumber(generalLedgerNumber);
-
- if (masterAccountNumber.equals("") && generalLedgerNumber
- .equals("")
- || masterAccount != null || generalLedger != null) {
- // create it
- Account account = new AccountImpl();
- account.setAccountNumber(accountImport
- .getAccountNumber());
- account.setLabel(accountImport.getLabel());
- account.setThirdParty(accountImport.getThirdParty());
-
- accountService.createAccount(account);
-
- result.append(_("lima-business.import.accountadded",
- accountImport.getAccountNumber(),
- accountImport.getLabel()));
- itr.remove();
- } else if (!accounts.containsKey(masterAccountNumber)
- && !accounts.containsKey(generalLedgerNumber)) {
- result.append(_("lima-business.import.accountnomaster",
- accountImport.getAccountNumber(),
- masterAccountNumber));
- itr.remove();
- }
- }
- }
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
- }
- return result.toString();
- }
-
+ /**
+ * @deprecated do only one method import without bean use (and remove beans)
+ */
+ @Deprecated
protected String updateClosedPeriodicEntryBooks(
List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks,
TopiaContext topiaContext) throws LimaException {
@@ -1236,14 +1178,18 @@
result.append(_("lima-business.common.failed", eee));
}
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
- } catch (ParseException eeePE) {
- log.error("Can't parse date", eeePE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
+ } catch (ParseException ex) {
+ log.error("Can't parse date", ex);
}
return result.toString();
}
+ /**
+ * @deprecated do only one method import without bean use (and remove beans)
+ */
+ @Deprecated
protected String createFinancialTransactionsAndEntries(
Map<Integer, FinancialTransactionImport> financialTransactions,
Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext)
@@ -1300,10 +1246,10 @@
financialTransaction.addEntry(entry);
}
}
- } catch (TopiaException eeeTE) {
- doCatch(topiaContext, eeeTE);
- } catch (ParseException eeePE) {
- log.error("Can't parse date", eeePE);
+ } catch (TopiaException ex) {
+ doCatch(topiaContext, ex);
+ } catch (ParseException ex) {
+ log.error("Can't parse date", ex);
}
return result.toString();
}
1
0
r3380 - in trunk/lima-business/src: main/java/org/chorem/lima/business main/java/org/chorem/lima/service test/java/org/chorem/lima/business/ejb
by echatellier@users.chorem.org April 18, 2012
by echatellier@users.chorem.org April 18, 2012
April 18, 2012
Author: echatellier
Date: 2012-04-18 16:24:21 +0200 (Wed, 18 Apr 2012)
New Revision: 3380
Url: http://chorem.org/repositories/revision/lima/3380
Log:
Refactor clear service to be part of ejb transaction
Removed:
trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceLocal.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceMonitorable.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearService.java
trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -54,30 +54,13 @@
@Stateless
public class LimaInterceptor {
- private final Log log = LogFactory.getLog(LimaInterceptor.class);
+ private static final Log log = LogFactory.getLog(LimaInterceptor.class);
public static final ThreadLocal<TopiaContext> TOPIA_CONTEXT = new ThreadLocal<TopiaContext>();
@Resource
private TransactionManager transactionManager;
- protected TopiaContext rootContext;
-
- public LimaInterceptor() {
- if (log.isInfoEnabled()) {
- log.info("Init root context");
- }
-
- LimaConfig config = LimaConfig.getInstance();
- try {
- rootContext = TopiaContextFactory.getContext(config.getFlatOptions());
- } catch (TopiaNotFoundException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't init root context", ex);
- }
- }
- }
-
@AroundInvoke
public Object invoke(InvocationContext context) throws Exception {
@@ -97,6 +80,8 @@
context.getTarget().getClass() + "#" + context.getMethod().getName());
}
+ LimaConfig config = LimaConfig.getInstance();
+ TopiaContext rootContext = TopiaContextFactory.getContext(config.getFlatOptions());
TopiaContext tx = rootContext.beginTransaction();
TOPIA_CONTEXT.set(tx);
@@ -107,8 +92,11 @@
// by container
tr.enlistResource(new LimaXAResource(tx));
- result = context.proceed();
- TOPIA_CONTEXT.remove();
+ try {
+ result = context.proceed();
+ } finally {
+ TOPIA_CONTEXT.remove();
+ }
} else {
result = context.proceed();
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -127,7 +127,9 @@
* Close openejb container.
*/
public static void destroy() {
- container.close();
+ if (container != null) {
+ container.close();
+ }
}
/**
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearService.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearService.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearService.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -41,6 +41,8 @@
/**
* Clear database.
+ *
+ * @throws LimaException
*/
void clearDatabase() throws LimaException;
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceImpl.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceImpl.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceImpl.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -24,10 +24,12 @@
package org.chorem.lima.business.ejb;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaInterceptor;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
/**
* Clear database service.
@@ -39,7 +41,8 @@
* By : $Author$
*/
@Stateless
-public class ClearServiceImpl extends AbstractLimaService implements ClearServiceLocal, ClearService {
+@TransactionAttribute
+public class ClearServiceImpl extends AbstractLimaService implements ClearService {
/*
* @see org.chorem.lima.business.ejb.ClearService#clearDatabase()
@@ -47,15 +50,11 @@
@Override
public void clearDatabase() throws LimaException {
try {
- TopiaContext rootContext = acquireRootContext();
- TopiaContext transaction = rootContext.beginTransaction();
+
+ TopiaContext transaction = LimaInterceptor.TOPIA_CONTEXT.get();
transaction.createSchema();
- transaction.commitTransaction();
- transaction.closeContext();
} catch (TopiaException ex) {
throw new LimaException("Can't clear database", ex);
}
-
}
-
}
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceLocal.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceLocal.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceLocal.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -1,40 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Codelutin, Chatellier Eric
- * %%
- * 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 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.business.ejb;
-
-import javax.ejb.Local;
-
-/**
- * Clear database service.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-@Local
-public interface ClearServiceLocal extends ClearService {
-
-}
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceMonitorable.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceMonitorable.java 2012-04-18 09:44:39 UTC (rev 3379)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/ejb/ClearServiceMonitorable.java 2012-04-18 14:24:21 UTC (rev 3380)
@@ -1,39 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Codelutin, Chatellier Eric
- * %%
- * 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 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package org.chorem.lima.business.ejb;
-
-import org.chorem.lima.business.ServiceMonitorable;
-
-/**
- * Clear database service.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public interface ClearServiceMonitorable extends ClearService, ServiceMonitorable {
-
-}
1
0
r3379 - trunk/lima-business/src/test/resources/META-INF
by echatellier@users.chorem.org April 18, 2012
by echatellier@users.chorem.org April 18, 2012
April 18, 2012
Author: echatellier
Date: 2012-04-18 11:44:39 +0200 (Wed, 18 Apr 2012)
New Revision: 3379
Url: http://chorem.org/repositories/revision/lima/3379
Log:
Duplicate interceptor configuration for test
Modified:
trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml
Modified: trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml 2012-04-18 09:14:13 UTC (rev 3378)
+++ trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml 2012-04-18 09:44:39 UTC (rev 3379)
@@ -25,5 +25,14 @@
<!--
Empty configuration file based on
http://openejb.apache.org/application-discovery-via-the-classpath.html
+
+ Interceptor based on : http://openejb.apache.org/examples-trunk/alternate-descriptors/
-->
-<ejb-jar/>
+<ejb-jar>
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.chorem.lima.business.LimaInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
1
0
r3378 - trunk/lima-business/src/test/java/org/chorem/lima/business
by echatellier@users.chorem.org April 18, 2012
by echatellier@users.chorem.org April 18, 2012
April 18, 2012
Author: echatellier
Date: 2012-04-18 11:14:13 +0200 (Wed, 18 Apr 2012)
New Revision: 3378
Url: http://chorem.org/repositories/revision/lima/3378
Log:
Add test about just created empty entry book
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-18 08:42:09 UTC (rev 3377)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-18 09:14:13 UTC (rev 3378)
@@ -29,7 +29,6 @@
import org.chorem.lima.entity.EntryBookImpl;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.text.ParseException;
@@ -52,21 +51,6 @@
}
/**
- * Permet de tester l'ajout d'un journal dans la base de données.
- * (erreur duplication).
- *
- * @throws LimaException
- */
- @Test(expected=LimaException.class)
- @Ignore
- public void createJournalTest() throws LimaException {
- EntryBook entryBook = new EntryBookImpl();
- entryBook.setLabel(JOURNAL_DES_VENTES);
- entryBook.setCode("jdv");
- entryBookService.createEntryBook(entryBook);
- }
-
- /**
* Permet de tester la modification d'un journal suivant son préfixe.
*
* @throws LimaException
@@ -86,4 +70,31 @@
Assert.assertEquals("Journal des achats", entryBook.getLabel());
}
+ /**
+ * Test que la suppression d'un journal utilisé n'est pas possible.
+ *
+ * @throws LimaException
+ */
+ @Test(expected=LimaBusinessException.class)
+ public void deleteUsedEntryBook() throws LimaException {
+ EntryBook entryBook = entryBookService.getAllEntryBooks().get(0); // VTE
+ Assert.assertNotNull(entryBook);
+ entryBookService.removeEntryBook(entryBook);
+ }
+
+ /**
+ * Un journal tout juste créé doit pouvoir être supprimé.
+ *
+ * @throws LimaException
+ */
+ @Test
+ public void deleteNonUsedEntryBookTest() throws LimaException {
+ EntryBook myEntryBook = new EntryBookImpl();
+ myEntryBook.setCode("JRN");
+ myEntryBook.setLabel("MyJournal");
+ myEntryBook = entryBookService.createEntryBook(myEntryBook);
+ entryBookService.removeEntryBook(myEntryBook);
+
+ Assert.assertEquals(1, entryBookService.getAllEntryBooks().size());
+ }
}
\ No newline at end of file
1
0
April 18, 2012
Author: echatellier
Date: 2012-04-18 10:42:09 +0200 (Wed, 18 Apr 2012)
New Revision: 3377
Url: http://chorem.org/repositories/revision/lima/3377
Log:
Remove Monitorable interfaces
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/monitorable/
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -23,6 +23,15 @@
package org.chorem.lima.business;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Locale;
+import java.util.Properties;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -37,14 +46,6 @@
import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.ejb.ClearService;
-import org.chorem.lima.business.ejb.ClearServiceMonitorable;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.Entry;
@@ -67,15 +68,6 @@
import org.nuiton.topia.TopiaNotFoundException;
import org.nuiton.topia.TopiaRuntimeException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.Properties;
-
/**
* Common initialization code for all lima tests.
*
@@ -123,14 +115,14 @@
* @throws IOException
*/
protected static void initServices() throws IOException {
- clearService = LimaServiceFactory.getService(ClearServiceMonitorable.class);
- accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
- entryBookService = LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- financialPeriodService = LimaServiceFactory.getService(FinancialPeriodServiceMonitorable.class);
- financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- reportService = LimaServiceFactory.getService(ReportServiceMonitorable.class);
- importService = LimaServiceFactory.getService(ImportServiceMonitorable.class);
+ clearService = LimaServiceFactory.getService(ClearService.class);
+ accountService = LimaServiceFactory.getService(AccountService.class);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
+ financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ importService = LimaServiceFactory.getService(ImportService.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -39,7 +39,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.actions.MiscAction;
-import org.chorem.lima.business.monitorable.OptionsServiceMonitorable;
+import org.chorem.lima.business.api.OptionsService;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.service.LimaServiceFactory;
import org.nuiton.topia.TopiaContextFactory;
@@ -67,7 +67,7 @@
private static final String configFile = "lima-config.properties";
- protected OptionsServiceMonitorable optionsService;
+ protected OptionsService optionsService;
/** La version du logiciel. */
protected Version version;
@@ -504,7 +504,7 @@
super.save(file, forceAll, excludeKeys);
// propagate scale option to serveur option
- optionsService = LimaServiceFactory.getService(OptionsServiceMonitorable.class);
+ optionsService = LimaServiceFactory.getService(OptionsService.class);
// scale server option
String scaleOption = getOption("scale");
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,27 @@
package org.chorem.lima;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.Arrays;
+import java.util.Date;
+
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
import jaxx.runtime.SwingUtil;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.MainViewHandler;
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-import java.util.Arrays;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Lima GUI main class.
*
@@ -169,10 +170,9 @@
splash.updateProgression(0.7, _("lima.splash.2"));
//start http server
- LimaServiceFactory.getService(HttpServerServiceMonitorable.class).start();
+ LimaServiceFactory.getService(HttpServerService.class).start();
- AccountService accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
+ AccountService accountService = LimaServiceFactory.getService(AccountService.class);
long accountCount = accountService.getAccountCount();
if (accountCount == 0) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,16 +25,28 @@
package org.chorem.lima.ui;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.util.Locale;
+
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+
import jaxx.runtime.JAXXContext;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.editor.config.ConfigUIHelper;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
import org.chorem.lima.business.LimaRuntimeException;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.account.AccountView;
@@ -56,19 +68,8 @@
import org.chorem.lima.ui.lettering.LetteringView;
import org.chorem.lima.ui.vatchart.VatChartView;
import org.chorem.lima.ui.vatreports.VatReportView;
-import org.chorem.lima.util.ErrorHelper;
import org.nuiton.util.DesktopUtil;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.URL;
-import java.util.Locale;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler for main view.
* <p/>
@@ -445,7 +446,7 @@
public void loadURI(MainView ui) {
int port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ HttpServerService.class).getHttpPort();
String address = LimaConfig.getInstance().getHostAdress();
String url = "http://" + address + ":" + port + "/";
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,25 @@
package org.chorem.lima.ui.accountsreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.AccountComboBoxModel;
-import org.chorem.lima.util.ErrorHelper;
-import java.math.BigDecimal;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -72,17 +71,14 @@
protected Date selectedEndDate;
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
protected AccountsReportsViewHandler(AccountsReportsView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(
- ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(
- FinancialTransactionServiceMonitorable.class, this);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,25 +25,8 @@
package org.chorem.lima.ui.balance;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
-import org.chorem.lima.beans.BalanceTrial;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.LimaRuntimeException;
-import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
-import org.chorem.lima.business.utils.DocumentsEnum;
-import org.chorem.lima.business.utils.FormatsEnum;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JOptionPane;
import java.awt.Desktop;
import java.io.IOException;
import java.math.BigDecimal;
@@ -54,9 +37,26 @@
import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaConfig;
+import org.chorem.lima.beans.BalanceTrial;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
+import org.chorem.lima.business.utils.DocumentsEnum;
+import org.chorem.lima.business.utils.FormatsEnum;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.service.LimaServiceFactory;
+
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -69,11 +69,11 @@
private static final Log log = LogFactory.getLog(BalanceViewHandler.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
- protected HttpServerServiceMonitorable httpServerServiceMonitorable;
+ protected HttpServerService httpServerServiceMonitorable;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
/** DatePicker Begin Date. */
protected Date selectedBeginDate;
@@ -96,15 +96,12 @@
protected BalanceViewHandler(BalanceView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,20 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/** Account combo box model. */
public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
@@ -57,9 +57,9 @@
public AccountComboBoxModel() {
accountService =
LimaServiceFactory.getService(
- AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(accountService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,20 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/**
* Opened financial period combo box model.
*
@@ -63,9 +63,9 @@
public EntryBookComboBoxModel() {
entryBookService =
- LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.getService(EntryBookService.class);
+ LimaServiceFactory.addServiceListener(EntryBookService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
cacheDatas = getDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,22 +25,22 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
/**
* Opened financial period combo box model.
*
@@ -84,10 +84,10 @@
financialPeriodService =
LimaServiceFactory.getService(
- FinancialPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialPeriodService, this);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialPeriodService.class);
+ LimaServiceFactory.addServiceListener(FinancialPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
if (displayAllPeriods) {
datasCache = getAllDataList();
} else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,21 +25,21 @@
package org.chorem.lima.ui.combobox;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.List;
-
public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel, ServiceListener {
private static final long serialVersionUID = 1L;
@@ -56,9 +56,9 @@
public FiscalPeriodComboBoxModel() {
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
@@ -66,9 +66,9 @@
public FiscalPeriodComboBoxModel(boolean all) {
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(fiscalPeriodService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getAllDataList();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/LeafAccountComboBoxModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,21 +25,21 @@
package org.chorem.lima.ui.combobox;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Account combo box model containing only leaf account (without sub accounts).
*/
@@ -57,9 +57,9 @@
public LeafAccountComboBoxModel() {
accountService =
- LimaServiceFactory.getService(AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(accountService, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ LimaServiceFactory.getService(AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
datasCache = getDataList();
}
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -46,18 +46,17 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
+import org.chorem.lima.business.api.DocumentService;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
/**
@@ -76,11 +75,11 @@
private static final Log log = LogFactory.getLog(EntryBooksReportsViewHandler.class);
/** Services. */
- protected ReportServiceMonitorable reportService;
+ protected ReportService reportService;
- protected DocumentServiceMonitorable documentService;
+ protected DocumentService documentService;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
/** Account. */
protected EntryBook selectedEntryBook;
@@ -99,19 +98,12 @@
protected EntryBooksReportsViewHandler(EntryBooksReportsView view) {
this.view = view;
- reportService =
- LimaServiceFactory.getService(
- ReportServiceMonitorable.class);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
- documentService =
- LimaServiceFactory.getService(
- DocumentServiceMonitorable.class);
- fiscalPeriodService =
- LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
+ documentService = LimaServiceFactory.getService(DocumentService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,20 +25,21 @@
package org.chorem.lima.ui.financialstatementchart;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
+import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-import javax.swing.tree.TreePath;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Tree table model for account edition.
*
@@ -55,7 +56,7 @@
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
/** Services. */
- protected final FinancialStatementServiceMonitorable financialStatementService;
+ protected final FinancialStatementService financialStatementService;
/** Model constructor. Init account service used here. */
public FinancialStatementChartTreeTableModel() {
@@ -63,8 +64,7 @@
super(new FinancialStatementImpl());
// Gets factory service
financialStatementService =
- LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
+ LimaServiceFactory.getService(FinancialStatementService.class);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,14 +25,19 @@
package org.chorem.lima.ui.financialstatementchart;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialStatementService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.enums.FinancialStatementsChartEnum;
@@ -40,14 +45,8 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
import org.jdesktop.swingx.JXTreeTable;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with account view.
*
@@ -62,7 +61,7 @@
/** log. */
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
- protected FinancialStatementServiceMonitorable financialStatementService;
+ protected FinancialStatementService financialStatementService;
protected FinancialStatementChartView view;
@@ -71,8 +70,8 @@
financialStatementService =
LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialStatementService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
/** Add new account with account form. */
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,19 @@
package org.chorem.lima.ui.financialstatementreport;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -34,28 +47,13 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.FinancialStatementService;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Entry book table model.
*
@@ -97,14 +95,14 @@
public FinancialStatementReportTableModel() {
financialStatementService =
LimaServiceFactory.getService(
- FinancialStatementServiceMonitorable.class);
+ FinancialStatementService.class);
- LimaServiceFactory.addServiceListener(financialStatementService, this);
+ LimaServiceFactory.addServiceListener(FinancialStatementService.class, this);
port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
- documentService = LimaServiceFactory.getService(DocumentServiceMonitorable.class);
+ HttpServerService.class).getHttpPort();
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ documentService = LimaServiceFactory.getService(DocumentService.class);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,23 +25,23 @@
package org.chorem.lima.ui.financialstatementreport;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with accounts reports view.
*
@@ -60,13 +60,13 @@
protected FinancialStatementReportTableModel model;
- protected FiscalPeriodServiceMonitorable fiscalPeriodService;
+ protected FiscalPeriodService fiscalPeriodService;
protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
this.view = view;
fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
+ FiscalPeriodService.class);
}
public void refresh() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,15 @@
package org.chorem.lima.ui.financialtransactionsearch;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -35,8 +44,6 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -47,16 +54,7 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -102,11 +100,11 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService, this);
+ FinancialTransactionService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
financialPeriodService =
LimaServiceFactory.getService(
- FinancialPeriodServiceMonitorable.class);
+ FinancialPeriodService.class);
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.financialtransactionsearch;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.Date;
+
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.FinancialStatementWayEnum;
@@ -32,7 +39,6 @@
import org.chorem.lima.beans.FinancialTransactionSearchImpl;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -41,12 +47,6 @@
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
import org.chorem.lima.util.DialogHelper;
-import javax.swing.JOptionPane;
-import javax.swing.ListSelectionModel;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Handler associated with financial transaction view.
*
@@ -84,7 +84,7 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ FinancialTransactionService.class);
financialTransactionSearch = new FinancialTransactionSearchImpl();
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 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,13 +25,22 @@
package org.chorem.lima.ui.financialtransactionunbalanced;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -41,17 +50,7 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -95,7 +94,7 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ FinancialTransactionService.class);
LimaServiceFactory.addServiceListener(financialTransactionService, this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -34,8 +34,8 @@
import org.chorem.lima.LimaContext;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.AccountService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -54,14 +54,14 @@
private static final Log log = LogFactory.getLog(AccountsPane.class);
- protected AccountServiceMonitorable accountService;
+ protected AccountService accountService;
public AccountsPane(HomeView view) {
super(view);
- accountService = LimaServiceFactory.getService(AccountServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(AccountServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ accountService = LimaServiceFactory.getService(AccountService.class);
+ LimaServiceFactory.addServiceListener(AccountService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -37,8 +37,7 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.EntryBookService;
-import org.chorem.lima.business.monitorable.EntryBookServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -63,9 +62,9 @@
public EntryBooksPane(HomeView view) {
super(view);
- entryBookService = LimaServiceFactory.getService(EntryBookServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(EntryBookServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
+ LimaServiceFactory.addServiceListener(EntryBookService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -38,9 +38,7 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
@@ -68,11 +66,11 @@
public FinancialTransactionsPane(HomeView view) {
super(view);
- financialTransactionService = LimaServiceFactory.getService(FinancialTransactionServiceMonitorable.class);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalPeriodsPane.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -37,8 +37,7 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.MainView;
@@ -69,9 +68,9 @@
public FiscalPeriodsPane(HomeView view) {
super(view);
- fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(FiscalPeriodServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
refresh();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.api.IdentityService;
-import org.chorem.lima.business.monitorable.IdentityServiceMonitorable;
import org.chorem.lima.entity.Identity;
import org.chorem.lima.entity.IdentityImpl;
import org.chorem.lima.service.LimaServiceFactory;
@@ -44,7 +43,7 @@
public IdentityHandler() {
identityService =
LimaServiceFactory.getService(
- IdentityServiceMonitorable.class);
+ IdentityService.class);
}
public Identity getIdentity() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,26 +25,8 @@
package org.chorem.lima.ui.importexport;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.ExportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.utils.ImportExportEntityEnum;
-import org.chorem.lima.enums.EncodingEnum;
-import org.chorem.lima.enums.ImportExportEnum;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.account.AccountViewHandler;
-import org.chorem.lima.util.DialogHelper;
-import org.jdesktop.swingx.painter.BusyPainter;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -61,8 +43,27 @@
import java.io.StringWriter;
import java.util.concurrent.ExecutionException;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.api.ExportService;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.utils.ImportExportEntityEnum;
+import org.chorem.lima.enums.EncodingEnum;
+import org.chorem.lima.enums.ImportExportEnum;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.account.AccountViewHandler;
+import org.chorem.lima.util.DialogHelper;
+import org.jdesktop.swingx.painter.BusyPainter;
+
public class ImportExport {
private static final Log log = LogFactory.getLog(AccountViewHandler.class);
@@ -71,9 +72,9 @@
protected EncodingEnum encodingEnum;
- protected ImportServiceMonitorable importService;
+ protected ImportService importService;
- protected ExportServiceMonitorable exportService;
+ protected ExportService exportService;
private ImportExportWaitView waitView;
@@ -81,12 +82,8 @@
viewComponent = view;
//services
- importService =
- LimaServiceFactory.getService(
- ImportServiceMonitorable.class);
- exportService =
- LimaServiceFactory.getService(
- ExportServiceMonitorable.class);
+ importService = LimaServiceFactory.getService(ImportService.class);
+ exportService = LimaServiceFactory.getService(ExportService.class);
//create the wait dialog panel
waitView = new ImportExportWaitView();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,6 +25,21 @@
package org.chorem.lima.ui.ledger;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -33,36 +48,19 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.business.api.HttpServerService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.ReportService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.ReportServiceMonitorable;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -105,16 +103,12 @@
this.view = view;
reportService =
- LimaServiceFactory.getService(ReportServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(reportService, this);
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
-// documentService =
-// LimaServiceFactory.getService(DocumentServiceMonitorable.class);
- fiscalPeriodService =
- LimaServiceFactory.getService(FiscalPeriodServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(FinancialTransactionServiceMonitorable.class, this);
+ LimaServiceFactory.getService(ReportService.class);
+ LimaServiceFactory.addServiceListener(ReportService.class, this);
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,14 +25,23 @@
package org.chorem.lima.ui.lettering;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
@@ -40,20 +49,7 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import org.nuiton.util.Resource;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
/**
* Basic transaction table model.
* <p/>
@@ -101,9 +97,9 @@
/* Services */
financialTransactionService =
LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(financialTransactionService,this);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ FinancialTransactionService.class);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class,this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
public void setSelectedBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,22 +25,16 @@
package org.chorem.lima.ui.lettering;
+import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
+import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.util.DialogHelper;
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
-import java.util.Date;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with financial transaction view.
*
@@ -67,7 +61,7 @@
protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
/** Transaction service. */
- protected final FinancialTransactionServiceMonitorable financialTransactionService;
+ protected final FinancialTransactionService financialTransactionService;
protected Object clipBoard;
@@ -75,9 +69,7 @@
this.view = view;
/* Services */
- financialTransactionService =
- LimaServiceFactory.getService(
- FinancialTransactionServiceMonitorable.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
}
public void setBeginDate(Date date) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateFiscalPeriodPanel.jaxx 2012-04-18 08:42:09 UTC (rev 3377)
@@ -29,16 +29,16 @@
org.apache.commons.lang3.time.DateUtils
org.jdesktop.swingx.JXDatePicker
org.chorem.lima.entity.FiscalPeriod
- org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable
+ org.chorem.lima.business.api.FiscalPeriodService
org.chorem.lima.business.LimaException
org.chorem.lima.service.LimaServiceFactory
</import>
<script>
<![CDATA[
- protected FiscalPeriodServiceMonitorable fiscalPeriodService =
+ protected FiscalPeriodService fiscalPeriodService =
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class);
+ FiscalPeriodService.class);
// set begin date picker
Date endDate = null;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -25,10 +25,19 @@
package org.chorem.lima.ui.opening;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Color;
+
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodImpl;
import org.chorem.lima.enums.AccountsChartEnum;
@@ -40,14 +49,6 @@
import org.chorem.lima.ui.identity.IdentityHandler;
import org.chorem.lima.ui.importexport.ImportExport;
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import java.awt.Color;
-
-import static org.nuiton.i18n.I18n._;
-
public class OpeningViewHandler {
private static final Log log = LogFactory.getLog(OpeningViewHandler.class);
@@ -192,7 +193,7 @@
fiscalPeriod.setEndDate(fsPanel.getEndDatePicker().getDate());
LimaServiceFactory.getService(
- FiscalPeriodServiceMonitorable.class).
+ FiscalPeriodService.class).
createFiscalPeriod(fiscalPeriod);
} catch (LimaException ex) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,27 +24,28 @@
*/
package org.chorem.lima.ui.vatchart;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
+import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-import javax.swing.tree.TreePath;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatChartTreeTableModel extends AbstractTreeTableModel {
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
/** Services. */
- protected final VatStatementServiceMonitorable vatStatementService;
+ protected final VatStatementService vatStatementService;
/** Model constructor. Initiate account service used here. */
public VatChartTreeTableModel() {
@@ -53,7 +54,7 @@
// Gets factory service
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
+ VatStatementService.class);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,13 +24,18 @@
*/
package org.chorem.lima.ui.vatchart;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
+import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementImpl;
import org.chorem.lima.enums.ImportExportEnum;
@@ -39,18 +44,12 @@
import org.chorem.lima.ui.importexport.ImportExport;
import org.jdesktop.swingx.JXTreeTable;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-import java.math.BigDecimal;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatChartViewHandler implements ServiceListener {
/** log. */
private static final Log log = LogFactory.getLog(VatChartViewHandler.class);
- protected VatStatementServiceMonitorable vatStatementService;
+ protected VatStatementService vatStatementService;
protected VatChartView view;
@@ -59,8 +58,8 @@
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class, this);
+ VatStatementService.class);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
public void addVatStatementMovement() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,27 +24,26 @@
*/
package org.chorem.lima.ui.vatreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.VatStatementAmounts;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.VatStatementService;
-import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
-import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
-import org.chorem.lima.business.monitorable.VatStatementServiceMonitorable;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.ErrorHelper;
import org.nuiton.topia.TopiaException;
-import javax.swing.table.AbstractTableModel;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
public class VatReportTableModel extends AbstractTableModel implements ServiceListener {
/** serialVersionUID. */
@@ -80,22 +79,13 @@
public VatReportTableModel() {
-// reportService =
-// LimaServiceFactory.getService(
-// ReportServiceMonitorable.class);
- //add listeners
vatStatementService =
LimaServiceFactory.getService(
- VatStatementServiceMonitorable.class);
- LimaServiceFactory.addServiceListener(vatStatementService, this);
- LimaServiceFactory.addServiceListener(
- FinancialTransactionServiceMonitorable.class, this);
- LimaServiceFactory.addServiceListener(
- ImportServiceMonitorable.class, this);
-
-// //sets autocomplete mode to true on start
-// autocomplete = "true";
+ VatStatementService.class);
+ LimaServiceFactory.addServiceListener(VatStatementService.class, this);
+ LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
+ LimaServiceFactory.addServiceListener(ImportService.class, this);
}
protected List<VatStatementAmounts> getDataList() throws TopiaException {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-04-18 08:14:53 UTC (rev 3376)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-04-18 08:42:09 UTC (rev 3377)
@@ -24,23 +24,23 @@
*/
package org.chorem.lima.ui.vatreports;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
-import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
-import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
+import org.chorem.lima.business.api.DocumentService;
+import org.chorem.lima.business.api.HttpServerService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-
public class VatReportViewHandler {
/** log. */
private static final Log log =
@@ -48,7 +48,7 @@
protected VatReportView view;
- protected DocumentServiceMonitorable documentService;
+ protected DocumentService documentService;
private static SimpleDateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd");
@@ -58,12 +58,9 @@
protected VatReportViewHandler(VatReportView view) {
this.view = view;
- port = LimaServiceFactory.getService(
- HttpServerServiceMonitorable.class).getHttpPort();
+ port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
- documentService =
- LimaServiceFactory.getService(
- DocumentServiceMonitorable.class);
+ documentService = LimaServiceFactory.getService(DocumentService.class);
}
public void init() {
1
0
r3376 - trunk/lima-business/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org April 18, 2012
by echatellier@users.chorem.org April 18, 2012
April 18, 2012
Author: echatellier
Date: 2012-04-18 10:14:53 +0200 (Wed, 18 Apr 2012)
New Revision: 3376
Url: http://chorem.org/repositories/revision/lima/3376
Log:
Disable openejb banner (sysout)
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 08:14:34 UTC (rev 3375)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-04-18 08:14:53 UTC (rev 3376)
@@ -89,6 +89,7 @@
// see http://openejb.apache.org/embedded-configuration.html
// http://openejb.apache.org/properties-listing.html
// for embedded configuration
+ props.setProperty("openejb.nobanner", "false");
container = EJBContainer.createEJBContainer(props);
}
1
0
r3375 - in trunk/lima-swing/src/main: java/org/chorem/lima resources/i18n
by echatellier@users.chorem.org April 18, 2012
by echatellier@users.chorem.org April 18, 2012
April 18, 2012
Author: echatellier
Date: 2012-04-18 10:14:34 +0200 (Wed, 18 Apr 2012)
New Revision: 3375
Url: http://chorem.org/repositories/revision/lima/3375
Log:
Manage business exception in different way
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-18 08:14:34 UTC (rev 3375)
@@ -96,7 +96,11 @@
log.error("Global application exception", ex);
}
- Throwable cause = ex.getCause();
+ Throwable cause = ex;
+ while (ex != null && !(cause instanceof LimaBusinessException)) {
+ cause = cause.getCause();
+ }
+
if (cause instanceof LimaBusinessException) {
JOptionPane.showMessageDialog(null, cause.getMessage(),
_("lima.ui.common.error"), JOptionPane.ERROR_MESSAGE);
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-04-18 08:14:34 UTC (rev 3375)
@@ -278,6 +278,7 @@
lima.ui.account.shortened=
lima.ui.account.updateaccounttitle=
lima.ui.common.cancel=
+lima.ui.common.error=
lima.ui.common.ok=
lima.ui.common.remove=
lima.ui.common.update=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-17 16:03:01 UTC (rev 3374)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-04-18 08:14:34 UTC (rev 3375)
@@ -257,6 +257,7 @@
lima.ui.account.shortened=Plan comptable abrégé
lima.ui.account.updateaccounttitle=Modification d'un compte
lima.ui.common.cancel=Annuler
+lima.ui.common.error=Erreur
lima.ui.common.ok=Ok
lima.ui.common.remove=Supprimer
lima.ui.common.update=Modifier
1
0
r3374 - trunk/lima-swing/src/main/java/org/chorem/lima/util
by echatellier@users.chorem.org April 17, 2012
by echatellier@users.chorem.org April 17, 2012
April 17, 2012
Author: echatellier
Date: 2012-04-17 18:03:01 +0200 (Tue, 17 Apr 2012)
New Revision: 3374
Url: http://chorem.org/repositories/revision/lima/3374
Log:
Deprecate another helper
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-04-17 16:00:24 UTC (rev 3373)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-04-17 16:03:01 UTC (rev 3374)
@@ -37,21 +37,11 @@
/**
* @author ore
* @author Rémi Chapelet
+ * @deprecated with no replacement, use JOptionPane directly
*/
+@Deprecated
public class DialogHelper {
- public static int showConfirmDialog(String message) {
- String[] response = {_("lima.response.yes"), _("lima.response.no")};
- return JOptionPane.showOptionDialog(null,
- message,
- _("lima.common.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null, //do not use a custom Icon
- response, //the titles of buttons
- response[0]); //default button title
- }
-
/**
* Use instead: JOptionPane.showMessageDialog (String message,String titre,int type)
* <p/>
@@ -86,24 +76,6 @@
}
/**
- * Permet d'afficher une boite de dialogue.
- *
- * @param message
- * @param titre
- * @param type
- */
- public static void showMessageDialog(String message, String titre, int type) {
- JFrame f = new JFrame();
- f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JOptionPane.showMessageDialog(
- f,
- message,
- titre,
- type);
- f.dispose();
- }
-
- /**
* Permet d'afficher une boite de dialogue avec rapport
*
* @param message
1
0
r3373 - in trunk/lima-swing/src/main/java/org/chorem/lima: . ui ui/accountsreports ui/balance ui/entrybooksreports ui/financialstatementchart ui/financialstatementreport ui/financialtransactionsearch ui/financialtransactionunbalanced ui/ledger ui/lettering ui/vatreports util
by echatellier@users.chorem.org April 17, 2012
by echatellier@users.chorem.org April 17, 2012
April 17, 2012
Author: echatellier
Date: 2012-04-17 18:00:24 +0200 (Tue, 17 Apr 2012)
New Revision: 3373
Url: http://chorem.org/repositories/revision/lima/3373
Log:
Refactor ErrorHelper use
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.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/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.monitorable.AccountServiceMonitorable;
import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
@@ -37,6 +38,7 @@
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
+import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.Arrays;
import java.util.Date;
@@ -49,7 +51,7 @@
* @author ore
* @version $Revision$
*/
-public class LimaMain {
+public class LimaMain implements Thread.UncaughtExceptionHandler {
/** Log. */
private static final Log log = LogFactory.getLog(LimaMain.class);
@@ -64,36 +66,46 @@
* Lima main method.
*
* @param args program args
+ * @throws Exception
*/
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
if (log.isInfoEnabled()) {
log.info("Lima starts at " + new Date());
log.info("Args: " + Arrays.toString(args));
}
- try {
+ // init root context
+ LimaContext context = init(args);
- // init root context
- LimaContext context = init(args);
+ // do actions
+ config = context.getConfig();
+ config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
- // do actions
- config = context.getConfig();
- config.doAction(LimaConfig.Action.AFTER_INIT_STEP);
+ // display main ui
+ if (config.isLaunchui()) {
+ // override default exception management (after config init)
+ Thread.setDefaultUncaughtExceptionHandler(new LimaMain());
- // display main ui
- if (config.isLaunchui()) {
- launch(context);
- }
- } catch (Exception ex) {
- if (log.isErrorEnabled()) {
- log.error(_("lima.common.globalexception"), ex);
- }
- ErrorHelper.showErrorDialog(_("lima.common.globalexception"), ex);
- System.exit(1);
+ launch(context);
}
}
+ public void uncaughtException(Thread t, Throwable ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Global application exception", ex);
+ }
+
+ Throwable cause = ex.getCause();
+ if (cause instanceof LimaBusinessException) {
+ JOptionPane.showMessageDialog(null, cause.getMessage(),
+ _("lima.ui.common.error"), JOptionPane.ERROR_MESSAGE);
+ } else {
+ ErrorHelper errorHelper = new ErrorHelper(config);
+ errorHelper.showErrorDialog(null, ex.getMessage(), ex);
+ }
+ }
+
/**
* initialisation de l'application :
* <p/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -33,6 +33,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.monitorable.HttpServerServiceMonitorable;
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
@@ -194,7 +195,7 @@
try {
DesktopUtil.browse(siteURL.toURI());
} catch (Exception e) {
- ErrorHelper.showErrorDialog("Can't open lima website at " + siteURL, e);
+ throw new LimaRuntimeException("Can't open lima website at " + siteURL, e);
}
}
@@ -451,7 +452,7 @@
try {
SwingUtil.openLink(url);
} catch (Exception e) {
- ErrorHelper.showErrorDialog("Can't open lima website at " + url, e);
+ throw new LimaRuntimeException("Can't open lima website at " + url, e);
}
}
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
@@ -108,10 +109,7 @@
results = reportService.generateAccountsReports(selectedAccount, true,
selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.accountsreports.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.accountsreports.listerror"), eee);
}
}
return results;
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -30,6 +30,7 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
@@ -133,10 +134,7 @@
try {
results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false, view.getMovmentedFilter().isSelected());
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.balance.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.balance.listerror"), eee);
}
return results;
}
@@ -187,10 +185,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.balance.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.balance.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -25,11 +25,26 @@
package org.chorem.lima.ui.entrybooksreports;
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.DocumentServiceMonitorable;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -44,20 +59,7 @@
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
-import javax.swing.JOptionPane;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import static org.nuiton.i18n.I18n._;
-
-
/**
* Handler associated with accounts reports view.
* By : $Author$
@@ -136,10 +138,7 @@
reportService.generateEntryBooksReports(
selectedEntryBook, selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.entrybooksreports.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.entrybooksreports.listerror"), eee);
}
}
return results;
@@ -191,10 +190,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.entrybooksreports.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.entrybooksreports.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.monitorable.FinancialStatementServiceMonitorable;
import org.chorem.lima.business.monitorable.ImportServiceMonitorable;
@@ -113,10 +114,7 @@
DialogHelper.showErrorMessageDialog(view, eee);
} catch (LimaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't add financialStatementHeader", ex);
- }
- ErrorHelper.showErrorDialog(_("lima.financialstatement.addfinancialStatementHeadererror"), ex);
+ throw new LimaRuntimeException(_("lima.financialstatement.addfinancialStatementHeadererror"), ex);
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -30,6 +30,7 @@
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.DocumentService;
import org.chorem.lima.business.api.FinancialStatementService;
@@ -257,10 +258,7 @@
try {
results = financialStatementService.financialStatementReport(selectedBeginDate, selectedEndDate);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.financialstatementreport.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.financialstatementreport.listerror"), eee);
}
}
return results;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.FiscalPeriod;
@@ -89,10 +90,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog("Enable to create document ", eee);
+ throw new LimaRuntimeException("Enable to create document ", eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -31,6 +31,7 @@
import org.chorem.lima.beans.FinancialTransactionSearch;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
@@ -124,11 +125,7 @@
try {
results = financialTransactionService.searchFinancialTransaction(financialTransactionSearch);
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
-
- ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ throw new LimaRuntimeException("Can't get transaction list", eee);
}
}
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 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -116,11 +117,7 @@
results.addAll(entries);
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
-
- ErrorHelper.showErrorDialog("Can't get transaction list", eee);
+ throw new LimaRuntimeException("Can't get transaction list", eee);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -31,6 +31,7 @@
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.ReportService;
@@ -151,10 +152,7 @@
}
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog("Can't get entries list", eee);
+ throw new LimaRuntimeException("Can't get entries list", eee);
}
return results;
}
@@ -202,10 +200,7 @@
try {
blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Enable to create document ", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.ledger.documentcreationerror"), eee);
+ throw new LimaRuntimeException(_("lima.ledger.documentcreationerror"), eee);
}
//tells if the fiscaPeriod as been found and is blocked
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -132,10 +133,7 @@
results.addAll(entries);
}
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.lettering.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.lettering.listerror"), eee);
}
}
return results;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -28,6 +28,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.VatStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.LimaRuntimeException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonitorable;
@@ -107,10 +108,7 @@
getBeginDate(),
getEndDate());
} catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog(_("lima.vatreport.listerror"), eee);
+ throw new LimaRuntimeException(_("lima.vatreport.listerror"), eee);
}
}
return list;
@@ -120,10 +118,7 @@
try {
cacheDataList = getDataList();
} catch (TopiaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't update model", eee);
- }
- ErrorHelper.showErrorDialog("Can't get VAT list", eee);
+ throw new LimaRuntimeException("Can't get VAT list", eee);
}
fireTableDataChanged();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2012-04-17 15:39:47 UTC (rev 3372)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2012-04-17 16:00:24 UTC (rev 3373)
@@ -25,17 +25,8 @@
package org.chorem.lima.util;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.MultiPartEmail;
-import org.chorem.lima.LimaMain;
-import org.jdesktop.swingx.JXErrorPane;
-import org.jdesktop.swingx.error.ErrorInfo;
-import org.jdesktop.swingx.error.ErrorReporter;
+import static org.nuiton.i18n.I18n._;
-import javax.swing.JOptionPane;
import java.awt.Component;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -44,8 +35,18 @@
import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.MultiPartEmail;
+import org.chorem.lima.LimaConfig;
+import org.jdesktop.swingx.JXErrorPane;
+import org.jdesktop.swingx.error.ErrorInfo;
+import org.jdesktop.swingx.error.ErrorReporter;
+
/**
* Error helper.
* <p/>
@@ -62,6 +63,12 @@
/** Log. */
private static final Log log = LogFactory.getLog(ErrorHelper.class);
+ protected LimaConfig config;
+
+ public ErrorHelper(LimaConfig config) {
+ this.config = config;
+ }
+
/**
* Display a user friendly error frame.
*
@@ -69,14 +76,14 @@
* @param message message for user
* @param cause exception cause
*/
- public static void showErrorDialog(Component parent, String message,
+ public void showErrorDialog(Component parent, String message,
Throwable cause) {
JXErrorPane pane = new JXErrorPane();
ErrorInfo info = new ErrorInfo(_("lima.common.error"),
_("lima.error.errorpane.htmlmessage", message), null, null,
cause, null, null);
pane.setErrorInfo(info);
- pane.setErrorReporter(new ErrorHelper());
+ pane.setErrorReporter(this);
JXErrorPane.showDialog(parent, pane);
}
@@ -85,7 +92,7 @@
*
* @param message message for user
*/
- public static void showErrorDialog(String message) {
+ public void showErrorDialog(String message) {
showErrorDialog(message, null);
}
@@ -95,7 +102,7 @@
* @param message message for user
* @param cause exception cause
*/
- public static void showErrorDialog(String message, Throwable cause) {
+ public void showErrorDialog(String message, Throwable cause) {
showErrorDialog(null, message, cause);
}
@@ -106,7 +113,7 @@
public void reportError(ErrorInfo errorInfo) throws NullPointerException {
try {
- String emailTo = LimaMain.config.getSupportEmail();
+ String emailTo = config.getSupportEmail();
MultiPartEmail email = new MultiPartEmail();
// smtp
@@ -120,19 +127,19 @@
// message description
StringBuffer message = new StringBuffer();
- message.append(formatMessage("Project", "Lima " + LimaMain.config.getVersion()));
+ message.append(formatMessage("Project", "Lima " + config.getVersion()));
message.append(formatMessage("Date", new Date().toString()));
message.append(formatMessage("Title", errorInfo.getTitle()));
message.append(formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", "")));
// message configuration
message.append(formatMessage("Configuration", null));
- List<String> propertiesNames = new ArrayList<String>(LimaMain.config.getOptions().stringPropertyNames());
+ List<String> propertiesNames = new ArrayList<String>(config.getOptions().stringPropertyNames());
Collections.sort(propertiesNames);
for (String propertyName : propertiesNames) {
// security, don't send string containing password :
if (!propertyName.contains("pass")) {
- message.append("\t" + propertyName + " : " + LimaMain.config.getOptions().getProperty(propertyName) + "\n");
+ message.append("\t" + propertyName + " : " + config.getOptions().getProperty(propertyName) + "\n");
}
}
@@ -142,9 +149,6 @@
errorInfo.getErrorException().printStackTrace(writer);
message.append(formatMessage("Exception", out.toString()));
- // TODO EC-20100409 i18n files are iso encoded ?
- email.setContent(message.toString(), "text/plain; charset=ISO-8859-9");
-
// send mail
email.send();
1
0