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
02 Apr '10
Author: echatellier
Date: 2010-04-02 19:02:58 +0200 (Fri, 02 Apr 2010)
New Revision: 2828
Log:
Regeneration des fichiers i18n
Modified:
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/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-04-02 17:02:21 UTC (rev 2827)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-04-02 17:02:58 UTC (rev 2828)
@@ -1,9 +1,15 @@
-lima.error.errorpane.title=Lima error
-lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>:<br/>%s</body></html>
+Bloqu\u00E9e=
+Can't\ add\ fiscal\ period=
+Confirmation=
+Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
+Exercice=
+Global\ lima\ exception=
lima.about.message=
-lima.accountplan=Plan de comptes
lima.account=Account
+lima.account.label=
+lima.account.number=
lima.account.type=Account type
+lima.accountplan=Plan de comptes
lima.actif=Asset
lima.action.commandline.disable.main.ui=Do not launch main ui
lima.action.commandline.help=Show help in console
@@ -37,15 +43,25 @@
lima.block=block
lima.cancel=Cancel
lima.charge=Expense
+lima.chartofaccounts=
+lima.chartofaccounts.journal=
+lima.chartofaccounts.management=
lima.closure.period.begin=Period from
lima.closure.timespan.warning=Warning\: when the period is blocked, it is possible to add, edit and delete entries on the accounting period.
+lima.common.add=
+lima.common.cancel=
+lima.common.ok=
+lima.common.remove=
+lima.common.update=
lima.config.category.directories=
lima.config.category.directories.description=
lima.config.category.other=
lima.config.category.other.description=
lima.config.configFileName.description=
lima.config.locale.description=
+lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen=
+lima.config.ui.fullscreen.description=
lima.credit=Credit
lima.daily=Daily
lima.date=Date
@@ -66,6 +82,12 @@
lima.edit=Edit
lima.edit.transaction=Edit transaction
lima.entries=Entries
+lima.entries.addtransaction=
+lima.entries.lettering=
+lima.entries.searchtransaction=
+lima.entrybook.description=
+lima.entrybook.label=
+lima.entrybook.prefix=
lima.error=Error
lima.error.account.double=It exists an account with a same number
lima.error.account.not.exist=This account doesn't exist
@@ -73,6 +95,8 @@
lima.error.account.with.entries=This account has some entries
lima.error.entry.not.exist=
lima.error.entry.not.remove=
+lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>\:<br/>%s</body></html>
+lima.error.errorpane.title=Lima error
lima.error.journal.double=A journal exist with this name
lima.error.journal.not.exist=This journal doesn't exist
lima.error.journal.with.transactions=This journal has some transactions
@@ -106,6 +130,11 @@
lima.filter.not.contains=Not contains
lima.filter.starts.with=Starts with
lima.find.transaction=Find transaction
+lima.fiscalyear=
+lima.fiscalyear.addperiod=
+lima.fiscalyear.closefiscalyear=
+lima.fiscalyear.closeperiod=
+lima.fiscalyear.listclosed=
lima.grand.livre=General Ledger
lima.home=Home - TODO
lima.import=Import
@@ -118,6 +147,7 @@
lima.import.success=Your datas had been loaded
lima.init.closed=Lima closed at %1$s
lima.init.context.done=Context was initialized in %1$s
+lima.init.errorclosing=
lima.init.ui.done=UI initialized
lima.journal=Journal
lima.lettered=Lettered
@@ -138,6 +168,8 @@
lima.menubar.closure.timespan=close a period (monthly)
lima.message.config.loaded=Config was loaded
lima.message.error.empty.line=Please choose an account
+lima.message.help.usage=
+lima.misc.supportemail.description=
lima.model.account=Account
lima.model.balance=Balance
lima.model.credit=Credit
@@ -159,8 +191,14 @@
lima.ok=OK
lima.passif=Liability
lima.period=Period
+lima.period.addFiscalPeriod=
+lima.period.begindate=
+lima.period.block=
lima.period.close=Close
+lima.period.enddate=
+lima.period.filter=
lima.period.open=Open
+lima.period.periodFilterLabel=
lima.preferences=Preferences
lima.prefix=Prefix
lima.print=Print
@@ -213,6 +251,7 @@
lima.tab.home=Home
lima.tab.journal=Journal
lima.tab.lettering=Lettering
+lima.tab.period=
lima.tab.reports=Reports
lima.tab.result=Result
lima.tab.search.result=Search result
@@ -220,6 +259,8 @@
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
lima.to=To
+lima.transaction.entrybook=
+lima.transaction.period=
lima.ui.add.account=Add account
lima.ui.add.journal=Add journal
lima.ui.block.timespan=Block period
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-04-02 17:02:21 UTC (rev 2827)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-04-02 17:02:58 UTC (rev 2828)
@@ -1,10 +1,14 @@
-lima.error.errorpane.title=Lima erreur
-lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>:<br/>%s</body></html>
-lima.about.message=
-lima.account.number=Num�ro du compte
-lima.accountplan=Plan de comptes
-lima.account.label=Libell�
+Bloqu\u00E9e=
+Can't\ add\ fiscal\ period=
+Confirmation=
+Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
+Exercice=
+Global\ lima\ exception=
+lima.about.message=\u00C0 propos de Lima
lima.account=Compte
+lima.account.label=Libell\u00E9
+lima.account.menu=Plan de comptes
+lima.account.number=Num\u00E9ro du compte
lima.account.type=Type de compte
lima.actif=Actif
lima.action.commandline.disable.main.ui=Ne pas lancer l'ui
@@ -13,14 +17,14 @@
lima.action.fullscreen.tip=Passer en mode plein \u00E9cran
lima.action.normalscreen=Ecran normal
lima.action.normalscreen.tip=Revenir en \u00E9cran normal
-lima.add=Ajout
+lima.add=
lima.add.entry=Ajouter une entr\u00E9e
-lima.add.lettering=Ajouter une lettre
-lima.add.transaction=Ajouter une transaction
+lima.add.lettering=
+lima.add.transaction=
lima.all=Tous
lima.all.criteria=Tous les crit\u00E8res correspondent
lima.amount=Montant
-lima.any.criteria=Au moins un critcre correspond
+lima.any.criteria=Au moins un crit\u00E8re correspond
lima.balance=Balance
lima.balance.account.libelle=Libell\u00E9
lima.balance.account.number=N\u00B0 de compte
@@ -37,17 +41,27 @@
lima.bilan.passif=Passif
lima.bilan.total=Total
lima.block=Bloquer
-lima.cancel=Annuler
+lima.cancel=
lima.charge=Charge
+lima.chartofaccounts=Plan des comptes
+lima.chartofaccounts.journal=Journal
+lima.chartofaccounts.management=Gestion du plan
lima.closure.period.begin=P\u00E9riode de
lima.closure.timespan.warning=Attention \: lorsque la p\u00E9riode est bloqu\u00E9e, il n'est plus possible d'ajouter, modifier et supprimer les entr\u00E9es comptables sur cette p\u00E9riode.
+lima.common.add=Ajout
+lima.common.cancel=Annuler
+lima.common.ok=OK
+lima.common.remove=Supprimer
+lima.common.update=Modifier
lima.config.category.directories=R\u00E9pertoires
lima.config.category.directories.description=R\u00E9pertoires utilis\u00E9s par Lima
lima.config.category.other=Autre
lima.config.category.other.description=Autre propri\u00E9t\u00E9s de configuration
lima.config.configFileName.description=
lima.config.locale.description=Locale utilis\u00E9e par l'application
+lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen=Drapeau pour utiliser le mode plein \u00E9cran
+lima.config.ui.fullscreen.description=
lima.credit=Credit
lima.daily=Quotidien
lima.date=Date
@@ -67,7 +81,13 @@
lima.description=Description
lima.edit=Editer
lima.edit.transaction=Editer une transaction
-lima.entries=Lignes d'\u00E9criture
+lima.entries=Op\u00E9ration de Saisie
+lima.entries.addtransaction=Ajouter une transaction
+lima.entries.lettering=Ajouter une lettre
+lima.entries.searchtransaction=Recherche les transactions
+lima.entrybook.description=Description
+lima.entrybook.label=Libelle
+lima.entrybook.prefix=Pr\u00E9fixe
lima.error=Erreur
lima.error.account.double=Il existe un compte avec ce m\u00EAme num\u00E9ro de compte
lima.error.account.not.exist=Ce num\u00E9ro de compte n'existe pas
@@ -75,6 +95,8 @@
lima.error.account.with.entries=Ce compte poss\u00E8de des entr\u00E9es comptables
lima.error.entry.not.exist=
lima.error.entry.not.remove=
+lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
+lima.error.errorpane.title=Lima erreur
lima.error.journal.double=Un journal poss\u00E8de d\u00E9j\u00E0 ce nom
lima.error.journal.not.exist=Ce journal n'existe pas
lima.error.journal.with.transactions=Ce journal poss\u00E8de des transactions comptables
@@ -108,6 +130,11 @@
lima.filter.not.contains=Ne contient pas
lima.filter.starts.with=Commence par
lima.find.transaction=Rechercher transaction
+lima.fiscalyear=Exercice comptable
+lima.fiscalyear.addperiod=Ajouter une p\u00E9riode
+lima.fiscalyear.closefiscalyear=Cl\u00F4turer l'exercice
+lima.fiscalyear.closeperiod=Cl\u00F4turer une p\u00E9riode
+lima.fiscalyear.listclosed=Voir toutes les cl\u00F4tures
lima.grand.livre=Grand-Livre
lima.home=Page d'accueil - TODO
lima.import=Import
@@ -120,6 +147,7 @@
lima.import.success=Vos donn\u00E9es ont bien \u00E9t\u00E9 charg\u00E9es
lima.init.closed=Lima ferm\u00E9 \u00E0 %1$s
lima.init.context.done=Initialisation du context termin\u00E9 en %1$s
+lima.init.errorclosing=
lima.init.ui.done=Initialisation des interface graphiques termin\u00E9e
lima.journal=Journal
lima.lettered=Lettr\u00E9
@@ -133,13 +161,11 @@
lima.menu.help.i18n.fr=Fran\u00E7ais
lima.menu.help.i18n.uk=Anglais
lima.menu.help.site=Acc\u00E9der au site de Lima
-lima.menubar.closure=Cl\u00F4ture
-lima.menubar.closure.addPeriod=Ajouter une p\u00E9riode
-lima.menubar.closure.listperiod=Voir toutes les cl\u00F4tures
-lima.menubar.closure.period=Cl\u00F4turer l'exercice
-lima.menubar.closure.timespan=Cl\u00F4turer une p\u00E9riode
+lima.menubar.closure.addPeriod=
lima.message.config.loaded=
lima.message.error.empty.line=Veuillez choisir un compte
+lima.message.help.usage=
+lima.misc.supportemail.description=
lima.model.account=Compte
lima.model.balance=Balance
lima.model.credit=Cr\u00E9dit
@@ -158,13 +184,20 @@
lima.non.valids.transactions=Ecritures non valides
lima.not.lettered=Non lettr\u00E9
lima.number=Num\u00E9ro
-lima.ok=OK
+lima.ok=
lima.passif=Passif
lima.period=P\u00E9riode
+lima.period.addFiscalPeriod=Nouvel exercice
+lima.period.begindate=D\u00E9but de l'exercice \:
+lima.period.block=Bloquer l'exercice
lima.period.close=Ferm\u00E9
+lima.period.enddate=Fin de l'exercice \:
+lima.period.filter=Filtre
+lima.period.menu=Exercice
lima.period.open=Ouvert
+lima.period.periodFilterLabel=Exercice
lima.preferences=Pr\u00E9f\u00E9rences
-lima.prefix=Prefixe
+lima.prefix=Pr\u00E9fixe
lima.print=Imprimer
lima.produit=Produit
lima.progressBar.export.etape1=Cr\u00E9ation base du fichier
@@ -187,7 +220,7 @@
lima.question.remove.journal=Voulez-vous supprimer ce journal?
lima.question.remove.transaction=Voulez-vous supprimer cette transaction?
lima.quit=Quitter
-lima.remove=Supprimer
+lima.remove=
lima.remove.lettering=Supprimer la lettre
lima.remove.transaction=Supprimer une transaction
lima.reports=Rapports
@@ -211,10 +244,10 @@
lima.tab.account=Compte
lima.tab.balance=Balance
lima.tab.bilan=Bilan
-lima.tab.closure=Cl\u00F4ture
lima.tab.home=Accueil
lima.tab.journal=Journal
lima.tab.lettering=Lettrage
+lima.tab.period=Exercice
lima.tab.reports=Rapports
lima.tab.result=Compte de r\u00E9sultat
lima.tab.search.result=Recherche
@@ -222,6 +255,8 @@
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=A propos de Lima...
lima.to=A
+lima.transaction.entrybook=Journal
+lima.transaction.period=
lima.ui.add.account=Ajouter un compte
lima.ui.add.journal=Ajouter un journal
lima.ui.block.timespan=Bloquer une p\u00E9riode mensuelle
@@ -229,7 +264,7 @@
lima.ui.update.account=Mettre \u00E0 jour le compte
lima.ui.update.journal=Mettre \u00E0 jour le journal
lima.unblock=D\u00E9bloquer
-lima.update=Mettre \u00E0 jour
+lima.update=
lima.view=Vue
lima.view.flatten=Vue aplatie
lima.voucher=Document
1
0
r2827 - trunk/lima-swing/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org 02 Apr '10
by echatellier@users.chorem.org 02 Apr '10
02 Apr '10
Author: echatellier
Date: 2010-04-02 19:02:21 +0200 (Fri, 02 Apr 2010)
New Revision: 2827
Log:
La factory des services supporte maintenant tous les services
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-04-02 17:01:48 UTC (rev 2826)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-04-02 17:02:21 UTC (rev 2827)
@@ -1,5 +1,5 @@
-/* *##%
- * Copyright (C) 2010 Code Lutin, Chatellier Eric
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
+ * ##%*/
package org.chorem.lima.service;
@@ -31,8 +31,12 @@
import org.apache.openejb.assembler.classic.Assembler;
import org.apache.openejb.loader.SystemInstance;
import org.chorem.lima.business.AccountService;
-import org.chorem.lima.business.ejb.JournalServiceImpl;
-import org.chorem.lima.business.ejb.PeriodServiceImpl;
+import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.RecordService;
+import org.chorem.lima.business.TransactionService;
+import org.chorem.lima.business.ejb.EntryBookServiceImpl;
/**
* Is class is a service factory based on embedded openejb container.
@@ -42,6 +46,13 @@
* <li>http://openejb.apache.org/embedding-openejb.html</li>
* </ul>
*
+ * Elle est pour l'instant statique en attendant mieux.
+ *
+ * Toutes les méthodes utilisent, <ServiceName>ImplLocal comme nom local
+ * (convention openejb) c'est donc plus factorisable que le code actuel.
+ * Mais il vaudrait mieux essayer en distant pour verifier si
+ * la factorisation est similaire.
+ *
* @author chatellier
* @version $Revision$
*
@@ -60,10 +71,11 @@
/**
* Init openejb jndi context.
*/
- public LimaServiceFactory() {
- Properties properties = new Properties();
+ protected LimaServiceFactory() {
// embedded server
+ // TODO put this in configuration
+ Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.openejb.client.LocalInitialContextFactory");
try {
@@ -105,10 +117,10 @@
// PortableRemoteObject.narrow(obj, FooHome.class);
// TODO put lookup name in configuration
- String lookupName = AccountService.class.getName().replace('.', '/');
+ String lookupName = "AccountServiceImplLocal";
AccountService ejbHome = null;
try {
- ejbHome = (AccountService)ctx.lookup("AccountServiceImplLocal");
+ ejbHome = (AccountService)ctx.lookup(lookupName);
} catch (NamingException eee) {
if (log.isErrorEnabled()) {
log.error("Can't lookup for service : " + lookupName, eee);
@@ -122,7 +134,7 @@
*
* @return account service proxy
*/
- public JournalServiceImpl getJournalService() {
+ public EntryBookServiceImpl getJournalService() {
// first way is
// FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
@@ -133,10 +145,10 @@
// PortableRemoteObject.narrow(obj, FooHome.class);
// TODO put lookup name in configuration
- String lookupName = JournalServiceImpl.class.getName().replace('.', '/');
- JournalServiceImpl ejbHome = null;
+ String lookupName = "JournalServiceImplLocal";
+ EntryBookServiceImpl ejbHome = null;
try {
- ejbHome = (JournalServiceImpl)ctx.lookup("JournalServiceImplLocal");
+ ejbHome = (EntryBookServiceImpl)ctx.lookup(lookupName);
} catch (NamingException eee) {
if (log.isErrorEnabled()) {
log.error("Can't lookup for service : " + lookupName, eee);
@@ -146,11 +158,11 @@
}
/**
- * Get Journal service.
+ * Get FiscalPeriod service.
*
- * @return account service proxy
+ * @return fiscalPeriod service proxy
*/
- public PeriodServiceImpl getPeriodService() {
+ public FiscalPeriodService getFiscalPeriodService() {
// first way is
// FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
@@ -161,10 +173,10 @@
// PortableRemoteObject.narrow(obj, FooHome.class);
// TODO put lookup name in configuration
- String lookupName = PeriodServiceImpl.class.getName().replace('.', '/');
- PeriodServiceImpl ejbHome = null;
+ String lookupName = "FiscalPeriodServiceImplLocal";
+ FiscalPeriodService ejbHome = null;
try {
- ejbHome = (PeriodServiceImpl)ctx.lookup("PeriodServiceImplLocal");
+ ejbHome = (FiscalPeriodService)ctx.lookup(lookupName);
} catch (NamingException eee) {
if (log.isErrorEnabled()) {
log.error("Can't lookup for service : " + lookupName, eee);
@@ -174,6 +186,118 @@
}
/**
+ * Get FinancialPeriod service.
+ *
+ * @return fiscalPeriod service proxy
+ */
+ public FinancialPeriodService getFinancialPeriodService() {
+
+ // first way is
+ // FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
+
+ // second way is (spec compliant)
+ // Object obj = ctx.lookup("my/bean/Foo");
+ // FooHome ejbHome = (FooHome)
+ // PortableRemoteObject.narrow(obj, FooHome.class);
+
+ // TODO put lookup name in configuration
+ String lookupName = "FinancialPeriodServiceImplLocal";
+ FinancialPeriodService ejbHome = null;
+ try {
+ ejbHome = (FinancialPeriodService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
+ * Get transaction service.
+ *
+ * @return transaction service proxy
+ */
+ public TransactionService getTransactionService() {
+
+ // first way is
+ // FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
+
+ // second way is (spec compliant)
+ // Object obj = ctx.lookup("my/bean/Foo");
+ // FooHome ejbHome = (FooHome)
+ // PortableRemoteObject.narrow(obj, FooHome.class);
+
+ // TODO put lookup name in configuration
+ String lookupName = "TransactionServiceImplLocal";
+ TransactionService ejbHome = null;
+ try {
+ ejbHome = (TransactionService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
+ * Get transaction service.
+ *
+ * @return transaction service proxy
+ */
+ public EntryBookService getEntryBookService() {
+
+ // first way is
+ // FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
+
+ // second way is (spec compliant)
+ // Object obj = ctx.lookup("my/bean/Foo");
+ // FooHome ejbHome = (FooHome)
+ // PortableRemoteObject.narrow(obj, FooHome.class);
+
+ // TODO put lookup name in configuration
+ String lookupName = "EntryBookServiceImplLocal";
+ EntryBookService ejbHome = null;
+ try {
+ ejbHome = (EntryBookService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
+ * Get record service.
+ *
+ * @return record service proxy
+ */
+ public RecordService getRecordService() {
+
+ // first way is
+ // FooHome ejbHome = (FooHome)new InitialContext().lookup("java:openejb/ejb/my/bean/Foo");
+
+ // second way is (spec compliant)
+ // Object obj = ctx.lookup("my/bean/Foo");
+ // FooHome ejbHome = (FooHome)
+ // PortableRemoteObject.narrow(obj, FooHome.class);
+
+ // TODO put lookup name in configuration
+ String lookupName = "RecordServiceImplLocal";
+ RecordService ejbHome = null;
+ try {
+ ejbHome = (RecordService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
* Destroy openejb jndi context.
*
* Code taken from openEJB faq :
1
0
02 Apr '10
Author: echatellier
Date: 2010-04-02 19:01:48 +0200 (Fri, 02 Apr 2010)
New Revision: 2826
Log:
Import/export code is now in business.
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/imports/
1
0
02 Apr '10
Author: echatellier
Date: 2010-04-02 19:01:38 +0200 (Fri, 02 Apr 2010)
New Revision: 2825
Log:
Import/export code is now in business.
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/export/
1
0
r2824 - in trunk/lima-business: . src/main/java/org/chorem/lima/business src/main/java/org/chorem/lima/business/ejb src/main/java/org/chorem/lima/business/ejb/csv src/main/java/org/chorem/lima/business/ejb/xml src/main/java/org/chorem/lima/business/utils src/main/resources src/test/java/org/chorem/lima/business src/test/resources
by echatellier@users.chorem.org 02 Apr '10
by echatellier@users.chorem.org 02 Apr '10
02 Apr '10
Author: echatellier
Date: 2010-04-02 18:55:19 +0200 (Fri, 02 Apr 2010)
New Revision: 2824
Log:
Fin de la structure des ejb (interface/impl) mais sans contenu
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/TransactionService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImport.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImportEBP.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLExport.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLImport.java
trunk/lima-business/src/test/resources/log4j.properties
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/dto/
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ServiceHelper.java
trunk/lima-business/src/main/resources/log4j.properties
Modified:
trunk/lima-business/pom.xml
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/TransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java
trunk/lima-business/src/main/resources/lima.properties
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java
Modified: trunk/lima-business/pom.xml
===================================================================
--- trunk/lima-business/pom.xml 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/pom.xml 2010-04-02 16:55:19 UTC (rev 2824)
@@ -33,10 +33,6 @@
<artifactId>nuiton-utils</artifactId>
</dependency>
<dependency>
- <groupId>javax.time</groupId>
- <artifactId>jsr-310-ri</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
</dependency>
@@ -62,6 +58,12 @@
<!-- Temp disable -->
<showDeprecation>false</showDeprecation>
<showWarnings>true</showWarnings>
+
+ <!-- XML/CSV import export don't compile for now -->
+ <excludes>
+ <exclude>**/*Import*.java</exclude>
+ <exclude>**/*Export*.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,5 +1,5 @@
-/* *##%
- * Copyright (C) 2010 Code Lutin, Chatellier Eric
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -14,7 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
+ * ##%*
+ */
package org.chorem.lima.business;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,44 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+import org.chorem.lima.entity.EntryBook;
+
+/**
+ * Entry book service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface EntryBookService {
+
+ List<EntryBook> getAllEntryBooks() throws LimaException;
+
+ void createEntryBook(EntryBook entryBook) throws LimaException;
+
+ void updateEntryBook(EntryBook entryBook) throws LimaException;
+
+ void removeEntryBook(EntryBook entryBook) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/EntryBookService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,46 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+import org.chorem.lima.entity.FinancialPeriod;
+
+/**
+ * Financial period service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface FinancialPeriodService {
+
+ List<FinancialPeriod> getAllFinancialPeriods() throws LimaException;
+
+ List<FinancialPeriod> getNonLockedFinancialPeriods() throws LimaException;
+
+ void createFinancialPeriod(FinancialPeriod financialPeriod) throws LimaException;
+
+ //void updateFiscalPeriod(FinancialPeriod financialPeriod) throws LimaException;
+
+ //void removeFiscalPeriod(FinancialPeriod financialPeriod) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialPeriodService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,44 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+import org.chorem.lima.entity.FiscalPeriod;
+
+/**
+ * Fiscal period service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface FiscalPeriodService {
+
+ List<FiscalPeriod> getAllFiscalPeriods() throws LimaException;
+
+ void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+
+ //void updateFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+
+ //void removeFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/FiscalPeriodService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,84 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+/**
+ * Import export service.
+ *
+ * Currently import and export as XML.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface ImportExportService {
+
+ /**
+ * Get database export as xml.
+ *
+ * For now it's use byte[] to be {@link java.io.Serializable}. InputStream
+ * nor file is allowed.
+ *
+ * TODO find a better solution than byte[]
+ *
+ * @return export as byte array
+ * @throws LimaException
+ */
+ byte[] exportAsXML() throws LimaException;
+
+ /**
+ * Import xml data into database.
+ *
+ * For now it's use byte[] to be {@link java.io.Serializable}. InputStream
+ * nor file is allowed.
+ *
+ * TODO find a better solution than byte[]
+ *
+ * @param data xml data as byte array
+ * @throws LimaException
+ */
+ void importAsXML(byte[] data) throws LimaException;
+
+ /**
+ * Get database export as CSV;
+ *
+ * @return export as byte array
+ * @throws LimaException
+ */
+ byte[] exportAsCSV() throws LimaException;
+
+ /**
+ * Import data as CSV into database.
+ *
+ * @param data data to import (CSV)
+ * @throws LimaException
+ */
+ void importAsCSV(byte[] data) throws LimaException;
+
+ /**
+ * Import data as EBP CSV export.
+ *
+ * @param data
+ * @throws LimaException
+ */
+ void importAsEbpCSV(byte[] data) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/ImportExportService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessException.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,19 +1,20 @@
-/* *##% Lima
- * Copyright (C) 2010 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,5 +1,5 @@
-/* *##%
- * Copyright (C) 2010 Code Lutin, Chatellier Eric
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -14,7 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
+ * ##%*
+ */
package org.chorem.lima.business;
@@ -25,8 +26,10 @@
import org.nuiton.util.ArgumentsParserException;
/**
- * TODO add comment here.
+ * Configuration pour le business.
*
+ * A voir comment le lier avec celui de lima main.
+ *
* @author chatellier
* @version $Revision$
*
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaException.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,19 +1,20 @@
-/* *##% Lima
- * Copyright (C) 2010 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business;
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,42 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+/**
+ * Fiscal period service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface RecordService {
+
+ //List<FiscalPeriod> getAllFiscalPeriods() throws LimaException;
+
+ //void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+
+ //void updateFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+
+ //void removeFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/RecordService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,50 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+/**
+ * Service de generation des rapports.
+ *
+ * Actuellement:
+ * <ul>
+ * <li>Balance</li>
+ * <li>Bilan</li>
+ * </ul>
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface ReportService {
+
+
+ /**
+ * Generation du bilan.
+ *
+ * @param period
+ * @return
+ * @throws LimaException
+ */
+ String generateBalanceSheet(String period) throws LimaException;
+
+
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/TransactionService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/TransactionService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/TransactionService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,44 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+import org.chorem.lima.entity.Transaction;
+
+/**
+ * Transaction service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface TransactionService {
+
+ //List<Transaction> getAllTransactions() throws LimaException;
+
+ //void createTransaction(Transaction transaction) throws LimaException;
+
+ //void updateTransaction(Transaction transaction) throws LimaException;
+
+ //void removeTransaction(Transaction transaction) throws LimaException;
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/TransactionService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,5 +1,5 @@
-/* *##%
- * Copyright (C) 2010 Code Lutin, Chatellier Eric
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -14,7 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
+ * ##%*
+ */
package org.chorem.lima.business.ejb;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,20 +1,20 @@
-/*
- * *##% Callao AccountServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
@@ -93,6 +93,9 @@
throw new LimaBusinessException("Invalid AccountNumber : " + account.getAccountNumber());
}
+ // TODO verifier que le numero de compte du fils commence par celui du pere
+ // (peut etre trop specific à la compta francaise)
+
TopiaContext transaction = null;
try {
// basic check done, make check in database
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,20 +1,20 @@
-/*
- * *##% Callao EntryBookServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
@@ -24,8 +24,11 @@
import java.util.ArrayList;
import java.util.List;
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
@@ -33,7 +36,6 @@
import org.chorem.lima.entity.EntryBookDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.Transaction;
-import org.chorem.lima.entity.TransactionDAO;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
@@ -45,12 +47,15 @@
*
* @author Rémi Chapelet
*/
-public class EntryBookServiceImpl {
+@Stateless
+public class EntryBookServiceImpl extends AbstractLimaService implements EntryBookService {
private static final Log log = LogFactory.getLog(EntryBookServiceImpl.class);
private TopiaContext rootContext;
+ protected TransactionServiceImpl transactionService = new TransactionServiceImpl();
+
//private ConvertEntryBook convertEntryBook = new ConvertEntryBook();
public EntryBookServiceImpl() {
@@ -70,7 +75,7 @@
* @param EntryBook EntryBook
* @throws LimaException
*/
- public void createEntryBook(EntryBook EntryBook) throws LimaException {
+ public void createEntryBook(EntryBook entryBook) throws LimaException {
/*String result = ServiceHelper.RESPOND_ERROR;
try {
// Acces BDD
@@ -113,60 +118,27 @@
transaction = rootContext.beginTransaction();
// test si un EntryBook de ce nom existe deja
- EntryBookDAO EntryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(transaction);
- EntryBook existingEntryBook = EntryBookDAO.findByLabel(EntryBook.getLabel());
+ EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(transaction);
+ EntryBook existingEntryBook = entryBookDAO.findByLabel(entryBook.getLabel());
if (existingEntryBook != null) {
- throw new LimaBusinessException(_("An EntryBook already exists with this label : %s", EntryBook.getLabel()));
+ throw new LimaBusinessException(_("An EntryBook already exists with this label : %s", entryBook.getLabel()));
}
// creation du EntryBook
- EntryBookDAO.create(EntryBook);
+ entryBookDAO.create(entryBook);
// commit
transaction.commitTransaction();
}
catch (TopiaException ex) {
- if (transaction != null) {
- try {
- transaction.rollbackTransaction();
- } catch (TopiaException e) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- }
- }
- if (log.isErrorEnabled()) {
- log.error("Error during create account", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
+ doCatch(transaction, ex, log);
}
finally {
- if (transaction != null) {
- try {
- transaction.closeContext();
- } catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
- }
- }
+ doFinally(transaction, log);
}
}
- /*
- * Création d'un EntryBook à partir de son DTO.
- * @param EntryBookDTO EntryBook au format DTO.
- * @return
- *
- public String createEntryBook(EntryBookDTO EntryBookDTO) {
- String result;
- result = createEntryBook(EntryBookDTO.getLabel(), EntryBookDTO.getPrefix(),
- EntryBookDTO.getDescription());
- return result;
- }*/
-
- public List<EntryBook> getAllEntryBook() throws LimaException {
+ public List<EntryBook> getAllEntryBooks() throws LimaException {
/*List<EntryBookDTO> listEntryBookDTO = new ArrayList<EntryBookDTO>();
try {
@@ -208,31 +180,10 @@
transaction.commitTransaction();
}
catch (TopiaException ex) {
- if (transaction != null) {
- try {
- transaction.rollbackTransaction();
- } catch (TopiaException e) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- }
- }
- if (log.isErrorEnabled()) {
- log.error("Error during create account", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
+ doCatch(transaction, ex, log);
}
finally {
- if (transaction != null) {
- try {
- transaction.closeContext();
- } catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
- }
- }
+ doFinally(transaction, log);
}
return EntryBooksList;
@@ -310,45 +261,39 @@
return EntryBookDTO;
}*/
- /*
- * Permet de modifier un EntryBook.
- * @param label
- * @param prefix
- * @return
- *
- public String modifyEntryBook(String topiaId, String label, String prefix,
- String description) {
- String result = ServiceHelper.RESPOND_ERROR;
- EntryBook EntryBookModify = searchEntryBookWithTopiaId(topiaId);
- // Si le EntryBook n'existe pas
- if (EntryBookModify == null) {
- if (log.isWarnEnabled()) {
- log.warn("Le EntryBook " + label + " n'existe pas !");
+ /**
+ * Permet de modifier un journal.
+ *
+ * @param entryBook journal
+ * @throws LimaException
+ */
+ public void updateEntryBook(EntryBook entryBook) throws LimaException {
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ // test si un EntryBook de ce nom existe deja
+ EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(transaction);
+ EntryBook existingEntryBook = entryBookDAO.findByLabel(entryBook.getLabel());
+ if (existingEntryBook != null) {
+ throw new LimaBusinessException(_("An EntryBook already exists with this label : %s", entryBook.getLabel()));
}
- result = ServiceHelper.EntryBook_NOT_EXIST;
- } else // Sinon on modifie le EntryBook
- {
- try {
- // Acces BDD
- TopiaContext topiaContext = rootContext.beginTransaction();
- // Chargement du DAO
- EntryBookDAO EntryBookDAO = LimaCallaoDAOHelper
- .getEntryBookDAO(topiaContext);
- // Modifie le EntryBook
- EntryBookModify.setPrefix(prefix);
- EntryBookModify.setDescription(description);
- EntryBookDAO.update(EntryBookModify);
- // Création BDD
- topiaContext.commitTransaction();
- // Fermeture BDD
- topiaContext.closeContext();
- result = ServiceHelper.RESPOND_SUCCESS;
- } catch (TopiaException e) {
- log.error(e);
- }
+
+ // creation du EntryBook
+ entryBookDAO.update(entryBook);
+
+ // commit
+ transaction.commitTransaction();
}
- return result;
- }*/
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
/**
* Permet d'effacer un EntryBook dans la base de données.
@@ -360,7 +305,7 @@
* @return
* @throws LimaException
*/
- public void removeEntryBook(EntryBook EntryBook) throws LimaException {
+ public void removeEntryBook(EntryBook entryBook) throws LimaException {
/*String result = ServiceHelper.RESPOND_ERROR;
EntryBook EntryBookDelete = searchEntryBookWithTopiaId(topiaId);
// Si le EntryBook n'existe pas
@@ -408,7 +353,7 @@
}
}
return result;*/
-
+
TopiaContext topiaTransaction = null;
try {
// basic check done, make check in database
@@ -416,58 +361,23 @@
topiaTransaction = rootContext.beginTransaction();
// Vérifie si une transaction n'appartient pas à ce EntryBook.
- TransactionDAO transactionDAO = LimaCallaoDAOHelper.getTransactionDAO(topiaTransaction);
- Transaction transaction = transactionDAO.findByEntryBook(EntryBook);
+ Transaction transaction = transactionService.findByEntryBook(topiaTransaction, entryBook);
if (transaction != null) {
throw new LimaBusinessException("Can't delete EntryBook with transactions");
}
// test si un EntryBook de ce nom existe deja
EntryBookDAO EntryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaTransaction);
- EntryBookDAO.delete(EntryBook);
+ EntryBookDAO.delete(entryBook);
// commit
topiaTransaction.commitTransaction();
}
catch (TopiaException ex) {
- if (topiaTransaction != null) {
- try {
- topiaTransaction.rollbackTransaction();
- } catch (TopiaException e) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- }
- }
- if (log.isErrorEnabled()) {
- log.error("Error during create account", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
+ doCatch(topiaTransaction, ex, log);
}
finally {
- if (topiaTransaction != null) {
- try {
- topiaTransaction.closeContext();
- } catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during rollback context", ex);
- }
- throw new LimaException("Can't create EntryBook", ex);
- }
- }
+ doFinally(topiaTransaction, log);
}
}
-
- /*
- * Permet d'effacer un EntryBook dans la base de données.
- * ATTENTION : si un EntryBook est associé avec des transactions, il est alors
- * impossible de supprimer celui-ci.
- * @param EntryBookDTO EntryBook au format DTO à supprimer
- * @return
- *
- public String removeEntryBook(EntryBookDTO EntryBookDTO) {
- String result = removeEntryBook(EntryBookDTO.getId());
- return result;
- }*/
-
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,20 +1,20 @@
-/*
- * *##% Callao EntryServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FilesServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,49 +1,32 @@
-/*
- * *##% Callao FilesServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.dto.AccountDTO;
-import org.chorem.lima.business.dto.EntryDTO;
-import org.chorem.lima.business.dto.JournalDTO;
-import org.chorem.lima.business.dto.PeriodDTO;
-import org.chorem.lima.business.dto.TimeSpanDTO;
-import org.chorem.lima.business.dto.TransactionDTO;
import org.chorem.lima.business.utils.DateUtil;
-import org.chorem.lima.business.utils.ServiceHelper;
-import org.jdom.Attribute;
+import org.chorem.lima.entity.Account;
import org.jdom.Document;
import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-import org.jdom.xpath.XPath;
-import org.nuiton.topia.TopiaContext;
/**
* Cette classe permet d'importer et exporter des données comptables. Ces données
@@ -318,7 +301,7 @@
* @param listAccountDTO
* @param accounts
*/
- protected void accountXML(List<AccountDTO> listAccountDTO, Element accounts) {
+ protected void accountXML(List<Account> listAccount, Element accounts) {
/*for (AccountDTO accountDTO : listAccountDTO) {
Element account = new Element("account");
accounts.addContent(account);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,30 +1,39 @@
-/*
- * *##% Callao TimeSpanServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
+import java.util.List;
+
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FinancialPeriodDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
/**
@@ -33,7 +42,8 @@
*
* @author Rémi Chapelet
*/
-public class FinancialPeriodServiceImpl { //implements TimeSpanService {
+@Stateless
+public class FinancialPeriodServiceImpl extends AbstractLimaService implements FinancialPeriodService {
/** log */
private static final Log log = LogFactory.getLog(FinancialPeriodServiceImpl.class);
@@ -61,8 +71,9 @@
* @param locked est à vrai si la période doit être bloquée.
* @return
*/
- public void createTimeSpan(FinancialPeriod timeSpan /*Date beginTimeSpan, Date endTimeSpan,
- Period period, boolean locked*/) {
+ @Override
+ public void createFinancialPeriod(FinancialPeriod financialPeriod /*Date beginTimeSpan, Date endTimeSpan,
+ Period period, boolean locked*/) throws LimaException {
/*
// timeSpan correspond à une période mensuelle.
// La fonction va donc prendre seulement pour date de référence la
@@ -101,8 +112,94 @@
log.error(e);
return ServiceHelper.RESPOND_ERROR;
}*/
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ createFinancialPeriod(transaction, financialPeriod);
+
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
}
+ /**
+ * Create a financial period with an opened transaction.
+ *
+ * @param transaction opened transaction
+ * @param financialPeriod financial period
+ * @throws TopiaException
+ */
+ protected void createFinancialPeriod(TopiaContext transaction, FinancialPeriod financialPeriod) throws TopiaException {
+
+ FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
+ financialPeriodDAO.create(financialPeriod);
+
+ }
+
+ @Override
+ public List<FinancialPeriod> getAllFinancialPeriods() throws LimaException {
+
+ List<FinancialPeriod> result = null;
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
+ result = financialPeriodDAO.findAll();
+
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<FinancialPeriod> getNonLockedFinancialPeriods() throws LimaException {
+
+ List<FinancialPeriod> result = null;
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper.getFinancialPeriodDAO(transaction);
+ result = financialPeriodDAO.findAllByLocked(false);
+
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return result;
+ }
+
/*
* Permet de trouver un timespan directement avec une date. La date peut
* être quelconque. Exemple : d = 17 sept 2000, renvoie la période du
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,30 +1,43 @@
-/*
- * *##% Callao PeriodServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.entity.FiscalPeriodDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
/**
@@ -34,13 +47,14 @@
*
* @author Rémi Chapelet
*/
-public class FiscalPeriodServiceImpl { //implements PeriodService {
+@Stateless
+public class FiscalPeriodServiceImpl extends AbstractLimaService implements FiscalPeriodService {
private static final Log log = LogFactory.getLog(FiscalPeriodServiceImpl.class);
private TopiaContext rootContext;
- private FinancialPeriodServiceImpl timeSpanServiceImpl = new FinancialPeriodServiceImpl();
+ private FinancialPeriodServiceImpl financialPeriodService = new FinancialPeriodServiceImpl();
public FiscalPeriodServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -54,16 +68,23 @@
}
/**
- * Permet de créer une période principale. Elle a une durée de un an,
- * composées de 12 périodes mensuelles. Elle correspond à l'exercice
- * comptable. Pour créer une nouvelle période, la précédente doit être
- * obligatoirement clôturée.
+ * Permet de créer un exercice.
+ *
+ * Elle a une durée de un an, composées de 12 périodes mensuelles.
+ * Elle peut aussi être plus courte ou plus longue si l'entreprise
+ * se constitu ou entre en liquidation ou que l'entreprise decide
+ * de changer
+ *
+ * Elle correspond à l'exercice comptable.
+ * Pour créer une nouvelle période, la précédente doit être obligatoirement clôturée.
+ *
* @param beginTimeSpan date début de période
* @param endTimeSpan date fin de période
* @param lock Vrai si la période est bloquée
* @return
*/
- public void createPeriod(FinancialPeriod period /*Date beginTimeSpan, Date endTimeSpan, boolean lock*/) {
+ @Override
+ public void createFiscalPeriod(FiscalPeriod fiscalPeriod /*Date beginTimeSpan, Date endTimeSpan, boolean lock*/) throws LimaException {
/*// Par défaut lock est à false
lock = false;
String result = ServiceHelper.RESPOND_ERROR;
@@ -127,8 +148,72 @@
log.error(e);
}
return result; */
+
+ // un exercice ne peut pas faire plus de 24 mois dans tous les cas
+
+ // un exercice doit faire au moins une période
+ if ( fiscalPeriod.getFinancialPeriod() == null ||
+ fiscalPeriod.getFinancialPeriod().isEmpty()) {
+ throw new LimaBusinessException(_("A fiscal period must have at least one financial period !"));
+ }
+
+ // un exercice doit être collé au precedent
+
+ // un exercice ne peut être crée que si l'anti precedent est fermé
+ // on peut creer un exercice si le precedent n'est pas fermé
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ // TODO maybe put this in antoher place
+ for (FinancialPeriod financialPeriod : fiscalPeriod.getFinancialPeriod()) {
+ financialPeriodService.createFinancialPeriod(transaction, financialPeriod);
+ }
+
+ FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+ fiscalPeriodDAO.create(fiscalPeriod);
+
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
}
+ public List<FiscalPeriod> getAllFiscalPeriods() throws LimaException {
+
+ List<FiscalPeriod> result = null;
+
+ TopiaContext transaction = null;
+ try {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ transaction = rootContext.beginTransaction();
+
+ FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
+ result = fiscalPeriodDAO.findAll();
+
+ // commit
+ transaction.commitTransaction();
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return result;
+ }
+
/*
* Permet de créer une période à partir d'une période DTO.
* @param periodDTO période à créer au format DTO.
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,120 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business.ejb;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.ejb.Stateless;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ImportExportService;
+import org.chorem.lima.business.LimaException;
+
+/**
+ * XML and CSV import export service.
+ *
+ * TODO maybe split this impl into different XML and CSV impl.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+@Stateless
+public class ImportExportServiceImpl implements ImportExportService {
+
+ private static final Log log = LogFactory.getLog(ImportExportServiceImpl.class);
+
+ /*
+ * @see org.chorem.lima.business.ImportExportService#exportAsXML()
+ */
+ @Override
+ public byte[] exportAsXML() throws LimaException {
+
+ byte[] data = null;
+ ByteArrayOutputStream byteArrayOutputStream = null;
+ try {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ exportAsXML(byteArrayOutputStream);
+ }
+ catch (IOException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't export as xml", eee);
+ }
+ throw new LimaException("Can't export as xml", eee);
+ }
+ finally {
+ IOUtils.closeQuietly(byteArrayOutputStream);
+ }
+
+ if (byteArrayOutputStream != null) {
+ data = byteArrayOutputStream.toByteArray();
+ }
+
+ return data;
+ }
+
+ /**
+ * Do real output into a simple {@link OutputStream}.
+ *
+ * @param output
+ * @throws IOException
+ */
+ protected void exportAsXML(OutputStream output) throws IOException {
+
+ }
+
+ /*
+ * @see org.chorem.lima.business.ImportExportService#importAsXML(byte[])
+ */
+ @Override
+ public void importAsXML(byte[] data) {
+
+ }
+
+ /*
+ * @see org.chorem.lima.business.ImportExportService#exportAsCSV()
+ */
+ @Override
+ public byte[] exportAsCSV() throws LimaException {
+ return null;
+ }
+
+ /*
+ * @see org.chorem.lima.business.ImportExportService#importAsCSV(byte[])
+ */
+ @Override
+ public void importAsCSV(byte[] data) throws LimaException {
+
+ }
+
+ /*
+ * @see org.chorem.lima.business.ImportExportService#importAsEBPCSV(byte[])
+ */
+ @Override
+ public void importAsEbpCSV(byte[] data) throws LimaException {
+
+ }
+}
Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportExportServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,20 +1,20 @@
-/*
- * *##% Callao LogServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
@@ -22,12 +22,15 @@
import java.util.ArrayList;
import java.util.List;
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.RecordService;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.Record;
import org.chorem.lima.entity.RecordDAO;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
@@ -40,7 +43,8 @@
*
* @author Rémi Chapelet
*/
-public class RecordServiceImpl { //implements LogService {
+@Stateless
+public class RecordServiceImpl implements RecordService {
/** log */
private static final org.apache.commons.logging.Log log = LogFactory
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,61 +1,57 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
package org.chorem.lima.business.ejb;
-import org.nuiton.topia.TopiaContext;
+import javax.ejb.Stateless;
-public class ReportServiceImpl { //implements ReportService {
+import org.chorem.lima.business.ReportService;
- //@Override
+@Stateless
+public class ReportServiceImpl implements ReportService {
+
public String generateAccount(String number, String amount, String label) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
+ public String generateBalanceTrial(String period) {
+ return null;
+ }
+
public String generateBalanceSheet(String period) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
public String generateCashFlowStatement(String period) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
public String generateGeneralLedger(String period) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
public String generateIncomeStatement(String period) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
public String generateJournal(String type, String period) {
- // TODO Auto-generated method stub
return null;
}
- //@Override
- public String[] getMethods() {
- // TODO Auto-generated method stub
- return null;
- }
-
- //@Override
- public void destroy() {
- // TODO Auto-generated method stub
-
- }
-
- //@Override
- public void init(TopiaContext arg0) {
- // TODO Auto-generated method stub
-
- }
-
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/TransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/TransactionServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/TransactionServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,47 +1,39 @@
-/*
- * *##% Callao TransactionServiceImpl
- * Copyright (C) 2009 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaConfig;
-import org.chorem.lima.business.dto.EntryDTO;
-import org.chorem.lima.business.dto.LogDTO;
-import org.chorem.lima.business.dto.TransactionDTO;
-import org.chorem.lima.business.utils.ServiceHelper;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryDAO;
+import org.chorem.lima.business.TransactionService;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
-import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.Transaction;
import org.chorem.lima.entity.TransactionDAO;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.framework.TopiaQuery;
/**
* Cette classe permet la création d'une transaction comptable dans l'application.
@@ -52,18 +44,18 @@
*
* @author Rémi Chapelet
*/
-public class TransactionServiceImpl {
+@Stateless
+public class TransactionServiceImpl implements TransactionService {
- private static final Log log = LogFactory
- .getLog(TransactionServiceImpl.class);
+ private static final Log log = LogFactory.getLog(TransactionServiceImpl.class);
private TopiaContext rootContext;
- private RecordServiceImpl logServiceImpl = new RecordServiceImpl();
+ //private RecordServiceImpl logServiceImpl = new RecordServiceImpl();
- private EntryServiceImpl entryServiceImpl = new EntryServiceImpl();
+ //private EntryServiceImpl entryServiceImpl = new EntryServiceImpl();
- private FinancialPeriodServiceImpl timeSpanServiceImpl = new FinancialPeriodServiceImpl();
+ //private FinancialPeriodServiceImpl timeSpanServiceImpl = new FinancialPeriodServiceImpl();
public TransactionServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
@@ -742,5 +734,26 @@
boolean isTransactionBalanced = debit == credit;
return isTransactionBalanced;
}*/
+
+ /**
+ * Permet de retrouver la premiere transaction associée au journal.
+ *
+ * @param topiaTransaction context à utiliser
+ * @param entryBook journal
+ * @throws TopiaException
+ */
+ protected Transaction findByEntryBook(TopiaContext topiaTransaction, EntryBook entryBook) throws TopiaException {
+ TransactionDAO transactionDAO = LimaCallaoDAOHelper.getTransactionDAO(topiaTransaction);
+
+ TopiaQuery query = transactionDAO.createQuery();
+ // entryBook is not visible, but column "entryBook"
+ // exist in transaction table
+ query.add("entryBook", entryBook);
+
+ Transaction result = transactionDAO.findByQuery(query);
+
+ return result;
+ }
+
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,20 +1,20 @@
-/*
- * *##% Callao
- * Copyright (C) 2010 CodeLutin
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
*/
package org.chorem.lima.business.ejb;
@@ -23,12 +23,9 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.entity.User;
-import org.chorem.lima.entity.UserDAO;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaNotFoundException;
/**
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java (from rev 2802, trunk/lima-swing/src/main/java/org/chorem/lima/export/CSVExport.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVExport.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,199 @@
+/**
+ * *##% Lima-Callao CVSImport
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.business.ejb.csv;
+
+import au.com.bytecode.opencsv.CSVWriter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+import org.chorem.lima.dto.AccountDTO;
+import org.chorem.lima.dto.EntryDTO;
+import org.chorem.lima.dto.JournalDTO;
+import org.chorem.lima.dto.PeriodDTO;
+import org.chorem.lima.dto.TransactionDTO;
+import org.chorem.lima.util.Util;
+import org.chorem.lima.service.util.ServiceHelper;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileWriter;
+import java.util.*;
+
+/**
+ * Cette méthode permet d'exporter toutes les données de Lima dans un fichier
+ * au format csv.
+ *
+ * @author Rémi Chapelet
+ */
+public class CSVExport {
+
+ private static final Log log = LogFactory.getLog(CSVExport.class);
+ private CSVWriter csvWriter;
+
+ /**
+ * Création de l'instance CSVWriter avec le fichier en paramètre.
+ * @param path
+ */
+ public CSVExport(String path) {
+ try {
+ File f = new File(path);
+ // Le fichier a pour séparateur ';'
+ csvWriter = new CSVWriter(new FileWriter(f), ';');
+ } catch (IOException e) {
+ log.debug(e);
+ }
+ }
+
+ /**
+ * Permet de retourner l'instance csv du fichier.
+ * @return
+ * @throws java.io.IOException
+ */
+ public CSVWriter getCSVWriter() throws IOException {
+ return csvWriter;
+ }
+
+ /**
+ * Méthode principale qui appelle chaque méthode pour chaque type de données
+ * à enregistrer (journaux, comptes, etc).
+ * @return
+ */
+ public String exportDatas() {
+ String result = ServiceHelper.RESPOND_SUCCESS;
+ /**
+ * Export des données
+ */
+ String[] nextLine = new String[1];
+ // Début période
+ // Sélection la période utilisée actuellement
+ PeriodDTO period = LimaContext.getContext().getDataManager()
+ .getCurrentPeriod();
+ // Si la période courante est une période mensuelle, on récupère la période annuelle
+ if (period.getParent() != null) {
+ period = period.getParent();
+ }
+ nextLine[0] = Util.DateToString(period.getBegin(), "dd/MM/yyyy");
+ csvWriter.writeNext(nextLine);
+ // Fin périod
+ nextLine[0] = Util.DateToString(period.getEnd(), "dd/MM/yyyy");
+ csvWriter.writeNext(nextLine);
+ // Export données
+ exportAccount();
+ exportJournal();
+ exportTransaction();
+ // Ecriture dans le fichier les données dans le tampon
+ try {
+ csvWriter.flush();
+ csvWriter.close();
+ } catch (IOException e) {
+ log.debug(e);
+ result = ServiceHelper.RESPOND_ERROR;
+ }
+ return result;
+ }
+
+ /**
+ * Export des comptes
+ */
+ public void exportAccount() {
+ String[] nextLine = new String[5];
+ // Récupère tous les comptes
+ List<AccountDTO> listAccount = ServiceHelper
+ .getAllFlatAccount(LimaContext.getContext().getDataManager()
+ .getAccountModel().getData());
+ // Pour tous les comptes
+ for (AccountDTO account : listAccount) {
+ nextLine[0] = "C";
+ nextLine[1] = account.getIdNumber();
+ nextLine[2] = account.getDescription();
+ nextLine[3] = account.getType();
+ nextLine[4] = account.getIdSeq();
+ // Ajoute la ligne au fichier
+ csvWriter.writeNext(nextLine);
+ }
+ }
+
+ /**
+ * Export des journaux
+ */
+ public void exportJournal() {
+ String[] nextLine = new String[5];
+ // Récupère tous les journaux
+ List<JournalDTO> listJournal = LimaContext.getContext()
+ .getDataManager().getJournalModel().getData();
+ // Pour tous les journaux
+ for (JournalDTO journal : listJournal) {
+ nextLine[0] = "J";
+ nextLine[1] = journal.getIdName();
+ nextLine[2] = journal.getPrefix();
+ nextLine[3] = journal.getDescription();
+ nextLine[4] = journal.getIdSeq();
+ // Ajoute la ligne au fichier
+ csvWriter.writeNext(nextLine);
+ }
+ }
+
+ /**
+ * Export des transactions et entrées comptables
+ */
+ public void exportTransaction() {
+ String[] nextLineTrans = new String[8];
+ String[] nextLineEntry = new String[7];
+ // Récupère toutes les transactions
+ List<TransactionDTO> listTransaction = LimaContext.getContext()
+ .getDataManager().getTransactionModel().getData();
+ // Pour toutes les transactions
+ for (TransactionDTO transaction : listTransaction) {
+ nextLineTrans[0] = "T";
+ nextLineTrans[1] = transaction.getVoucherRef();
+ nextLineTrans[2] = transaction.getDescription().trim();
+ nextLineTrans[3] = transaction.getIdName().trim();
+ nextLineTrans[4] = Util.DateToString(transaction.getEntryDate(),
+ "dd/MM/yyyy");
+ nextLineTrans[5] = transaction.getJournal().getPrefix();
+ nextLineTrans[6] = Util.DateToString(transaction.getPeriod()
+ .getBegin(), "dd/MM/yyyy");
+ nextLineTrans[7] = transaction.getIdSeq();
+ // Ajoute la ligne au fichier
+ csvWriter.writeNext(nextLineTrans);
+ /**
+ * Ajout des entrées
+ */
+ List<EntryDTO> listEntry = transaction.getEntries();
+ // Pour chaque entrée de la transaction
+ for (EntryDTO entry : listEntry) {
+ nextLineEntry[0] = "E";
+ nextLineEntry[1] = entry.getAccount().getIdNumber();
+ nextLineEntry[2] = entry.getDescription();
+ nextLineEntry[3] = entry.getAmount();
+ nextLineEntry[4] = entry.getLettrage();
+ if (entry.getDebit()) {
+ nextLineEntry[5] = "D";
+ } else {
+ nextLineEntry[5] = "C";
+ }
+ nextLineEntry[6] = entry.getIdSeq();
+ // Ajoute la ligne au fichier
+ csvWriter.writeNext(nextLineEntry);
+ }
+ }
+ }
+
+}
\ No newline at end of file
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImport.java (from rev 2802, trunk/lima-swing/src/main/java/org/chorem/lima/imports/CSVImport.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImport.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImport.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,361 @@
+/**
+ * *##% Lima-Callao CVSImport
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.business.ejb.csv;
+
+import au.com.bytecode.opencsv.CSVReader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+import org.chorem.lima.dto.AccountDTO;
+import org.chorem.lima.dto.EntryDTO;
+import org.chorem.lima.dto.JournalDTO;
+import org.chorem.lima.dto.PeriodDTO;
+import org.chorem.lima.dto.TransactionDTO;
+import org.chorem.lima.dto.util.DTOHelper;
+import org.chorem.lima.util.Util;
+import org.chorem.lima.service.*;
+import org.chorem.lima.service.util.ServiceHelper;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.*;
+
+
+/**
+ * Cette classe permet d'importer un fichier de données au format csv créé
+ * par l'application Lima
+ *
+ * @author Rémi Chapelet
+ */
+public class CSVImport {
+
+ private static final Log log = LogFactory.getLog(CSVImport.class);
+ private CSVReader csvReader;
+ private LinkedList<TransactionDTO> listTransactions= new LinkedList<TransactionDTO>();
+ private TransactionDTO transactionLast = null;
+
+ protected final PeriodService periodService;
+ protected final EntryService entryService;
+ protected final TransactionService transactionService;
+
+ /**
+ * Le constructeur avec en paramètre l'adresse du fichier de données.
+ * @param path
+ */
+ public CSVImport(String path) {
+ try {
+ File f = new File(path);
+ // Le fichier a pour séparateur ';'
+ csvReader = new CSVReader(new FileReader(f), ';');
+ } catch (FileNotFoundException e) {
+ log.debug(e);
+ }
+ // Déclaration des services
+ periodService = ServiceFactory.getServiceFactory().getPeriodService();
+ entryService = ServiceFactory.getServiceFactory().getEntryService();
+ transactionService = ServiceFactory.getServiceFactory().getTransactionService();
+ }
+
+ /**
+ * permet de retourner l'instance csv du fichier.
+ * @return
+ * @throws java.io.FileNotFoundException
+ */
+ public CSVReader getCSVReader() throws FileNotFoundException {
+ return csvReader;
+ }
+
+
+ /**
+ * Fonction principale permettant de lire un fichier au format csv.
+ * Chaque ligne possède un identifiant :
+ * C : compte
+ * J : journal
+ * E : entrée comptable
+ * T : transaction
+ * @return
+ */
+ public String importDatas ()
+ {
+ // Message de retour de la méthode : success ou error
+ String result = ServiceHelper.RESPOND_ERROR;
+ try {
+ /**
+ * Déclaration des variables
+ */
+ // Tableau de chaines correspondant à chaque ligne du fichier qui sera lue.
+ String[] nextLine;
+ // Création account Master
+ // Lima possède un compte principal, numéroté '0'.
+ AccountDTO accountRac = new AccountDTO("0", "0", "Plan comptable", null, new LinkedList<AccountDTO>(), null);
+
+ /**
+ * Lecture des premières lignes du fichier
+ */
+ nextLine = csvReader.readNext(); // Date début période
+ Date beginPeriod = Util.stringToDate(nextLine[0], "dd/MM/yyyy");
+ nextLine = csvReader.readNext(); // Date fin période
+ Date endPeriod = Util.stringToDate(nextLine[0], "dd/MM/yyyy");
+
+ /**
+ * Création de la période : l'exercice comptable avec ses 12 mois.
+ */
+ // Création de l'exercice
+ Date begin = Util.InitDateFirstDayMonth(beginPeriod);
+ Date end = Util.InitDateEndDayMonth(endPeriod);
+ PeriodDTO period = new PeriodDTO("",Integer.toString(begin.getYear()+1900),begin,end,null,null,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN"));
+ // Création des 12 mois
+ List<PeriodDTO> listPeriodChild = new LinkedList<PeriodDTO>();
+ // Pour chaque mois
+ for (int i=0 ; i<12 ; i++)
+ {
+ Date beginTimeSpan = Util.InitDateFirstDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate()));
+ Date endTimeSpan = Util.InitDateEndDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate()));
+ // Création période
+ PeriodDTO periodChild = new PeriodDTO("",ServiceHelper.dateToMonth(beginTimeSpan)+" "+(beginTimeSpan.getYear()+1900),beginTimeSpan,endTimeSpan,null,period,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN"));
+ listPeriodChild.add(periodChild);
+ }
+ // On ajoute les 12 mois à l'exercice
+ period.setChildren(listPeriodChild);
+ // On ajoute la liste des exercices (ici un seul exercice) à Lima
+ LinkedList<PeriodDTO> listPeriod= new LinkedList<PeriodDTO>();
+ listPeriod.add(period);
+ // Ajoute la période dans le service des Périodes
+ periodService.createPeriod(period, LimaContext.getContext().getDataManager().getStatus());
+ // Réinitialise les périodes
+ LimaContext.getContext().getDataManager().resetPeriodes(listPeriod);
+
+ /**
+ * Lecture de chaque ligne
+ * Ajout des comptes, journaux et entrées comptables
+ */
+ boolean endReadAccount = false; // Vrai lorsque tous les comptes sont chargés
+ // Pour chaque ligne
+ while ((nextLine = csvReader.readNext()) != null) {
+ // Lecture de la 1ière cellule
+ String indice = nextLine[0];
+ /**
+ * Compte
+ */
+ if ( indice.equals("C") )
+ {
+ log.debug("Ajout compte "+nextLine[1]);
+ result = importAccount(nextLine,accountRac);
+ }
+ /**
+ * Journal
+ */
+ if ( indice.equals("J") )
+ {
+ // Tous les comtes ont été chargés, on relance pour les charger
+ if (!endReadAccount)
+ {
+ LimaContext.getContext().getDataManager().resetAccountModel(accountRac);
+ endReadAccount = true;
+ }
+ log.debug("Ajout journal "+nextLine[1]);
+ result = importJournal(nextLine);
+ }
+ /**
+ * Transaction
+ */
+ if ( indice.equals("T") )
+ {
+ log.debug("Ajout transaction "+nextLine[1]);
+ result = importTransactions(nextLine);
+ }
+ /**
+ * Entry
+ */
+ if ( indice.equals("E") )
+ {
+ log.debug("Ajout entry "+nextLine[1]);
+ result = importEntries(nextLine);
+ }
+ }
+ }catch ( Exception e) {
+ log.debug(e);
+ }
+
+ // Reset transactions
+ LimaContext.getContext().getDataManager().resetTransactionModel(listTransactions);
+ return result;
+ }
+
+ /**
+ * Permet de découper une ligne du fichier csv pour charger les comptes.
+ * Pour chaque compte, il vérifie si il appartient à un compte père.
+ * Exemple : compte 164 - 'Emprunts auprès des établissements'
+ * On recherche dans tous les comptes, le compte numéro 16, si il existe,
+ * alors 16 sera le compte père, sinon on remonte d'un rang (recherche sur
+ * le compte 1, etc.).
+ * @param line
+ * @return
+ */
+ public String importAccount(String[] line,AccountDTO accountRac)
+ {
+ // Numéro de compte (exemple : 512)
+ String numberAccount = line[1];
+ // Label du compte (exemple : Banque)
+ String label = line[2];
+ // Actif/Passif/Produit/Charge
+ String type = line[3];
+ /**
+ * Détection des comptes pères
+ */
+ AccountDTO accountMaster = null;
+ // si compte principal correspondant à une classe (1-2-3-4-5-6-7-8)
+ if ( numberAccount.length() == 1 ) // c-a-d taille du numéro de compte à 1
+ {
+ accountMaster = accountRac;
+ } else {
+ // Sinon on recherche un compte père
+ int i=1;
+ // Liste des comptes existants
+ List<AccountDTO> listAccount = ServiceHelper.getAllFlatAccount(accountRac);
+ // Tant que le compte père n'a pas été trouvé
+ while (i<numberAccount.length() && accountMaster == null)
+ {
+ accountMaster = ServiceHelper.findAccountById(listAccount,numberAccount.substring(0, numberAccount.length()-i));
+ i++;
+ }
+ }
+ // Création du compte
+ AccountDTO account = new AccountDTO("",numberAccount,label,type,new LinkedList<AccountDTO>(),accountMaster);
+ String result = LimaContext.getContext().getDataManager().getAccountModel().addAccount(account);
+ return result;
+ }
+
+ /**
+ * Import des transactions. Il recherche le journal correspondant dans la
+ * base. C'est pourquoi le journal doit être chargé avant la lecture des
+ * transactions. Il fait de même avec les périodes. Lorsqu'il a chargé
+ * toutes les données de la transaction, il ajoute celle-ci dans lima.
+ * Il associe également la transaction lue dans la variable transactionLast.
+ * ainsi après avoir lu la transaction, il va lire les entrées de la transaction.
+ * Lors de l'ajout d'une entrée, il est nécessaire de connaître la transaction
+ * à laquelle elle est rattachée.
+ * @param line
+ * @return
+ */
+ public String importTransactions (String[] line)
+ {
+ String result="";
+ // document de référence
+ String voucherRef = line[1];
+ // description
+ String description = line[2];
+ // nom de la transaction
+ String name = line[3];
+ // date de transaction
+ Date date = Util.stringToDate(line[4], "dd/MM/yyyy");
+ // journal
+ String journal = line[5];
+ JournalDTO journalDTO = ServiceHelper.findJournalById(
+ LimaContext.getContext().getDataManager().getJournalModel().getData(),
+ journal);
+ if (journalDTO == null) {
+ log.warn("Import : Journal " + journal + " does not exist.");
+ }
+ // periode
+ Date period = Util.stringToDate(line[6], "dd/MM/yyyy");
+ // Recherche la période correspondante
+ PeriodDTO periodDTO = ServiceHelper.findPeriodByDate(
+ ServiceHelper.getAllFlatPeriod(LimaContext.getContext().getDataManager().getPeriodes()), period);
+ /**
+ * Création de la transaction
+ */
+ TransactionDTO transaction = new TransactionDTO(null, name, date,
+ voucherRef, description, journalDTO, new LinkedList<EntryDTO>(), periodDTO,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "TR_WIP"));
+ transactionLast = transaction;
+ // Ajoute la transaction dans le service
+ //result = Main.getContext().getDataManager().getTransactionModel().addTransaction(transaction);
+ result = transactionService.addTransaction(transaction, LimaContext.getContext().getDataManager().getStatus());
+ // Ajoute la transaction dans la liste des transactions
+ listTransactions.add(transaction);
+ return result;
+ }
+
+ /**
+ * Permet de rechercher toutes les entrées comptables dans le fichier.
+ * @param line
+ * @param nameTransacPrev
+ * @return
+ */
+ public String importEntries (String[] line)
+ {
+ String result;
+ /**
+ * Account
+ */
+ String accountId = line[1];
+ AccountDTO accountDTO = ServiceHelper.findAccountById(
+ ServiceHelper.getAllFlatAccount(LimaContext.getContext().getDataManager().getAccountModel().getData()),
+ accountId);
+ if (accountDTO == null) {
+ log.warn("Import : Account " + accountId + " does not exist.");
+ }
+ /**
+ * Description
+ */
+ String description = line[2];
+ /**
+ * Amount
+ */
+ String amount = line[3].trim();
+ /**
+ * Lettrage
+ */
+ String lettrage = line[4];
+ /**
+ * Debit - Credit
+ */
+ boolean debit = line[5].equals("D");
+ // Création de l'entrée comptable
+ EntryDTO entry = new EntryDTO("",description,DTOHelper.format(amount),debit,lettrage,accountDTO,transactionLast,null);
+ // Ajout de l'entrée comptable dans le service
+ result = entryService.addEntry(LimaContext.getContext().getDataManager().getStatus(), entry);
+ // Ajout l'entrée à la transaction
+ transactionLast.addChild(entry);
+ return result;
+ }
+
+ /**
+ * Cette méthode permet d'importer les journaux.
+ * @param line
+ * @return
+ */
+ public String importJournal (String[] line)
+ {
+ String name = line[1];
+ String prefixe = line[2];
+ String description = line[3];
+ // Création du journal
+ JournalDTO journalDTO = new JournalDTO("",name,description,prefixe);
+ // Ajout du journal dans le modèle de Lima
+ String result = LimaContext.getContext().getDataManager().getJournalModel().addJournal(journalDTO);
+ return result;
+ }
+
+}
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImportEBP.java (from rev 2802, trunk/lima-swing/src/main/java/org/chorem/lima/imports/CSVImportEBP.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImportEBP.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/CSVImportEBP.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,362 @@
+/**
+ * *##% Lima-Callao CVSImportEBP
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.business.ejb.csv;
+
+import au.com.bytecode.opencsv.CSVReader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+import org.chorem.lima.balance.Category;
+import org.chorem.lima.dto.AccountDTO;
+import org.chorem.lima.dto.EntryDTO;
+import org.chorem.lima.dto.JournalDTO;
+import org.chorem.lima.dto.PeriodDTO;
+import org.chorem.lima.dto.TransactionDTO;
+import org.chorem.lima.dto.util.DTOHelper;
+import org.chorem.lima.util.Util;
+import org.chorem.lima.service.*;
+import org.chorem.lima.service.util.ServiceHelper;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.*;
+
+
+/**
+ * Cette classe permet d'importer un fichier de données au format csv.
+ * Il respecte la norme de l'application EBP. Toutefois, il est possible de modifier
+ * facilement et adapter le code pour un autre type de formatage de données.
+ *
+ * @author Rémi Chapelet
+ */
+public class CSVImportEBP {
+
+ private static final Log log = LogFactory.getLog(CSVImportEBP.class);
+ private CSVReader csvReader;
+ private LinkedList<TransactionDTO> listTransactions= new LinkedList<TransactionDTO>();
+ private TransactionDTO transactionWithSamePrefix = null;
+
+ protected final PeriodService periodService;
+ protected final EntryService entryService;
+ protected final TransactionService transactionService;
+
+ /**
+ * Le constructeur avec en paramètre l'adresse du fichier de données.
+ * @param path
+ */
+ public CSVImportEBP(String path) {
+ //URL url = CSVImportEBP.class.getResource(path);
+ try {
+ File f = new File(path);
+ // Le fichier a pour séparateur ';'
+ csvReader = new CSVReader(new FileReader(f), ';');
+ } catch (FileNotFoundException e) {
+ log.debug(e);
+ }
+ // Déclaration des services
+ periodService = ServiceFactory.getServiceFactory().getPeriodService();
+ entryService = ServiceFactory.getServiceFactory().getEntryService();
+ transactionService = ServiceFactory.getServiceFactory().getTransactionService();
+ }
+
+ /**
+ * permet de retourner l'instance csv du fichier.
+ * @return
+ * @throws java.io.FileNotFoundException
+ */
+ public CSVReader getCSVReader() throws FileNotFoundException {
+ return csvReader;
+ }
+
+
+ /**
+ * Fonction principale permettant de lire un fichier au format csv.
+ * Ce dernier permet de lire les fichiers de l'application EBP.
+ * Chaque ligne possède un identifiant :
+ * C : compte
+ * J : journal
+ * E : entrée comptable
+ * Attention : EBP ne possède pas dans son fichier de sauvegarde de
+ * transactions, mais seulement des entrées. Or Lima utilise les transactions,
+ * reliées aux entrées. Il est donc important de créer une transaction pour
+ * chaque groupe d'entrées comptables.
+ * @return
+ */
+ public String importDatas ()
+ {
+ // Message de retour de la méthode : success ou error
+ String result = ServiceHelper.RESPOND_ERROR;
+ try {
+ /**
+ * Déclaration des variables
+ */
+ // Tableau de chaines correspondant à chaque ligne du fichier qui sera lue.
+ String[] nextLine;
+ // Création account Master
+ // Lima possède un compte principal, numéroté '0'.
+ AccountDTO accountRac = new AccountDTO("0", "0", "Plan comptable", null, new LinkedList<AccountDTO>(), null);
+
+ /**
+ * Lecture des 6 premières lignes du fichier
+ */
+ csvReader.readNext(); // Nom application
+ csvReader.readNext(); // Codage des caractères
+ csvReader.readNext(); // Code 01
+ csvReader.readNext(); // Nom de l'entreprise
+ nextLine = csvReader.readNext(); // Date début période
+ Date beginPeriod = Util.stringToDate(nextLine[0], "ddMMyyyy");
+ nextLine = csvReader.readNext(); // Date fin période
+ Date endPeriod = Util.stringToDate(nextLine[0], "ddMMyyyy");
+
+ /**
+ * Création de la période : l'exercice comptable avec ses 12 mois.
+ */
+ // Création de l'exercice
+ Date begin = Util.InitDateFirstDayMonth(beginPeriod);
+ Date end = Util.InitDateEndDayMonth(endPeriod);
+ PeriodDTO period = new PeriodDTO("",Integer.toString(begin.getYear()+1900),begin,end,null,null,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN"));
+ // Création des 12 mois
+ List<PeriodDTO> listPeriodChild = new LinkedList<PeriodDTO>();
+ // Pour chaque mois
+ for (int i=0 ; i<12 ; i++)
+ {
+ Date beginTimeSpan = Util.InitDateFirstDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate()));
+ Date endTimeSpan = Util.InitDateEndDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate()));
+ // Création période
+ PeriodDTO periodChild = new PeriodDTO("",ServiceHelper.dateToMonth(beginTimeSpan)+" "+(beginTimeSpan.getYear()+1900),beginTimeSpan,endTimeSpan,null,period,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN"));
+ listPeriodChild.add(periodChild);
+ }
+ // On ajoute les 12 mois à l'exercice
+ period.setChildren(listPeriodChild);
+ // On ajoute la liste des exercices (ici un seul exercice) à Lima
+ LinkedList<PeriodDTO> listPeriod= new LinkedList<PeriodDTO>();
+ listPeriod.add(period);
+ // Ajoute la période dans le service des Périodes
+ periodService.createPeriod(period, LimaContext.getContext().getDataManager().getStatus());
+ // Réinitialise les périodes
+ LimaContext.getContext().getDataManager().resetPeriodes(listPeriod);
+
+ /**
+ * Lecture de chaque ligne
+ * Ajout des comptes, journaux et entrées comptables
+ */
+ boolean endReadAccount = false; // Vrai lorsque tous les comptes sont chargés
+ String nameTransacPrev = ""; // Valeur du nom de la transaction précédente
+ // Pour chaque ligne
+ while ((nextLine = csvReader.readNext()) != null) {
+ // Lecture de la 1ière cellule
+ String indice = nextLine[0];
+ /**
+ * Compte
+ */
+ if ( indice.equals("C") )
+ {
+ log.debug("Ajout compte "+nextLine[1]);
+ result = importAccount(nextLine,accountRac);
+ }
+ /**
+ * Journal
+ */
+ if ( indice.equals("J") )
+ {
+ // Tous les comtes ont été chargés, on relance pour les charger
+ if (!endReadAccount)
+ {
+ LimaContext.getContext().getDataManager().resetAccountModel(accountRac);
+ endReadAccount = true;
+ }
+ log.debug("Ajout journal "+nextLine[1]);
+ result = importJournal(nextLine);
+ }
+ /**
+ * Entry
+ */
+ if ( indice.equals("E") )
+ {
+ log.debug("Ajout entry "+nextLine[1]);
+ result = importEntries(nextLine,nameTransacPrev);
+ nameTransacPrev = nextLine[4];
+ }
+ }
+ }catch ( Exception e) {
+ log.debug(e);
+ }
+
+ // Reset transactions
+ LimaContext.getContext().getDataManager().resetTransactionModel(listTransactions);
+ return result;
+ }
+
+ /**
+ * Permet de découper une ligne du fichier csv pour charger les comptes.
+ * Pour chaque compte, il vérifie si il appartient à un compte père.
+ * Exemple : compte 164 - 'Emprunts auprès des établissements'
+ * On recherche dans tous les comptes, le compte numéro 16, si il existe,
+ * alors 16 sera le compte père, sinon on remonte d'un rang (recherche sur
+ * le compte 1, etc.).
+ * @param line
+ * @return
+ */
+ public String importAccount(String[] line,AccountDTO accountRac)
+ {
+ // Numéro de compte (exemple : 512)
+ String numberAccount = line[1];
+ // Label du compte (exemple : Banque)
+ String label = line[2];
+ /**
+ * Détection des comptes pères
+ */
+ AccountDTO accountMaster = null;
+ // si compte principal correspondant à une classe (1-2-3-4-5-6-7-8)
+ if ( numberAccount.length() == 1 ) // c-a-d taille du numéro de compte à 1
+ {
+ accountMaster = accountRac;
+ } else {
+ // Sinon on recherche un compte père
+ int i=1;
+ // Liste des comptes existants
+ List<AccountDTO> listAccount = ServiceHelper.getAllFlatAccount(accountRac);
+ // Tant que le compte père n'a pas été trouvé
+ while (i<numberAccount.length() && accountMaster == null)
+ {
+ accountMaster = ServiceHelper.findAccountById(listAccount,numberAccount.substring(0, numberAccount.length()-i));
+ i++;
+ }
+ }
+ // Recherche de la catégorie
+ String category = Category.findCategory(numberAccount);
+ // Création du compte
+ AccountDTO account = new AccountDTO("",numberAccount,label,category,new LinkedList<AccountDTO>(),accountMaster);
+ String result = LimaContext.getContext().getDataManager().getAccountModel().addAccount(account);
+ return result;
+ }
+
+ /**
+ * Permet de rechercher toutes les transactions/entrées comptables dans le fichier.
+ * Néanmoins, le fichier ne possède pas de transactions, il est donc important
+ * d'identifier ces dernières. Il exsite dans le fichier des 'groupes" d'entrées
+ * comptables. Elles se suivent, et possèdent un numéro de document en
+ * commun (appelé dans l'algo ci-dessous 'numTransac').
+ * On vérifie à chaque fois si l'entrée appartient au groupe lu précédent. Si
+ * oui, alors on l'a rattache à la même transaction 'transactionWithSamePrefix' ;
+ * si non, on créé dans ce cas une nouvelle transaction 'transactionWithSamePrefix'.
+ * Chaque transaction est ajoutée dans une liste, pour les ajouter au modèle
+ * dans Lima.
+ * @param line
+ * @param nameTransacPrev
+ * @return
+ */
+ public String importEntries (String[] line, String nameTransacPrev)
+ {
+ String result;
+ /**
+ * Account
+ */
+ String accountId = line[1];
+ AccountDTO accountDTO = ServiceHelper.findAccountById(
+ ServiceHelper.getAllFlatAccount(LimaContext.getContext().getDataManager().getAccountModel().getData()),
+ accountId);
+ if (accountDTO == null) {
+ log.warn("Import : Account " + accountId + " does not exist.");
+ }
+ /**
+ * Date
+ */
+ Date dateTransac = Util.stringToDate(line[2], "ddMMyyyy");
+ /**
+ * Journal
+ */
+ String journalId = line[3];
+ JournalDTO journalDTO = ServiceHelper.findJournalById(
+ LimaContext.getContext().getDataManager().getJournalModel().getData(),
+ journalId);
+ if (journalDTO == null) {
+ log.warn("Import : Journal " + journalId + " does not exist.");
+ }
+ /**
+ * Transaction
+ */
+ String numTransac = line[4];
+ String descTransac = line[6];
+ /**
+ * Debit - Credit
+ */
+ boolean debit = line[7].equals("D");
+ /**
+ * Amount
+ */
+ String amount = line[8].trim();
+ /**
+ * Lettrage
+ */
+ String lettrage = line[10];
+ /**
+ * Création transaction
+ */
+ if ( !nameTransacPrev.equals(numTransac) )
+ {
+ // Recherche la période correspondante
+ PeriodDTO period = ServiceHelper.findPeriodByDate(
+ ServiceHelper.getAllFlatPeriod(LimaContext.getContext().getDataManager().getPeriodes()), dateTransac);
+ // Création de la transaction
+ TransactionDTO transaction = new TransactionDTO(null, "", dateTransac,
+ numTransac, descTransac, journalDTO, new LinkedList<EntryDTO>(), period,
+ ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "TR_WIP"));
+ transactionWithSamePrefix = transaction;
+ // Ajoute la transaction dans le service
+ result = transactionService.addTransaction(transaction, LimaContext.getContext().getDataManager().getStatus());
+ // Ajoute la transaction dans la liste des transactions
+ listTransactions.add(transaction);
+ }
+ // Création de l'entrée comptable
+ EntryDTO entry = new EntryDTO("","",DTOHelper.format(amount),debit,lettrage,accountDTO,transactionWithSamePrefix,null);
+ // Ajout de l'entrée comptable dans le service
+ result = entryService.addEntry(LimaContext.getContext().getDataManager().getStatus(), entry);
+ // Ajout l'entrée à la transaction
+ transactionWithSamePrefix.addChild(entry);
+ return result;
+ }
+
+ /**
+ * Cette méthode permet d'importer les journaux.
+ * Attention : dans le fichier de base de EBP, il ne possède pas de journaux,
+ * or il est important d'apporter des journaux dans le logiciel, sinon
+ * les transactions ne sont pas rattachés.
+ * Il suffit d'ajouter les journaux souhaités après les comptes avec la lettre
+ * J dans le fichier.
+ * Exemple : J;Journal des achats;AC
+ * @param line
+ * @return
+ */
+ public String importJournal (String[] line)
+ {
+ String description = line[1];
+ String prefixe = line[2];
+ // Création du journal
+ JournalDTO journalDTO = new JournalDTO("",description,description,prefixe);
+ // Ajout du journal dans le modèle de Lima
+ String result = LimaContext.getContext().getDataManager().getJournalModel().addJournal(journalDTO);
+ return result;
+ }
+
+}
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLExport.java (from rev 2802, trunk/lima-swing/src/main/java/org/chorem/lima/export/XMLExport.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLExport.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLExport.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,501 @@
+/**
+ * *##% Lima-Callao XMLExport
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.business.ejb.xml;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.io.FileOutputStream;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+import org.chorem.lima.dto.AccountDTO;
+import org.chorem.lima.dto.EntryDTO;
+import org.chorem.lima.dto.JournalDTO;
+import org.chorem.lima.dto.PeriodDTO;
+import org.chorem.lima.dto.TransactionDTO;
+import org.chorem.lima.ui.MainViewImpl;
+import org.chorem.lima.ui.ProgressBarImpl;
+import org.chorem.lima.util.ServiceHelper;
+import org.chorem.lima.util.Util;
+import org.jdom.Attribute;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+/**
+ * Permet d'exporter les données dans un document xml.
+ *
+ * @author Rémi Chapelet
+ */
+public class XMLExport {
+
+ /**
+ * log
+ */
+ protected static final Log log = LogFactory.getLog(XMLExport.class);
+
+ private static Element racine = new Element("Callao");
+
+ private static org.jdom.Document document = new Document(racine);
+
+ private ProgressBarImpl progressBar;
+
+ private String file;
+
+ // Déclaration variables pour chargement des données
+
+ private static List<PeriodDTO> listPeriodDTO = LimaContext.getContext().getDataManager().getPeriodes();
+ private static List<JournalDTO> listJournalDTO = LimaContext.getContext().getDataManager().getJournalModel().getData();
+ private static AccountDTO AccountMasterDTO = LimaContext.getContext().getDataManager().getAccountModel().getData();
+ private static List<TransactionDTO> listTransactionDTO = LimaContext.getContext().getDataManager().getTransactionModel().getData();
+
+ /**
+ * Cete méthode permet d'exporter des données de Callao vers un fichier au
+ * format xml.
+ *
+ * @param pathFile
+ * @return
+ */
+ public String exportFile(String pathFile) {
+ if (log.isDebugEnabled()) {
+ log.debug("Save file XML : ");
+ }
+ // Charge le nom du fichier
+ file = pathFile;
+ // Mise en place de la barre de progression
+ MainViewImpl context = LimaContext.get().getMainUI();
+ progressBar = new ProgressBarImpl(context, context);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ progressBar.setVisible(true);
+ }
+ };
+ SwingUtilities.invokeLater(runnable);
+ new Thread() {
+ @Override
+ public void run() {
+ // MainViewImpl context = LimaContext.get().getMainUI();
+ // progressBar = new ProgressBarImpl(context, context);
+ progressBar.setTitle(_("lima.progressBar.export.title"));
+ progressBar.getProgressBar().setString(
+ "0% : " + _("lima.progressBar.export.etape1"));
+ progressBar.getProgressBar().setValue(0);
+
+ /**
+ * Partie Informations
+ */
+ progressBar.getProgressBar().setString(
+ "10% : " + _("lima.progressBar.export.etape2"));
+ progressBar.getProgressBar().setValue(10);
+ Element info = new Element("informations");
+ racine.addContent(info);
+ Attribute date = new Attribute("date", new Date().toString());
+ info.setAttribute(date);
+ Attribute user = new Attribute("user", "Name user");
+ info.setAttribute(user);
+ Attribute company = new Attribute("company", "Name company");
+ info.setAttribute(company);
+ /**
+ * Partie Save
+ */
+ // Création Element save
+ Element save = new Element("save");
+ racine.addContent(save);
+ /**
+ * Period
+ */
+ progressBar.getProgressBar().setString(
+ "25% : " + _("lima.progressBar.export.etape3"));
+ progressBar.getProgressBar().setValue(25);
+ Element periods = new Element("periods");
+ Element timeSpans = new Element("timespans");
+ save.addContent(periods);
+ save.addContent(timeSpans);
+ exportPeriod(periods, timeSpans);
+ /**
+ * Journal
+ */
+ progressBar.getProgressBar().setString(
+ "35% : " + _("lima.progressBar.export.etape4"));
+ progressBar.getProgressBar().setValue(35);
+ Element journals = new Element("journals");
+ save.addContent(journals);
+ exportJournal(journals);
+ /**
+ * Account
+ */
+ progressBar.getProgressBar().setString(
+ "50% : " + _("lima.progressBar.export.etape5"));
+ progressBar.getProgressBar().setValue(50);
+ Element accounts = new Element("accounts");
+ save.addContent(accounts);
+ // Appel une fonction récursive pour parcourir l'arborescence des comptes
+ accountXML(AccountMasterDTO.getChildren(), accounts);
+ /**
+ * Transaction
+ */
+ progressBar.getProgressBar().setString(
+ "60% : " + _("lima.progressBar.export.etape6"));
+ progressBar.getProgressBar().setValue(60);
+ Element transactions = new Element("transactions");
+ save.addContent(transactions);
+ Element entries = new Element("entries");
+ save.addContent(entries);
+ exportTransaction(transactions, entries, progressBar);
+ /**
+ * Enregistre le fichier
+ */
+ progressBar.getProgressBar().setString(
+ "100% : " + _("lima.progressBar.export.etape7"));
+ progressBar.getProgressBar().setValue(100);
+ enregistre(file);
+ progressBar.dispose();
+
+ }
+ }.start();
+
+ return ServiceHelper.RESPOND_SUCCESS;
+ }
+
+ public String exportAccount(String pathFile) {
+ if (log.isDebugEnabled()) {
+ log.debug("Save Account XML : ");
+ }
+ // Charge le nom du fichier
+ file = pathFile;
+
+ MainViewImpl context = LimaContext.get().getMainUI();
+ progressBar = new ProgressBarImpl(context, context);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ progressBar.setVisible(true);
+ }
+ };
+ SwingUtilities.invokeLater(runnable);
+
+ // Mise en place de la barre de progression
+ new Thread() {
+ @Override
+ public void run() {
+ // MainViewImpl context = LimaContext.get().getMainUI();
+ // progressBar = new ProgressBarImpl(context, context);
+ progressBar.setTitle(_("lima.progressBar.export.title"));
+ progressBar.getProgressBar().setString(
+ "0% : " + _("lima.progressBar.export.etape1"));
+ progressBar.getProgressBar().setValue(0);
+ /**
+ * Partie Informations
+ */
+ progressBar.getProgressBar().setString(
+ "10% : " + _("lima.progressBar.export.etape2"));
+ progressBar.getProgressBar().setValue(10);
+ Element info = new Element("informations");
+ racine.addContent(info);
+ Attribute date = new Attribute("date", new Date().toString());
+ info.setAttribute(date);
+ Attribute user = new Attribute("user", "Name user");
+ info.setAttribute(user);
+ Attribute company = new Attribute("company", "Name company");
+ info.setAttribute(company);
+ /**
+ * Partie Save
+ */
+ // Création Element save
+ Element save = new Element("save");
+ racine.addContent(save);
+ /**
+ * Account
+ */
+ progressBar.getProgressBar().setString(
+ "50% : " + _("lima.progressBar.export.etape5"));
+ progressBar.getProgressBar().setValue(50);
+ Element accounts = new Element("accounts");
+ save.addContent(accounts);
+ // Appel une fonction récursive pour parcourir l'arborescence des comptes
+ accountXML(AccountMasterDTO.getChildren(), accounts);
+ /**
+ * Enregistre le fichier
+ */
+ progressBar.getProgressBar().setString(
+ "100% : " + _("lima.progressBar.export.etape7"));
+ progressBar.getProgressBar().setValue(100);
+ enregistre(file);
+ progressBar.dispose();
+ }
+ }.start();
+ return ServiceHelper.RESPOND_SUCCESS;
+ }
+
+ /**
+ * @param periods
+ * @param timeSpans
+ */
+ public void exportPeriod(Element periods, Element timeSpans) {
+ // Pour chaque période
+ for (PeriodDTO periodDTO : listPeriodDTO) {
+ // Création élément périod
+ Element period = new Element("period");
+ periods.addContent(period);
+ // Identifiant période
+ Attribute id = new Attribute("id", periodDTO.getIdSeq());
+ period.setAttribute(id);
+ // BeginPeriod
+ // Découpage date
+ String dateTab[] = Util.arrayDate(periodDTO.getBegin());
+ Attribute beginYear = new Attribute("beginYear", dateTab[0]);
+ period.setAttribute(beginYear);
+ Attribute beginMonth = new Attribute("beginMonth", dateTab[1]);
+ period.setAttribute(beginMonth);
+ Attribute beginDay = new Attribute("beginDay", dateTab[2]);
+ period.setAttribute(beginDay);
+ // EndPeriod
+ dateTab = Util.arrayDate(periodDTO.getEnd());
+ Attribute endYear = new Attribute("endYear", dateTab[0]);
+ period.setAttribute(endYear);
+ Attribute endMonth = new Attribute("endMonth", dateTab[1]);
+ period.setAttribute(endMonth);
+ Attribute endDay = new Attribute("endDay", dateTab[2]);
+ period.setAttribute(endDay);
+ // Locked Period
+ if (periodDTO.getStatus().getIdName()
+ .equals(ServiceHelper.PE_CLOSE)) {
+ Attribute locked = new Attribute("locked", "true");
+ period.setAttribute(locked);
+ } else {
+ Attribute locked = new Attribute("locked", "false");
+ period.setAttribute(locked);
+ }
+ /**
+ * TimeSpan
+ */
+ // Recherche des timeSpans de la période
+ List<PeriodDTO> listTimeSpanDTO = periodDTO.getChildren();
+ // Pour chaque timeSpan
+ for (PeriodDTO timeSpanDTO : listTimeSpanDTO) {
+ Element timeSpan = new Element("timespan");
+ timeSpans.addContent(timeSpan);
+ // Identifiant timeSpan
+ Attribute idTimeSpan = new Attribute("id", timeSpanDTO
+ .getIdSeq());
+ timeSpan.setAttribute(idTimeSpan);
+ Attribute idPeriod = new Attribute("idPeriod", periodDTO
+ .getIdSeq());
+ timeSpan.setAttribute(idPeriod);
+ // Begin TimeSpan
+ // Découpage date
+ dateTab = Util.arrayDate(timeSpanDTO.getBegin());
+ Attribute beginYearTimeSpan = new Attribute("beginYear",
+ dateTab[0]);
+ timeSpan.setAttribute(beginYearTimeSpan);
+ Attribute beginMonthTimeSpan = new Attribute("beginMonth",
+ dateTab[1]);
+ timeSpan.setAttribute(beginMonthTimeSpan);
+ Attribute beginDayTimeSpan = new Attribute("beginDay",
+ dateTab[2]);
+ timeSpan.setAttribute(beginDayTimeSpan);
+ // End TimeSpan
+ dateTab = Util.arrayDate(timeSpanDTO.getEnd());
+ Attribute endYearTimeSpan = new Attribute("endYear", dateTab[0]);
+ timeSpan.setAttribute(endYearTimeSpan);
+ Attribute endMonthTimeSpan = new Attribute("endMonth",
+ dateTab[1]);
+ timeSpan.setAttribute(endMonthTimeSpan);
+ Attribute endDayTimeSpan = new Attribute("endDay", dateTab[2]);
+ timeSpan.setAttribute(endDayTimeSpan);
+ // Lock timeSpan
+ if (timeSpanDTO.getStatus().getIdName().equals(
+ ServiceHelper.PE_CLOSE)) {
+ Attribute locked = new Attribute("locked", "true");
+ timeSpan.setAttribute(locked);
+ } else {
+ Attribute locked = new Attribute("locked", "false");
+ timeSpan.setAttribute(locked);
+ }
+ }
+ }
+ }
+
+ /**
+ * @param journals
+ */
+ public void exportJournal(Element journals) {
+ for (JournalDTO journalDTO : listJournalDTO) {
+ Element journal = new Element("journal");
+ journals.addContent(journal);
+ // Identification du journal
+ Attribute idJournal = new Attribute("id", journalDTO.getIdSeq());
+ journal.setAttribute(idJournal);
+ // Label
+ Attribute label = new Attribute("label", journalDTO.getIdName());
+ journal.setAttribute(label);
+ // Prefix
+ Attribute prefix = new Attribute("prefix", journalDTO.getPrefix());
+ journal.setAttribute(prefix);
+ // Description
+ Attribute description = new Attribute("description", journalDTO
+ .getDescription());
+ journal.setAttribute(description);
+ }
+ }
+
+ /**
+ * Converti la liste des comptes pour être ajouté au document xml.
+ *
+ * @param listAccountDTO
+ * @param accounts
+ */
+ public void accountXML(List<AccountDTO> listAccountDTO, Element accounts) {
+ for (AccountDTO accountDTO : listAccountDTO) {
+ Element account = new Element("account");
+ accounts.addContent(account);
+ // Identification du account
+ Attribute idAccount = new Attribute("id", accountDTO.getIdSeq());
+ account.setAttribute(idAccount);
+ // Label
+ Attribute label = new Attribute("label", accountDTO
+ .getDescription());
+ account.setAttribute(label);
+ // Type
+ Attribute type = new Attribute("type", accountDTO.getType());
+ account.setAttribute(type);
+ // AccountNumber
+ Attribute accountNumber = new Attribute("accountNumber", accountDTO
+ .getIdNumber());
+ account.setAttribute(accountNumber);
+ // MasterAccountNumber
+ Attribute masterAccountNumber = new Attribute("masterAccount",
+ accountDTO.getParent().getIdNumber());
+ account.setAttribute(masterAccountNumber);
+ // Ajoute les comptes enfants à la liste
+ accountXML(accountDTO.getChildren(), accounts);
+ }
+ }
+
+ public void exportTransaction(Element transactions, Element entries,
+ ProgressBarImpl progressBar) {
+ // Nombre de transaction
+ float nbTransactions = listTransactionDTO.size();
+ float incremente = 20 / nbTransactions;
+ float value = 80;
+ // Pour chaque transaction
+ for (TransactionDTO transactionDTO : listTransactionDTO) {
+ Element transaction = new Element("transaction");
+ transactions.addContent(transaction);
+ // Identification de la transaction
+ Attribute idTransaction = new Attribute("id", transactionDTO
+ .getIdSeq());
+ transaction.setAttribute(idTransaction);
+ // EntryDate
+ String dateTab[] = Util.arrayDate(transactionDTO.getEntryDate());
+ Attribute entryDateYear = new Attribute("entryDateYear", dateTab[0]);
+ transaction.setAttribute(entryDateYear);
+ Attribute entryDateMonth = new Attribute("entryDateMonth",
+ dateTab[1]);
+ transaction.setAttribute(entryDateMonth);
+ Attribute entryDateDay = new Attribute("entryDateDay", dateTab[2]);
+ transaction.setAttribute(entryDateDay);
+ // VoucherRef
+ Attribute voucherRef = new Attribute("voucherRef", transactionDTO
+ .getVoucherRef());
+ transaction.setAttribute(voucherRef);
+ // Description
+ Attribute description = new Attribute("description", transactionDTO
+ .getDescription());
+ transaction.setAttribute(description);
+ // Id journal
+ Attribute IdJournal = new Attribute("idJournal", transactionDTO
+ .getJournal().getIdSeq());
+ transaction.setAttribute(IdJournal);
+ // Id timeSpan
+ Attribute IdTimeSpan = new Attribute("idTimeSpan", transactionDTO
+ .getPeriod().getIdSeq());
+ transaction.setAttribute(IdTimeSpan);
+ /**
+ * Entry
+ */
+ List<EntryDTO> listEntryDTO = transactionDTO.getEntries();
+ for (EntryDTO entryDTO : listEntryDTO) {
+ Element entry = new Element("entry");
+ entries.addContent(entry);
+ // Identification du entry
+ Attribute idEntry = new Attribute("id", entryDTO.getIdSeq());
+ entry.setAttribute(idEntry);
+ // Description
+ Attribute descriptionEntry = new Attribute("description",
+ entryDTO.getDescription());
+ entry.setAttribute(descriptionEntry);
+ // Amount
+ Attribute amount = new Attribute("amount", entryDTO.getAmount());
+ entry.setAttribute(amount);
+ // Lettering
+ Attribute lettering = new Attribute("lettering", entryDTO
+ .getLettrage());
+ entry.setAttribute(lettering);
+ // Detail
+ Attribute detail = new Attribute("detail", entryDTO
+ .getDescription());
+ entry.setAttribute(detail);
+ // Debit / crédit
+ if (entryDTO.getDebit()) {
+ Attribute debit = new Attribute("debit", "true");
+ entry.setAttribute(debit);
+ } else {
+ Attribute debit = new Attribute("debit", "false");
+ entry.setAttribute(debit);
+ }
+ // Transaction
+ Attribute idrefTransaction = new Attribute("idTransaction",
+ transactionDTO.getIdSeq());
+ entry.setAttribute(idrefTransaction);
+ // Account
+ Attribute idAccount = new Attribute("idAccount", entryDTO
+ .getAccount().getIdSeq());
+ entry.setAttribute(idAccount);
+ }
+ // Mise à jour de la barre de chargement
+ value = value + incremente;
+ progressBar.getProgressBar().setValue((int) value);
+ progressBar.getProgressBar().setString(
+ value + "% : " + _("lima.progressBar.export.etape6"));
+
+ }
+ }
+
+ /**
+ * Permet d'enregistrer le fichier xml.
+ *
+ * @param fichier
+ */
+ static void enregistre(String fichier) {
+ try {
+ XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
+ sortie.output(document, new FileOutputStream(fichier));
+ } catch (java.io.IOException e) {
+ log.error(e);
+ }
+ }
+
+}
Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLImport.java (from rev 2802, trunk/lima-swing/src/main/java/org/chorem/lima/imports/XMLImport.java)
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLImport.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/xml/XMLImport.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,234 @@
+/**
+ * *##% Lima-Callao XMLImport
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.business.ejb.xml;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaContext;
+import org.jdom.*;
+import org.chorem.lima.dto.AccountDTO;
+import org.chorem.lima.dto.JournalDTO;
+import org.chorem.lima.service.util.ServiceHelper;
+
+import org.jdom.input.SAXBuilder;
+import java.io.*;
+import org.jdom.xpath.XPath;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+import org.chorem.lima.table.model.JournalTableModel;
+import org.chorem.lima.ui.accounting.model.AccountTreeTableModel;
+
+
+/**
+ * Permet de charger les données à partir d'un document xml.
+ * Il est possibble de charger les journaux, les comptes.
+ *
+ * @author Rémi Chapelet
+ */
+public class XMLImport {
+
+
+ /** log */
+ protected static final Log log = LogFactory.getLog(XMLImport.class);
+
+ static Element racine = new Element("Callao");
+
+ static org.jdom.Document document = new Document(racine);
+
+ protected JournalTableModel journalServ;
+ protected AccountTreeTableModel accountServ;
+
+ /**
+ * Import Journal
+ * @param file
+ * @return
+ */
+ public String importJournal(String file)
+ {
+ if (log.isDebugEnabled()) {
+ log.debug("Load Journal XML ");
+ }
+ // Variables
+ journalServ = LimaContext.getContext().getDataManager().getJournalModel();
+ String result = ServiceHelper.RESPOND_ERROR;
+ boolean existError = false;
+ // Chargement du fichier
+ loadFile(file);
+ try {
+ // Recherche de la racine
+ racine = document.getRootElement();
+ // Chargement
+ XPath requeteXpath = XPath.newInstance("//journal");
+ List results = requeteXpath.selectNodes(racine);
+ Iterator iter = results.iterator();
+ // Pour tous les journaux
+ while (iter.hasNext()){
+ Element noeudCourant = (Element) iter.next();
+ // Recherche attributs
+ String label = noeudCourant.getAttribute("label").getValue();
+ log.debug("Label "+label);
+ String prefix = noeudCourant.getAttribute("prefix").getValue();
+ String description = noeudCourant.getAttribute("description").getValue();
+ // Création du journal
+ JournalDTO journal = new JournalDTO("0", label, description, prefix);
+ // Ajout journal
+ result = journalServ.addJournal(journal);
+ // Control erreur
+ if ( result.equals(ServiceHelper.RESPOND_ERROR) )
+ {
+ existError = true;
+ }
+ }
+ } catch (JDOMException e) {
+ log.error("Erreur JDOM " + e.getMessage() );
+ e.printStackTrace();
+ }
+ // Détection des erreurs
+ if ( !existError )
+ {
+ result = ServiceHelper.RESPOND_SUCCESS;
+ }
+ return result;
+ }
+
+ public String importAccount(InputStream stream) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load Account XML ");
+ }
+ // Chargement du fichier
+ loadFile(stream, InputStream.class);
+ return importAccount();
+ }
+
+ /**
+ * Import Account
+ * @param file
+ * @return
+ */
+ public String importAccount(String file)
+ {
+ if (log.isDebugEnabled()) {
+ log.debug("Load Account XML ");
+ }
+ loadFile(file);
+ return importAccount();
+ }
+
+ private String importAccount() {
+ // Variables
+ accountServ = LimaContext.getContext().getDataManager().getAccountModel();
+ String result = ServiceHelper.RESPOND_ERROR;
+ boolean existError = false;
+ try {
+ // Recherche de la racine
+ racine = document.getRootElement();
+ // Chargement
+ XPath requeteXpath = XPath.newInstance("//account");
+ List results = requeteXpath.selectNodes(racine);
+ Iterator iter = results.iterator();
+ // Création du compte principal pour Lima
+ AccountDTO accountMaster = new AccountDTO("0", "0", "Plan comptable", null, new LinkedList<AccountDTO>(), null);
+ // Pour tous les accounts
+ while (iter.hasNext()){
+ Element noeudCourant = (Element) iter.next();
+ // Recherche attributs
+ String label = noeudCourant.getAttribute("label").getValue();
+ String accountNumber = noeudCourant.getAttribute("accountNumber").getValue();
+ String masterAccount = noeudCourant.getAttribute("masterAccount").getValue();
+ String type = noeudCourant.getAttribute("type").getValue();
+ // Création bdd
+ // Si il n'a pas de compte père, alors on rattache le compte au compte '0' master.
+ if ( masterAccount.equals("0") )
+ {
+ // Creation account sur le compte 0
+ AccountDTO account = new AccountDTO("0", accountNumber, label, type, new LinkedList<AccountDTO>(), accountMaster);
+ // Ajout dans le service
+ result = accountServ.addAccount(account);
+ // Ajout dans Lima
+ account.getParent().addChild(account);
+ } else {
+ // Creation account sur le compte père donné dans le fichier
+ AccountDTO account = new AccountDTO("0",accountNumber,label,type,
+ new LinkedList<AccountDTO>(),
+ ServiceHelper.findAccountById(ServiceHelper.getAllFlatAccount(accountMaster),masterAccount));
+ // Ajout dans le service
+ result = accountServ.addAccount(account);
+ // Ajout dans Lima
+ account.getParent().addChild(account);
+ }
+ // Control erreur
+ if ( result.equals(ServiceHelper.RESPOND_ERROR) )
+ {
+ existError = true;
+ }
+ }
+ } catch (JDOMException e) {
+ log.error("Erreur JDOM " + e.getMessage() );
+ e.printStackTrace();
+ }
+ // Détection des erreurs
+ if ( !existError )
+ {
+ result = ServiceHelper.RESPOND_SUCCESS;
+ }
+ // Reset pour le chargement des comptes
+ LimaContext.getContext().getDataManager().resetAccountModel();
+ return result;
+ }
+
+ private void loadFile(String file) {
+ loadFile(file, String.class);
+ }
+ /**
+ *
+ * @param file
+ */
+ private <T> void loadFile(T file, Class<T> fileClass)
+ {
+ /**
+ * Chargement du fichier et construction du Dom
+ */
+ if (log.isDebugEnabled()) {
+ log.debug("Load file : "+file);
+ }
+ try {
+ /* On crée une instance de SAXBuilder */
+ SAXBuilder sxb = new SAXBuilder();
+ if (fileClass.equals(String.class)) {
+ document = sxb.build((String)file);
+ } else if (fileClass.equals(InputStream.class)){
+ document = sxb.build((InputStream)file);
+ }
+ } catch (IOException e) {
+ log.error("Erreur lors de la lecture du fichier "
+ + e.getMessage() );
+ e.printStackTrace();
+ } catch (JDOMException e){
+ log.error("Erreur lors de la construction du fichier JDOM "
+ + e.getMessage() );
+ e.printStackTrace();
+ }
+ }
+
+
+}
\ No newline at end of file
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ServiceHelper.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ServiceHelper.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ServiceHelper.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,87 +0,0 @@
-/**
- * *##% Callao ServiceHelper
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
-
-package org.chorem.lima.business.utils;
-
-/**
- * Définition des messages acceptés par Callao
- * @author Rémi Chapelet
- *
- * @deprecated since 0.4.0, with no replacement (Exception)
- */
-public interface ServiceHelper {
-
- /**
- * Réponses utilisées par la couche métier Callao
- */
- public static final String RESPOND_SUCCESS = "success";
- public static final String RESPOND_ERROR = "error";
-
- /**
- * Account Error
- */
- public static final String ACCOUNT_DOUBLE = "account_double";
- public static final String ACCOUNT_NOT_MASTER = "account_not_master";
- public static final String ACCOUNT_NOT_EXIST = "account_not_exist";
- public static final String ACCOUNT_WITH_ENTRIES = "account_with_entries";
-
- /**
- * Entries Error
- */
- public static final String ENTRY_NOT_EXIST = "entry_not_exist";
-
- /**
- * Journal
- */
- public static final String JOURNAL_DOUBLE = "journal_double";
- public static final String JOURNAL_NOT_EXIST = "journal_not_exist";
- public static final String JOURNAL_WITH_TRANSACTIONS = "journal_with_transactions";
-
- /**
- * Period
- */
- public static final String PERIOD_CREATE_TIMESPANS = "period_create_timespan";
- public static final String PERIOD_TIMESPAN_NOT_BLOCK = "period_timespan_not_block";
- public static final String PERIOD_TIMESPAN_BLOCK = "period_timespan_block";
- public static final String PERIOD_ALL_TIMESPAN = "period_all_timespan";
- public static final String PERIOD_NOT_EXIST = "period_not_exist";
-
- /**
- * TimeSpan
- */
- public static final String TIMESPAN_PREC_NOT_BLOCK = "timespan_prec_not_block";
- public static final String TIMESPAN_NEXT_NOT_BLOCK = "timespan_next_not_block";
-
- /**
- * Transaction
- */
- public static final String TRANSACTION_NOT_JOURNAL = "transaction_not_journal";
- public static final String TRANSACTION_NOT_TIMESPAN = "transaction_not_timespan";
- public static final String TRANSACTION_TIMESPAN_BLOCKED = "transaction_timespan_blocked";
- public static final String TRANSACTION_NOT_EXIST = "transaction_not_exist";
- public static final String TRANSACTION_NOT_BALANCED = "transaction_not_balanced";
-
- /**
- * Définition des types de logs possibles
- */
- public static final String LOG_ADD = "add";
- public static final String LOG_MODIFY = "modify";
- public static final String LOG_REMOVE = "remove";
-
-}
\ No newline at end of file
Modified: trunk/lima-business/src/main/resources/lima.properties
===================================================================
--- trunk/lima-business/src/main/resources/lima.properties 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/resources/lima.properties 2010-04-02 16:55:19 UTC (rev 2824)
@@ -6,12 +6,4 @@
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:~/.lima/limadb
-
-# Permet de preciser les classes a utiliser
-#topia.persistence.classes=org.chorem.callao.entity.AccountImpl, \
-#org.chorem.callao.entity.ClientImpl, \
-#org.chorem.callao.entity.EntryImpl, org.chorem.callao.entity.PeriodImpl, \
-#org.chorem.callao.entity.JournalImpl, org.chorem.callao.entity.ProjectImpl, \
-#org.chorem.callao.entity.TimeSpanImpl, org.chorem.callao.entity.TransactionImpl, \
-#org.chorem.callao.entity.UsersImpl, org.chorem.callao.entity.LogImpl
+hibernate.connection.url=jdbc:h2:file:~/.lima/limadb
\ No newline at end of file
Deleted: trunk/lima-business/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-business/src/main/resources/log4j.properties 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/main/resources/log4j.properties 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,11 +0,0 @@
-# Global logging configuration
-log4j.rootLogger=WARN, stdout
-
-# Console output...
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
-
-# package level
-log4j.logger.org.chorem.lima=DEBUG
-log4j.logger.org.nuiton.util=DEBUG
\ No newline at end of file
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -4,9 +4,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.dto.AccountDTO;
import org.chorem.lima.business.ejb.AccountServiceImpl;
-import org.chorem.lima.business.utils.ServiceHelper;
import org.chorem.lima.entity.Account;
import org.junit.AfterClass;
import org.junit.Assert;
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,15 +1,9 @@
package org.chorem.lima.business;
-import static org.junit.Assert.assertTrue;
-import java.util.Date;
-
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
-import org.chorem.lima.business.utils.ServiceHelper;
-import org.chorem.lima.entity.FinancialPeriod;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -1,19 +1,9 @@
package org.chorem.lima.business;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.dto.PeriodDTO;
-import org.chorem.lima.business.dto.TimeSpanDTO;
import org.chorem.lima.business.ejb.FiscalPeriodServiceImpl;
-import org.chorem.lima.business.utils.ServiceHelper;
-import org.chorem.lima.entity.FiscalPeriod;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java 2010-04-02 16:53:54 UTC (rev 2823)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java 2010-04-02 16:55:19 UTC (rev 2824)
@@ -5,7 +5,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.dto.LogDTO;
import org.chorem.lima.business.ejb.RecordServiceImpl;
import org.chorem.lima.entity.Record;
import org.junit.AfterClass;
Copied: trunk/lima-business/src/test/resources/log4j.properties (from rev 2807, trunk/lima-business/src/main/resources/log4j.properties)
===================================================================
--- trunk/lima-business/src/test/resources/log4j.properties (rev 0)
+++ trunk/lima-business/src/test/resources/log4j.properties 2010-04-02 16:55:19 UTC (rev 2824)
@@ -0,0 +1,11 @@
+# Global logging configuration
+log4j.rootLogger=WARN, stdout
+
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+
+# package level
+log4j.logger.org.chorem.lima=DEBUG
+log4j.logger.org.nuiton.util=DEBUG
\ No newline at end of file
1
0
Author: echatellier
Date: 2010-04-02 18:53:54 +0200 (Fri, 02 Apr 2010)
New Revision: 2823
Log:
Use snapshot of topia/eugene
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-02 14:26:48 UTC (rev 2822)
+++ trunk/pom.xml 2010-04-02 16:53:54 UTC (rev 2823)
@@ -124,7 +124,7 @@
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
- <!-- 3.2.1 has a startup warning with 1.6.0_u18 -->
+ <!-- 3.1.2 has a startup warning with 1.6.0_u18 -->
<version>3.1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
@@ -159,13 +159,6 @@
</dependency>
<dependency>
- <groupId>javax.time</groupId>
- <artifactId>jsr-310-ri</artifactId>
- <version>20100212</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
@@ -240,10 +233,10 @@
<!-- customized libs version -->
<nuiton-utils.version>1.2.1-SNAPSHOT</nuiton-utils.version>
- <eugene.version>2.0</eugene.version>
- <topia.version>2.3.1-SNAPSHOT</topia.version>
+ <eugene.version>2.0.1-SNAPSHOT</eugene.version>
+ <topia.version>2.3.2-SNAPSHOT</topia.version>
<jaxx.version>2.0</jaxx.version>
- <i18n.version>1.1</i18n.version>
+ <i18n.version>1.2</i18n.version>
<!--axis.version>1.4.1</axis.version-->
<!-- 1.4 and 1.4.1 breaks jnlp with corrupt jar
1
0
Author: echatellier
Date: 2010-04-02 16:26:48 +0200 (Fri, 02 Apr 2010)
New Revision: 2822
Log:
Add documentation about "voucher" attribute.
Modified:
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0
Author: echatellier
Date: 2010-03-31 16:21:37 +0200 (Wed, 31 Mar 2010)
New Revision: 2821
Log:
Suppression des doubles visibilit?\195?\169s
Modified:
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0
r2820 - trunk/lima-business/src/main/java/org/chorem/lima/business
by echatellier@users.chorem.org 30 Mar '10
by echatellier@users.chorem.org 30 Mar '10
30 Mar '10
Author: echatellier
Date: 2010-03-30 18:20:40 +0200 (Tue, 30 Mar 2010)
New Revision: 2820
Log:
Balance, Bilan beans are now generated
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/data/
1
0
r2819 - in trunk/src/site: resources resources/callao resources/callao/class resources/callao/uc rst rst/callao
by echatellier@users.chorem.org 30 Mar '10
by echatellier@users.chorem.org 30 Mar '10
30 Mar '10
Author: echatellier
Date: 2010-03-30 16:15:15 +0200 (Tue, 30 Mar 2010)
New Revision: 2819
Log:
Add old site documentation from callao.
Added:
trunk/src/site/resources/callao/
trunk/src/site/resources/callao/class/
trunk/src/site/resources/callao/class/class-diag.png
trunk/src/site/resources/callao/uc/
trunk/src/site/resources/callao/uc/uc-base.png
trunk/src/site/resources/callao/uc/uc-cloture.png
trunk/src/site/resources/callao/uc/uc-comptes.png
trunk/src/site/resources/callao/uc/uc-etats.png
trunk/src/site/resources/callao/uc/uc-exercice.png
trunk/src/site/resources/callao/uc/uc-fichiers.png
trunk/src/site/resources/callao/uc/uc-journal.png
trunk/src/site/rst/callao/
trunk/src/site/rst/callao/callao.rst
trunk/src/site/rst/callao/classes.rst
trunk/src/site/rst/callao/contact.rst
trunk/src/site/rst/callao/developpement.rst
trunk/src/site/rst/callao/howto.rst
trunk/src/site/rst/callao/index.rst
trunk/src/site/rst/callao/lexique.rst
trunk/src/site/rst/callao/news.rst
trunk/src/site/rst/callao/roadmap.rst
trunk/src/site/rst/callao/todo.rst
trunk/src/site/rst/callao/usecases.rst
Added: trunk/src/site/resources/callao/class/class-diag.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/class/class-diag.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-base.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-base.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-cloture.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-cloture.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-comptes.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-comptes.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-etats.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-etats.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-exercice.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-exercice.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-fichiers.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-fichiers.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/callao/uc/uc-journal.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/callao/uc/uc-journal.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/rst/callao/callao.rst
===================================================================
--- trunk/src/site/rst/callao/callao.rst (rev 0)
+++ trunk/src/site/rst/callao/callao.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,68 @@
+======================
+Présentation de CALLAO
+======================
+(Computing Active Layer for Lutin's Accounting Organization)
+
+``1. Présentation``
+-------------------
+
+La comptabilité est une tâche longue, répétitive, et induisant un nombre
+important de contrôles et de calculs.
+
+C'est un excellent exemple de ce que l'automatisation grâce à l'informatique
+peut apporter en terme de gain de temps. Longtemps réservée aux grosses
+entreprises, l'explosion de l'informatique personnelle (puis portable) à
+largement démocratisé la comptabilité par informatique mais toujours par le biais
+de solutions malheureusement propriétaires et/ou peu portables.
+
+L'essor récent du logiciel libre permet l'émergence de solutions encore plus
+accessibles, débarrassées des traditionnels verrous emprisonnant l'information
+comptable, et donc son propriétaire, dans un contexte étriqué d'utilisation.
+Ces logiciels nécessitant l'achat de licences spécifiques en cas d'emplois sur
+plusieurs postes, et interdisant le partage ou la migration entre applications
+"concurrentes".
+
+``2. Naissance``
+----------------
+
+Issu du projet Chorem_,
+CALLAO_ est un moteur de comptabilité `libre de droits`_ respectant les conventions
+ainsi que les normes comptables imposées aux entreprises par la législation
+française.
+
+Bien que créé pour fonctionner avec l'interface graphique LIMA_, CALLAO_ a été
+conçu pour pouvoir être utilisé par différentes interfaces graphiques. Il est
+donc possible de créer une interface Web de comptabilité reposant sur le moteur
+CALLAO_
+
+``3. Architecture``
+-------------------
+
+Les utilisateurs de l'interface utilisateur LIMA_ effectuaient jusqu'alors cette gestion
+des données gràce au moteur de comptabilité d'OFBiz-Neogia. CALLAO_ doit pouvoir se
+substituer à ce moteur mais sans nécessité une refonte de LIMA_ afin de laisser aux
+utilisateurs de ce dernier le choix du moteur de comptabilité qu'ils
+utilisent ou de faciliter les migrations d'un moteur à l'autre [#]_.
+
+Ainsi notre couche de DTO se substituera à toute la partie exterieure à
+l'interface de LIMA_ comme suit :
+
+.. image:: resources/schemas/schema-architecture.png
+
+
+
+On peut voir que le DTO utilise le modèle définit par le design pattern du même
+nom pour décrire le moteur CALLAO de l’application comptable finale.
+L’architecture est elle même composée de deux couches : une de persistance pour
+la gestion des données, et une autre métier pour la gestion des flux entre la
+persistance et les interfaces d’entrées/sorties véhiculées par des objets
+JavaBeans.
+
+
+----
+
+.. _`libre de droits`: licence.html
+.. [#] A cet effet des fonctions d'import et d'export seront mises en place.
+.. _ChoreM: http://chorem.org/
+.. _LIMA: http://maven-site.chorem.org/lima/
+.. _CALLAO: callao.html
Added: trunk/src/site/rst/callao/classes.rst
===================================================================
--- trunk/src/site/rst/callao/classes.rst (rev 0)
+++ trunk/src/site/rst/callao/classes.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,364 @@
+====================
+Diagramme de classes
+====================
+
+.. image:: class/class-diag.png
+
+``Entry``
+=========
+``Description :``
+-----------------
+Une Entry est une écriture comptable, qui traduit le passage d'une somme au débit
+ou au crédit d'un compte.
+
+``Attributs :``
+---------------
+
+- description : Description textuelle de l'opération.
+
+- amount : Montant de l'opération, stocké sous forme de string.
+
+- debit : Booléen indiquant s'il s'agit d'une opération de type débit ou crédit.
+
+- lettering : Chaîne de caractères employée pour le lettrage
+
+- detail : Chaîne de caractères servant au stockage d'informations caractérisant
+l'écriture en question au format CSV.
+
+- Transaction : Une Entry fait forcément partie d'une Transaction (soit d'une
+Transaction existante, soit une nouvelle Transaction est créée lors de la
+création
+
+
+``Liens :``
+-----------
+
+- Log : Toute opération sur une Entry sera consignée dans un objet Log(RM).
+
+- Account : Une Entry est une opération de débit ou de crédit sur un compte donné.
+Chacune d'elle concerne donc un et un seul compte.
+
+
+
+``Transaction``
+===============
+``Description :``
+-----------------
+Une Transaction représente une opération comptable, soit un ensemble d'écritures
+(Entry). Une Transaction n'est dite équilibrée que si la somme des montants des
+écritures de débit qui la composent est égale à celle des écritures de crédit(RM).
+Elle fera souvent référence à un document justificatif (par exemple une facture)
+qu'elle représentera comptablement. Elle est passée à une date donnée qui concerne
+par extension toutes les écritures qu'elle contient.
+
+``Attributs :``
+---------------
+
+- entryDate : La date d'entrée de l'opération (saisie par l'utilisateur).
+
+- voucherRef : Si utile, référence du document justificatif.
+
+- description : Description textuelle.
+
+
+``Liens :``
+-----------
+
+- Entry : Une Transaction est une composition d'un certain nombre d'écritures
+(Entry).
+
+- TimeSpan : Une transaction intervient pendant un intervalle de temps. La clôture
+de cet intervalle de temps (TimeSpan) implique que la Transaction n'est pas
+modifiable (règles métier de l'application(RM)).
+
+- Journal : Une Transaction appartient à un journal donné, selon là où elle a
+été entrée par l'utilisateur.
+
+
+
+``TimeSpan``
+============
+``Description :``
+-----------------
+Un TimeSpan, ou intervalle de temps, représente une subdivision de l'exercice
+comptable (Period) en plusieurs périodes plus petites afin de pouvoir clôturer
+son travail au fur et à mesure. La loi impose juste que les exercices soient
+clôturés de manière définitive, donc les clôtures de TimeSpan seront
+réversibles(RM). Un intervalle de temps ne pourra être verrouillé que si les
+précédents intervalles sont également verrouillés(RM). L'idée de cette
+fonctionnalité nous a été soumise par notre professeur de comptabilité. Nous
+avions commencé par concevoir des intervalles de temps de durée quelconque mis
+en place par l'utilisateur avant de s'orienter vers des TimeSpan d'une durée
+d'un mois, également sur ses conseils. Les différents TimeSpan (autant que de
+mois pour l'exercice) seront générés lors de la création de l'exercice(RM).
+
+``Attributs :``
+---------------
+
+- beginTimeSpan : Date de début de l'intervalle de temps.
+
+- endTimeSpan : Date de fin de l'intervalle de temps.
+
+- locked : Booléen indiquant si l'IT est clôturé ou non.
+
+
+``Liens :``
+-----------
+
+- Period : Un intervalle de temps appartient à un exercice (Period donné). En
+fait, il constitue un mois de cet exercice. Les dates de début et de fin de l'IT
+sont donc évidemment comprises dans celles de l'exercice auquel il appartient.
+
+- Transaction : Un ensemble de transactions est effectué pendant un intervalle
+de temps donné, déterminé par la date de transaction. Un intervalle de temps ne
+peut être clôturé que si toutes ses transactions sont équilibrées(RM).
+
+
+
+``Period``
+==========
+``Description :``
+-----------------
+Il s'agit d'un exercice comptable. Ses dates seront définies par l'utilisateur
+dans la limite de certaines règles métier qui permettront de respecter le cadre
+légal : un exercice commence là où le précédent se finit; la durée de l'exercice
+est fixée à l'avance et ne peut être modifiée; la clôture d'un exercice est
+définitive(RM). Il ne peut y avoir plus de deux exercices ouverts en même temps(RM)
+et aucun exercice ne peut être clôturé sans que le précédent ait été clôturé(RM).
+Lors de la clôture d'un exercice, une opération de report à nouveau est effectuée
+sur l'exercice suivant(RM). De fait, il est impossible de clôturer un exercice
+sans avoir préalablement créé le suivant(RM).
+
+``Attributs :``
+---------------
+
+- beginTimeSpan : Date de début de l'exercice.
+
+- endTimeSpan : Date de fin de l'exercice.
+
+- locked : Booléen indiquant si l'exercice est clôturé ou non.
+
+
+``Liens :``
+-----------
+
+- TimeSpan : Un exercice contient, selon sa longueur, un certain nombre
+d'intervalles de temps qui correspondent à ses différents mois. Les différents
+TimeSpan sont créés en même temps que l'exercice(RM). La clôture de l'exercice
+implique automatiquement la clôture de tous ses TimeSpan(RM).
+
+
+
+``Journal``
+===========
+``Description :``
+-----------------
+Le logiciel supporte la « comptabilité multi-journal », c'est-à-dire que
+l'utilisateur peut saisir ses opérations dans plusieurs journaux différents
+(Journal des ventes, journal des achats...).
+
+``Attributs :``
+---------------
+
+- label : Libellé du journal.
+
+- prefix : Prefix du journal, utilisé par l'interface.
+
+
+``Liens :``
+-----------
+
+- Transaction : Un journal est composé de transactions, mais peut être vide.
+
+
+
+``Log``
+=======
+``Description :``
+-----------------
+Chaque ajout/modification/suppression sur une Entry entraine la création d'un
+log contenant toutes les nouvelles informations de celui-ci (qui seront vides
+s'il s'agit d'une suppression(RM)). La modification d'une Transaction entraine
+aussi la création d'un log pour chacune de ses Entry(RM). Dans la mesure où les
+logs devraient pouvoir être consultés sans impliquer de traitement, on y réunira
+les informations consultant les Entry et les Transaction.
+
+``Attributs :``
+---------------
+
+- logDate : Date où le log est créé (déterminée à partir de l'horloge système)
+
+- type : Type de modification. Peut prendre 4 valeurs différentes : add (ajout),
+mod (modification), del (suppression), tmod (modification de transaction).
+
+- transDate : Date de la Transaction.
+
+- voucherRef : Référence du justificatif de la Transaction.
+
+- transDesc : Description de la Transaction.
+
+- entryDesc : Description de l'Entry.
+
+- amount : Montant de l'Entry.
+
+- debit : Booléen indiquant s'il s'agit d'une écriture de débit ou de crédit.
+
+- lettering : Letterage de l'Entry.
+
+
+``Liens :``
+-----------
+
+- Entry : Le log correspond à une Entry qui, elle, peut avoir plusieurs logs (au
+moins un et autant qu'elle a subi de modifications).
+
+
+
+``Account``
+===========
+``Description :``
+-----------------
+Correspond à un compte du PCG. Les sous-comptes (e.g. 4111) sont considérés
+comme étant agrégés dans leur « compte père » (e.g. 411). Un compte ne peut être
+supprimé s'il contient des écritures(RM).
+
+``Attributs :``
+---------------
+
+- label : Libellé du compte.
+
+- accountNumber : Numéro de compte.
+
+- Entry : Les Entry représentent les différentes opérations effectuées sur les
+comptes. Plusieurs écritures peuvent être passées concernant un compte donné,
+mais celui-ci peut exister sans écriture.
+
+
+``Liens :``
+-----------
+
+- Account : Un compte peut contenir des sous-comptes.
+
+
+``CallaoUser``
+==============
+``Description :``
+-----------------
+Bien que l'interface prévoit une phase d'authentification à son lancement, il
+n'est pour l'instant pas prévu d'implémenter une gestion multi-utilisateurs de
+Callao. Nous ajoutons néanmoins cette classe afin de pouvoir prévoir cette
+gestion dans une implémentation future.
+
+``Attributs :``
+---------------
+
+- userID : ID de l'utilisateur.
+
+- login : Login de l'utilisateur.
+
+- password : Mot de passe de l'utilisateur
+
+- right : Code le groupe de droits auquel l'utilisateur a accès
+
+
+
+``User``
+========
+``Description :``
+-----------------
+Cette classe va permettre de typer des écritures vis à vis des utilisateurs
+relatifs qu'elle touche. Ceci permettre d'effectuer des tris d'écriture afin
+d'extraire le coût ou produit généré par des individus.
+Cette démarche s'inscrit dans l'optique d'une synchronisation des données entre
+Chorem et Callao.
+
+``Attributs :``
+---------------
+
+- matcher : Le nom d'utilisateur
+
+
+
+``Type Presta``
+===============
+``Description :``
+-----------------
+Correspond aux propriétés d'une écriture. Permet de définir et classifier les
+écritures grâce aux catégories pertinentes afin de mieux analyser les résultats
+des différentes activités de l'entreprise.
+
+``Attributs :``
+---------------
+
+- matcher : Description du type de prestation associée à une écriture
+
+
+
+``Client``
+==========
+``Description :``
+-----------------
+Les catégories de clients sont des informations venant éventuellement se greffer
+sur des comptes afin de mieux renseigner les informations sur ces derniers, de
+pouvoir éventuellement les regrouper et déduire des généralisations par catégories
+de client, anticiper des durées de stockages de créances pour un client lambda
+fonction de sa catégorie.
+Ces catégories seront cependant le plus souvent associées aux comptes descendants
+du compte 411 (client) et assez rarement (voir pas du tout) d'autres comptes
+sauf exceptions sur les comptes 416 ou autres cas exceptionnels.
+Ce système reste évolutif et permet à un comptable d'associer des catégorie à
+n'importe quel compte dans la mesure où il le jugerait utile.
+
+``Attributs :``
+---------------
+
+- matcher : Le nom de la catégorie du client.
+
+
+
+``Project``
+===========
+``Description :``
+-----------------
+Les projets sont un moyen de regrouper des écritures afin de réaliser des
+recherches et des calculs de coûts associés à un projet précis. Ainsi un
+comptable pourra réaliser une compta-analytique et connaître la rentabilité de
+ses différents contrats.
+A long terme ces informations relatives à un projet proviendront de Chorem ou
+d'autre solutions purement de gestion de projet, ces informations seront importé
+afin d'en faciliter l'analyse comptable.
+
+``Attributs :``
+---------------
+
+- matcher : Le nom du projet.
+
+- uri : Une adresse vers laquelle sur laquelle pointera le projet Chorem relatif
+à l'écriture ciblée.
+
+
+
+``Tax``
+=======
+``Description :``
+-----------------
+Permettra d'assigner un type d'impot à une écriture comptable (TVA, IS, Banque,
+etc.).
+
+``Attributs :``
+---------------
+
+- matcher : Un type de taxe.
+
+
+
+``Particularité des classes : User, TypePresta, Client, Project et Tax``
+========================================================================
+``Explication :``
+-----------------
+Ces classes s'inscrivent dans une démarche de synchronisation des données entre
+Callao et Chorem dans l'objectif de pouvoir catégoriser des données en fonctions
+de ces cinq critères, fournis par Chorem.
+Ces données seront en fait stockées dans l'attribut detail d'une instance d'Entry
+afin dans une structure de données formatée CSV.
+Par exemple : "user:dupont;user:martin;typePresta:dev;client:LM;projet:lima"
Added: trunk/src/site/rst/callao/contact.rst
===================================================================
--- trunk/src/site/rst/callao/contact.rst (rev 0)
+++ trunk/src/site/rst/callao/contact.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,75 @@
+============
+Contact list
+============
+
+Pour contacter les membres du projet ou suivre son évolution, vous pouvez
+utiliser les listes de diffusion du projet :
+
+- Liste utilisateurs : (..USERS_) Liste de discussions des utilisateurs de CALLAO_
+- Liste développeurs : (..DEVEL_) Liste de discussions des développeurs de CALLAO_
+- Liste des commits : (..COMMITS_) Liste des modifications du code de CALLAO_
+
+=======
+Support
+=======
+
+.. image:: logo/codelutin.png
+
+
+Code Lutin est une société de services en logiciels libres spécialisée dans les
+technologies Java/J2EE, XML, UML. Son offre s'étend à l'audit, au conseil, à la
+tierce maintenance applicative et à la formation.
+
+SARL Code Lutin
+44 boulevard des Pas Enchantés
+44230 Saint-Sébastien-Sur-Loire
+France
+
+Contact : Benjamin Poussin, gérant et chef de projet.
+
+Tél : 02 40 50 29 28
+
+
+Code Lutin participe activement au mouvement du logiciel libre et fait partie du
+consortium ObjectWeb, d'Alliance Libre et du réseau Libre-entreprise
+
+
+Plus_.
+
+.. _Plus: http://www.codelutin.com
+
+
+
+
+----------------
+Libre-entreprise
+----------------
+
+.. image:: http://www.csquad.org/stages/stage-tech3/img/libre-entreprise.jpeg
+
+Un regroupement de sociétés expertes en solutions libres
+
+Libre-entreprise est un réseau de sociétés de services en logiciel libre. Son
+développement est fondé sur celui de la communauté du libre : mutualisation des
+compétences et transparence.
+
+
+SiteLibreEntreprise_.
+
+.. _SiteLibreEntreprise: http://www.libre-entreprise.com/index.php/Accueil
+
+
+--------------
+Alliance Libre
+--------------
+
+.. image:: http://www.solago.com/images/logo_AL.png
+
+SiteAllianceLibre_.
+
+.. _SiteAllianceLibre: http://www.alliance-libre.org/
+
+.. _USERS: http://list.chorem.org/cgi-bin/mailman/listinfo/callao-users
+.. _DEVEL: http://list.chorem.org/cgi-bin/mailman/listinfo/callao-devel
+.. _COMMITS: http://list.chorem.org/cgi-bin/mailman/listinfo/callao-commits
+.. _CALLAO: http://maven-site.chorem.org/callao/
\ No newline at end of file
Added: trunk/src/site/rst/callao/developpement.rst
===================================================================
--- trunk/src/site/rst/callao/developpement.rst (rev 0)
+++ trunk/src/site/rst/callao/developpement.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,82 @@
+=============
+Développement
+=============
+
+Nous utiliserons cette section pour fournir des informations concernant
+l'avancement du développement du moteur Callao.
+
+
+-----------------------
+La génération via ToPIA
+-----------------------
+
+A l'heure actuelle, la génération de code concerne uniquement la couche de
+données via l'utilisation de ToPIA-persistence_ avec xmi pour la définition du
+modèle, H2 pour la base de données, Hibernate pour la couche d'accès aux données,
+et Java pour l'implémentation.
+La construction et la génération du code du projet s'effectue directement via
+Maven à l'aide de la commande de compilation :
+
+``mvn clean compile``
+
+L'ensemble des paramètres commandant cette génération sont définis dans les
+fichiers de configuration de Maven du super pom et du pom du module
+''callao-entity''. Le modèle quant à lui est stocké dans un fichier ''zargo'',
+toujours dans le module ''callao-entity'' et peut être consulté à l'aide
+d' ArgoUML_ .
+LIMA propose un certain nombre de services disponibles via des interfaces, le but
+initial de CALLAO et de pouvoir implémenter ces services de manière locale ou
+distante. L'utilisation de Web Services, comme mis en place pour effectuer la
+communication entre LIMA et OFBiz constitue la solution à cette problématique.
+
+
+
+Néanmoins, pour le moment, les implémentation s'effectuent uniquement de manière
+locale. CALLAO s'occupe uniquement d'implémenter les interfaces de LIMA situées
+dans le module ''lima-service'' de manière locale, et les échanges de Web Services
+n'ont pas encore été mis en place.
+
+
+
+Cependant, une configuration de la génération de cette couche de communication
+par services a tout de même été effectuée via l'utilisation de ToPIA-soa_ . A ce
+titre, un modèle des services est présent en parallèle du modèle entité dans le
+module ''callao-entity''. Ce modèle décrit l'ensemble des services fournissant
+l'application des règles métiers définies pour l'application CALLAO. Couplé à
+ToPIA-soa_ , il permet la génération de cette couche et de ses interfaces associées.
+Cependant une problèmatique de connection aux services de LIMA reste encore non
+résolue.
+
+
+
+De même que pour la partie entity, la génération de la couche service est
+commandée par Maven via la configuration du fichier pom du module
+''callao-service''.
+
+
+
+-------------------------------
+L'implémentation des interfaces
+-------------------------------
+
+Les implémentations des interfaces services de LIMA dans CALLAO représentent les
+fragments de code source de l'application qui vont définir les règles métiers.
+L'ensemble de ce code source se situent dans le module ''callao-service'' et
+s'occupe à l'heure actuelle d'implémenter uniquement localement les interfaces
+services de LIMA.
+
+
+
+L'état d'avancement actuel de ces implémentations est inachevé. En effet, il
+reste encore des améliorations à fournir à celles effectuées et à compléter
+celles des classes ''Period'' et ''Journal'' pour pouvoir au moins répondre aux
+interfaces services existantes de LIMA. De plus, notre modèle de services ne
+reflétant pas entièrement celui de LIMA, il est fort à penser que LIMA aura à
+intégrer de nouvelles fonctionnalités notamment au niveau de l'intégration à
+Chorem, de la gestion des Imports Exports de sauvegardes et de la génération des
+états comptables.
+
+
+.. _ToPIA-persistence: http://topia.labs.libre-entreprise.org/topia/topia-persistence/
+.. _ToPIA-soa: http://topia.labs.libre-entreprise.org/topia/topia-soa/
+.. _ArgoUML: http://argouml.tigris.org/
Added: trunk/src/site/rst/callao/howto.rst
===================================================================
--- trunk/src/site/rst/callao/howto.rst (rev 0)
+++ trunk/src/site/rst/callao/howto.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,6 @@
+
+============================
+Installer et démarrer Callao
+============================
+
+A venir
\ No newline at end of file
Added: trunk/src/site/rst/callao/index.rst
===================================================================
--- trunk/src/site/rst/callao/index.rst (rev 0)
+++ trunk/src/site/rst/callao/index.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,21 @@
+
+==================
+Callao
+==================
+
+Issu du projet Chorem_, et créé pour fonctionner en collaboration avec LIMA_,
+CALLAO_ est *un moteur de comptabilité générale* respectant les conventions
+ainsi que normes imposées par la législation française aux entreprises.
+
+Ce rôle était jusqu'à alors remplis via le moteur de comptabilité d'OfBiz-Neogia,
+CALLAO_ doit pouvoir se substituer à ce moteur mais sans refondre LIMA_ afin de
+laisser aux utilisateurs de LIMA_ le choix du moteur de comptabilité qu'ils
+utilisent ou de faciliter les migrations d'un moteur à l'autre [#]_.
+
+
+----
+
+.. [#] A cet effet des fonctions d'import et d'export seront mises en place.
+.. _ChoreM: http://chorem.labs.libre-entreprise.org
+.. _LIMA: http://maven-site.chorem.org/lima
+.. _CALLAO: http://maven-site.chorem.org/callao
Added: trunk/src/site/rst/callao/lexique.rst
===================================================================
--- trunk/src/site/rst/callao/lexique.rst (rev 0)
+++ trunk/src/site/rst/callao/lexique.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,127 @@
+==========================
+Lexique de la comptabilité
+==========================
+
+Nous définirons ici les quelques notions de comptabilité d'entreprise nécessaires
+à l'appréhension du fonctionnement de CALLAO.
+
+``Actif :``
+-----------
+L'actif d'une entreprise est l'ensemble de son patrimoine. Il comporte notamment
+la trésorerie, les immobilisations et les créances (sommes dues par des tiers).
+
+``Bilan :``
+-----------
+Le bilan est un état comptable, obligatoirement publié à l'issue de l'exercice
+et déduit du Grand Livre. Il présente l'état des actifs (patrimoines, ou emplois
+des ressources) et passifs (ressources, sous diverses formes de dettes) de
+l'entreprise à une date donnée : la date de clôture de l'exercice.
+On peut également établir un bilan provisoire avant la fin de l'exercice.
+
+``Compte :``
+------------
+Un compte est la plus petite unité retenue pour le classement des flux de valeur.
+Il sera débité ou crédité pour symboliser certaines opérations. Il existe par
+exemple des comptes de charges (Impôts sur les sociétés, Achats, Variations de
+stocks...) qui sont débités lors de l'enregistrement d'une charge, des comptes
+d'actifs (Immobilisations...), qui sont débités lors de l'enregistrement d'une
+acquisition d'actif, etc.
+La liste des comptes est données, en France, par le Plan Comptable Général. Ce
+dernier définit, pour chaque compte, un numéro d'identifiant normalisé permettant
+de l'identifier. On distingue 4 grands types de comptes : d'actif, de passif, de
+charge et de produit. L'augmentation d'un compte de charge ou d'actif se traduit
+par un débit du compte concerné (et sa diminution par un crédit). De même,
+l'augmentation d'un compte de produit ou de passif se traduit par un crédit du
+compte concerné (débit pour la diminution).
+Ces comptes sont généralement représentés par deux colonnes (débit et crédit),
+dans lesquelles sont consignées par ordre chronologique descendant les sommes
+passées respectivement au débit et au crédit du compte. Cela leur donne une
+forme de T, ce qui a donné naissance à l'appellation de compte en T.
+
+``Compte de résultat :``
+------------------------
+Le compte de résultat est un état comptable, obligatoirement publié à l'issue de
+l'exercice et déduit du Grand Livre. Il oppose la liste des différentes charges
+(pertes d'argent ou de valeur, que ce soit par consommation, par paiement de
+taxes ou de salaires, par donations, par dépréciation d'actif...) à celle des
+différents produits (gains d'argent, généralement par vente de produits finis ou
+de marchandises).
+Il met également en avant la différence entre les deux, qui représente le
+résultat de l'entreprise pour l'exercice. Celui-ci peut être positif ou négatif,
+suivant que la somme des produits dépasse celle des charges ou non. S'il est
+positif, on parle alors de bénéfice qui pourra être redistribué aux actionnaires
+(propriétaires) ou conservé pour financer l'activité.
+
+``Ecriture :``
+--------------
+Une écriture comptable représente tout simplement le débit ou le crédit d'un
+compte. Elles sont passées par compte dans le Grand Livre, et rassemblées par
+opérations dans le Journal.
+
+``Etats comptables :``
+----------------------
+Les états comptables sont des documents de synthèse déduits du Journal et du
+Grand Livre et dont la publication est également obligatoire à la fin de
+l'exercice. Ils fournissent des indications sur la santé de l'entreprise. Les
+états sont, en France, le bilan, le compte de résultat et l'annexe.
+
+``Exercice :``
+--------------
+Un exercice est une période, généralement de un an, pour laquelle l'entreprise
+établit sa comptabilité. A l'issu de l'exercice, l'entreprise doit publier sa
+comptabilité concernant cette période. Une fois cette publication effectuée,
+aucun retour en arrière ne peut être effectué. C'est pourquoi on considère qu'un
+exercice, une fois fini, doit être clôturé, ce qui interdit alors toutes
+modifications sur les informations comptables concernant cet exercice.
+
+``Grand Livre :``
+-----------------
+Historiquement, le Grand Livre est le cahier où sont consignés tous les comptes
+en T de l'entreprises (tableaux de deux colonnes, débit et crédit, consignant
+les diverses écritures passées sur le compte), à raison d'un par page.
+
+``Journal :``
+-------------
+Historiquement, le journal est le cahier où l'entreprise consigne par ordre
+chronologique la trace de ses opérations comptables (transactions). Parfois,
+celle-ci utilise plusieurs journaux (journal des achats, journal des stocks,
+journal des ventes...) afin de séparer les différents types d'opération et de
+mieux s'y retrouver, ou de diviser la responsabilité de la consignation des
+transactions entre différentes personnes, chacune responsable d'un domaine
+précis (achat, vente, stock...). On parle alors de comptabilité multi-journaux.
+
+``Passif :``
+------------
+Le passif d'une entreprise est l'ensemble des ressources de l'entreprise, sous
+la forme de capitaux et de dettes.
+
+``Report à nouveau :``
+----------------------
+Historiquement, lors de la clôture d'un exercice comptable, on changeait de
+cahiers (Journal et Grand Live) pour attaquer la consignation des opérations du
+nouvel exercice. On soldait alors tous les comptes du Grand Livre en débitant
+les comptes créditeurs et en créditant les comptes débiteurs de la valeur du
+solde (différence entre débit et crédit) du compte. On effectuait alors
+l'opération inverse en première opération du nouvel exercice. On appelle cette
+opération un report à nouveau.
+Dans notre cas, comme dans tous les logiciels de comptabilité, le report à
+nouveau ne sera que partiellement effectué. Si CALLAO reportera bien le solde
+des différents comptes sur l'exercice suivant, nous ne solderons pas l'exercice
+précédent.
+
+``Transaction :``
+-----------------
+Ce que nous appelons ici transaction désigne une opération comptable, c'est-à-dire
+l'inscription au journal, à une date donnée, d'un certain nombre d'écritures de
+débit et de crédit. Pour que l'opération soit équilibrée, il faut que la somme
+des écritures de crédit (sur certains comptes) la composant soit égale à celle
+des écritures de débit (sur d'autres comptes). C'est pourquoi on peut voir
+l'ensemble comme une transaction entre plusieurs comptes.
+Une transaction peut, par exemple, représenter une opération d'achat à un
+fournisseur (Crédit du compte de "Achat", débit du compte "Fournisseur"), une
+opération de vente à un client... Dans ce genre de cas, la réalité de l'opération
+peut être prouvée à l'aide d'un justificatif, dont la référence sera inscrite
+dans la comptabilité.
+Historiquement, une transaction est inscrite au Journal (ou, pour la comptabilité
+multi-journaux au journal concerné : journal des ventes, journal des achats...)
+et ses écritures sont reportées au Grand Livre.
\ No newline at end of file
Added: trunk/src/site/rst/callao/news.rst
===================================================================
--- trunk/src/site/rst/callao/news.rst (rev 0)
+++ trunk/src/site/rst/callao/news.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,14 @@
+====
+News
+====
+
+Quoi de neuf sur le projet CALLAO ?
+
+Mise en Ligne du site
+=====================
+
+``Par :`` Jean ``[le Jeudi 24 septembre 2009]``
+
+Le site du projet est enfin en ligne, il faisait précédemment partie du site de
+Lima, il est maintenant autonome et s'étoffera au fur et à mesure de l'avancée
+du projet.
\ No newline at end of file
Added: trunk/src/site/rst/callao/roadmap.rst
===================================================================
--- trunk/src/site/rst/callao/roadmap.rst (rev 0)
+++ trunk/src/site/rst/callao/roadmap.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,9 @@
+=======
+RoadMap
+=======
+
++-----------------------------------------------------------------------------------------+
+| **A venir** |
++-------------------+---------------------------------------------------------------------+
+| *Release* | Release d'une version packagée exécutable comprenant Lima et Callao |
++-------------------+---------------------------------------------------------------------+
Added: trunk/src/site/rst/callao/todo.rst
===================================================================
--- trunk/src/site/rst/callao/todo.rst (rev 0)
+++ trunk/src/site/rst/callao/todo.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,17 @@
+TODO
+====
+
+- suppression des DTOs et utilisation directe des entities
+- suppression des convertObject qui du coup ne servent plus
+- les services devrait plutot lever des exceptions au lieu de retourner des
+ codes d'erreur. (donc revoir la gestion des erreurs dans lima)
+- les methodes de recherche devrait plutot etre dans les DAO que sur les
+ services
+- certaine methode de service ne devrait pas exister (modifyAccount qui prend
+ en argument les differents champs de l'entity, est a remplacer simplement
+ par un store de l'entity)
+- potentiellement il ne faudrait qu'un service CallaoService:
+ store(Object); load(Object); delete(Object); search(Criteria); search(????);
+ getReportList():List<String>; getReport(String name): html/pdf/data?
+ pas de: import(); export(); car c le job de lima ce qui uniformise les formats
+- a quoi sert les UserSerice (ne faut-il pas plutot utiliser celui de Topia ?)
Added: trunk/src/site/rst/callao/usecases.rst
===================================================================
--- trunk/src/site/rst/callao/usecases.rst (rev 0)
+++ trunk/src/site/rst/callao/usecases.rst 2010-03-30 14:15:15 UTC (rev 2819)
@@ -0,0 +1,312 @@
+=====================
+Les Cas d'Utilisation
+=====================
+
+| Cette section présente les cas d'utilisation du moteur CALLAO couplé à LIMA.
+
+``Cas d'utilisation``
+=====================
+
+``Diagramme global``
+--------------------
+
+| Afin d'optimiser la lisibilité des diagrammes, nous avons commencé par décrire les grandes groupes de fonctionnalités, avant d'entrer dans le détail des cas d'utilisation pour chacun.
+
+.. image:: uc/uc-base.png
+
+| On se retrouve donc avec 5 cas d'utilisation globaux :
+
+- Gérer Ecritures : Saisie et modification des écritures comptables.
+- Gérer Périodes : Paramétrage et clôturage des exercice, gestion de la semi-clôture des intervalles de temps.
+- Gérer Comptes : Ajout et modification des comptes.
+- Gérer Fichiers : Import et export des données.
+- Générer Etats : Génération d'états comptables sous forme imprimable, ainsi que des journaux et du grand livre.
+- Synchronier Chorem : Cette fonctionnalité ne correspond pas vraiment à un cas d'utilisation inhérent à LIMA-CALLAO, mais plus à une possibilité d'accès à certaines données qui doit être prévue pour une synchronisation entre CALLAO et Chorem via un logiciel tiers (qui est néanmoins détaillé ici).
+
+``Gérer Ecritures``
+-------------------
+.. image:: uc/uc-journal.png
+| Le diagramme parle de lui-même. Il faudra être vigilent à ne pas pouvoir ajouter d'écriture dans un exercice non encore ouvert ou déjà verrouillé. Il en va de même pour les modification et les suppression.
+
+
+
+| **Cas d'utilisation** : Ajouter Écriture étend : Ajouter Transaction; Gérer Ecritures
+| Acteur principal : Comptable
+| Invariants :
+
+- Une écriture (Entry) appartient à une transaction.
+- Toute opération (par extension tout ajout) sur une écriture (Entry) est répertoriée dans un Log.
+- On ne peut ajouter d'entrée à un exercice (Period) ou un intervalle de temps (TimeSpan) clôturé ou inexistant.
+| Scénario
+| Cas 1 : Ajout d'une écriture dans une transaction non existante pour un intervalle de temps (TimeSpan) non clôturé :
+| Préconditions :
+
+- L'entrée à créer n'appartient pas à une transaction déjà existante.
+- La date entrée pour cette transaction correspond à l'intervalle de temps en cours ou à un intervalle non clôturé.
+| Résultat :
+
+- Une nouvelle entrée est créée et répertoriée dans une nouvelle transaction, elle-même répertoriée dans un journal donné et dans l'intervalle de temps correspondant à la date donnée pour la transaction.
+- Cet ajout d'entrée est consigné dans un nouveau Log.
+| Description :
+
+- Une nouvelle transaction est créée, avec pour attributs les valeurs de la date et de la référence justificatif entrée dans l'interface.
+- Elle est ajoutée au journal depuis lequel l'utilisateur l'a créée (menu déroulant de l'interface), ainsi que dans l'intervalle de temps correspondant à la date donnée.
+- L'entrée est créée avec les données saisies (description, montant, débit, lettrage, compte) et ajoutée à la nouvelle transaction. Un Log est également créé, consignant la date courante (date de modif), la date donnée pour la transaction, le type d'opération (en l'occurrence, ajout) et les attributs de l'écriture et de la transaction.
+| Cas 2 : Ajout d'une écriture dans une transaction existante pour un intervalle de temps (TimeSpan) non clôturé :
+| Préconditions :
+
+- L'entrée à créer appartient à une transaction déjà existante.
+- La date entrée pour cette transaction correspond à l'intervalle de temps en cours ou à un intervalle non clôturé.
+| Résultat :
+
+- Une nouvelle entrée est créée dans une transaction existante. Cet ajout d'entrée est consigné dans un nouveau Log.
+| Description :
+
+- L'entrée est créée avec les données saisies (description, montant, débit, lettrage, compte) et ajoutée à la transaction donnée.
+- Un Log est également créé, consignant la date courante (date de modif), la date donnée pour la transaction, le type d'opération (en l'occurrence, ajout) et les attributs de l'écriture.
+| Exceptions
+| Exception1 : Ajout d'une écriture pour un exercice à venir n'existant pas encore.
+| Préconditions :
+
+- La date de la transaction correspondant à l'entrée ne correspond à aucun exercice existant.
+| Résultat : Rien.
+| Description :
+
+- Un message est affiché pour indiquer à l'utilisateur la démarche à suivre pour créer un nouvel exercice.
+| Exception 2 : Ajout d'une écriture pour un exercice (Period) ou un intervalle de temps (TimeSpan) clôturé.
+| Préconditions :
+
+- La date de la transaction correspondant à l'entrée appartient à un exercice ou un IT clôturé.
+| Résultat : Rien.
+| Description :
+
+- Un message d'erreur est affiché, indiquant à l'utilisateur qu'il ne peut effectuer l'opération d'ajout.
+
+| **Cas d'utilisation **: Modifier Ecriture étend : Gérer Ecritures
+| Acteur principal : Comptable
+| Invariants :
+
+- Une écriture (Entry) ne migre pas d'une transaction à l'autre.
+- Toute opération (par extension toute modification sur une écriture (Entry) est répertoriée dans un Log.
+- On ne peut migrer une entrée vers un exercice (Period) ou un intervalle de temps (TimeSpan) clôturé ou inexistant.
+
+| Scénario :
+| Cas 1 : Modification d'une écriture pour un intervalle de temps (TimeSpan) non clôturé :
+| Pré-conditions :
+
+- L'entrée à créer n'appartient pas à une transaction déjà existante.
+- La date entrée pour cette transaction correspond à l'intervalle de temps en cours ou à un intervalle non clôturé.
+| Résultat :
+
+- Une nouvelle entrée est créée et répertoriée dans une nouvelle transaction, elle-même répertoriée dans un journal donné et dans l'intervalle de temps correspondant à la date donnée pour la transaction.
+- Cet ajout d'entrée est consigné dans un nouveau Log.
+| Description :
+
+- L'entrée est modifiée avec les données nouvellement saisies (description, montant, débit, lettrage, compte).
+- Un Log est également créé, consignant la date courante (date de modif), la date donnée pour la transaction, le type d'opération (en l'occurrence, modification) et les attributs de l'écriture et de la transaction.
+| Exceptions
+| Exception1 : Modification d'une écriture pour un intervalle de temps clôturé.
+| Pré-conditions :
+
+- La date de la transaction correspondant à l'entrée correspond à un intervalle de temps semi-clôturé, voire à un exercice clôturé.
+| Résultat : Rien.
+| Description :
+
+- Un message d'erreur est affiché, indiquant à l'utilisateur qu'il ne peut effectuer l'opération de modification.
+
+| La suppression d'écriture se comporte de manière analogue à la modification, c'est pourquoi nous ne la détaillerons pas ici. Notons juste que si la dernière écriture restant dans une transaction est supprimée, celle-ci sera également supprimée.
+
+|
+| **Cas d'utilisation** : Modifier Transaction étend : Gérer Transactions
+| Acteur principal : Comptable
+| Invariants :
+
+- Aucune transaction ne peut être déplacée dans une période clôturée ou un intervalle de temps semi-clôturé, ni dans un exercice n'existant pas.
+| scénario
+| Cas 1 : Modification du voucherRef ou de la date vers un intervalle de temps existant et non-clôturé :
+| Pré-conditions :
+
+- La transaction n'appartient pas à un intervalle de temps clôturé.
+- La date n'est pas modifiée pour une date concernant un intervalle de temps non existant ou clôturé.
+| Résultat :
+
+- La transaction est modifiée.
+- Un nouveau log est créé pour chacune des Entry de la Transaction.
+| Description :
+
+- La transaction est modifiée avec les données nouvellement saisies (description, montant, débit, lettrage, compte).
+- Pour chacune des écritures de la transaction, un Log est également créé, consignant la date courante (date de modif), la date donnée pour la transaction, le type d'opération (en l'occurrence, modification) et les attributs de l'écriture et de la transaction.
+| Exceptions
+| Exception1 : Modification d'une transaction dans un intervalle de temps clôturé.
+| Pré-conditions :
+
+- La date de la transaction correspond à un intervalle de temps semi-clôturé, voire à un exercice clôturé.
+| Résultat : Rien.
+| Description :
+- Un message d'erreur est affiché, indiquant à l'utilisateur qu'il ne peut effectuer l'opération de modification.
+| Exception2 : Modification de la date de la transaction vers un intervalle de temps clôturé.
+| Pré-conditions :
+- La nouvelle date donnée pour la transaction correspond à un intervalle de temps semi-clôturé, voire à un exercice clôturé.
+| Résultat : Rien.
+| Description :
+- Un message d'erreur est affiché, indiquant à l'utilisateur qu'il ne peut effectuer l'opération de modification.
+
+
+``Gérer Périodes``
+------------------
+.. image:: uc/uc-exercice.png
+| Lors de l'ouverture d'un exercice, il est automatiquement divisé en TimeSpan (qui représenteront des mois en pratique). Ces TimeSpan sont verrouillables, de manière à accéder à un état proche de la clôture, mais où il reste possible de les déverrouiller, ce afin d'éviter d'éventuelles erreurs de saisie. La clôture d'un exercice entraîne la fermeture (définitive cette fois) de tous les TimeSpan qui le composent. A noter également qu'un TimeSpan ne peut être ouvert qu'à la condition que tous les TS posterieurs le soient aussi (et consecutivement un TS ne peut être semi-cloturé que si les TS anterieurs le sont aussi.
+|
+| **Cas d'utilisation** : UC Ouvrir Nouvel Exercice étend l'UC « cloture de periode »
+| Acteur principal : Comptable.
+| Invariant
+
+- Il ne peut jamais y avoir plus de deux exercices non clôturer en même temps.
+| Scénario
+| Cas 1: Création d'un exercice(Period).
+| Pré-condition :
+
+- L'exercice ne doit pas être déjà créer.
+| Description :
+
+- La création d'un nouvel exercice à besoin de connaitre la durée de ce nouvel exercice.
+- Par défaut cette période est de 12 mois.
+- Pour chaque mois, on crée un intervalle de temps.
+- On réalise les différents report à nouveau pour équilibrer l'exercice précèdent et commencer avec les bons chiffre l'exercice nouvellement créer.
+| Post-condition :
+
+- L'intégralité de l'exercice est couvert par des intervalles de temps.
+- La date de début d'exercice et la date de fin de l'exercice précédent se suivent.
+
+| Cas d'utilisation : UC Clôturer Exercice étend l'UC « cloture de periode »
+| Acteur principal : Comptable.
+| Scénario
+| Cas 1: Clôture d'un exercice(Period).
+| Pré-condition :
+
+- L'exercice ne doit pas être déjà clôturé.
+- La date de fin d'exercice doit être atteinte pour pouvoir clôturer l'exercice.
+| Description :
+
+- La clôture de l'exercice entraine la clôture définitive de l'ensemble des intervalles de temps qui le compose.
+- Les opérations de l'exercice ne sont plus éditables.
+- Il est alors possible de publier les documents comptables (ex: bilan, compte de résultat).
+- Les reports à nouveau sont calculés et passés sur l'exercice suivant.
+- Un backup de l'exercice est alors généré.
+| Post-condition :
+
+- L'ensemble des écritures n'est modifiable depuis Callao.
+
+
+| **Cas d'utilisation** : UC Semi-clôturer Intervalle de Temps (Cet UC est étendu par l'UC « création de période »)
+| Acteur principal : Comptable.
+| Invariant
+
+- Toutes les périodes d'un exercice clôturé sont clôturé.
+- Un intervalle de temps dure 1 mois
+| Scénario
+
+- Cas 1: Clôture d'un intervalle de temps(TimeSpan).
+| Pré-condition :
+- L'intervalle de temps ne doit pas être déjà clôturé.
+- La date de fin de période doit être supérieure à la date de début de la période à clôturer.
+| Description :
+
+- Lorsque l'utilisateur clôture l'intervalle, l'ensemble des écritures du mois sont bloquées.
+- S'ils ne le sont pas déjà, l'ensemble des mois précédents sont clôturés.
+- L'utilisateur a toujours la possibilité de débloquer cet intervalle tant que
+l'exercice n'est pas clôturé lui même.
+| Post-condition :
+
+- L'ensemble des écritures n'est plus modifiable depuis Callao.
+- Les périodes précédents cet intervalle sont clôturés.
+| Cas 2: Dé-clôturer un intervalle de temps.
+| Pré-condition :
+
+- L'intervalle de temps doit être clôturer.
+- L'exercice dont il fait parti ne doit pas être clôturer.
+| Description :
+
+- L'intervalle de temps redevient modifiable par l'utilisateur.
+- Le comptable peut alors ajouter, modifier ou supprimer des transactions sur cet intervalle.
+- Tout les intervalles de temps qui le suivent sont dé-clôturés, si ils sont déjà clôturés.
+- L'intervalle est de nouveau clôturable.
+| Post-Condition :
+- Les écritures sont de nouveaux modifiables, les périodes suivantes sont dé-clôturés.
+
+
+``Gérer Comptes``
+-----------------
+.. image:: uc/uc-comptes.png
+| La seule petite particularité de ces cas d'utilisation est qu'on ne pourra pas modifier le numéro ou supprimer un compte sur lequel des écritures ont été passées.
+
+``Gérer Fichiers``
+------------------
+.. image:: uc/uc-fichiers.png
+Génère des fichiers pour sauvegarder ou échanger les données.
+
+| **Cas d'utilisation** : UC Exporter vers Fichiers
+| Acteur principal : Comptable.
+| Scénario
+| Cas 1: Export d'un exercice comptable.
+| Description :
+
+- Récupération de l'ensemble des données.
+- Un fichier est crée avec l'ensemble des paramètres de l'application. Il comprend :
+- les données relatives à l'entreprise (siret, raison sociale...)
+- les comptes de l'entreprise
+- les journaux
+- Les exercices de l'entreprise.(Intervalle de temps, transactions, écritures...)
+| Post-condition :
+
+- Un fichier XML valide est généré.
+
+| **Cas d'utilisation** : UC Importer depuis Fichiers
+| Acteur principal : Comptable.
+| Scénario
+| Cas 1: Import de données
+| Description :
+
+- L'utilisateur spécifie le chemin du fichier à importer.
+- Le fichier est parsé, on supprime l'ensemble des données de la base
+- On enregistre dans la base de données les informations récupérer du fichier.
+| Cas exceptionnels
+| Cas Exceptionnel 1 : Le fichier spécifier n'est pas valide ou n'existe pas.
+| Description :
+
+- Un message d'erreur est affiché.
+- La base de données n'est pas changer.
+
+
+``Générer Etats``
+-----------------
+.. image:: uc/uc-etats.png
+| On aura une génération d'états provisoires pour les périodes non clôturées, et définitif pour les périodes clôturées. On prévoit pour l'instant une génération en PDF. Cette génération pourra être effectuée à n'importe quel moment.
+
+| **Cas d'utilisation** : UC Générer état
+| Acteur principal : Comptable.
+| Invariants
+
+- Un état concerne un seul exercice.
+- Un état sera prévisionnel tant que l'exercice concerné ne sera pas clôturé.
+| Scénario
+| Cas 1: Génération d'un état(Bilan, compte de résultat...).
+| Pré-condition :
+
+- Il faut que l'exercice existe pour pouvoir générer un état.
+| Description :
+
+- On solde les comptes concernés ( ex :produit et charge pour compte de résultat... ).
+- On les affectes aux champs de l'état comptable.
+- On récupère les informations sur la société ( numéro siren, raison sociale...)
+- On exporte dans un fichier au format pdf dont le chemin est prédéfini, l'état concerné.
+- Si l'état n'est pas clôturé, le fichier indique que c'est un état prévisionnel.
+| Post-condition :
+
+- Un fichier pdf est créé.
+
+
+``Synchronier Chorem``
+----------------------
+.. image:: uc/uc-liaison.png
+| Cette liaison permet de récupérer des informations de facturation depuis Chorem afin de les passer en écriture dans Lima/Callao, de fait cette "couche de liaison" disposera d'informations persistantes de manière à associer les clients de Chorem à des comptes (client tartenpion = 4111tartenpion etc ...) et de répercuter les domaines tout en sachant aussi éviter les redondances et faciliter les corrections. Une fois les informations éxtraite de Chorem et les données de liaison mises à jour, ces données pourront être poussées dans Lima/Callao.
1
0