Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 1853 discussions
r3863 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/resources/i18n lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart
by sbavencoff@users.chorem.org 24 Jul '14
by sbavencoff@users.chorem.org 24 Jul '14
24 Jul '14
Author: sbavencoff
Date: 2014-07-24 14:11:50 +0200 (Thu, 24 Jul 2014)
New Revision: 3863
Url: http://forge.chorem.org/projects/lima/repository/revisions/3863
Log:
refs #1044 : financial statement service
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
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
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -25,7 +25,6 @@
package org.chorem.lima.business.ejb;
-import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,12 +51,11 @@
import javax.ejb.TransactionAttribute;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
-import static org.nuiton.i18n.I18n.t;
-
@Stateless
@Remote(FinancialStatementService.class)
@TransactionAttribute
@@ -97,29 +95,21 @@
FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
- // remove financialstatement
+ // refresh financialstatement
FinancialStatement financialStatementToDelete =
- financialStatementTopiaDao.findByTopiaId(financialStatement.getTopiaId());
- financialStatementTopiaDao.delete(financialStatementToDelete);
+ financialStatementTopiaDao.forTopiaIdEquals(financialStatement.getTopiaId()).findUnique();
- //get all subFinancialStatement
- List<FinancialStatement> financialStatements =
- getAllChildrenFinancialStatement(financialStatement, new ArrayList<FinancialStatement>());
-
- //if FinancialStatement have subFinancialStatement
- for (FinancialStatement subFinancialStatement : financialStatements) {
- FinancialStatement subFinancialStatementToDelete =
- financialStatementTopiaDao.findByTopiaId(
- subFinancialStatement.getTopiaId());
- financialStatementTopiaDao.delete(subFinancialStatementToDelete);
- }
+ financialStatementTopiaDao.delete(financialStatementToDelete);
}
@Override
public void removeAllFinancialStatement() {
- for (FinancialStatement financialStatement : getChildrenFinancialStatement(null)) {
- removeFinancialStatement(financialStatement);
- }
+
+ FinancialStatementTopiaDao financialStatementDao = getDaoHelper().getFinancialStatementDao();
+
+ List<FinancialStatement> allRoots = getRootFinancialStatements();
+
+ financialStatementDao.deleteAll(allRoots);
}
@Override
@@ -131,24 +121,18 @@
}
@Override
- public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement,
- List<FinancialStatement> result) {
- List<FinancialStatement> childFinancialStatements =
- getChildrenFinancialStatement(financialStatement);
- for (FinancialStatement childFinancialStatement : childFinancialStatements) {
- result.add(childFinancialStatement);
- getAllChildrenFinancialStatement(childFinancialStatement, result);
- }
+ public List<FinancialStatement> getRootFinancialStatements() {
+ FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
+
+ List<FinancialStatement> result = financialStatementTopiaDao
+ .forMasterFinancialStatementEquals(null)
+ .setOrderByArguments(FinancialStatement.PROPERTY_TOPIA_CREATE_DATE)
+ .findAll();
+
return result;
}
@Override
- public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement masterFinancialStatement) {
- return Lists.newArrayList(masterFinancialStatement.getSubFinancialStatements());
- }
-
-
- @Override
public void updateFinancialStatement(FinancialStatement financialStatement) {
// TopiaDao
@@ -187,8 +171,14 @@
Date selectedEndDate,
FinancialStatementDatas result) {
- List<FinancialStatement> financialStatements = getChildrenFinancialStatement(financialStatement);
+ Collection<FinancialStatement> financialStatements;
+ if (financialStatement == null) {
+ financialStatements = getRootFinancialStatements();
+ } else {
+ financialStatements = financialStatement.getSubFinancialStatements();
+ }
+
BigDecimal grossAmount = new BigDecimal(0),
provisionDeprecationAmount = new BigDecimal(0);
List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
@@ -398,8 +388,7 @@
}
@Override
- public String checkFinancialStatementChart() {
- StringBuilder result = new StringBuilder(t("lima-business.financialstatement.check.warn"));
+ public List<Account> checkFinancialStatementChart() {
AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao();
FinancialStatementTopiaDao financialStatementTopiaDao = getDaoHelper().getFinancialStatementDao();
@@ -419,13 +408,7 @@
accountsList.removeAll(accountService.stringToListAccounts(financialStatement.getProvisionDeprecationAccounts()));
}
- for (Account account : accountsList) {
-
- result.append(t("lima-business.financialstatement.check.nothing",
- account.getAccountNumber(), account.getLabel()));
- }
-
- return result.toString();
+ return accountsList;
}
@Override
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-24 12:11:50 UTC (rev 3863)
@@ -69,8 +69,6 @@
lima-business.document.voucher=Pièce comptable
lima-business.document.zipcode=Code postal
lima-business.entrybook.entrybookalreadyexist=Un journal existe déjà avec ce code \: %s
-lima-business.financialstatement.check.nothing=Introuvable \: %s - %s \n
-lima-business.financialstatement.check.warn=Attention cette fonctionnalité n'est qu'une aide utilisateur.\n Certains comptes ne doivent pas être présent au bilan et compte de résultat.\n Il est donc normal que des comptes sont marqués comme introuvable.\n\n
lima-business.financialtransaction.retainedearnings.description=Report à nouveau
lima-business.financialtransaction.retainedearnings.voucher=Selon décision AG
lima-business.fiscalperiod.fiscalperiodalreadyblocked=La période fiscale est déjà bloquée
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialStatementService.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -27,6 +27,7 @@
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FinancialStatement;
import java.util.Date;
@@ -46,15 +47,16 @@
List<FinancialStatement> getAllFinancialStatements();
- List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement);
+ List<FinancialStatement> getRootFinancialStatements();
- List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement,
- List<FinancialStatement> financialStatements);
-
List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate,
Date selectedEndDate);
- String checkFinancialStatementChart();
+ /**
+ *
+ * @return la liste de compte non utilisés.
+ */
+ List<Account> checkFinancialStatementChart();
/**
* Check if Financial Statement exist according the label given as parameter.
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 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -25,6 +25,7 @@
package org.chorem.lima.ui.financialstatementchart;
+import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.api.FinancialStatementService;
@@ -99,12 +100,11 @@
int result = 0;
if (node == getRoot()) {
result = financialStatementService.
- getChildrenFinancialStatement(null).size();
+ getRootFinancialStatements().size();
} else {
FinancialStatement parentFinancialStatementHeader =
(FinancialStatement) node;
- result = financialStatementService.getChildrenFinancialStatement(
- parentFinancialStatementHeader).size();
+ result = parentFinancialStatementHeader.getSubFinancialStatements().size();
}
return result;
}
@@ -114,13 +114,15 @@
Object result = null;
if (parent == getRoot()) {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getRootFinancialStatements();
result = financialStatements.get(index);
} else {
FinancialStatement parentFinancialStatement =
(FinancialStatement) parent;
- List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+
+ List<FinancialStatement> financialStatements =
+ Lists.newArrayList(parentFinancialStatement.getSubFinancialStatements());
+
result = financialStatements.get(index);
}
return result;
@@ -132,13 +134,15 @@
if (parent == getRoot()) {
List<FinancialStatement> financialStatements =
- financialStatementService.getChildrenFinancialStatement(null);
+ financialStatementService.getRootFinancialStatements();
result = financialStatements.indexOf(child);
} else {
FinancialStatement parentFinancialStatement =
(FinancialStatement) parent;
- List<FinancialStatement> financialStatements = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatement);
+
+ List<FinancialStatement> financialStatements =
+ Lists.newArrayList(parentFinancialStatement.getSubFinancialStatements());
+
result = financialStatements.indexOf(child);
}
return result;
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 2014-07-24 12:04:19 UTC (rev 3862)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2014-07-24 12:11:50 UTC (rev 3863)
@@ -30,6 +30,7 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialStatementService;
import org.chorem.lima.business.api.ImportService;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.enums.FinancialStatementsChartEnum;
@@ -40,9 +41,15 @@
import org.jdesktop.swingx.JXTreeTable;
import org.nuiton.util.Resource;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.JTextArea;
+import javax.swing.KeyStroke;
import javax.swing.tree.TreePath;
-import java.awt.*;
+import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
@@ -376,8 +383,17 @@
public void financialStatementChartCheck() {
- String result = financialStatementService.checkFinancialStatementChart();
- showReportDialog(result, t("lima.financialstatement.check"), view);
+ java.util.List<Account> unusedAccounts = financialStatementService.checkFinancialStatementChart();
+
+ StringBuilder result = new StringBuilder(t("lima.financialStatements.check.warn"));
+
+ for (Account account : unusedAccounts) {
+
+ result.append(t("lima.financialStatements.check.nothing",
+ account.getAccountNumber(), account.getLabel()));
+ }
+
+ showReportDialog(result.toString(), t("lima.financialStatements.check"), view);
}
/**
1
0
r3862 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: account entrybook financialperiod financialstatementchart financialtransaction financialtransactionunbalanced fiscalperiod home lettering vatchart
by dcosse@users.chorem.org 24 Jul '14
by dcosse@users.chorem.org 24 Jul '14
24 Jul '14
Author: dcosse
Date: 2014-07-24 14:04:19 +0200 (Thu, 24 Jul 2014)
New Revision: 3862
Url: http://forge.chorem.org/projects/lima/repository/revisions/3862
Log:
Utilisation De DesctopUtils de nuiton-utils ?\195?\160 la place de Desktop
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.ui.account.addaccount" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.ui.account.addaccount") + " (Ctrl+N)"}"
actionIcon='account-new'
onActionPerformed="handler.addAccount()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.ui.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.ui.common.update") + " (Ctrl+M)"}"
actionIcon='account-edit'
onActionPerformed="handler.updateAccount()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.ui.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.ui.common.remove") + " (Del)"}"
actionIcon='account-remove'
onActionPerformed="handler.removeAccount()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.ui.entrybook.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.ui.entrybook.add") + " (Ctrl+N)"}"
actionIcon='entryBook-new'
onActionPerformed="handler.addEntryBook()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.ui.entrybook.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.ui.entrybook.update") + " (Ctrl+M)"}"
actionIcon='entryBook-edit'
onActionPerformed="handler.updateEntryBook()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.ui.entrybook.remove" + " (Del)"}"
+ toolTipText="{ t("lima.ui.entrybook.remove") + " (Del)"}"
actionIcon='entryBook-remove'
onActionPerformed="handler.deleteEntryBook()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -46,7 +46,7 @@
<JToolBar floatable="false">
<JButton id="blockButton"
- toolTipText="{ "lima.ui.financialperiod.block" + " (Ctrl+C)"}"
+ toolTipText="{ t("lima.ui.financialperiod.block") + " (Ctrl+C)"}"
actionIcon='financialPeriod-close'
onActionPerformed="handler.blockFinancialPeriod()"
enabled="{isSelectedPeriod()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -28,6 +28,7 @@
<import>
javax.swing.ListSelectionModel
org.jdesktop.swingx.decorator.HighlighterFactory
+ static org.nuiton.i18n.I18n.t
</import>
<FinancialStatementChartViewHandler id="handler"
@@ -39,37 +40,37 @@
<JToolBar floatable="false">
<JButton id="addFinancialStatementHeader"
- toolTipText="{ "lima.financialstatement.header.add" + " (Ctrl+Maj+N)"}"
+ toolTipText="{ t("lima.financialstatement.header.add") + " (Ctrl+Maj+N)"}"
actionIcon='financialstatement-add-header'
onActionPerformed="handler.addFinancialStatementHeader()"/>
<JButton id="addFinancialStatementMovement"
- toolTipText="{ "lima.financialstatement.movement.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.financialstatement.movement.add") + " (Ctrl+N)"}"
actionIcon='financialstatement-add-movement'
onActionPerformed="handler.addFinancialStatementMovement()"
enabled="{isSelectedRow()}"/>
<JButton id="updateButton"
- toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
actionIcon='financialstatement-edit'
onActionPerformed="handler.updateFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.common.remove") + " (Del)"}"
actionIcon='financialstatement-remove'
onActionPerformed="handler.removeFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="importButton"
- toolTipText="{ "lima.ui.importexport.import" + " (Ctrl+I)"}"
+ toolTipText="{ t("lima.ui.importexport.import") + " (Ctrl+I)"}"
actionIcon='financialstatement-import'
onActionPerformed="handler.importFinancialStatementChart()"/>
<JToolBar.Separator/>
<JButton id="checkButton"
- toolTipText="{ "lima.financialstatement.check" + " (Ctrl+F)"}"
+ toolTipText="{ t("lima.financialstatement.check") + " (Ctrl+F)"}"
actionIcon='financialstatement-check'
onActionPerformed="handler.financialStatementChartCheck()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -61,39 +61,39 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ "lima.entries.addTransaction" + " (Ctrl+Shift+N)"}"
+ <JButton toolTipText="{ t("lima.entries.addTransaction") + " (Ctrl+Shift+N)"}"
actionIcon='add-financial-transaction'
onActionPerformed="handler.addFinancialTransaction()" />
- <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedTransaction()" />
- <JButton toolTipText="{ "lima.entries.copy.transaction" + " (Ctrl+Shift+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ t("lima.entries.copy.transaction") + " (Ctrl+Shift+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyTransaction()" />
- <JButton toolTipText="{ "lima.entries.paste.transaction" + " (Ctrl+Shift+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ t("lima.entries.paste.transaction") + " (Ctrl+Shift+V)"}" actionIcon='paste'
enabled="{isTransactionInClipBoard()}"
onActionPerformed="handler.pasteTransaction()" />
<JToolBar.Separator/>
- <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.addEntry()" />
- <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedEntry()" />
- <JButton toolTipText="{ "lima.entries.copy.entry" + " (Ctrl+Alt+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ t("lima.entries.copy.entry") + " (Ctrl+Alt+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyEntry()" />
- <JButton toolTipText="{ "lima.entries.paste.entry" + " (Ctrl+Alt+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ t("lima.entries.paste.entry") + " (Ctrl+Alt+V)"}" actionIcon='paste'
enabled="{isEntryInClipBoard() && isSelectedRow()}"
onActionPerformed="handler.pasteEntry()" />
- <JButton toolTipText="{ "lima.entries.assign.entries" + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
+ <JButton toolTipText="{ t("lima.entries.assign.entries") + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
enabled="{isAssignableInAllEntries() && isSelectedRow()}"
onActionPerformed="handler.assignAllEntries()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
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 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -53,18 +53,18 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedTransaction()" />
- <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().addEntry()" />
- <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedEntry()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
<JToolBar.Separator/>
@@ -79,7 +79,7 @@
getHandler().refresh()"
editable="false"/>
<JToolBar.Separator/>
- <JButton toolTipText="{ "lima.ui.common.refresh" + " (F5)"}" actionIcon='refresh'
+ <JButton toolTipText="{ t("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
onActionPerformed="getHandler().refresh()"/>
</JToolBar>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -28,6 +28,7 @@
<import>
javax.swing.ListSelectionModel
javax.swing.DefaultListSelectionModel
+ static org.nuiton.i18n.I18n.t
</import>
<FiscalPeriodViewHandler id="handler" constructorParams="this"/>
@@ -46,24 +47,24 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ "lima.charts.fiscalperiod.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.add") + " (Ctrl+N)"}"
actionIcon='fiscalPeriod-new'
onActionPerformed="handler.addFiscalPeriod()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.charts.fiscalperiod.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.update") + " (Ctrl+M)"}"
actionIcon='fiscalPeriod-edit'
onActionPerformed="handler.updateFiscalPeriod()"
enabled="{isDeleteEnabled()}" />
<JButton id="blockButton"
- toolTipText="{ "lima.charts.fiscalperiod.block" + " (Ctrl+B)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.block") + " (Ctrl+B)"}"
actionIcon='fiscalPeriod-close'
onActionPerformed="handler.blockFiscalPeriod()"
enabled="{isBlockEnabled()}"/>
<JButton id="deleteButton"
- toolTipText="{ "lima.charts.fiscalperiod.delete" + " (Del)"}"
+ toolTipText="{ t("lima.charts.fiscalperiod.delete") + " (Del)"}"
actionIcon='fiscalPeriod-remove'
onActionPerformed="handler.deleteFiscalPeriod()"
enabled="{isDeleteEnabled()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -29,6 +29,7 @@
javax.swing.BoxLayout
javax.swing.border.EtchedBorder
jaxx.runtime.SwingUtil
+ static org.nuiton.i18n.I18n.t
</import>
<Dimension id="fixedSize" javaBean='new Dimension(500,200)'/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -32,6 +32,7 @@
org.chorem.lima.entity.Account
javax.swing.ListSelectionModel
org.jdesktop.swingx.JXDatePicker
+ static org.nuiton.i18n.I18n.t
</import>
<LetteringViewHandler id="handler" constructorParams="this"/>
@@ -54,19 +55,19 @@
<JToolBar floatable="false">
<JButton id="lettered"
- toolTipText="{ "lima.ui.lettering.buttonLettered" + " (Ctrl+L)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonLettered") + " (Ctrl+L)"}"
enabled="{editModel.isLettred()}"
actionIcon='lettering'
onActionPerformed="handler.addLetter()"/>
<JButton id="noLettered"
- toolTipText="{ "lima.ui.lettering.buttonNoLettered" + " (Del)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonNoLettered") + " (Del)"}"
enabled="{editModel.isUnLettred()}"
actionIcon='un-lettering'
onActionPerformed="handler.removeLetter()"/>
<JButton id="round"
- toolTipText="{ "lima.ui.lettering.buttonEqualize" + " (Ctrl+B)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonEqualize") + " (Ctrl+B)"}"
enabled="{editModel.isEqualized()}"
actionIcon='balance'
onActionPerformed="handler.roundAndCreateEntry()"/>
@@ -113,7 +114,7 @@
<JToolBar.Separator/>
<JButton id="refresh"
- toolTipText="{ "lima.ui.lettering.buttonRefresh" + " (F5)"}"
+ toolTipText="{ t("lima.ui.lettering.buttonRefresh") + " (F5)"}"
actionIcon='refresh'
onActionPerformed="handler.updateAllEntries()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-23 16:36:19 UTC (rev 3861)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-24 12:04:19 UTC (rev 3862)
@@ -42,18 +42,18 @@
<JToolBar floatable="false">
<JButton id="addVatStatementMovement"
- toolTipText="{ "lima.vatstatement.movement.add" + " (Ctrl+N)"}"
+ toolTipText="{ t("lima.vatstatement.movement.add") + " (Ctrl+N)"}"
actionIcon='vatstatement-new'
onActionPerformed="handler.addVatStatementMovement()"/>
<JButton id="updateButton"
- toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
+ toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
actionIcon='vatstatement-edit'
onActionPerformed="handler.updateVatStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ "lima.common.remove" + " (Del)"}"
+ toolTipText="{ t("lima.common.remove") + " (Del)"}"
actionIcon='vatstatement-remove'
onActionPerformed="handler.removeVatStatement()"
enabled="{isSelectedRow()}"/>
1
0
r3861 - 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 lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 18:36:19 +0200 (Wed, 23 Jul 2014)
New Revision: 3861
Url: http://forge.chorem.org/projects/lima/repository/revisions/3861
Log:
refs #1032 progression migration vers nouveaux services
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -26,6 +26,7 @@
package org.chorem.lima.business.ejb;
import com.google.common.collect.Lists;
+import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -243,10 +244,10 @@
}
@Override
- public String exportEntriesAsCSV(String charset) {
+ public String exportEntriesAsCSV(String charset, Boolean humanReadable) {
String result;
try {
- File file = exportEntriesFile(charset, true);
+ File file = exportEntriesFile(charset, humanReadable);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
} catch (Exception e) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -23,6 +23,7 @@
*/
import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils;
import org.chorem.lima.business.BeginAfterEndFiscalPeriodException;
@@ -85,8 +86,15 @@
@EJB
private FiscalPeriodService fiscalPeriodService;
+ protected static final Function<TopiaEntity, String> GET_TOPIA_ID = new Function<TopiaEntity, String>() {
+ @Override
+ public String apply(TopiaEntity input) {
+ return input == null ? null : input.getTopiaId();
+ }
+ };
+
@Override
- public void importAccountAsCSV(String contents) {
+ public String importAccountAsCSV(String contents) {
InputStream contentStream = IOUtils.toInputStream(contents);
try {
@@ -106,11 +114,11 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
-
+ return "SUCCES";
}
@Override
- public void importEntryBooksAsCSV(String contents) {
+ public String importEntryBooksAsCSV(String contents) {
InputStream contentStream = IOUtils.toInputStream(contents);
try {
ImportModel<EntryBook> model = new EntryBookModel();
@@ -125,6 +133,7 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
@Override
@@ -155,29 +164,32 @@
}
@Override
- public void importFinancialTransactionsAsCSV(String contents) {
+ public String importFinancialTransactionsAsCSV(String contents) {
+
+ EntryBookTopiaDao entryBookdao = getDaoHelper().getEntryBookDao();
+ Preconditions.checkArgument(entryBookdao.count() > 0, "Les journaux doivent avoir été importé.");
+
// import and save FinancialTransactions
InputStream contentStream = IOUtils.toInputStream(contents);
try {
ImportModel<FinancialTransaction> model = new FinancialTransactionModel(entryBookService);
-
+
FinancialTransactionTopiaDao dao = getDaoHelper().getFinancialTransactionDao();
Import<FinancialTransaction> result = Import.newImport(model, contentStream);
dao.createAll(result);
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
- protected static final Function<TopiaEntity, String> GET_TOPIA_ID = new Function<TopiaEntity, String>() {
- @Override
- public String apply(TopiaEntity input) {
- return input == null ? null : input.getTopiaId();
- }
- };
+ @Override
+ public String importEntriesAsCSV(String contents) {
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ FinancialTransactionTopiaDao financialTransactionDao = getDaoHelper().getFinancialTransactionDao();
- @Override
- public void importEntriesAsCSV(String contents) {
+ Preconditions.checkArgument(accountDao.count() > 0 && financialTransactionDao.count() > 0, "Les comptes et trasactions financières doivent avoir été importé.");
+
// import and save entries
InputStream contentStream = IOUtils.toInputStream(contents);
try {
@@ -190,14 +202,16 @@
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return "SUCCES";
}
@Override
- public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
+ public String importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
+ importAccountAsCSV(accounts);
importEntryBooksAsCSV(entryBooks);
+ importFiscalPeriodsAsCSV(fiscalPeriods);
importFinancialTransactionsAsCSV(financialTransactions);
- importFiscalPeriodsAsCSV(fiscalPeriods);
- importAccountAsCSV(accounts);
importEntriesAsCSV(entries);
+ return "SUCCES";
}
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -141,7 +141,7 @@
//test export
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name());
+ String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name(), false);
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-entries.csv");
IOUtils.copy(stream, res);
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -48,5 +48,5 @@
String exportFinancialTransactionsAsCSV(String charset);
- String exportEntriesAsCSV(String charset);
+ String exportEntriesAsCSV(String charset, Boolean humanReadable);
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -27,15 +27,15 @@
*/
public interface NewImportService {
- void importAccountAsCSV(String contents);
+ String importAccountAsCSV(String contents);
- void importEntryBooksAsCSV(String contents);
+ String importEntryBooksAsCSV(String contents);
String importFiscalPeriodsAsCSV(String contents);
- void importFinancialTransactionsAsCSV(String contents);
+ String importFinancialTransactionsAsCSV(String contents);
- void importEntriesAsCSV(String contents);
+ String importEntriesAsCSV(String contents);
- void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
+ String importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
}
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 2014-07-23 15:44:45 UTC (rev 3860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 16:36:19 UTC (rev 3861)
@@ -160,7 +160,7 @@
createFile(filePath, charset.name(), datas);
break;
case CSV_ENTRIES_EXPORT:
- datas = newExportService.exportEntriesAsCSV(charset.name());
+ datas = newExportService.exportEntriesAsCSV(charset.name(), true);
createFile(filePath, charset.name(), datas);
break;
case CSV_FINANCIALSTATEMENTS_EXPORT:
@@ -186,24 +186,24 @@
break;
case CSV_ACCOUNTCHARTS_IMPORT:
datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ACCOUNT);
+ result = newImportService.importAccountAsCSV(datas);
break;
case CSV_ENTRYBOOKS_IMPORT:
datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ENTRYBOOK);
+ result = newImportService.importEntryBooksAsCSV(datas);
break;
case CSV_FINANCIALSTATEMENTS_IMPORT:
datas = extractFile(filePath, charset.name());
result = importService.importAsCSV(datas, ImportExportEntityEnum.FINANCIALSTATEMENT);
break;
+ case CSV_ENTRIES_IMPORT:
+ datas = extractFile(filePath, charset.name());
+ result = newImportService.importEntriesAsCSV(datas);
+ break;
case CSV_VAT_IMPORT:
datas = extractFile(filePath, charset.name());
result = importService.importAsCSV(datas, ImportExportEntityEnum.VATSTATEMENT);
break;
- case CSV_ENTRIES_IMPORT:
- datas = extractFile(filePath, charset.name());
- result = importService.importAsCSV(datas, ImportExportEntityEnum.ENTRY);
- break;
case PDF_VAT_IMPORT:
int response = JOptionPane.showConfirmDialog(waitView,
t("lima.importexport.usevatpdf"),
1
0
23 Jul '14
Author: dcosse
Date: 2014-07-23 17:44:45 +0200 (Wed, 23 Jul 2014)
New Revision: 3860
Url: http://forge.chorem.org/projects/lima/repository/revisions/3860
Log:
refs #1032 export entries as CSV replace financialTransaction id by financialTransaction date
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -99,7 +99,7 @@
files.add(exportEntryBooksFile(charset));
files.add(exportFiscalPeriodFile(charset));
files.add(exportFinancialTransactionsFile(charset));
- files.add(exportEntriesFile(charset));
+ files.add(exportEntriesFile(charset, false));
export = new ZipOutputStream(rstBao);
@@ -139,7 +139,7 @@
}
@Override
- public String exportAccountsStream(String charset) {
+ public String exportAccountsAsCSV(String charset) {
String result;
try {
File file = exportAccountsFile(charset);
@@ -165,7 +165,7 @@
@Override
- public String exportEntryBooksStream(String charset) {
+ public String exportEntryBooksAsCSV(String charset) {
String result;
try {
File file = exportEntryBooksFile(charset);
@@ -191,7 +191,7 @@
}
@Override
- public String exportFiscalPeriodsStream(String charset) {
+ public String exportFiscalPeriodsAsCSV(String charset) {
String result;
try {
File file = exportFiscalPeriodFile(charset);
@@ -219,7 +219,7 @@
}
@Override
- public String exportFinancialTransactionsAsStream(String charset) {
+ public String exportFinancialTransactionsAsCSV(String charset) {
String result;
try {
File file = exportFinancialTransactionsFile(charset);
@@ -231,13 +231,13 @@
return result;
}
- protected File exportEntriesFile(String charset) throws Exception {
+ protected File exportEntriesFile(String charset, Boolean humanReadable) throws Exception {
EntryTopiaDao dao = getDaoHelper().getEntryDao();
List<Entry> entities = dao.findAll();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
File result = new File(tmpDir + "entries.csv");
- EntryModel model = new EntryModel(accountService, financialTransactionService);
+ EntryModel model = new EntryModel(accountService, financialTransactionService , humanReadable);
Export.exportToFile(model, entities, result, Charset.forName(charset));
return result;
}
@@ -246,7 +246,7 @@
public String exportEntriesAsCSV(String charset) {
String result;
try {
- File file = exportEntriesFile(charset);
+ File file = exportEntriesFile(charset, true);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
} catch (Exception e) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -181,7 +181,7 @@
// import and save entries
InputStream contentStream = IOUtils.toInputStream(contents);
try {
- ImportModel<Entry> model = new EntryModel(accountService, financialTransactionService);
+ ImportModel<Entry> model = new EntryModel(accountService, financialTransactionService, false);
Import<Entry> result = Import.newImport(model, contentStream);
EntryTopiaDao dao = getDaoHelper().getEntryDao();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -52,6 +52,10 @@
protected static AccountService accountService;
+ protected static Boolean humanReadable;
+
+ protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
public AbstractLimaModel(char separator) {
super(separator);
}
@@ -290,12 +294,12 @@
}
};
- protected static final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_ID_FORMATTER = new ValueFormatter<FinancialTransaction>() {
+ protected static final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER = new ValueFormatter<FinancialTransaction>() {
@Override
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = value.getTopiaId();
+ result = humanReadable ? simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
} else {
result = "";
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -35,10 +35,11 @@
*/
public class EntryModel extends AbstractLimaModel<Entry> implements ExportModel<Entry> {
- public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService) {
+ public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService, boolean humanReadable) {
super(';');
AbstractLimaModel.accountService = accountService;
AbstractLimaModel.financialTransactionService = financialTransactionService;
+ AbstractLimaModel.humanReadable = humanReadable;
newMandatoryColumn("account", Entry.PROPERTY_ACCOUNT, ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER);
newOptionalColumn("amount", Entry.PROPERTY_AMOUNT, BIG_DECIMAL_WITH_NULL_PARSER);
@@ -62,7 +63,7 @@
modelBuilder.newColumnForExport("voucher", Entry.PROPERTY_VOUCHER);
modelBuilder.newColumnForExport("description", Entry.PROPERTY_DESCRIPTION);
modelBuilder.newColumnForExport("lettering", Entry.PROPERTY_LETTERING);
- modelBuilder.newColumnForExport("financialTransaction", Entry.PROPERTY_FINANCIAL_TRANSACTION, FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_ID_FORMATTER);
+ modelBuilder.newColumnForExport("financialTransaction", Entry.PROPERTY_FINANCIAL_TRANSACTION, FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER);
return (Iterable) modelBuilder.getColumnsForExport();
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -15,14 +15,11 @@
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
/**
* Created by davidcosse on 03/06/14.
@@ -39,7 +36,7 @@
// export accounts
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportAccountsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportAccountsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-accounts.csv");
IOUtils.copy(stream, res);
@@ -70,7 +67,7 @@
initTestWithEntryBooks();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntryBooksStream(Charset.defaultCharset().name());
+ String export = newExportService.exportEntryBooksAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-EntryBooks.csv");
IOUtils.copy(stream, res);
@@ -102,7 +99,7 @@
initTestWithFinancialTransaction();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFinancialTransactionsAsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportFinancialTransactionsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-financial-transactions.csv");
IOUtils.copy(stream, res);
@@ -189,7 +186,7 @@
initTestWithFiscalPeriod();
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFiscalPeriodsStream(Charset.defaultCharset().name());
+ String export = newExportService.exportFiscalPeriodsAsCSV(Charset.defaultCharset().name());
InputStream stream = IOUtils.toInputStream(export);
FileOutputStream res = new FileOutputStream(tmpDir + "export-fiscal-periods.csv");
IOUtils.copy(stream, res);
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewExportService.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -40,13 +40,13 @@
String exportAllAsCSV(String charset);
- String exportAccountsStream(String charset);
+ String exportAccountsAsCSV(String charset);
- String exportEntryBooksStream(String charset);
+ String exportEntryBooksAsCSV(String charset);
- String exportFiscalPeriodsStream(String charset);
+ String exportFiscalPeriodsAsCSV(String charset);
- String exportFinancialTransactionsAsStream(String charset);
+ String exportFinancialTransactionsAsCSV(String charset);
String exportEntriesAsCSV(String charset);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -33,9 +33,10 @@
CSV_ALL_EXPORT(false, false), CSV_ALL_IMPORT(true, true),
CSV_ACCOUNTCHARTS_EXPORT(false, true), CSV_ACCOUNTCHARTS_IMPORT(true, true),
CSV_ENTRYBOOKS_EXPORT(false, true), CSV_ENTRYBOOKS_IMPORT(true, true),
+ CSV_ENTRIES_EXPORT(false, true),CSV_ENTRIES_IMPORT(true, true),
CSV_FINANCIALSTATEMENTS_EXPORT(false, true), CSV_FINANCIALSTATEMENTS_IMPORT(true, true),
CSV_VAT_EXPORT(false, true), CSV_VAT_IMPORT(true, true),
- CSV_ENTRIES_IMPORT(true, true),
+
PDF_VAT_EXPORT(false, true), PDF_VAT_IMPORT(true, true),
EBP_ACCOUNTCHARTS_EXPORT(false, false), EBP_ENTRIES_EXPORT(false, false),
EBP_ACCOUNTCHARTS_IMPORT(true, true), EBP_ENTRIES_IMPORT(true, true),
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 15:44:45 UTC (rev 3860)
@@ -83,6 +83,8 @@
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
+ <JMenuItem text="lima.ui.importexport.financialtransactions"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
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 2014-07-23 14:52:58 UTC (rev 3859)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 15:44:45 UTC (rev 3860)
@@ -152,13 +152,17 @@
createZipFile(filePath, datas);
break;
case CSV_ACCOUNTCHARTS_EXPORT:
- datas = exportService.exportAccountsChartAsCSV();
+ datas = newExportService.exportAccountsAsCSV(charset.name());
createFile(filePath, charset.name(), datas);
break;
case CSV_ENTRYBOOKS_EXPORT:
- datas = exportService.exportEntryBookChartAsCSV();
+ datas = newExportService.exportEntryBooksAsCSV(charset.name());
createFile(filePath, charset.name(), datas);
break;
+ case CSV_ENTRIES_EXPORT:
+ datas = newExportService.exportEntriesAsCSV(charset.name());
+ createFile(filePath, charset.name(), datas);
+ break;
case CSV_FINANCIALSTATEMENTS_EXPORT:
datas = exportService.exportFinancialStatementChartAsCSV();
createFile(filePath, charset.name(), datas);
1
0
r3859 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 16:52:58 +0200 (Wed, 23 Jul 2014)
New Revision: 3859
Url: http://forge.chorem.org/projects/lima/repository/revisions/3859
Log:
refs #1032 fix import export for entries
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -193,11 +193,11 @@
}
@Override
- public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String entries, String accounts){
+ public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries){
importEntryBooksAsCSV(entryBooks);
importFinancialTransactionsAsCSV(financialTransactions);
importFiscalPeriodsAsCSV(fiscalPeriods);
+ importAccountAsCSV(accounts);
importEntriesAsCSV(entries);
- importAccountAsCSV(accounts);
}
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -37,5 +37,5 @@
void importEntriesAsCSV(String contents);
- void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String entries, String accounts);
+ void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String accounts, String entries);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-07-23 14:52:58 UTC (rev 3859)
@@ -65,24 +65,24 @@
<JMenu text="lima.ui.importexport.import" actionIcon='import-element'>
<JMenuItem text="lima.ui.importexport.all"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_IMPORT)'/>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_IMPORT)'/>
+ <JMenuItem text="lima.ui.importexport.financialtransactions"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_VAT_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.financialtransactions"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRIES_IMPORT)'/>
</JMenu>
<JMenu text="lima.ui.importexport.export" actionIcon='export-element'>
<JMenuItem text="lima.ui.importexport.all"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ALL_EXPORT)'/>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ACCOUNTCHARTS_EXPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.financialstatements"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.CSV_FINANCIALSTATEMENTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.vatstatements"
@@ -91,20 +91,20 @@
</JMenu>
<JMenu text="lima.ui.importexport.ebp">
<JMenu text="lima.ui.importexport.import" actionIcon='import-element'>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT)'/>
<JMenuItem text="lima.ui.importexport.entries"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_IMPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_IMPORT)'/>
</JMenu>
<JMenu text="lima.ui.importexport.export" actionIcon='export-element'>
+ <JMenuItem text="lima.ui.importexport.entrybooks"
+ onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.accountcharts"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ACCOUNTCHARTS_EXPORT)'/>
<JMenuItem text="lima.ui.importexport.entries"
onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRIES_EXPORT)'/>
- <JMenuItem text="lima.ui.importexport.entrybooks"
- onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.EBP_ENTRYBOOKS_EXPORT)'/>
</JMenu>
</JMenu>
<JSeparator/>
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 2014-07-23 14:27:23 UTC (rev 3858)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:52:58 UTC (rev 3859)
@@ -472,16 +472,16 @@
String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
IOUtils.closeQuietly(fiscalPeriodsStream);
+ accountsStream = new FileInputStream(tmpDir + "accounts.csv");
+ String accountsStreamString = IOUtils.toString(accountsStream);
+ IOUtils.closeQuietly(accountsStream);
+
entriesStream = new FileInputStream(tmpDir + "entries.csv");
String entriesStreamString = IOUtils.toString(entriesStream);
IOUtils.closeQuietly(entriesStream);
- accountsStream = new FileInputStream(tmpDir + "accounts.csv");
- String accountsStreamString = IOUtils.toString(accountsStream);
- IOUtils.closeQuietly(accountsStream);
+ newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, accountsStreamString, entriesStreamString);
- newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, entriesStreamString, accountsStreamString);
-
} catch (Exception ex) {
if(log.isInfoEnabled()) {
log.info(ex);
1
0
r3858 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 23 Jul '14
by dcosse@users.chorem.org 23 Jul '14
23 Jul '14
Author: dcosse
Date: 2014-07-23 16:27:23 +0200 (Wed, 23 Jul 2014)
New Revision: 3858
Url: http://forge.chorem.org/projects/lima/repository/revisions/3858
Log:
refs #1032 correction sur import EBP
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/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -27,6 +27,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -98,6 +99,10 @@
FinancialTransactionTopiaDao financialtransactionTopiaDao = getDaoHelper().getFinancialTransactionDao();
+ if (financialtransaction.getEntry() == null) {
+ financialtransaction.setEntry(Lists.<Entry>newArrayList());
+ }
+
FinancialTransaction result = financialtransactionTopiaDao.create(financialtransaction);
return result;
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 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -551,102 +551,6 @@
// ################ IMPORT ################
- /** Remote methode to call all entities import from UI */
- @Override
- public String importAllAsCSV(String datas) throws ImportEbpException {
- StringBuilder result = new StringBuilder();
-
- Map<String, List<FinancialStatementImport>> financialStatements =
- new LinkedHashMap<String, List<FinancialStatementImport>>();
-
- Map<String, List<VatStatementImport>> vatStatements =
- new LinkedHashMap<String, List<VatStatementImport>>();
-
- List<FiscalPeriod> fiscalPeriods = new ArrayList<FiscalPeriod>();
-
- List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks =
- new ArrayList<ClosedPeriodicEntryBookImport>();
-
- Map<Integer, FinancialTransactionImport> financialTransactions =
- new HashMap<Integer, FinancialTransactionImport>();
-
- Map<Integer, List<EntryImport>> entries =
- new HashMap<Integer, List<EntryImport>>();
-
- CSVReader csvReader = null;
- try {
-
- String[] nextLine;
- csvReader = new CSVReader(new StringReader(datas), ';');
-
- while ((nextLine = csvReader.readNext()) != null) {
- ImportExportEntityEnum importExportEntityEnum = ImportExportEntityEnum
- .valueOfLabel(nextLine[0]);
- if (importExportEntityEnum != null) {
- switch (importExportEntityEnum) {
- case ACCOUNT:
- result.append(importAccountsChartsCSV(nextLine));
- break;
- case ENTRYBOOK:
- result.append(importEntryBooksChartCSV(nextLine));
- break;
- case FINANCIALSTATEMENT:
- result.append(importFinancialsStatementChartCSV(nextLine,
- financialStatements));
- break;
- case VATSTATEMENT:
- result.append(importVatStatementChartCSV(nextLine,
- vatStatements));
- break;
- case FISCALPERIOD:
- result.append(importFiscalPeriodCSV(nextLine,
- fiscalPeriods));
- break;
- case CLOSEDPERIODICENTRYBOOK:
- importClosedPeriodicEntryBookCSV(nextLine,
- closedPeriodicEntryBooks);
- break;
- case FINANCIALTRANSACTION:
- importFinancialTransactionsCSV(nextLine,
- financialTransactions);
- break;
- case ENTRY:
- importEntriesCSV(nextLine, entries);
- break;
- case IDENTITY:
- importIdentity(nextLine);
- break;
- }
- }
- }
-
- // create financialStatements
- result.append(createFinancialStatements(financialStatements));
- // create vatStatements
- result.append(createVatStatements(vatStatements));
- // create fiscalperiod
- Collections.sort(fiscalPeriods, new FiscalPeriodComparator());
- result.append(createFiscalPeriod(fiscalPeriods));
- // update closedperiodicentrybooks
- result.append(updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks));
- // create financialtransaction and entries
- result.append(createFinancialTransactionsAndEntries(
- financialTransactions, entries));
-
- } catch (IOException e) {
- throw new ImportEbpException("Can't import", e);
- } finally {
- if (csvReader != null) {
- try {
- csvReader.close();
- } catch (IOException e) {
- // on fait rien
- }
- }
- }
- return result.toString();
- }
-
/**
* Remote methode to call entity import from UI
* This methode let import just on type of entity
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 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -63,17 +63,6 @@
String importEntriesFromEbp(String data) throws ImportEbpException;
/**
- * Import data as lima CSV import.
- * <p/>
- * Read first line to detect file type and call {@link #importAsCSV(String, ImportExportEntityEnum)}.
- *
- * @param data import file content as string (remote service can't take File)
- * @return result log
- * @throws LimaException
- */
- String importAllAsCSV(String data) throws ImportEbpException;
-
- /**
* Import content as CSV depending on import type.
*
* @param data import file content as string (remote service can't take File)
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 2014-07-23 13:46:03 UTC (rev 3857)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:27:23 UTC (rev 3858)
@@ -243,10 +243,6 @@
//hidde wait dialog panel
waitView.setVisible(false);
- if(log.isInfoEnabled()) {
- log.info(get());
- }
-
// display result dialog
if (verboseMode) {
String result = get();
1
0
Author: dcosse
Date: 2014-07-23 15:46:03 +0200 (Wed, 23 Jul 2014)
New Revision: 3857
Url: http://forge.chorem.org/projects/lima/repository/revisions/3857
Log:
refs #1032 d?\195?\169but de mise en place du nouveau servcice d'import export
Added:
trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java
Removed:
trunk/lima-business/src/test/java/org/chorem/lima/business/NewExportServiceTest.java
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/EntryBookService.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
trunk/lima-business/src/main/resources/lima.properties
trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java
trunk/lima-callao/src/main/xmi/accounting-model.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -36,6 +36,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaXAResource;
+import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext;
import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier;
import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext;
@@ -43,6 +44,8 @@
import org.nuiton.topia.persistence.TopiaApplicationContextCache;
import com.google.common.base.Function;
+import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.persistence.util.TopiaUtil;
/**
* Interceptor for topia context transaction.
@@ -101,6 +104,8 @@
LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext();
+ createShemaIfNeeded(rootContext, tx);
+
DAO_HELPER.set(tx);
Transaction tr = transactionManager.getTransaction();
@@ -125,4 +130,26 @@
return result;
}
+ /**
+ * Test if schema do not already exists and create it if not found.
+ *
+ * @param applicationContext transaction
+ * @throws TopiaException
+ */
+ protected void createShemaIfNeeded(LimaCallaoTopiaApplicationContext applicationContext, LimaCallaoTopiaPersistenceContext tx) throws TopiaException {
+ //LimaCallaoTopiaPersistenceContext
+ if (!schemaExistChecked) {
+ boolean exist = TopiaUtil.isSchemaExist(tx, AccountImpl.class.getName());
+ if (!exist) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Creating to schema in database");
+ }
+ applicationContext.createSchema();
+ }
+
+ schemaExistChecked = true;
+ }
+ }
+
}
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -62,8 +62,8 @@
@Override
public long getAccountCount() {
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- long result = AccountTopiaDao.count();
+ AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao();
+ long result = accountTopiaDao.count();
return result;
}
@@ -85,14 +85,14 @@
account.setAccountNumber(account.getAccountNumber().toUpperCase().trim());
// check if account number already exist
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
- if (AccountTopiaDao.existByNaturalId(account.getAccountNumber())) {
+ if (accountDao.forNaturalId(account.getAccountNumber()).exists()) {
throw new AlreadyExistAccountException(account.getAccountNumber());
}
//create it
- Account result = AccountTopiaDao.create(account);
+ Account result = accountDao.create(account);
return result;
}
@@ -101,12 +101,12 @@
public Account getMasterAccount(String accountNumber) {
Account account = null;
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
while (account == null && accountNumber.length() > 1) {
accountNumber = accountNumber.substring(0);
- account = AccountTopiaDao.forAccountNumberEquals(accountNumber).findUniqueOrNull();
+ account = accountDao.forAccountNumberEquals(accountNumber).findUniqueOrNull();
}
return account;
}
@@ -115,8 +115,8 @@
@Override
public Account getAccountByNumber(String accountNumber) {
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- Account account = AccountTopiaDao.forAccountNumberEquals(accountNumber).findUniqueOrNull();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ Account account = accountDao.forAccountNumberEquals(accountNumber).findUniqueOrNull();
return account;
}
@@ -126,8 +126,8 @@
@Override
public List<Account> getAllAccounts() {
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- List<Account> accountsList = AccountTopiaDao.findAll();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ List<Account> accountsList = accountDao.findAll();
Collections.sort(accountsList, new AccountComparator());
return accountsList;
@@ -138,8 +138,8 @@
@Override
public List<Account> getAllLeafAccounts() {
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- List<Account> accountsList = AccountTopiaDao.findAllLeafAccounts();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ List<Account> accountsList = accountDao.findAllLeafAccounts();
return accountsList;
}
@@ -150,8 +150,8 @@
@Override
public List<Account> getAllSubAccounts(Account account) {
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- List<Account> accountsList = AccountTopiaDao.findAllSubAccounts(account);
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ List<Account> accountsList = accountDao.findAllSubAccounts(account);
return accountsList;
}
@@ -174,9 +174,9 @@
accountingRules.removeAccountRules(account);
// remove account
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
- Account accountToDelete = AccountTopiaDao.findByTopiaId(account.getTopiaId());
- AccountTopiaDao.delete(accountToDelete);
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
+ Account accountToDelete = accountDao.findByTopiaId(account.getTopiaId());
+ accountDao.delete(accountToDelete);
}
/**
@@ -194,9 +194,9 @@
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
// DAO
- AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao();
+ AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
accountingRules.updateAccountRules(account);
- Account result = AccountTopiaDao.update(account);
+ Account result = accountDao.update(account);
return result;
}
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -69,30 +69,35 @@
// creation du EntryBook
result = entryBookTopiaDao.create(entryBook);
- //create ClosedPeriodicEntryBook for all unblocked financial period
- ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao =
- getDaoHelper().getClosedPeriodicEntryBookDao();
- FinancialPeriodTopiaDao financialPeriodTopiaDao =
- getDaoHelper().getFinancialPeriodDao();
- // for all unblocked financialperiod
- List<FinancialPeriod> financialPeriods = financialPeriodTopiaDao.forProperties(FinancialPeriod.PROPERTY_LOCKED, true).findAll();
- for (FinancialPeriod financialPeriod : financialPeriods) {
-
- //new closed periodic entrybook
- ClosedPeriodicEntryBook closedPeriodicEntryBook =
- new ClosedPeriodicEntryBookImpl();
- // set entrybook
- closedPeriodicEntryBook.setEntryBook(entryBook);
- // set financial period
- closedPeriodicEntryBook.setFinancialPeriod(financialPeriod);
- // create it
- closedPeriodicEntryBookTopiaDao.create(closedPeriodicEntryBook);
- }
+ createClosedPeriodicEntryBook(result);
}
return result;
}
@Override
+ public void createClosedPeriodicEntryBook(EntryBook entryBook) {
+ //create ClosedPeriodicEntryBook for all unblocked financial period
+ ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao =
+ getDaoHelper().getClosedPeriodicEntryBookDao();
+ FinancialPeriodTopiaDao financialPeriodTopiaDao =
+ getDaoHelper().getFinancialPeriodDao();
+ // for all unblocked financialperiod
+ List<FinancialPeriod> financialPeriods = financialPeriodTopiaDao.forProperties(FinancialPeriod.PROPERTY_LOCKED, true).findAll();
+ for (FinancialPeriod financialPeriod : financialPeriods) {
+
+ //new closed periodic entrybook
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ new ClosedPeriodicEntryBookImpl();
+ // set entrybook
+ closedPeriodicEntryBook.setEntryBook(entryBook);
+ // set financial period
+ closedPeriodicEntryBook.setFinancialPeriod(financialPeriod);
+ // create it
+ closedPeriodicEntryBookTopiaDao.create(closedPeriodicEntryBook);
+ }
+ }
+
+ @Override
public List<EntryBook> getAllEntryBooks() {
// check if entrybook with is name already exist
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -155,6 +155,47 @@
return result;
}
+ @Override
+ public void createFiscalPeriodsClosePeriodicEntryBooks(Collection<FiscalPeriod> fiscalPeriods) throws
+ BeginAfterEndFiscalPeriodException, NotBeginNextDayOfLastFiscalPeriodException, MoreOneUnlockFiscalPeriodException {
+ EntryBookTopiaDao entryBookTopiaDao = getDaoHelper().getEntryBookDao();
+ AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
+
+ for (FiscalPeriod fiscalPeriod : fiscalPeriods) {
+ createFiscalPeriodClosePeriodicEntryBooks(fiscalPeriod, accountingRules, entryBookTopiaDao);
+ }
+ }
+
+ protected void createFiscalPeriodClosePeriodicEntryBooks(FiscalPeriod fiscalPeriod, AccountingRules accountingRules, EntryBookTopiaDao entryBookTopiaDao) throws
+ BeginAfterEndFiscalPeriodException, NotBeginNextDayOfLastFiscalPeriodException, MoreOneUnlockFiscalPeriodException {
+
+ List<FinancialPeriod> financialPeriods;
+
+ financialPeriods = accountingRules.createFiscalPeriodRules(fiscalPeriod);
+
+ // create
+ fiscalPeriod.addAllFinancialPeriod(financialPeriods);
+
+ //create all financial period
+ for (FinancialPeriod financialPeriod : financialPeriods) {
+
+ List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks = Lists.newArrayList();
+ //create ClosedPeriodicEntryBook for all entrybook
+ for (EntryBook entryBook : entryBookTopiaDao.findAll()) {
+ //new closed periodic entrybook
+ ClosedPeriodicEntryBook closedPeriodicEntryBook = new ClosedPeriodicEntryBookImpl();
+ // set entrybook
+ closedPeriodicEntryBook.setEntryBook(entryBook);
+ // set financial period
+ closedPeriodicEntryBook.setFinancialPeriod(financialPeriod);
+
+ closedPeriodicEntryBooks.add(closedPeriodicEntryBook);
+ }
+ financialPeriod.addAllEntryBookClosedPeriodicEntryBook(closedPeriodicEntryBooks);
+
+ }
+ }
+
/**
* return all fiscal period.
*/
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -277,7 +277,7 @@
// if account not exist not export -> exception
else if (account == null) {
- //// TODO DCossé 28/05/14 this message is not displayed on user's error window.
+ // TODO DCossé 28/05/14 this message is not displayed on user's error window.
throw new ImportEbpException(t(
"lima-business.import.ebpmissingaccount",
entryEBP.getCompte()));
@@ -335,8 +335,8 @@
// create transaction
if (financialTransaction == null
|| !(dateEcr.equals(financialTransaction
- .getTransactionDate()) && entryBook
- .getCode().equals(
+ .getTransactionDate()) && entryBook
+ .getCode().equals(
financialTransaction.getEntryBook()
.getCode()))) {
// create financial transaction
@@ -349,6 +349,7 @@
"lima-business.import.transactionadded", dateEcr,
entryBook.getCode()));
}
+ financialTransaction.getEntry().add(entry);
// Inside the db, the entries reference the financialTransaction
entry.setFinancialTransaction(financialTransaction);
entry = financialTransactionService.createEntry(entry);
@@ -369,6 +370,7 @@
}
}
+
if (log.isInfoEnabled()) {
long after = System.currentTimeMillis();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewExportServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -145,10 +145,6 @@
File file = exportAccountsFile(charset);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
} catch (Exception e) {
throw new LimaTechnicalException(e);
}
@@ -175,10 +171,6 @@
File file = exportEntryBooksFile(charset);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
} catch (Exception e) {
throw new LimaTechnicalException(e);
}
@@ -205,10 +197,6 @@
File file = exportFiscalPeriodFile(charset);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
} catch (Exception e) {
throw new LimaTechnicalException(e);
}
@@ -237,10 +225,6 @@
File file = exportFinancialTransactionsFile(charset);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
} catch (Exception e) {
throw new LimaTechnicalException(e);
}
@@ -265,10 +249,6 @@
File file = exportEntriesFile(charset);
FileInputStream inputStream = new FileInputStream(file);
result = IOUtils.toString(inputStream);
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
} catch (Exception e) {
throw new LimaTechnicalException(e);
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -23,15 +23,16 @@
*/
import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
-import org.chorem.lima.LimaTechnicalException;
+import org.chorem.lima.business.BeginAfterEndFiscalPeriodException;
+import org.chorem.lima.business.MoreOneUnlockFiscalPeriodException;
+import org.chorem.lima.business.NotBeginNextDayOfLastFiscalPeriodException;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.EntryBookService;
+import org.chorem.lima.business.api.EntryService;
import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.NewImportService;
import org.chorem.lima.business.ejb.csv.AccountModel;
import org.chorem.lima.business.ejb.csv.EntryBookModel;
@@ -43,6 +44,7 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryBookTopiaDao;
+import org.chorem.lima.entity.EntryTopiaDao;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionTopiaDao;
import org.chorem.lima.entity.FiscalPeriod;
@@ -55,17 +57,11 @@
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
-import java.util.Collection;
import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
+import static org.nuiton.i18n.I18n.t;
+
/**
* Created by davidcosse on 03/06/14.
*/
@@ -81,8 +77,14 @@
private AccountService accountService;
@EJB
+ private EntryService entryService;
+
+ @EJB
private FinancialTransactionService financialTransactionService;
+ @EJB
+ private FiscalPeriodService fiscalPeriodService;
+
@Override
public void importAccountAsCSV(String contents) {
InputStream contentStream = IOUtils.toInputStream(contents);
@@ -116,23 +118,40 @@
EntryBookTopiaDao dao = getDaoHelper().getEntryBookDao();
Import<EntryBook> result = Import.newImport(model, contentStream);
dao.createAll(result);
+
+ for (EntryBook entryBook : result) {
+ entryBookService.createClosedPeriodicEntryBook(entryBook);
+ }
} finally {
IOUtils.closeQuietly(contentStream);
}
}
@Override
- public void importFiscalPeriodsAsCSV(String contents) {
+ public String importFiscalPeriodsAsCSV(String contents) {
+ StringBuilder result = new StringBuilder();
InputStream contentStream = IOUtils.toInputStream(contents);
try {
ImportModel<FiscalPeriod> model = new FiscalPeriodModel();
FiscalPeriodTopiaDao dao = getDaoHelper().getFiscalPeriodDao();
- Import<FiscalPeriod> result = Import.newImport(model, contentStream);
- dao.createAll(result);
+ Import<FiscalPeriod> importedFPs = Import.newImport(model, contentStream);
+ List<FiscalPeriod> fiscalPeriods = Lists.newArrayList(importedFPs);
+ try {
+ fiscalPeriodService.createFiscalPeriodsClosePeriodicEntryBooks(fiscalPeriods);
+ result.append(t("lima-business.import.fiscalperiodscloseperiodicentrybooks"));
+ } catch (BeginAfterEndFiscalPeriodException e) {
+ result.append("Can't import " + t("lima-business.import.FiscalPeriod.error.beginAfterEndFiscalPeriod"));
+ } catch (MoreOneUnlockFiscalPeriodException e) {
+ result.append("Can't import " + t("lima-business.import.FiscalPeriod.error.moreOneUnlockFiscalPeriod"));
+ } catch (NotBeginNextDayOfLastFiscalPeriodException e) {
+ result.append("Can't import " + t("lima-business.import.FiscalPeriod.error.notBeginNextDayOfLastFiscalPeriod"));
+ }
+ dao.createAll(fiscalPeriods);
} finally {
IOUtils.closeQuietly(contentStream);
}
+ return result.toString();
}
@Override
@@ -162,104 +181,23 @@
// import and save entries
InputStream contentStream = IOUtils.toInputStream(contents);
try {
- FinancialTransactionTopiaDao financialTransactionTopiaDao = getDaoHelper().getFinancialTransactionDao();
-
ImportModel<Entry> model = new EntryModel(accountService, financialTransactionService);
Import<Entry> result = Import.newImport(model, contentStream);
- Collection<FinancialTransaction> financialTransactions = financialTransactionTopiaDao.findAll();
- ImmutableMap<String, FinancialTransaction> indexedFinancialTransactions = Maps.uniqueIndex(financialTransactions, GET_TOPIA_ID);
+ EntryTopiaDao dao = getDaoHelper().getEntryDao();
+ dao.createAll(result);
- for (Entry entry : result) {
- FinancialTransaction financialTransaction = entry.getFinancialTransaction();
- financialTransaction = indexedFinancialTransactions.get(financialTransaction.getTopiaId());
- Collection<Entry> fEntries = financialTransaction.getEntry();
- if(fEntries == null) {
- fEntries = Lists.newArrayList();
- financialTransaction.setEntry(fEntries);
- }
- fEntries.add(entry);
- }
-
- financialTransactionTopiaDao.updateAll(indexedFinancialTransactions.values());
-
} finally {
IOUtils.closeQuietly(contentStream);
}
}
@Override
- public void importAllAsCSV(String zippedBase64Str) {
- ZipInputStream zipInputStream = null;
-
- InputStream transactionsStream = null, entryBooksStream = null, fiscalPeriodsStream = null, entriesStream = null, accountsStream = null;
- try {
- //contentStream = new FileInputStream(path);
- byte[] bytes = Base64.decodeBase64(zippedBase64Str);
- zipInputStream = new ZipInputStream(new ByteArrayInputStream(bytes));
-
- // unzip
- ZipEntry entry;
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- while ((entry = zipInputStream.getNextEntry()) != null) {
- byte[] buffer = new byte[2048];
- FileOutputStream fileoutputstream = null;
-
- if (entry.getName().equalsIgnoreCase("accounts.csv")) {
- fileoutputstream = new FileOutputStream(tmpDir + "accounts.csv");
- } else if (entry.getName().equalsIgnoreCase("entryBooks.csv")) {
- fileoutputstream = new FileOutputStream(tmpDir + "entryBooks.csv");
- } else if (entry.getName().equalsIgnoreCase("fiscalPeriod.csv")) {
- fileoutputstream = new FileOutputStream(tmpDir + "fiscalPeriods.csv");
- } else if (entry.getName().equalsIgnoreCase("financialTransactions.csv")) {
- fileoutputstream = new FileOutputStream(tmpDir + "financialTransactions.csv");
- } else if (entry.getName().equalsIgnoreCase("entries.csv")) {
- fileoutputstream = new FileOutputStream(tmpDir + "entries.csv");
- }
- int n;
-
- if (fileoutputstream != null) {
- while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
- fileoutputstream.write(buffer, 0, n);
- }
- fileoutputstream.close();
- }
-
- zipInputStream.closeEntry();
- }
-
- entryBooksStream = new FileInputStream(tmpDir + "entryBooks.csv");
- String entryBooksStreamString = IOUtils.toString(entryBooksStream);
- importEntryBooksAsCSV(entryBooksStreamString);
-
- // import
- transactionsStream = new FileInputStream(tmpDir + "financialTransactions.csv");
- String transactionsStreamString = IOUtils.toString(transactionsStream);
- importFinancialTransactionsAsCSV(transactionsStreamString);
-
- fiscalPeriodsStream = new FileInputStream(tmpDir + "fiscalPeriods.csv");
- String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
- importFiscalPeriodsAsCSV(fiscalPeriodsStreamString);
-
- entriesStream = new FileInputStream(tmpDir + "entries.csv");
- String entriesStreamString = IOUtils.toString(entriesStream);
- importEntriesAsCSV(entriesStreamString);
-
- accountsStream = new FileInputStream(tmpDir + "accounts.csv");
- String accountsStreamString = IOUtils.toString(accountsStream);
- importAccountAsCSV(accountsStreamString);
-
- } catch (FileNotFoundException e) {
- throw new LimaTechnicalException(e);
- } catch (IOException e) {
- throw new LimaTechnicalException(e);
- } finally {
- IOUtils.closeQuietly(zipInputStream);
- IOUtils.closeQuietly(transactionsStream);
- IOUtils.closeQuietly(entryBooksStream);
- IOUtils.closeQuietly(fiscalPeriodsStream);
- IOUtils.closeQuietly(entriesStream);
- IOUtils.closeQuietly(accountsStream);
- }
+ public void importAllAsCSV(String entryBooks, String financialTransactions, String fiscalPeriods, String entries, String accounts){
+ importEntryBooksAsCSV(entryBooks);
+ importFinancialTransactionsAsCSV(financialTransactions);
+ importFiscalPeriodsAsCSV(fiscalPeriods);
+ importEntriesAsCSV(entries);
+ importAccountAsCSV(accounts);
}
}
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-07-23 13:46:03 UTC (rev 3857)
@@ -114,6 +114,7 @@
lima-business.import.financialstatementalreadyexist=FAILED \: The financial statement %s already exists \!\n
lima-business.import.fiscalperiodadded=SUCCESS \: The fiscalPeriod %s - %s is created \! \n
lima-business.import.fiscalperiodalreadyexist=FAILED \: The fiscal period %s - %s already exists \!\n
+lima-business.import.fiscalperiodscloseperiodicentrybooks=
lima-business.import.identityadded=SUCCESS \: The identity %s is created \! \n
lima-business.import.lineformatmismatch=Line format is invalid.
lima-business.import.noaccount=ERROR \: This file contains no account
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-23 13:46:03 UTC (rev 3857)
@@ -112,6 +112,7 @@
lima-business.import.financialstatementalreadyexist=u00C9chec \: Le mouvement %s exist déjà \!\n
lima-business.import.fiscalperiodadded=Succès \: Exercice %s - %s ajoutée \! \n
lima-business.import.fiscalperiodalreadyexist=u00C9chec \: L'exerice %s - %s existe déjà \!\n
+lima-business.import.fiscalperiodscloseperiodicentrybooks=
lima-business.import.identityadded=Succès \: Identité %s ajoutée \! \n
lima-business.import.lineformatmismatch=Le format de la ligne est incorrect.
lima-business.import.noaccount=Erreur \: Ce fichier ne contient aucun compte.
Modified: trunk/lima-business/src/main/resources/lima.properties
===================================================================
--- trunk/lima-business/src/main/resources/lima.properties 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/main/resources/lima.properties 2014-07-23 13:46:03 UTC (rev 3857)
@@ -28,3 +28,4 @@
hibernate.connection.password=
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:file:${lima.data.dir}/limadb
+hibernate.jdbc.batch_size=50
\ No newline at end of file
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -109,7 +109,7 @@
@Before
public void initAbstractTest() throws Exception {
setUpLocale();
-
+// LimaInterceptor.schemaExistChecked = false;
Properties options = getTestConfiguration();
LimaConfig config = new LimaTestsConfig("/lima-test.properties", options);
initServices(config);
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/NewExportServiceTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewExportServiceTest.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewExportServiceTest.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -1,250 +0,0 @@
-package org.chorem.lima.business;
-
-/*
- * #%L
- * Lima :: business
- * %%
- * Copyright (C) 2008 - 2014 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 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%
- */
-
-import com.google.common.collect.Lists;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.io.IOUtils;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.util.List;
-
-/**
- * Created by davidcosse on 03/06/14.
- */
-public class NewExportServiceTest extends AbstractLimaTest {
-
- @Test
- public void testExportImportAccounts() throws Exception {
- initTestWithFiscalPeriod();
- // make sure they are some accounts.
- List<Account> accounts = accountService.getAllAccounts();
- Assert.assertTrue(accountService.getAllAccounts().size() > 0);
-
-
- // export accounts
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportAccountsStream(Charset.defaultCharset().name());
- InputStream stream = IOUtils.toInputStream(export);
- FileOutputStream res = new FileOutputStream(tmpDir + "export-accounts.csv");
- IOUtils.copy(stream, res);
-
- // remove accounts
- int nbEntities = accounts.size();
- for (Account account : accounts) {
- accountService.removeAccount(account);
- }
- Assert.assertEquals(0, accountService.getAllAccounts().size());
-
- // import accounts
- InputStream contentStream = null;
- try {
- contentStream = new FileInputStream(tmpDir + "export-accounts.csv");
- String inportStream = IOUtils.toString(contentStream);
- newImportService.importAccountAsCSV(inportStream);
-
- // make sure all account have been created
- Assert.assertEquals(nbEntities, accountService.getAllAccounts().size());
- } finally {
- IOUtils.closeQuietly(contentStream);
- }
- }
-
- @Test
- public void testExportImportEntryBooks() throws Exception {
- initTestWithEntryBooks();
-
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntryBooksStream(Charset.defaultCharset().name());
- InputStream stream = IOUtils.toInputStream(export);
- FileOutputStream res = new FileOutputStream(tmpDir + "export-EntryBooks.csv");
- IOUtils.copy(stream, res);
-
- List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
- int nbEntities = entryBooks.size();
- Assert.assertEquals(3, nbEntities);
-
- for (EntryBook entryBook : entryBooks) {
- entryBookService.removeEntryBook(entryBook);
- }
-
- Assert.assertEquals(0, entryBookService.getAllEntryBooks().size());
-
- FileInputStream contentStream = null;
- try {
- contentStream = new FileInputStream(tmpDir + "export-EntryBooks.csv");
- String inportStream = IOUtils.toString(contentStream);
- newImportService.importEntryBooksAsCSV(inportStream);
- } finally {
- IOUtils.closeQuietly(contentStream);
- }
-
- Assert.assertEquals(nbEntities, entryBookService.getAllEntryBooks().size());
- }
-
- @Test
- public void testExportImportFinancialTransactions() throws Exception {
- initTestWithFinancialTransaction();
-
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFinancialTransactionsAsStream(Charset.defaultCharset().name());
- InputStream stream = IOUtils.toInputStream(export);
- FileOutputStream res = new FileOutputStream(tmpDir + "export-financial-transactions.csv");
- IOUtils.copy(stream, res);
-
- List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"),df.parse("December 31, 2012"));
- int nbEntities = financialTransactions.size();
- Assert.assertEquals(1, nbEntities);
-
- for (FinancialTransaction financialTransaction : financialTransactions) {
- financialTransactionService.removeFinancialTransaction(financialTransaction);
- }
-
- Assert.assertEquals(0, financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"), df.parse("December 31, 2012")).size());
-
- FileInputStream contentStream = null;
- try {
- contentStream = new FileInputStream(tmpDir + "export-financial-transactions.csv");
- String inportStream = IOUtils.toString(contentStream);
- newImportService.importFinancialTransactionsAsCSV(inportStream);
- } finally {
- IOUtils.closeQuietly(contentStream);
- }
-
- Assert.assertEquals(nbEntities, financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"),df.parse("December 31, 2012")).size());
- }
-
- @Test
- public void testExportImportEntries() throws Exception {
- initTestWithFinancialTransaction();
-
- List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
- List<Entry> entries = Lists.newArrayList();
- Assert.assertFalse(financialTransactions.isEmpty());
- for (FinancialTransaction financialTransaction : financialTransactions) {
- entries.addAll(financialTransaction.getEntry());
- }
- int nbEntities = entries.size();
- Assert.assertEquals(2,nbEntities);
-
- //test export
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name());
- InputStream stream = IOUtils.toInputStream(export);
- FileOutputStream res = new FileOutputStream(tmpDir + "export-entries.csv");
- IOUtils.copy(stream, res);
-
- for (Entry entry : entries) {
- FinancialTransaction financialTransaction = entry.getFinancialTransaction();
- financialTransactionService.removeEntry(entry);
- financialTransactionService.updateFinancialTransaction(financialTransaction);
- }
-
- // check all entries have been cleared
- entries.clear();//
-
- financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
- for (FinancialTransaction financialTransaction : financialTransactions) {
- entries.addAll(financialTransaction.getEntry());
- }
- Assert.assertTrue(entries.isEmpty());
-
- // test import
- FileInputStream contentStream = null;
- try {
- contentStream = new FileInputStream(tmpDir + "export-entries.csv");
- String inputStream = IOUtils.toString(contentStream);
- newImportService.importEntriesAsCSV(inputStream);
- } finally {
- IOUtils.closeQuietly(contentStream);
- }
-
- // valid import
- financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
- Assert.assertEquals(1, financialTransactions.size());
- for (FinancialTransaction financialTransaction : financialTransactions) {
- entries.addAll(financialTransaction.getEntry());
- }
-
- Assert.assertEquals(nbEntities, entries.size());
- }
-
- @Test
- public void testExportImportFiscalPeriodsAsCSV() throws Exception {
- initTestWithFiscalPeriod();
-
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
- String export = newExportService.exportFiscalPeriodsStream(Charset.defaultCharset().name());
- InputStream stream = IOUtils.toInputStream(export);
- FileOutputStream res = new FileOutputStream(tmpDir + "export-fiscal-periods.csv");
- IOUtils.copy(stream, res);
-
- List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods();
- int nbEntities = fiscalPeriods.size();
- Assert.assertEquals(1, nbEntities);
-
- initAbstractTest();
-
- Assert.assertEquals(0, fiscalPeriodService.getAllFiscalPeriods().size());
-
- FileInputStream contentStream = null;
- try {
- contentStream = new FileInputStream(tmpDir + "export-fiscal-periods.csv");
- String inputStream = IOUtils.toString(contentStream);
- newImportService.importFiscalPeriodsAsCSV(inputStream);
- } finally {
- IOUtils.closeQuietly(contentStream);
- }
-
- Assert.assertEquals(nbEntities, fiscalPeriodService.getAllFiscalPeriods().size());
- }
-
- @Test
- public void exportAllAsCSVTest() throws Exception {
- initTestWithFinancialTransaction();
- String export = newExportService.exportAllAsCSV("UTF-8");
- initAbstractTest();
- String tmpDir = System.getProperty("java.io.tmpdir")+"/TMP_BACKUP.zip";
- createZipFile(tmpDir, export);
- newImportService.importAllAsCSV(export);
- }
-
- protected void createZipFile(String path, String zippedBase64Str) throws Exception {
- byte[] bytes = Base64.decodeBase64(zippedBase64Str);
- ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
- IOUtils.copy(inputStream, new FileOutputStream(path));
- }
-
-
-}
Copied: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java (from rev 3833, trunk/lima-business/src/test/java/org/chorem/lima/business/NewExportServiceTest.java)
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java (rev 0)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -0,0 +1,337 @@
+package org.chorem.lima.business;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.IOUtils;
+import org.chorem.lima.LimaTechnicalException;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * Created by davidcosse on 03/06/14.
+ */
+public class NewImportExportServiceTest extends AbstractLimaTest {
+
+ @Test
+ public void testExportImportAccounts() throws Exception {
+ initTestWithFiscalPeriod();
+ // make sure they are some accounts.
+ List<Account> accounts = accountService.getAllAccounts();
+ Assert.assertTrue(accountService.getAllAccounts().size() > 0);
+
+
+ // export accounts
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String export = newExportService.exportAccountsStream(Charset.defaultCharset().name());
+ InputStream stream = IOUtils.toInputStream(export);
+ FileOutputStream res = new FileOutputStream(tmpDir + "export-accounts.csv");
+ IOUtils.copy(stream, res);
+
+ // remove accounts
+ int nbEntities = accounts.size();
+ for (Account account : accounts) {
+ accountService.removeAccount(account);
+ }
+ Assert.assertEquals(0, accountService.getAllAccounts().size());
+
+ // import accounts
+ InputStream contentStream = null;
+ try {
+ contentStream = new FileInputStream(tmpDir + "export-accounts.csv");
+ String inportStream = IOUtils.toString(contentStream);
+ newImportService.importAccountAsCSV(inportStream);
+
+ // make sure all account have been created
+ Assert.assertEquals(nbEntities, accountService.getAllAccounts().size());
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+ }
+
+ @Test
+ public void testExportImportEntryBooks() throws Exception {
+ initTestWithEntryBooks();
+
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String export = newExportService.exportEntryBooksStream(Charset.defaultCharset().name());
+ InputStream stream = IOUtils.toInputStream(export);
+ FileOutputStream res = new FileOutputStream(tmpDir + "export-EntryBooks.csv");
+ IOUtils.copy(stream, res);
+
+ List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
+ int nbEntities = entryBooks.size();
+ Assert.assertEquals(3, nbEntities);
+
+ for (EntryBook entryBook : entryBooks) {
+ entryBookService.removeEntryBook(entryBook);
+ }
+
+ Assert.assertEquals(0, entryBookService.getAllEntryBooks().size());
+
+ FileInputStream contentStream = null;
+ try {
+ contentStream = new FileInputStream(tmpDir + "export-EntryBooks.csv");
+ String inportStream = IOUtils.toString(contentStream);
+ newImportService.importEntryBooksAsCSV(inportStream);
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+
+ Assert.assertEquals(nbEntities, entryBookService.getAllEntryBooks().size());
+ }
+
+ @Test
+ public void testExportImportFinancialTransactions() throws Exception {
+ initTestWithFinancialTransaction();
+
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String export = newExportService.exportFinancialTransactionsAsStream(Charset.defaultCharset().name());
+ InputStream stream = IOUtils.toInputStream(export);
+ FileOutputStream res = new FileOutputStream(tmpDir + "export-financial-transactions.csv");
+ IOUtils.copy(stream, res);
+
+ List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"),df.parse("December 31, 2012"));
+ int nbEntities = financialTransactions.size();
+ Assert.assertEquals(1, nbEntities);
+
+ for (FinancialTransaction financialTransaction : financialTransactions) {
+ financialTransactionService.removeFinancialTransaction(financialTransaction);
+ }
+
+ Assert.assertEquals(0, financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"), df.parse("December 31, 2012")).size());
+
+ FileInputStream contentStream = null;
+ try {
+ contentStream = new FileInputStream(tmpDir + "export-financial-transactions.csv");
+ String inportStream = IOUtils.toString(contentStream);
+ newImportService.importFinancialTransactionsAsCSV(inportStream);
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+
+ Assert.assertEquals(nbEntities, financialTransactionService.getAllFinancialTransactions(df.parse("January 1, 2012"),df.parse("December 31, 2012")).size());
+ }
+
+ @Test
+ public void testExportImportEntries() throws Exception {
+ initTestWithFinancialTransaction();
+
+ List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
+ List<Entry> entries = Lists.newArrayList();
+ Assert.assertFalse(financialTransactions.isEmpty());
+ for (FinancialTransaction financialTransaction : financialTransactions) {
+ entries.addAll(financialTransaction.getEntry());
+ }
+ int nbEntities = entries.size();
+ Assert.assertEquals(2,nbEntities);
+
+ //test export
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String export = newExportService.exportEntriesAsCSV(Charset.defaultCharset().name());
+ InputStream stream = IOUtils.toInputStream(export);
+ FileOutputStream res = new FileOutputStream(tmpDir + "export-entries.csv");
+ IOUtils.copy(stream, res);
+
+ for (Entry entry : entries) {
+ FinancialTransaction financialTransaction = entry.getFinancialTransaction();
+ financialTransactionService.removeEntry(entry);
+ financialTransactionService.updateFinancialTransaction(financialTransaction);
+ }
+
+ // ake sure all entries have been cleared
+ entries.clear();//
+
+ financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
+ for (FinancialTransaction financialTransaction : financialTransactions) {
+ entries.addAll(financialTransaction.getEntry());
+ }
+ Assert.assertTrue(entries.isEmpty());
+
+ // test import
+ FileInputStream contentStream = null;
+ try {
+ contentStream = new FileInputStream(tmpDir + "export-entries.csv");
+ String inputStream = IOUtils.toString(contentStream);
+ newImportService.importEntriesAsCSV(inputStream);
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+
+ // valid import
+ financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012"));
+ Assert.assertEquals(1, financialTransactions.size());
+ for (FinancialTransaction financialTransaction : financialTransactions) {
+ entries.addAll(financialTransaction.getEntry());
+ }
+
+ Assert.assertEquals(nbEntities, entries.size());
+ }
+
+ @Test
+ public void testExportImportFiscalPeriodsAsCSV() throws Exception {
+ initTestWithFiscalPeriod();
+
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String export = newExportService.exportFiscalPeriodsStream(Charset.defaultCharset().name());
+ InputStream stream = IOUtils.toInputStream(export);
+ FileOutputStream res = new FileOutputStream(tmpDir + "export-fiscal-periods.csv");
+ IOUtils.copy(stream, res);
+
+ List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods();
+ int nbEntities = fiscalPeriods.size();
+ Assert.assertEquals(1, nbEntities);
+
+ initAbstractTest();
+
+ Assert.assertEquals(0, fiscalPeriodService.getAllFiscalPeriods().size());
+
+ FileInputStream contentStream = null;
+ try {
+ contentStream = new FileInputStream(tmpDir + "export-fiscal-periods.csv");
+ String inputStream = IOUtils.toString(contentStream);
+ // TODO DCossé 22/07/14 traiter les messages de retour
+ newImportService.importFiscalPeriodsAsCSV(inputStream);
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+
+ Assert.assertEquals(nbEntities, fiscalPeriodService.getAllFiscalPeriods().size());
+ }
+
+ @Test
+ public void exportImportAllAsCSVTest() throws Exception {
+ initTestWithFinancialTransaction();
+ String export = newExportService.exportAllAsCSV("UTF-8");
+ initAbstractTest();
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/TMP_BACKUP.zip";
+ createZipFile(tmpDir, export);
+
+ initAbstractTest();
+
+ FileInputStream contentStream = null;
+ try {
+ importAllFromZipFile(tmpDir);
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+ }
+
+ protected void createZipFile(String path, String zippedBase64Str) throws Exception {
+ byte[] bytes = Base64.decodeBase64(zippedBase64Str);
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
+ IOUtils.copy(inputStream, new FileOutputStream(path));
+ }
+
+ protected String importAllFromZipFile(String filePath) {
+ ZipInputStream zipInputStream = null;
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ FileInputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(filePath);
+
+ zipInputStream = new ZipInputStream(inputStream);
+
+ ZipEntry entry;
+ while ((entry = zipInputStream.getNextEntry()) != null) {
+ byte[] buffer = new byte[2048];
+ FileOutputStream fileoutputstream = null;
+
+ if (entry.getName().equalsIgnoreCase("accounts.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "accounts.csv");
+ } else if (entry.getName().equalsIgnoreCase("entryBooks.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "entryBooks.csv");
+ } else if (entry.getName().equalsIgnoreCase("fiscalPeriod.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "fiscalPeriods.csv");
+ } else if (entry.getName().equalsIgnoreCase("financialTransactions.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "financialTransactions.csv");
+ } else if (entry.getName().equalsIgnoreCase("entries.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "entries.csv");
+ }
+ int n;
+
+ if (fileoutputstream != null) {
+ while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
+ fileoutputstream.write(buffer, 0, n);
+ }
+ fileoutputstream.close();
+ }
+
+ zipInputStream.closeEntry();
+ }
+ } catch (Exception e) {
+ throw new LimaTechnicalException("could not extract zip file", e);
+ } finally {
+ IOUtils.closeQuietly(zipInputStream);
+ IOUtils.closeQuietly(inputStream);
+ }
+ InputStream transactionsStream, entryBooksStream, fiscalPeriodsStream, entriesStream, accountsStream;
+ try {
+ entryBooksStream = new FileInputStream(tmpDir + "entryBooks.csv");
+ String entryBooksStreamString = IOUtils.toString(entryBooksStream);
+ IOUtils.closeQuietly(entryBooksStream);
+
+ // import
+ transactionsStream = new FileInputStream(tmpDir + "financialTransactions.csv");
+ String transactionsStreamString = IOUtils.toString(transactionsStream);
+ IOUtils.closeQuietly(transactionsStream);
+
+ fiscalPeriodsStream = new FileInputStream(tmpDir + "fiscalPeriods.csv");
+ String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
+ IOUtils.closeQuietly(fiscalPeriodsStream);
+
+ entriesStream = new FileInputStream(tmpDir + "entries.csv");
+ String entriesStreamString = IOUtils.toString(entriesStream);
+ IOUtils.closeQuietly(entriesStream);
+
+ accountsStream = new FileInputStream(tmpDir + "accounts.csv");
+ String accountsStreamString = IOUtils.toString(accountsStream);
+ IOUtils.closeQuietly(accountsStream);
+
+ // TODO DCossé 23/07/14 should be done in one transaction on service side but it doesn't work now
+ newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, entriesStreamString, accountsStreamString);
+// newImportService.importEntryBooksAsCSV(entryBooksStreamString);
+// if(log.isInfoEnabled()) {
+// log.info("jouranux importés");
+// }
+// newImportService.importFinancialTransactionsAsCSV(transactionsStreamString);
+// if(log.isInfoEnabled()) {
+// log.info("transactions importés");
+// }
+// newImportService.importFiscalPeriodsAsCSV(fiscalPeriodsStreamString);
+// if(log.isInfoEnabled()) {
+// log.info("période ficales importés");
+// }
+// newImportService.importEntriesAsCSV(entriesStreamString);
+// if(log.isInfoEnabled()) {
+// log.info("entrées importés");
+// }
+// newImportService.importAccountAsCSV(accountsStreamString);
+// if(log.isInfoEnabled()) {
+// log.info("comptes importés");
+// }
+ } catch (Exception ex) {
+ if(log.isInfoEnabled()) {
+ log.info(ex);
+ }
+ throw new LimaTechnicalException("could not import files", ex);
+ }
+ return "SUCCES";
+ }
+}
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -100,4 +100,5 @@
void removeAccount(Account account) throws UsedAccountException;
List<Account> stringToListAccounts(String selectedAccounts);
+
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -85,4 +85,6 @@
* @throws org.chorem.lima.business.UsedEntryBookException
*/
void removeEntryBook(EntryBook entryBook) throws UsedEntryBookException;
+
+ void createClosedPeriodicEntryBook(EntryBook entryBook);
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -39,6 +39,7 @@
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FiscalPeriod;
+import java.util.Collection;
import java.util.List;
/**
@@ -96,4 +97,9 @@
boolean isRetainedEarnings(FiscalPeriod fiscalPeriod);
FiscalPeriod updateEndDate(FiscalPeriod fiscalPeriod);
+
+ void createFiscalPeriodsClosePeriodicEntryBooks(Collection<FiscalPeriod> fiscalPeriods) throws
+ BeginAfterEndFiscalPeriodException,
+ NotBeginNextDayOfLastFiscalPeriodException,
+ MoreOneUnlockFiscalPeriodException;
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/NewImportService.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -31,11 +31,11 @@
void importEntryBooksAsCSV(String contents);
- void importFiscalPeriodsAsCSV(String contents);
+ String importFiscalPeriodsAsCSV(String contents);
void importFinancialTransactionsAsCSV(String contents);
void importEntriesAsCSV(String contents);
- void importAllAsCSV(String zippedBase64Str);
+ void importAllAsCSV(String entryBooks, String transactions, String fiscalPeriods, String entries, String accounts);
}
Modified: trunk/lima-callao/src/main/xmi/accounting-model.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -30,7 +30,7 @@
* second one to allow or not choce for encoding
* */
public enum ImportExportEnum {
- CSV_ALL_EXPORT(false, true), CSV_ALL_IMPORT(true, true),
+ CSV_ALL_EXPORT(false, false), CSV_ALL_IMPORT(true, true),
CSV_ACCOUNTCHARTS_EXPORT(false, true), CSV_ACCOUNTCHARTS_IMPORT(true, true),
CSV_ENTRYBOOKS_EXPORT(false, true), CSV_ENTRYBOOKS_IMPORT(true, true),
CSV_FINANCIALSTATEMENTS_EXPORT(false, true), CSV_FINANCIALSTATEMENTS_IMPORT(true, true),
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ t("lima.ui.account.addaccount") + " (Ctrl+N)"}"
+ toolTipText="{ "lima.ui.account.addaccount" + " (Ctrl+N)"}"
actionIcon='account-new'
onActionPerformed="handler.addAccount()"/>
<JButton id="updateButton"
- toolTipText="{ t("lima.ui.common.update") + " (Ctrl+M)"}"
+ toolTipText="{ "lima.ui.common.update" + " (Ctrl+M)"}"
actionIcon='account-edit'
onActionPerformed="handler.updateAccount()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ t("lima.ui.common.remove") + " (Del)"}"
+ toolTipText="{ "lima.ui.common.remove" + " (Del)"}"
actionIcon='account-remove'
onActionPerformed="handler.removeAccount()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -45,18 +45,18 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ t("lima.ui.entrybook.add") + " (Ctrl+N)"}"
+ toolTipText="{ "lima.ui.entrybook.add" + " (Ctrl+N)"}"
actionIcon='entryBook-new'
onActionPerformed="handler.addEntryBook()"/>
<JButton id="updateButton"
- toolTipText="{ t("lima.ui.entrybook.update") + " (Ctrl+M)"}"
+ toolTipText="{ "lima.ui.entrybook.update" + " (Ctrl+M)"}"
actionIcon='entryBook-edit'
onActionPerformed="handler.updateEntryBook()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ t("lima.ui.entrybook.remove") + " (Del)"}"
+ toolTipText="{ "lima.ui.entrybook.remove" + " (Del)"}"
actionIcon='entryBook-remove'
onActionPerformed="handler.deleteEntryBook()"
enabled="{isSelectedRow()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -30,7 +30,6 @@
org.chorem.lima.entity.FinancialPeriod
org.chorem.lima.ui.financialperiod.FinancialPeriodTable
org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel
- static org.nuiton.i18n.I18n.t
</import>
<FinancialPeriodViewHandler id="handler" constructorParams="this"/>
@@ -47,7 +46,7 @@
<JToolBar floatable="false">
<JButton id="blockButton"
- toolTipText="{ t("lima.ui.financialperiod.block") + " (Ctrl+C)"}"
+ toolTipText="{ "lima.ui.financialperiod.block" + " (Ctrl+C)"}"
actionIcon='financialPeriod-close'
onActionPerformed="handler.blockFinancialPeriod()"
enabled="{isSelectedPeriod()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -28,7 +28,6 @@
<import>
javax.swing.ListSelectionModel
org.jdesktop.swingx.decorator.HighlighterFactory
- static org.nuiton.i18n.I18n.t
</import>
<FinancialStatementChartViewHandler id="handler"
@@ -40,37 +39,37 @@
<JToolBar floatable="false">
<JButton id="addFinancialStatementHeader"
- toolTipText="{ t("lima.financialstatement.header.add") + " (Ctrl+Maj+N)"}"
+ toolTipText="{ "lima.financialstatement.header.add" + " (Ctrl+Maj+N)"}"
actionIcon='financialstatement-add-header'
onActionPerformed="handler.addFinancialStatementHeader()"/>
<JButton id="addFinancialStatementMovement"
- toolTipText="{ t("lima.financialstatement.movement.add") + " (Ctrl+N)"}"
+ toolTipText="{ "lima.financialstatement.movement.add" + " (Ctrl+N)"}"
actionIcon='financialstatement-add-movement'
onActionPerformed="handler.addFinancialStatementMovement()"
enabled="{isSelectedRow()}"/>
<JButton id="updateButton"
- toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
+ toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
actionIcon='financialstatement-edit'
onActionPerformed="handler.updateFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ t("lima.common.remove") + " (Del)"}"
+ toolTipText="{ "lima.common.remove" + " (Del)"}"
actionIcon='financialstatement-remove'
onActionPerformed="handler.removeFinancialStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="importButton"
- toolTipText="{ t("lima.ui.importexport.import") + " (Ctrl+I)"}"
+ toolTipText="{ "lima.ui.importexport.import" + " (Ctrl+I)"}"
actionIcon='financialstatement-import'
onActionPerformed="handler.importFinancialStatementChart()"/>
<JToolBar.Separator/>
<JButton id="checkButton"
- toolTipText="{ t("lima.financialstatement.check") + " (Ctrl+F)"}"
+ toolTipText="{ "lima.financialstatement.check" + " (Ctrl+F)"}"
actionIcon='financialstatement-check'
onActionPerformed="handler.financialStatementChartCheck()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -39,11 +39,11 @@
<FinancialTransactionViewHandler id="handler" constructorParams="this"/>
<ListSelectionModel
- id='selectionModel'
- initializer="new DefaultListSelectionModel()"
- selectionMode='{ListSelectionModel.SINGLE_SELECTION}'
- onValueChanged="handler.selectionChanged()"/>
-
+ id='selectionModel'
+ initializer="new DefaultListSelectionModel()"
+ selectionMode='{ListSelectionModel.SINGLE_SELECTION}'
+ onValueChanged="handler.selectionChanged()"/>
+
<Boolean id="selectedRow" javaBean="false"/>
<Boolean id="transactionInClipBoard" javaBean="false"/>
@@ -61,39 +61,39 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ t("lima.entries.addTransaction") + " (Ctrl+Shift+N)"}"
+ <JButton toolTipText="{ "lima.entries.addTransaction" + " (Ctrl+Shift+N)"}"
actionIcon='add-financial-transaction'
onActionPerformed="handler.addFinancialTransaction()" />
- <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedTransaction()" />
- <JButton toolTipText="{ t("lima.entries.copy.transaction") + " (Ctrl+Shift+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ "lima.entries.copy.transaction" + " (Ctrl+Shift+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyTransaction()" />
- <JButton toolTipText="{ t("lima.entries.paste.transaction") + " (Ctrl+Shift+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ "lima.entries.paste.transaction" + " (Ctrl+Shift+V)"}" actionIcon='paste'
enabled="{isTransactionInClipBoard()}"
onActionPerformed="handler.pasteTransaction()" />
<JToolBar.Separator/>
- <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.addEntry()" />
- <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="handler.deleteSelectedEntry()" />
- <JButton toolTipText="{ t("lima.entries.copy.entry") + " (Ctrl+Alt+C)"}" actionIcon='copy'
+ <JButton toolTipText="{ "lima.entries.copy.entry" + " (Ctrl+Alt+C)"}" actionIcon='copy'
enabled="{isSelectedRow()}"
onActionPerformed="handler.copyEntry()" />
- <JButton toolTipText="{ t("lima.entries.paste.entry") + " (Ctrl+Alt+V)"}" actionIcon='paste'
+ <JButton toolTipText="{ "lima.entries.paste.entry" + " (Ctrl+Alt+V)"}" actionIcon='paste'
enabled="{isEntryInClipBoard() && isSelectedRow()}"
onActionPerformed="handler.pasteEntry()" />
- <JButton toolTipText="{ t("lima.entries.assign.entries") + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
+ <JButton toolTipText="{ "lima.entries.assign.entries" + " (Ctrl+Alt+A)"}" actionIcon='assign-all-entries-in-transaction'
enabled="{isAssignableInAllEntries() && isSelectedRow()}"
onActionPerformed="handler.assignAllEntries()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
@@ -139,10 +139,10 @@
<JScrollPane>
<FinancialTransactionTableModel id="financialTransactionTableModel"/>
<FinancialTransactionTable
- id="financialTransactionTable" rowHeight="22"
- constructorParams='handler'
- selectionModel='{selectionModel}'
- model='{financialTransactionTableModel}'/>
+ id="financialTransactionTable" rowHeight="22"
+ constructorParams='handler'
+ selectionModel='{selectionModel}'
+ model='{financialTransactionTableModel}'/>
</JScrollPane>
</cell>
</row>
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -53,18 +53,18 @@
<row>
<cell fill="horizontal">
<JToolBar floatable="false">
- <JButton toolTipText="{ t("lima.entries.remove.transaction") + " (Ctrl+Shift+Del)"}"
+ <JButton toolTipText="{ "lima.entries.remove.transaction" + " (Ctrl+Shift+Del)"}"
actionIcon='delete-financial-transaction'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedTransaction()" />
- <JButton toolTipText ="{ t("lima.entries.addEntry") + " (Ctrl+N)"}" actionIcon='add-entry'
+ <JButton toolTipText ="{ "lima.entries.addEntry" + " (Ctrl+N)"}" actionIcon='add-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().addEntry()" />
- <JButton toolTipText="{ t("lima.entries.remove.entry") + " (Ctrl+Del)"}" actionIcon='delete-entry'
+ <JButton toolTipText="{ "lima.entries.remove.entry" + " (Ctrl+Del)"}" actionIcon='delete-entry'
enabled="{isSelectedRow()}"
onActionPerformed="getHandler().deleteSelectedEntry()" />
<JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.entries.balance") + " (Ctrl+B)"}" actionIcon='balance'
+ <JButton toolTipText="{ "lima.entries.balance" + " (Ctrl+B)"}" actionIcon='balance'
enabled="{!isBalance()}"
onActionPerformed="handler.balanceTransaction()" />
<JToolBar.Separator/>
@@ -79,7 +79,7 @@
getHandler().refresh()"
editable="false"/>
<JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
+ <JButton toolTipText="{ "lima.ui.common.refresh" + " (F5)"}" actionIcon='refresh'
onActionPerformed="getHandler().refresh()"/>
</JToolBar>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -28,7 +28,6 @@
<import>
javax.swing.ListSelectionModel
javax.swing.DefaultListSelectionModel
- static org.nuiton.i18n.I18n.t
</import>
<FiscalPeriodViewHandler id="handler" constructorParams="this"/>
@@ -47,24 +46,24 @@
<JToolBar floatable="false">
<JButton id="addButton"
- toolTipText="{ t("lima.charts.fiscalperiod.add") + " (Ctrl+N)"}"
+ toolTipText="{ "lima.charts.fiscalperiod.add" + " (Ctrl+N)"}"
actionIcon='fiscalPeriod-new'
onActionPerformed="handler.addFiscalPeriod()"/>
<JButton id="updateButton"
- toolTipText="{ t("lima.charts.fiscalperiod.update") + " (Ctrl+M)"}"
+ toolTipText="{ "lima.charts.fiscalperiod.update" + " (Ctrl+M)"}"
actionIcon='fiscalPeriod-edit'
onActionPerformed="handler.updateFiscalPeriod()"
enabled="{isDeleteEnabled()}" />
<JButton id="blockButton"
- toolTipText="{ t("lima.charts.fiscalperiod.block") + " (Ctrl+B)"}"
+ toolTipText="{ "lima.charts.fiscalperiod.block" + " (Ctrl+B)"}"
actionIcon='fiscalPeriod-close'
onActionPerformed="handler.blockFiscalPeriod()"
enabled="{isBlockEnabled()}"/>
<JButton id="deleteButton"
- toolTipText="{ t("lima.charts.fiscalperiod.delete") + " (Del)"}"
+ toolTipText="{ "lima.charts.fiscalperiod.delete" + " (Del)"}"
actionIcon='fiscalPeriod-remove'
onActionPerformed="handler.deleteFiscalPeriod()"
enabled="{isDeleteEnabled()}"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -29,7 +29,6 @@
javax.swing.BoxLayout
javax.swing.border.EtchedBorder
jaxx.runtime.SwingUtil
- static org.nuiton.i18n.I18n.t
</import>
<Dimension id="fixedSize" javaBean='new Dimension(500,200)'/>
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 13:46:03 UTC (rev 3857)
@@ -32,12 +32,12 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaTechnicalException;
import org.chorem.lima.business.ImportEbpException;
import org.chorem.lima.business.api.ExportService;
import org.chorem.lima.business.api.ImportService;
import org.chorem.lima.business.api.NewExportService;
+import org.chorem.lima.business.api.NewImportService;
import org.chorem.lima.business.utils.ImportExportEntityEnum;
import org.chorem.lima.enums.EncodingEnum;
import org.chorem.lima.enums.ImportExportEnum;
@@ -64,14 +64,18 @@
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.concurrent.ExecutionException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
import static org.nuiton.i18n.I18n.t;
/**
* Import export helper.
* Calling service with specified file to import and displaying wait view to user.
- *
+ *
* @author echatellier
* Date : 24 avr. 2012
*/
@@ -89,8 +93,11 @@
protected ImportService importService;
+ @Deprecated
protected ExportService exportService;
+ protected NewImportService newImportService;
+
protected NewExportService newExportService;
private ImportExportWaitView waitView;
@@ -103,8 +110,8 @@
//services
importService = LimaServiceFactory.getService(ImportService.class);
exportService = LimaServiceFactory.getService(ExportService.class);
+ newImportService = LimaServiceFactory.getService(NewImportService.class);
newExportService = LimaServiceFactory.getService(NewExportService.class);
- errorHelper = new ErrorHelper(LimaConfig.getInstance());
//create the wait dialog panel
waitView = new ImportExportWaitView();
@@ -171,8 +178,7 @@
createFile(filePath, EncodingEnum.ISOLATIN1.getEncoding(), datas);
break;
case CSV_ALL_IMPORT:
- datas = extractFile(filePath, charset.name());
- result = importService.importAllAsCSV(datas);
+ result = importAllFromZipFile(filePath);
break;
case CSV_ACCOUNTCHARTS_IMPORT:
datas = extractFile(filePath, charset.name());
@@ -236,13 +242,18 @@
//hidde wait dialog panel
waitView.setVisible(false);
+
+ if(log.isInfoEnabled()) {
+ log.info(get());
+ }
+
// display result dialog
if (verboseMode) {
String result = get();
if (importMode && StringUtils.isBlank(result)) {
JOptionPane.showMessageDialog(viewComponent, t("lima.ui.importexport.importerror"),
t("lima.ui.importexport.importtitle"), JOptionPane.ERROR_MESSAGE);
-
+
} else {
if (importMode) {
if (log.isDebugEnabled()) {
@@ -281,14 +292,10 @@
}
}
}
- } catch (InterruptedException ex) {
+ } catch (InterruptedException | ExecutionException ex) {
if (log.isErrorEnabled()) {
log.error("Can't get result message", ex);
}
- } catch (ExecutionException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't get result message", ex);
- }
}
}
}.execute();
@@ -312,36 +319,37 @@
JComboBox comboBox = new JComboBox(EncodingEnum.descriptions());
- if(importExportMethode.equals(ImportExportEnum.CSV_ALL_EXPORT)){
+ if (importExportMethode.getEncodingOption()) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(new JLabel(t("lima.importexport.choiceencoding")), BorderLayout.WEST);
+ panel.add(comboBox, BorderLayout.CENTER);
+ ((Container) chooser.getComponent(2)).add(panel, BorderLayout.SOUTH);
+ }
+ String approveButtonText;
+ if (importMode) {
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ approveButtonText = t("lima.ui.importexport.import");
+ chooser.setDialogTitle(approveButtonText);
+ chooser.setApproveButtonText(approveButtonText);
+ } else if (importExportMethode.equals(ImportExportEnum.CSV_ALL_EXPORT)) {
+ approveButtonText = t("lima.ui.importexport.export");
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ chooser.setDialogTitle(approveButtonText);
+ chooser.setApproveButtonText(approveButtonText);
} else {
+ approveButtonText = t("lima.ui.importexport.export");
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ chooser.setDialogTitle(approveButtonText);
+ chooser.setApproveButtonText(approveButtonText);
+ }
+ if (chooser.showOpenDialog(viewComponent) == JFileChooser.APPROVE_OPTION) {
+ filePath = chooser.getSelectedFile().getAbsolutePath();
+
if (importExportMethode.getEncodingOption()) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.add(new JLabel(t("lima.importexport.choiceencoding")), BorderLayout.WEST);
- panel.add(comboBox, BorderLayout.CENTER);
- ((Container) chooser.getComponent(2)).add(panel, BorderLayout.SOUTH);
+ encodingEnum = EncodingEnum.valueOfDescription((String) comboBox.getSelectedItem());
}
-
- String approveButtonText;
- if (importMode) {
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- approveButtonText = t("lima.ui.importexport.import");
- chooser.setDialogTitle(approveButtonText);
- chooser.setApproveButtonText(approveButtonText);
- } else {
- approveButtonText = t("lima.ui.importexport.export");
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- chooser.setDialogTitle(approveButtonText);
- chooser.setApproveButtonText(approveButtonText);
- }
- if (chooser.showOpenDialog(viewComponent) == JFileChooser.APPROVE_OPTION) {
- filePath = chooser.getSelectedFile().getAbsolutePath();
-
- if (importExportMethode.getEncodingOption()) {
- encodingEnum = EncodingEnum.valueOfDescription((String) comboBox.getSelectedItem());
- }
- }
}
@@ -352,7 +360,7 @@
/**
* Get csv datas in string and write file.
- *
+ *
* @param filePath
* @param charset
* @param datas
@@ -372,12 +380,12 @@
} finally {
IOUtils.closeQuietly(out);
}
-
+
}
/**
* Open csv file and get his datas on a string.
- *
+ *
* @param filePath
* @param charset
* @return
@@ -404,9 +412,86 @@
try {
byte[] bytes = Base64.decodeBase64(zippedBase64Str);
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
- IOUtils.copy(inputStream, new FileOutputStream(path));
+ SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
+ IOUtils.copy(inputStream, new FileOutputStream(path+"/LIMA-BACKUP-"+ dateFormat.format(new Date())));
} catch (IOException e) {
- throw new LimaTechnicalException(e);
+ throw new LimaTechnicalException("could not zip file", e);
}
}
+
+ protected String importAllFromZipFile(String filePath) {
+ ZipInputStream zipInputStream = null;
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ FileInputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(filePath);
+
+ zipInputStream = new ZipInputStream(inputStream);
+
+ ZipEntry entry;
+ while ((entry = zipInputStream.getNextEntry()) != null) {
+ byte[] buffer = new byte[2048];
+ FileOutputStream fileoutputstream = null;
+
+ if (entry.getName().equalsIgnoreCase("accounts.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "accounts.csv");
+ } else if (entry.getName().equalsIgnoreCase("entryBooks.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "entryBooks.csv");
+ } else if (entry.getName().equalsIgnoreCase("fiscalPeriod.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "fiscalPeriods.csv");
+ } else if (entry.getName().equalsIgnoreCase("financialTransactions.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "financialTransactions.csv");
+ } else if (entry.getName().equalsIgnoreCase("entries.csv")) {
+ fileoutputstream = new FileOutputStream(tmpDir + "entries.csv");
+ }
+ int n;
+
+ if (fileoutputstream != null) {
+ while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
+ fileoutputstream.write(buffer, 0, n);
+ }
+ fileoutputstream.close();
+ }
+
+ zipInputStream.closeEntry();
+ }
+ } catch (Exception e) {
+ throw new LimaTechnicalException("could not extract zip file", e);
+ } finally {
+ IOUtils.closeQuietly(zipInputStream);
+ IOUtils.closeQuietly(inputStream);
+ }
+ InputStream transactionsStream, entryBooksStream, fiscalPeriodsStream, entriesStream, accountsStream;
+ try {
+ entryBooksStream = new FileInputStream(tmpDir + "entryBooks.csv");
+ String entryBooksStreamString = IOUtils.toString(entryBooksStream);
+ IOUtils.closeQuietly(entryBooksStream);
+
+ // import
+ transactionsStream = new FileInputStream(tmpDir + "financialTransactions.csv");
+ String transactionsStreamString = IOUtils.toString(transactionsStream);
+ IOUtils.closeQuietly(transactionsStream);
+
+ fiscalPeriodsStream = new FileInputStream(tmpDir + "fiscalPeriods.csv");
+ String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
+ IOUtils.closeQuietly(fiscalPeriodsStream);
+
+ entriesStream = new FileInputStream(tmpDir + "entries.csv");
+ String entriesStreamString = IOUtils.toString(entriesStream);
+ IOUtils.closeQuietly(entriesStream);
+
+ accountsStream = new FileInputStream(tmpDir + "accounts.csv");
+ String accountsStreamString = IOUtils.toString(accountsStream);
+ IOUtils.closeQuietly(accountsStream);
+
+ newImportService.importAllAsCSV(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, entriesStreamString, accountsStreamString);
+
+ } catch (Exception ex) {
+ if(log.isInfoEnabled()) {
+ log.info(ex);
+ }
+ throw new LimaTechnicalException("could not import files", ex);
+ }
+ return "SUCCES";
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -54,19 +54,19 @@
<JToolBar floatable="false">
<JButton id="lettered"
- toolTipText="{ t("lima.ui.lettering.buttonLettered") + " (Ctrl+L)"}"
+ toolTipText="{ "lima.ui.lettering.buttonLettered" + " (Ctrl+L)"}"
enabled="{editModel.isLettred()}"
actionIcon='lettering'
onActionPerformed="handler.addLetter()"/>
<JButton id="noLettered"
- toolTipText="{ t("lima.ui.lettering.buttonNoLettered") + " (Del)"}"
+ toolTipText="{ "lima.ui.lettering.buttonNoLettered" + " (Del)"}"
enabled="{editModel.isUnLettred()}"
actionIcon='un-lettering'
onActionPerformed="handler.removeLetter()"/>
<JButton id="round"
- toolTipText="{ t("lima.ui.lettering.buttonEqualize") + " (Ctrl+B)"}"
+ toolTipText="{ "lima.ui.lettering.buttonEqualize" + " (Ctrl+B)"}"
enabled="{editModel.isEqualized()}"
actionIcon='balance'
onActionPerformed="handler.roundAndCreateEntry()"/>
@@ -113,7 +113,7 @@
<JToolBar.Separator/>
<JButton id="refresh"
- toolTipText="{ t("lima.ui.lettering.buttonRefresh") + " (F5)"}"
+ toolTipText="{ "lima.ui.lettering.buttonRefresh" + " (F5)"}"
actionIcon='refresh'
onActionPerformed="handler.updateAllEntries()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2014-07-23 13:46:03 UTC (rev 3857)
@@ -42,18 +42,18 @@
<JToolBar floatable="false">
<JButton id="addVatStatementMovement"
- toolTipText="{ t("lima.vatstatement.movement.add") + " (Ctrl+N)"}"
+ toolTipText="{ "lima.vatstatement.movement.add" + " (Ctrl+N)"}"
actionIcon='vatstatement-new'
onActionPerformed="handler.addVatStatementMovement()"/>
<JButton id="updateButton"
- toolTipText="{ t("lima.common.update") + " (Ctrl+M)"}"
+ toolTipText="{ "lima.common.update" + " (Ctrl+M)"}"
actionIcon='vatstatement-edit'
onActionPerformed="handler.updateVatStatement()"
enabled="{isSelectedRow()}"/>
<JButton id="removeButton"
- toolTipText="{ t("lima.common.remove") + " (Del)"}"
+ toolTipText="{ "lima.common.remove" + " (Del)"}"
actionIcon='vatstatement-remove'
onActionPerformed="handler.removeVatStatement()"
enabled="{isSelectedRow()}"/>
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-07-23 13:46:03 UTC (rev 3857)
@@ -366,6 +366,7 @@
lima.ui.entry.add.error.beforeFirstFiscalPeriod=
lima.ui.entry.add.error.lockedEntryBook=
lima.ui.entry.add.error.lockedFinancialPeriod=
+lima.ui.entry.add.error.noFinancialPeriod=Any fiscal period are difined.
lima.ui.entry.paste.error.afterLastFiscalPeriod=
lima.ui.entry.paste.error.beforeFirstFiscalPeriod=
lima.ui.entry.paste.error.lockedEntryBook=
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 2014-07-23 08:52:27 UTC (rev 3856)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-07-23 13:46:03 UTC (rev 3857)
@@ -348,6 +348,7 @@
lima.ui.entry.add.error.beforeFirstFiscalPeriod=Impossible d'ajouter une entré car la date de la transaction est avant le %1$te %1$tB %1$tY début du premier exercice.
lima.ui.entry.add.error.lockedEntryBook=Impossible d'ajouter une entré car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
lima.ui.entry.add.error.lockedFinancialPeriod=Impossible d'ajouter une entré car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée.
+lima.ui.entry.add.error.noFinancialPeriod=Aucune période fiscale n'est définie.
lima.ui.entry.paste.error.afterLastFiscalPeriod=Impossible de copier une entré car la date de la transaction est après le %1$te %1$tB %1$tY fin du dernier exercice.
lima.ui.entry.paste.error.beforeFirstFiscalPeriod=Impossible de copier une entré car la date de la transaction est avant le %1$te %1$tB %1$tY début du premier exercice.
lima.ui.entry.paste.error.lockedEntryBook=Impossible de copier une entré car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
1
0
Author: sbavencoff
Date: 2014-07-23 10:52:27 +0200 (Wed, 23 Jul 2014)
New Revision: 3856
Url: http://forge.chorem.org/projects/lima/repository/revisions/3856
Log:
refs #974 : change filter view
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
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/Filter/AccountCondition/AccountConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -31,7 +31,6 @@
import org.chorem.lima.ui.Filter.ConditionHandler;
import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler;
-import javax.swing.*;
import java.awt.event.ItemEvent;
/**
@@ -74,7 +73,7 @@
}
@Override
- public JComponent getView() {
+ public AccountConditionView getView() {
return view;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,10 +22,14 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
+<JInternalFrame title="lima.ui.financialtransaction.account"
+ preferredSize="{new Dimension(400, 100)}"
+ onInternalFrameClosed="handler.delete()"
+ layout="{new FlowLayout()}">
-<Table>
<import>
java.awt.Dimension
+ java.awt.FlowLayout
javax.swing.ListSelectionModel
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
@@ -38,21 +42,11 @@
<org.chorem.lima.ui.combobox.AccountComboBoxModel id="accountModel" />
- <row>
- <cell>
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.ui.financialtransaction.account"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JComboBox id="account"
- model="{accountModel}"
- renderer="{new AccountListRenderer()}"
- selectedItem="{handler.getAccount()}"
- onItemStateChanged="handler.accountSelected(event)"/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JComboBox id="account"
+ preferredSize="{new Dimension(390, 30)}"
+ model="{accountModel}"
+ renderer="{new AccountListRenderer()}"
+ selectedItem="{handler.getAccount()}"
+ onItemStateChanged="handler.accountSelected(event)"/>
+
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,10 +22,14 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title=""
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()"
+ layout="{new FlowLayout()}">
<import>
java.awt.Dimension
+ java.awt.FlowLayout
javax.swing.ListSelectionModel
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
@@ -38,35 +42,22 @@
<BigDecimalConditionHandler id="handler"
javaBean="new BigDecimalConditionHandler(this)"/>
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel id="label" text=""/>
- </cell>
- <cell>
- <JComboBox id="operandComboBox"
- model="{new DefaultComboBoxModel(AbstractBigDecimalCondition.Operand.values())}"
- renderer="{new LabelListCellRenderer()}"
- selectedItem="{handler.getOperand()}"
- onItemStateChanged="handler.operandSelected(event)"/>
- </cell>
- <cell weightx="1" anchor="west">
- <NumberEditor id="bigDecimaleditor"
- constructorParams="this"
- bean="{handler}"
- model="{handler.getValue()}"
- property="value"
- modelType="{BigDecimal.class}"
- numberPattern="([1-9]\d*|0)(\.\d*)?"
- useFloat="true"
- useSign="false"
- autoPopup="false"
- showPopupButton="false"
- showReset="false"/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+
+ <JComboBox id="operandComboBox"
+ model="{new DefaultComboBoxModel(AbstractBigDecimalCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
+ selectedItem="{handler.getOperand()}"
+ onItemStateChanged="handler.operandSelected(event)"/>
+ <NumberEditor id="bigDecimaleditor"
+ constructorParams="this"
+ bean="{handler}"
+ model="{handler.getValue()}"
+ property="value"
+ modelType="{BigDecimal.class}"
+ numberPattern="([1-9]\d*|0)(\.\d*)?"
+ useFloat="true"
+ useSign="false"
+ autoPopup="false"
+ showPopupButton="false"
+ showReset="false"/>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,7 +34,7 @@
public CreditConditionView() {
super();
setHandler(new CreditConditionHandler(this));
- getLabel().setText(t("lima.ui.financialtransaction.credit"));
+ setTitle(t("lima.ui.financialtransaction.credit"));
getBigDecimaleditor().setBean(handler);
getBigDecimaleditor().init();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,7 +34,7 @@
public DebitConditionView() {
super();
setHandler(new DebitConditionHandler(this));
- getLabel().setText(t("lima.ui.financialtransaction.debit"));
+ setTitle(t("lima.ui.financialtransaction.debit"));
getBigDecimaleditor().setBean(handler);
getBigDecimaleditor().init();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -36,7 +36,7 @@
public Condition getCondition();
- public JComponent getView();
+ public JInternalFrame getView();
public void setFilterHandler(FinancialTransactionConditionHandler filterHandler);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,7 +34,6 @@
import org.chorem.lima.ui.Filter.ConditionHandler;
import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler;
-import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import java.util.List;
@@ -63,7 +62,7 @@
}
@Override
- public JComponent getView() {
+ public EntryBookConditionView getView() {
return view;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,8 +22,9 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title="lima.enum.list.entryBook"
+ preferredSize="{new Dimension(400, 100)}"
+ onInternalFrameClosed="handler.delete()">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
@@ -32,25 +33,12 @@
</import>
<EntryBookConditionHandler id="handler"
javaBean="new EntryBookConditionHandler(this)"/>
-
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.enum.list.entryBook"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JScrollPane preferredSize="{new Dimension(300, 60)}" minimumSize="{new Dimension(300, 60)}">
- <JList id="entryBookList"
- selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- visibleRowCount="-1"
- listData="{handler.getEntryBookList()}"
- cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
- onValueChanged="handler.setEntryBook(event)"/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JScrollPane >
+ <JList id="entryBookList"
+ selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ visibleRowCount="-1"
+ listData="{handler.getEntryBookList()}"
+ cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}"
+ onValueChanged="handler.setEntryBook(event)"/>
+ </JScrollPane>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,6 +34,6 @@
public DescriptionConditionView() {
super();
setHandler(new DescriptionConditionHandler(this));
- getLabel().setText(t("lima.ui.financialtransaction.description"));
+ setTitle(t("lima.ui.financialtransaction.description"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,6 +34,6 @@
public LetteringConditionView() {
super();
setHandler(new LetteringConditionHandler(this));
- getLabel().setText(t("lima.ui.financialtransaction.letter"));
+ setTitle(t("lima.ui.financialtransaction.letter"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,10 +22,14 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title="lima.filter.date.window"
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()"
+ layout="{new FlowLayout(FlowLayout.CENTER, 0, 0)}">
<import>
java.awt.Dimension
+ java.awt.FlowLayout
javax.swing.ListSelectionModel
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
@@ -35,33 +39,16 @@
<StringConditionHandler id="handler"
javaBean="new StringConditionHandler(this)"/>
-
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel id="label" text=""/>
- </cell>
- <cell>
- <JComboBox id="operandComboBox"
- model="{new DefaultComboBoxModel(AbstractStringCondition.Operand.values())}"
- renderer="{new LabelListCellRenderer()}"
- selectedItem="{handler.getOperand()}"
- onItemStateChanged="handler.operandSelected(event)"/>
- </cell>
- <cell>
- <JTextField id="textField"
- text="{handler.getText()}"
- onKeyReleased="handler.setText(event)" />
- </cell>
- <cell weightx="1" anchor="west">
- <JCheckBox id="sensitiveCaseCheckBox"
- text="lima.filer.condition.sensitive.case"
- selected="{handler.isSensitiveCase()}"
- onActionPerformed="handler.setSensitiveCase(event)" />
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JComboBox id="operandComboBox"
+ model="{new DefaultComboBoxModel(AbstractStringCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
+ selectedItem="{handler.getOperand()}"
+ onItemStateChanged="handler.operandSelected(event)"/>
+ <JTextField id="textField"
+ text="{handler.getText()}"
+ onKeyReleased="handler.setText(event)" />
+ <JCheckBox id="sensitiveCaseCheckBox"
+ text="lima.filer.condition.sensitive.case"
+ selected="{handler.isSensitiveCase()}"
+ onActionPerformed="handler.setSensitiveCase(event)" />
+</JInternalFrame>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,7 +34,7 @@
public VoucherConditionView() {
super();
setHandler(new VoucherConditionHandler(this));
- getLabel().setText(t("lima.ui.financialtransaction.voucher"));
+ setTitle(t("lima.ui.financialtransaction.voucher"));
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,10 +22,14 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title="lima.ui.financialtransaction.date"
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()"
+ layout="{new FlowLayout()}">
<import>
java.awt.Dimension
+ java.awt.FlowLayout
javax.swing.ListSelectionModel
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
@@ -35,27 +39,13 @@
<DateConditionHandler id="handler"
javaBean="new DateConditionHandler(this)"/>
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.ui.financialtransaction.date"/>
- </cell>
- <cell>
- <JComboBox id="operandComboBox"
- model="{new DefaultComboBoxModel(DateCondition.Operand.values())}"
- renderer="{new LabelListCellRenderer()}"
- selectedItem="{handler.getOperand()}"
- onItemStateChanged="handler.operandSelected(event)"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JAXXDatePicker id='datePicker'
- date='{handler.getDate()}'
- formats='{handler.getFormats()}'
- onActionPerformed='handler.setDate(datePicker.getDate())'/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JComboBox id="operandComboBox"
+ model="{new DefaultComboBoxModel(DateCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
+ selectedItem="{handler.getOperand()}"
+ onItemStateChanged="handler.operandSelected(event)"/>
+ <JAXXDatePicker id='datePicker'
+ date='{handler.getDate()}'
+ formats='{handler.getFormats()}'
+ onActionPerformed='handler.setDate(datePicker.getDate())'/>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -32,7 +32,6 @@
import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler;
import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler;
-import javax.swing.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -63,7 +62,7 @@
}
@Override
- public JComponent getView() {
+ public DateIntervalConditionView getView() {
return view;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -23,7 +23,10 @@
#L%
-->
-<Table>
+<JInternalFrame title="lima.ui.financialtransaction.dateInterval"
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
@@ -33,30 +36,28 @@
</import>
<DateIntervalConditionHandler id="handler"
javaBean="new DateIntervalConditionHandler(this)"/>
-
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.ui.financialtransaction.date.in"/>
- </cell>
- <cell>
- <JAXXDatePicker id='beginDatePicker'
- date='{handler.getBeginDate()}'
- formats='{handler.getFormats()}'
- onActionPerformed='handler.setBeginDate(beginDatePicker.getDate())'/>
- </cell>
- <cell>
- <JLabel text="lima.ui.financialtransaction.date.to"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JAXXDatePicker id='endDatePicker'
- date='{handler.getEndDate()}'
- formats='{handler.getFormats()}'
- onActionPerformed='handler.setEndDate(endDatePicker.getDate())'/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="lima.ui.financialtransaction.dateInterval.in"/>
+ </cell>
+ <cell>
+ <JAXXDatePicker id='beginDatePicker'
+ date='{handler.getBeginDate()}'
+ formats='{handler.getFormats()}'
+ onActionPerformed='handler.setBeginDate(beginDatePicker.getDate())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.ui.financialtransaction.dateInterval.to"/>
+ </cell>
+ <cell>
+ <JAXXDatePicker id='endDatePicker'
+ date='{handler.getEndDate()}'
+ formats='{handler.getFormats()}'
+ onActionPerformed='handler.setEndDate(endDatePicker.getDate())'/>
+ </cell>
+ </row>
+ </Table>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -35,7 +35,6 @@
import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler;
import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler;
-import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import java.util.List;
@@ -66,7 +65,7 @@
}
@Override
- public JComponent getView() {
+ public FinancialPeriodConditionView getView() {
return view;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,8 +22,10 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title="lima.enum.comboboxperiod.financialperiod"
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
@@ -33,24 +35,12 @@
<FinancialPeriodConditionHandler id="handler"
javaBean="new FinancialPeriodConditionHandler(this)"/>
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.enum.comboboxperiod.financialperiod"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JScrollPane preferredSize="{new Dimension(250, 80)}" minimumSize="{new Dimension(250, 80)}">
- <JList id="financialPeriodList"
- selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- visibleRowCount="-1"
- listData="{handler.getFinancialPeriodList()}"
- cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
- onValueChanged="handler.setFinancialPeriod(event)"/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JScrollPane>
+ <JList id="financialPeriodList"
+ selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ visibleRowCount="-1"
+ listData="{handler.getFinancialPeriodList()}"
+ cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}"
+ onValueChanged="handler.setFinancialPeriod(event)"/>
+ </JScrollPane>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -32,6 +32,7 @@
import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler;
import javax.swing.*;
+import java.beans.PropertyVetoException;
import java.util.List;
/**
@@ -73,8 +74,13 @@
// add view
if (add) {
JPanel conditionPanel = view.getConditionPanel();
- JComponent conditionView = conditionHandler.getView();
+ JInternalFrame conditionView = conditionHandler.getView();
conditionPanel.add(conditionView);
+ try {
+ conditionView.setSelected(true);
+ } catch (PropertyVetoException e) {
+
+ }
conditionPanel.validate();
conditionPanel.repaint();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -23,37 +23,27 @@
#L%
-->
-<Table>
+<JPanel layout="{new BorderLayout()}">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
javax.swing.text.Document
- javax.swing.BoxLayout
+ java.awt.FlowLayout
</import>
<FinancialTransactionConditionHandler id="handler"
javaBean="new FinancialTransactionConditionHandler(this)"/>
- <row>
- <cell weightx="1" anchor="east">
- <JRadioButton text="lima.filter.condition.one"
- id="AllRadioButton"
- onActionPerformed="handler.setAllConditions(false)"
- buttonGroup="radioButtons"
- selected="{!handler.isAllConditions()}"/>
- </cell>
- <cell weightx="0" >
- <JRadioButton text="lima.filter.condition.all"
- id="OneRadioButton"
- onActionPerformed="handler.setAllConditions(true)"
- buttonGroup="radioButtons"
- selected="{handler.isAllConditions()}"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1" columns="2" anchor="west">
- <JPanel id="conditionPanel"
- layout="{new BoxLayout(conditionPanel, BoxLayout.PAGE_AXIS)}">
- </JPanel>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <JPanel constraints="BorderLayout.NORTH">
+ <JRadioButton text="lima.filter.condition.one"
+ id="AllRadioButton"
+ onActionPerformed="handler.setAllConditions(false)"
+ buttonGroup="radioButtons"
+ selected="{!handler.isAllConditions()}"/>
+ <JRadioButton text="lima.filter.condition.all"
+ id="OneRadioButton"
+ onActionPerformed="handler.setAllConditions(true)"
+ buttonGroup="radioButtons"
+ selected="{handler.isAllConditions()}"/>
+ </JPanel>
+ <JPanel id="conditionPanel" constraints="BorderLayout.CENTER" layout="{new FlowLayout(FlowLayout.LEADING, 0, 0)}"/>
+</JPanel>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java 2014-07-23 08:52:27 UTC (rev 3856)
@@ -34,7 +34,6 @@
import org.chorem.lima.ui.Filter.ConditionHandler;
import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler;
-import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import java.util.List;
@@ -64,7 +63,7 @@
}
@Override
- public JComponent getView() {
+ public FiscalPeriodConditionView getView() {
return view;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -22,8 +22,10 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
-<Table>
+<JInternalFrame title="lima.enum.comboboxperiod.fiscalperiod"
+ preferredSize="{new Dimension(200, 100)}"
+ minimumSize="{new Dimension(200, 100)}"
+ onInternalFrameClosed="handler.delete()">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
@@ -33,24 +35,13 @@
<FiscalPeriodConditionHandler id="handler"
javaBean="new FiscalPeriodConditionHandler(this)"/>
- <row>
- <cell >
- <JButton toolTipText="lima.filter.condition.delete"
- actionIcon='remove-condition'
- onActionPerformed="handler.delete()" />
- </cell>
- <cell>
- <JLabel text="lima.enum.comboboxperiod.fiscalperiod"/>
- </cell>
- <cell weightx="1" anchor="west">
- <JScrollPane preferredSize="{new Dimension(250, 80)}" minimumSize="{new Dimension(250, 80)}">
- <JList id="fiscalPeriodList"
- selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- visibleRowCount="-1"
- listData="{handler.getFiscalPeriodList()}"
- cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
- onValueChanged="handler.setFiscalPeriod(event)"/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+
+ <JScrollPane >
+ <JList id="fiscalPeriodList"
+ selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ visibleRowCount="-1"
+ listData="{handler.getFiscalPeriodList()}"
+ cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}"
+ onValueChanged="handler.setFiscalPeriod(event)"/>
+ </JScrollPane>
+</JInternalFrame>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2014-07-23 08:52:27 UTC (rev 3856)
@@ -23,11 +23,12 @@
#L%
-->
-<Table>
+<JPanel layout="{new BorderLayout()}">
<import>
java.awt.Dimension
javax.swing.ListSelectionModel
javax.swing.text.Document
+ javax.swing.ScrollPaneConstants
org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionView
org.chorem.lima.enums.ComboBoxPeriodEnum
org.chorem.lima.enums.ComboBoxAccountsEnum
@@ -45,79 +46,71 @@
javaBean="new FinancialTransactionSearchViewHandler(this)"/>
<Boolean id="selectedRow" javaBean="false"/>
<Dimension id="fieldSize" javaBean="new java.awt.Dimension()"/>
- <row>
- <cell fill="both">
- <JToolBar floatable="false">
- <JButton toolTipText="lima.filter.date.one"
- actionIcon='filter-transaction-date'
- onActionPerformed="getHandler().addDateCondition()"/>
- <JButton toolTipText="lima.filter.date.interval"
- actionIcon='filter-transaction-interval'
- onActionPerformed="getHandler().addDateIntervalCondition()"/>
- <JButton toolTipText="lima.filter.date.financial.period"
- actionIcon='filter-transaction-financial-period'
- onActionPerformed="getHandler().addFinancialPeriodCondition()"/>
- <JButton toolTipText="lima.filter.date.fiscal.period"
- actionIcon='filter-transaction-fiscal-period'
- onActionPerformed="getHandler().addFiscalPeriodCondition()"/>
+ <JToolBar floatable="false" constraints="BorderLayout.NORTH">
+ <JButton toolTipText="lima.filter.date.one"
+ actionIcon='filter-transaction-date'
+ onActionPerformed="getHandler().addDateCondition()"/>
+ <JButton toolTipText="lima.filter.date.interval"
+ actionIcon='filter-transaction-interval'
+ onActionPerformed="getHandler().addDateIntervalCondition()"/>
+ <JButton toolTipText="lima.filter.date.financial.period"
+ actionIcon='filter-transaction-financial-period'
+ onActionPerformed="getHandler().addFinancialPeriodCondition()"/>
+ <JButton toolTipText="lima.filter.date.fiscal.period"
+ actionIcon='filter-transaction-fiscal-period'
+ onActionPerformed="getHandler().addFiscalPeriodCondition()"/>
- <JToolBar.Separator/>
+ <JToolBar.Separator/>
- <JButton toolTipText="lima.filter.entrybook"
- actionIcon='filter-transaction-entrybook'
- onActionPerformed="getHandler().addEntryBookCondition()"/>
+ <JButton toolTipText="lima.filter.entrybook"
+ actionIcon='filter-transaction-entrybook'
+ onActionPerformed="getHandler().addEntryBookCondition()"/>
- <JToolBar.Separator/>
+ <JToolBar.Separator/>
- <JButton toolTipText="lima.filter.voucher"
- actionIcon='filter-transaction-voucher'
- onActionPerformed="getHandler().addVoucherCondition()"/>
- <JButton toolTipText="lima.filter.account"
- actionIcon='filter-transaction-account'
- onActionPerformed="getHandler().addAccountCondition()"/>
- <JButton toolTipText="lima.filter.description"
- actionIcon='filter-transaction-description'
- onActionPerformed="getHandler().addDescriptionCondition()"/>
- <JButton toolTipText="lima.filter.letter"
- actionIcon='filter-transaction-letter'
- onActionPerformed="getHandler().addLetteringCondition()"/>
+ <JButton toolTipText="lima.filter.voucher"
+ actionIcon='filter-transaction-voucher'
+ onActionPerformed="getHandler().addVoucherCondition()"/>
+ <JButton toolTipText="lima.filter.account"
+ actionIcon='filter-transaction-account'
+ onActionPerformed="getHandler().addAccountCondition()"/>
+ <JButton toolTipText="lima.filter.description"
+ actionIcon='filter-transaction-description'
+ onActionPerformed="getHandler().addDescriptionCondition()"/>
+ <JButton toolTipText="lima.filter.letter"
+ actionIcon='filter-transaction-letter'
+ onActionPerformed="getHandler().addLetteringCondition()"/>
- <JToolBar.Separator/>
+ <JToolBar.Separator/>
- <JButton toolTipText="lima.filter.debit"
- actionIcon='filter-transaction-debit'
- onActionPerformed="getHandler().addDebitCondition()"/>
- <JButton toolTipText="lima.filter.credit"
- actionIcon='filter-transaction-credit'
- onActionPerformed="getHandler().addCreditCondition()"/>
- <JToolBar.Separator/>
- <JButton toolTipText="{ t("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
- onActionPerformed="getHandler().refresh()"/>
- </JToolBar>
- </cell>
- </row>
+ <JButton toolTipText="lima.filter.debit"
+ actionIcon='filter-transaction-debit'
+ onActionPerformed="getHandler().addDebitCondition()"/>
+ <JButton toolTipText="lima.filter.credit"
+ actionIcon='filter-transaction-credit'
+ onActionPerformed="getHandler().addCreditCondition()"/>
+ <JToolBar.Separator/>
+ <JButton toolTipText="{ t("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
+ onActionPerformed="getHandler().refresh()"/>
+ </JToolBar>
- <row>
- <cell fill='both' weightx="1">
+ <JSplitPane constraints="BorderLayout.CENTER"
+ orientation='{JSplitPane.VERTICAL_SPLIT}'>
+ <JScrollPane>
<FinancialTransactionConditionView id="financialTransactionConditionView" />
- </cell>
- </row>
-
- <row>
- <cell fill="both" weightx="1" weighty="1">
- <JScrollPane>
- <FinancialTransactionSearchTableModel
- id="financialTransactionSearchTableModel"/>
- <FinancialTransactionDefaultTable
- id="financialTransactionSearchTable"
- constructorParams='handler'
- rowHeight="22"
- model="{getFinancialTransactionSearchTableModel()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
- <ListSelectionModel
- javaBean="getFinancialTransactionSearchTable().getSelectionModel()"
- onValueChanged="setSelectedRow(financialTransactionSearchTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ </JScrollPane>
+ <JScrollPane>
+ <FinancialTransactionSearchTableModel
+ id="financialTransactionSearchTableModel"/>
+ <FinancialTransactionDefaultTable
+ id="financialTransactionSearchTable"
+ constructorParams='handler'
+ rowHeight="22"
+ model="{getFinancialTransactionSearchTableModel()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <ListSelectionModel
+ javaBean="getFinancialTransactionSearchTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(financialTransactionSearchTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
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 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-07-23 08:52:27 UTC (rev 3856)
@@ -236,6 +236,7 @@
lima.filter.date.fiscal.period=
lima.filter.date.interval=
lima.filter.date.one=
+lima.filter.date.window=
lima.filter.debit=
lima.filter.description=
lima.filter.entrybook=
@@ -427,6 +428,9 @@
lima.ui.financialtransaction.date=
lima.ui.financialtransaction.date.in=
lima.ui.financialtransaction.date.to=
+lima.ui.financialtransaction.dateInterval=
+lima.ui.financialtransaction.dateInterval.in=
+lima.ui.financialtransaction.dateInterval.to=
lima.ui.financialtransaction.debit=
lima.ui.financialtransaction.description=
lima.ui.financialtransaction.entrybook=
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 2014-07-22 13:36:55 UTC (rev 3855)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-07-23 08:52:27 UTC (rev 3856)
@@ -220,6 +220,7 @@
lima.filter.date.fiscal.period=Ajouter un filtre sur l'exercice
lima.filter.date.interval=Ajouter un filtre sur un interval de dates
lima.filter.date.one=Ajouter un filtre sur une date
+lima.filter.date.window=
lima.filter.debit=Ajouter un filtre sur les débits
lima.filter.description=Ajouter un filtre sur les descriptions
lima.filter.entrybook=Ajouter un filtre sur les journaux
@@ -404,8 +405,9 @@
lima.ui.financialtransaction.buttonnext=→
lima.ui.financialtransaction.credit=Crédit
lima.ui.financialtransaction.date=Date
-lima.ui.financialtransaction.date.in=Date du
-lima.ui.financialtransaction.date.to=au
+lima.ui.financialtransaction.dateInterval=Interval de dates
+lima.ui.financialtransaction.dateInterval.in=Du
+lima.ui.financialtransaction.dateInterval.to=au
lima.ui.financialtransaction.debit=Débit
lima.ui.financialtransaction.description=Description
lima.ui.financialtransaction.entrybook=Journal
1
0
r3855 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by sbavencoff@users.chorem.org 22 Jul '14
by sbavencoff@users.chorem.org 22 Jul '14
22 Jul '14
Author: sbavencoff
Date: 2014-07-22 15:36:55 +0200 (Tue, 22 Jul 2014)
New Revision: 3855
Url: http://forge.chorem.org/projects/lima/repository/revisions/3855
Log:
fixes #1045 : disable lettering column
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetterColumn.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetterColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetterColumn.java 2014-07-18 15:52:47 UTC (rev 3854)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/LetterColumn.java 2014-07-22 13:36:55 UTC (rev 3855)
@@ -36,7 +36,7 @@
public class LetterColumn extends AbstractColumn<FinancialTransactionTableModel> {
public LetterColumn() {
- super(String.class, t("lima.table.letter"), true);
+ super(String.class, t("lima.table.letter"), false);
}
@Override
1
0
r3854 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by sbavencoff@users.chorem.org 18 Jul '14
by sbavencoff@users.chorem.org 18 Jul '14
18 Jul '14
Author: sbavencoff
Date: 2014-07-18 17:52:47 +0200 (Fri, 18 Jul 2014)
New Revision: 3854
Url: http://forge.chorem.org/projects/lima/repository/revisions/3854
Log:
refs #1044 : fiscal period
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-07-18 15:33:15 UTC (rev 3853)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-07-18 15:52:47 UTC (rev 3854)
@@ -111,9 +111,6 @@
MoreOneUnlockFiscalPeriodException {
FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao();
- FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao();
-
- ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao();
EntryBookTopiaDao entryBookTopiaDao = getDaoHelper().getEntryBookDao();
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
@@ -224,7 +221,7 @@
// Get the old fiscal period instance for no object conflict
FiscalPeriod oldFiscalPeriod =
- fiscalPeriodTopiaDao.findByTopiaId(fiscalPeriod.getTopiaId());
+ fiscalPeriodTopiaDao.forTopiaIdEquals(fiscalPeriod.getTopiaId()).findUnique();
// lock fiscalperiod
oldFiscalPeriod.setLocked(true);
@@ -245,19 +242,13 @@
financialTransactionService.getAllFinancialTransactions(
fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate());
//check if they are at least one transaction to be report
- if (!financialTransactionsList.isEmpty()) {
- int i = 0;
- while (i < financialTransactionsList.size() && !found) {
- Collection<Entry> entryList = financialTransactionsList.get(i).getEntry();
- for (Entry entry : entryList) {
- if (entry.getAccount() != null) {
- if (Integer.valueOf(entry.getAccount().getAccountNumber().substring(0, 1)) < 6
- && !entry.getAmount().equals(BigDecimal.ZERO)) {
- found = true;
- }
- }
+ for (FinancialTransaction financialTransaction : financialTransactionsList) {
+ for (Entry entry : financialTransaction.getEntry()) {
+ if (Integer.valueOf(entry.getAccount().getAccountNumber().substring(0, 1)) < 6
+ && !entry.getAmount().equals(BigDecimal.ZERO)) {
+ found = true;
+ return found;
}
- i++;
}
}
return found;
@@ -269,7 +260,7 @@
FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao();
String topiaId = fiscalPeriod.getTopiaId();
- FiscalPeriod fiscalPeriodOld = fiscalPeriodTopiaDao.findByTopiaId(topiaId);
+ FiscalPeriod fiscalPeriodOld = fiscalPeriodTopiaDao.forTopiaIdEquals(topiaId).findUnique();
Date endDate = fiscalPeriod.getEndDate();
fiscalPeriodOld.setEndDate(endDate);
@@ -461,7 +452,7 @@
FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao();
// re-attach entities to current session
- FiscalPeriod localFiscalPeriod = fiscalPeriodTopiaDao.findByTopiaId(fiscalPeriod.getTopiaId());
+ FiscalPeriod localFiscalPeriod = fiscalPeriodTopiaDao.forTopiaIdEquals(fiscalPeriod.getTopiaId()).findUnique();
//check rules
accountingRules.deleteFiscalPeriodRules(localFiscalPeriod);
1
0