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
August 2014
- 1 participants
- 25 discussions
r3912 - in trunk: lima-business/src/test/java/org/chorem/lima/business lima-callao/src/main/java/org/chorem/lima/entity
by dcosse@users.chorem.org 14 Aug '14
by dcosse@users.chorem.org 14 Aug '14
14 Aug '14
Author: dcosse
Date: 2014-08-14 18:09:01 +0200 (Thu, 14 Aug 2014)
New Revision: 3912
Url: http://forge.chorem.org/projects/lima/repository/revisions/3912
Log:
Ajout d'un test en vue de ractorer la requ?\195?\170te de r?\195?\169cup?\195?\169ration des comptes feuille
Added:
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java
Added: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java (rev 0)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountDaoTest.java 2014-08-14 16:09:01 UTC (rev 3912)
@@ -0,0 +1,515 @@
+package org.chorem.lima.business;
+
+import org.chorem.lima.business.exceptions.AlreadyExistAccountException;
+import org.chorem.lima.business.exceptions.InvalidAccountNumberException;
+import org.chorem.lima.business.exceptions.NotAllowedLabelException;
+import org.chorem.lima.business.exceptions.NotNumberAccountNumberException;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.AccountTopiaDao;
+import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Created by davidcosse on 14/08/14.
+ */
+public class AccountDaoTest extends AbstractLimaTest {
+
+ @Test
+ public void testFindAllLeafAccounts() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException {
+ LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext();
+ AccountTopiaDao accountTopiaDao = tcontext.getAccountDao();
+
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "101");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "104");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "105");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1061");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1062");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1063");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1064");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "106");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1068");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "107");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "108");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "10");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "109");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "110");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "11");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "119");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "120");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "12");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "129");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "131");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "138");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "13");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1391");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "139");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1398");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "142");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "143");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "144");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "145");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "146");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "147");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "14");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "148");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "151");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "153");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "154");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "155");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "156");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "157");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "15");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "158");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "161");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "163");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "164");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "165");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "166");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "16");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "169");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "171");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "174");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "17");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "178");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "201");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "203");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "205");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "206");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "207");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "20");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "208");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "211");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "212");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "213");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "214");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "215");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "21");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "218");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "231");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "232");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "237");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "23");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "238");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "261");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "266");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "267");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "268");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "26");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "269");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "271");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "272");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "273");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "274");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "275");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "279");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "28");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "29");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "311");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "312");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "31");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "317");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "321");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "322");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "32");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "326");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "331");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "33");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "335");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "341");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "34");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "345");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "351");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "355");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "35");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "358");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "371");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "37");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "372");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "3");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "391");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "392");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "393");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "394");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "395");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "39");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "397");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "400");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "401");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "403");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "404");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "405");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "40");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "410");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "411");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "413");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "416");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "417");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "418");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "41");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "421");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "422");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "424");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "425");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "426");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "427");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "42");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "431");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "437");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "43");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "438");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "441");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "442");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "443");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "444");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4452");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4455");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44551");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44562");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445661");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445662");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445664");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44566");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445665");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4456");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44567");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4457");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445711");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445712");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445714");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44571");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445715");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44583");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44584");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44586");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4458");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44587");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "446");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "447");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "451");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "455");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "456");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "457");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "45");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "458");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "462");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "464");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "465");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "467");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "46");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4686");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "468");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4687");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "470");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "476");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "477");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "47");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "478");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "481");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "486");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "487");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "48");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "488");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "491");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "495");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "49");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "496");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "501");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "502");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "503");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "504");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "505");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "506");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "507");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "508");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "50");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "509");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5111");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5112");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5113");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "511");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5114");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5121");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "512");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5122");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "514");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "515");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "516");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "517");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "518");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "51");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "519");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "52");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "53");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "530");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "54");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "540");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "58");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "580");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "59");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "590");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "601");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "604");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "605");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "606");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "607");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "608");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "60");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "611");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "612");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "613");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "614");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "615");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "616");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "617");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "618");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "61");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "619");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "621");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "622");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "623");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "624");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "625");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "626");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "627");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "628");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "62");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "629");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "631");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "633");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "635");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "637");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "63");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6371");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6411");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6412");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6413");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "641");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6414");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "644");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6451");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6452");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6453");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "645");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6454");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "646");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "647");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "64");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "648");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "651");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "653");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "654");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "655");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "65");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "658");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "661");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "664");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "665");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "667");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "66");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "668");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6688");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "671");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "672");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "675");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "67");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "678");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68111");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68112");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68161");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "681");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68162");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "686");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "687");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68725");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "691");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "695");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "696");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "697");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "698");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "69");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "699");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "701");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "702");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "703");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "704");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "705");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "706");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "707");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "708");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "70");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "709");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "71");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7133");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7134");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "713");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7135");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "721");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "72");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "722");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "74");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "740");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "751");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "752");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "753");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "754");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "755");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "75");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "758");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "761");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "762");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "763");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "764");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "765");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "766");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "767");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "768");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "76");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7688");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "771");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "772");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "775");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "777");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "77");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "778");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78161");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "781");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78162");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "786");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "787");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78725");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "791");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "79");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "796");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "801");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "802");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "80");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "809");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "88");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "8");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "890");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "89");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "891");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6031");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6032");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "603");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2761");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "276");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27682");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27684");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27685");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27688");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2768");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2801");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2803");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2805");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2807");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2808");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "280");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2811");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2812");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2813");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2814");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2815");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2818");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "281");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2905");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2906");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2907");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2908");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "290");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2911");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "291");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2931");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2932");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "293");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2961");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2966");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2967");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2968");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "296");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2971");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2972");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2973");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2974");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2975");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2976");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "297");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1671");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1674");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1675");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "167");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "168");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4081");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4084");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4088");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "408");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4091");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4096");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4097");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4098");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "409");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4191");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4196");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4197");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4198");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "419");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4282");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4284");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4286");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4287");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "428");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6022");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "602");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6026");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6091");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6092");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6094");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6095");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6096");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6097");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6098");
+ accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "609");
+
+ for (int i = 0 ; i < 10 ; i++ ) {
+ long before = System.currentTimeMillis();
+ List<Account> accounts = accountTopiaDao.findAllLeafAccounts();
+ long after = System.currentTimeMillis();
+// log.info("temps refactoré:" + (after - before));
+
+ // code temporaire non performant en attandant:
+
+ long before1 = System.currentTimeMillis();
+ List<Account> allAccounts = (List<Account>) accountTopiaDao.findAll();
+ Iterator<Account> itAccount = allAccounts.iterator();
+ while (itAccount.hasNext()) {
+ Account acc = itAccount.next();
+ for (Account acc2 : allAccounts) {
+ if (!acc2.getAccountNumber().equals(acc.getAccountNumber()) &&
+ acc2.getAccountNumber().startsWith(acc.getAccountNumber())) {
+ itAccount.remove();
+ break;
+ }
+ }
+ }
+ long after1 = System.currentTimeMillis();
+// log.info("temps original:" + (after1 - before1));
+
+ Assert.assertEquals(allAccounts.size(), accounts.size());
+ }
+ }
+}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java 2014-08-14 14:06:09 UTC (rev 3911)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java 2014-08-14 16:09:01 UTC (rev 3912)
@@ -26,6 +26,8 @@
package org.chorem.lima.entity;
import com.google.common.collect.Maps;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.HqlAndParametersBuilder;
import org.nuiton.topia.persistence.TopiaException;
@@ -34,6 +36,7 @@
import java.util.Map;
public class AccountTopiaDao extends AbstractAccountTopiaDao<Account> {
+ protected static final Log log = LogFactory.getLog(AccountTopiaDao.class);
/**
* Retourne tous les comptes qui n'ont pas eux meme de sous compte.
@@ -41,18 +44,23 @@
* @return leaf accounts
*/
public List<Account> findAllLeafAccounts() {
- // FIXME echatellier 20120413 la requete ne fonctionne pas
- // et retourne vide
- /*String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" +
- "FROM " + Account.class.getName() + " b where b.accountNumber like concat(a.accountNumber,'%'))";
- List<Account> accounts = find(query);*/
+// TODO DCossé 14/08/14 La requête suivante fonctionne mais est moins performante que le traitement java
+// String query = "SELECT a." + Account.PROPERTY_ACCOUNT_NUMBER +" FROM " +
+// Account.class.getName() + " a " +
+// "WHERE LENGTH( a." + Account.PROPERTY_ACCOUNT_NUMBER +")=" +
+// "(SELECT MAX(LENGTH(b." + Account.PROPERTY_ACCOUNT_NUMBER +")) " +
+// " FROM " + Account.class.getName() + " b" +
+// " WHERE b." + Account.PROPERTY_ACCOUNT_NUMBER +
+// " LIKE CONCAT (a." + Account.PROPERTY_ACCOUNT_NUMBER + ",'%')" +
+// ")";
+//
+// List<Account> result = findAll(query);
- // code temporaire non performant en attandant:
- List<Account> allAccounts = (List<Account>) findAll();
- Iterator<Account> itAccount = allAccounts.iterator();
+ List<Account> result = (List<Account>) findAll();
+ Iterator<Account> itAccount = result.iterator();
while (itAccount.hasNext()) {
Account acc = itAccount.next();
- for (Account acc2 : allAccounts) {
+ for (Account acc2 : result) {
if (!acc2.getAccountNumber().equals(acc.getAccountNumber()) &&
acc2.getAccountNumber().startsWith(acc.getAccountNumber())) {
itAccount.remove();
@@ -60,19 +68,10 @@
}
}
}
- return allAccounts;
+ return result;
}
/**
- * TODO pas compris l'interet de la methode, si on veut un compte feuille
- * par son numero, cela revient a avoir un compte par son numero.
- */
- @Deprecated
- public Account findLeafAccountByNumber(String number) {
- return forAccountNumberEquals(number).findUniqueOrNull();
- }
-
- /**
* Find account contained into account number interval.
*
* @param accountNumberLow min account number
1
0
r3911 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv
by dcosse@users.chorem.org 14 Aug '14
by dcosse@users.chorem.org 14 Aug '14
14 Aug '14
Author: dcosse
Date: 2014-08-14 16:06:09 +0200 (Thu, 14 Aug 2014)
New Revision: 3911
Url: http://forge.chorem.org/projects/lima/repository/revisions/3911
Log:
fix sonar warning
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-14 14:00:32 UTC (rev 3910)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-14 14:06:09 UTC (rev 3911)
@@ -66,36 +66,6 @@
};
/**
- * String to integer converter (null allowed).
- */
- protected static final ValueParser<Integer> INTEGER_WITH_NULL_PARSER = new ValueParser<Integer>() {
- @Override
- public Integer parse(String value) throws ParseException {
- Integer result = null;
- if (!Strings.isNullOrEmpty(value)) {
- result = Integer.valueOf(value);
- }
- return result;
- }
- };
-
- /**
- * String to double converter.
- * Can handle , or . as decimal separator and ' ' as thousand separator
- */
- protected static final ValueParser<Double> DOUBLE_PARSER = new ValueParser<Double>() {
- @Override
- public Double parse(String value) throws ParseException {
- double result = 0;
- if (!value.isEmpty()) {
- // " " est un espace insécable, pas un " "
- result = Double.valueOf(value.replace(',','.').replace(" ", ""));
- }
- return result;
- }
- };
-
- /**
* O/N boolean parser.
*/
protected static final ValueParser<Boolean> O_N_PARSER = new ValueParser<Boolean>() {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-14 14:00:32 UTC (rev 3910)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-14 14:06:09 UTC (rev 3911)
@@ -37,6 +37,8 @@
import org.nuiton.csv.ValueFormatter;
import org.nuiton.csv.ValueParser;
+import java.text.SimpleDateFormat;
+
/**
* Created by davidcosse on 03/06/14.
*/
@@ -65,7 +67,7 @@
@Override
public Iterable<ExportableColumn<Entry, Object>> getColumnsForExport() {
- ModelBuilder<Entry> modelBuilder = new ModelBuilder<Entry>();
+ ModelBuilder<Entry> modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForExport("account", Entry.PROPERTY_ACCOUNT, ACCOUNT_TO_ACCOUNT_NUMBER_FORMATTER);
modelBuilder.newColumnForExport("amount", Entry.PROPERTY_AMOUNT, BIG_DECIMAL_FORMATTER);
modelBuilder.newColumnForExport("debit", Entry.PROPERTY_DEBIT, O_N_FORMATTER);
@@ -114,7 +116,8 @@
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = humanReadable ? AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+ result = humanReadable ? simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
} else {
result = "";
}
1
0
r3910 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejb/csv lima-swing/src/main/java/org/chorem/lima/ui/celleditor lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 14 Aug '14
by dcosse@users.chorem.org 14 Aug '14
14 Aug '14
Author: dcosse
Date: 2014-08-14 16:00:32 +0200 (Thu, 14 Aug 2014)
New Revision: 3910
Url: http://forge.chorem.org/projects/lima/repository/revisions/3910
Log:
fix sonar warning
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-08-08 23:31:21 UTC (rev 3909)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-08-14 14:00:32 UTC (rev 3910)
@@ -161,9 +161,6 @@
String[] columnHeaderTable = {boldBegin+t("lima-business.document.label")+boldEnd, boldBegin+t("lima-business.document.grossamount")+boldEnd,
boldBegin+t("lima-business.document.provisiondeprecationamount")+boldEnd, boldBegin+t("lima-business.document.netamount")+boldEnd};
financialReport += constructTableLine(columnHeaderTable);
- } else if (printedType == 1) {
- String[] columnHeaderTable = {boldBegin+t("lima-business.document.label")+boldEnd, boldBegin+t("lima-business.document.amount")+boldEnd};
- financialReport += constructTableLine(columnHeaderTable);
} else {
String[] columnHeaderTable = {boldBegin+t("lima-business.document.label")+boldEnd, boldBegin+t("lima-business.document.amount")+boldEnd};
financialReport += constructTableLine(columnHeaderTable);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-08 23:31:21 UTC (rev 3909)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-14 14:00:32 UTC (rev 3910)
@@ -45,7 +45,7 @@
*/
public abstract class AbstractLimaModel<E> extends AbstractImportModel<E> {
- protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ protected static String DATE_FORMAT = "dd/MM/yyyy";
public AbstractLimaModel(char separator) {
super(separator);
@@ -96,37 +96,6 @@
};
/**
- * String to double converter (null allowed).
- * Can handle , or . as decimal separator and ' ' as thousand separator
- */
- protected static final ValueParser<Double> DOUBLE_WITH_NULL_PARSER = new ValueParser<Double>() {
- @Override
- public Double parse(String value) throws ParseException {
- Double result = null;
- if (!value.isEmpty()) {
- // " " est un espace insécable, pas un " "
- result = Double.valueOf(value.replace(',','.').replace(" ", ""));
- }
- return result;
- }
- };
-
- /**
- * Zero to empty string converter.
- */
- protected static final ValueParser<String> ZERO_TO_EMPTY_PARSER = new ValueParser<String>() {
- @Override
- public String parse(String value) throws ParseException {
- String result = value.trim();
- result = result.replaceAll("\\s{2,}", " "); // replace multiple spaces
- if (result.equals("0")) {
- result = "";
- }
- return result;
- }
- };
-
- /**
* O/N boolean parser.
*/
protected static final ValueParser<Boolean> O_N_PARSER = new ValueParser<Boolean>() {
@@ -150,38 +119,13 @@
}
};
- protected static final ValueFormatter<Integer> INTEGER_FORMATTER = new ValueFormatter<Integer>() {
- @Override
- public String format(Integer value) {
- String result;
- if (value != null) {
- result = String.valueOf(value);
- } else {
- result = "";
- }
- return result;
- }
- };
-
- protected static final ValueFormatter<Double> DOUBLE_FORMATTER = new ValueFormatter<Double>() {
- @Override
- public String format(Double value) {
- String result;
- if (value != null) {
- result = String.valueOf(value);
- } else {
- result = "";
- }
- return result;
- }
- };
-
protected static final ValueFormatter<Date> DATE_FORMATTER = new ValueFormatter<Date>() {
@Override
public String format(Date value) {
String result;
if (value != null) {
- result = AbstractLimaModel.simpleDateFormat.format(value);
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+ result = simpleDateFormat.format(value);
} else {
result = "";
}
@@ -197,7 +141,8 @@
public Date parse(String value) throws ParseException {
Date result = null;
if (!Strings.isNullOrEmpty(value)) {
- result = AbstractLimaModel.simpleDateFormat.parse(value);
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+ result = simpleDateFormat.parse(value);
}
return result;
}
@@ -266,14 +211,18 @@
FinancialStatementWayEnum result = null;
if (StringUtils.isNotBlank(value)) {
value = StringUtils.trim(value.toUpperCase());
- if (value.equals("BOTH")) {
- result = FinancialStatementWayEnum.BOTH;
- } else if (value.equals("DEBIT")) {
- result = FinancialStatementWayEnum.DEBIT;
- } else if (value.equals("CREDIT")) {
- result = FinancialStatementWayEnum.CREDIT;
- } else {
- throw new UnsupportedOperationException("Unsupported statement way" + value);
+ switch (value) {
+ case "BOTH":
+ result = FinancialStatementWayEnum.BOTH;
+ break;
+ case "DEBIT":
+ result = FinancialStatementWayEnum.DEBIT;
+ break;
+ case "CREDIT":
+ result = FinancialStatementWayEnum.CREDIT;
+ break;
+ default:
+ throw new UnsupportedOperationException("Unsupported statement way" + value);
}
}
return result;
@@ -326,7 +275,8 @@
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate());
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
+ result = simpleDateFormat.format(value.getTransactionDate());
} else {
result = "";
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-08-08 23:31:21 UTC (rev 3909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-08-14 14:00:32 UTC (rev 3910)
@@ -109,7 +109,7 @@
} else if( (String.valueOf(e.getKeyChar()).matches(",") || String.valueOf(e.getKeyChar()).matches("\\."))
&& comma.equals("")) {
comma = ",";
- } else if(!getComponent().getText().matches(",") || !getComponent().getText().matches(".") &&
+ } else if(!getComponent().getText().matches(",") || !getComponent().getText().matches("\\.") &&
(!String.valueOf(e.getKeyChar()).matches(",") || !String.valueOf(e.getKeyChar()).matches("\\."))) {
comma = "";
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java 2014-08-08 23:31:21 UTC (rev 3909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DefaultLimaTableCellRenderer.java 2014-08-14 14:00:32 UTC (rev 3910)
@@ -82,7 +82,7 @@
LimaConfig.Option backgroundOption;
LimaConfig.Option foreGroundOption;
- if (line % 2 == 1) {
+ if ((line & 1) == 1 || line % 2 == 1) {
if (isSelected) {
if (errorDetector.isError(table, value, row, column)) {
backgroundOption = LimaConfig.Option.TABLE_CELL_PAIR_SELECTED_ERROR_BACKGROUND;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-08 23:31:21 UTC (rev 3909)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-14 14:00:32 UTC (rev 3910)
@@ -134,26 +134,24 @@
/**
* Call the appropriate method in business service.
*
- * @param importExportMethode
- * @param path
- * @param verbose
+ * @param importExportChoice determine what to import/export and export type (CSV, EBP, PDF)
+ * @param path file path for import/export file, if null a dialog will ask for it
+ * @param verbose if true a dialog show result
*/
- public void importExport(ImportExportEnum importExportMethode, String path, boolean verbose) {
- final ImportExportEnum importExportMethodeF = importExportMethode;
+ public void importExport(final ImportExportEnum importExportChoice, String path, boolean verbose) {
final Charset defaultCharset = Charsets.UTF_8;
String filePath = path;
if (Strings.isNullOrEmpty(filePath)) {
- filePath = chooseFile(importExportMethode.getImportMode(), importExportMethode);
+ filePath = chooseFile(importExportChoice.getImportMode(), importExportChoice);
}
- processImport(importExportMethode, verbose, importExportMethodeF, defaultCharset, filePath);
+ processImport(verbose, importExportChoice, defaultCharset, filePath);
}
- protected void processImport(ImportExportEnum importExportMethode, boolean verbose, final ImportExportEnum importExportMethod, final Charset defaultCharset, final String filePath) {
+ protected void processImport(final boolean verboseMode, final ImportExportEnum importExportMethod, final Charset defaultCharset, final String filePath) {
//if export cancel
if (!Strings.isNullOrEmpty(filePath)) {
- final Boolean verboseMode = verbose;
- final Boolean importMode = importExportMethode.getImportMode();
+ final Boolean importMode = importExportMethod.getImportMode();
new SwingWorker<ImportExportResults, Void>() {
@@ -292,7 +290,7 @@
}
}
- private void ComputeExportResultMessage(List<ExportResult> exportResults) {
+ protected void ComputeExportResultMessage(List<ExportResult> exportResults) {
StringBuilder message = new StringBuilder();
for (ExportResult result : exportResults) {
Class fromSource = result.getFromSource();
@@ -309,7 +307,7 @@
DisplayImportExportResultMessage(message, false);
}
- private void ComputeImportResultMessage(List<ImportResult> resultList) {
+ protected void ComputeImportResultMessage(List<ImportResult> resultList) {
StringBuilder message = new StringBuilder();
message.append(t("lima.ui.importexport.import.terminated"));
StringBuilder errorMessage = null;
@@ -336,7 +334,7 @@
}
}
- private void DisplayImportExportResultMessage(StringBuilder message, Boolean importMode) {
+ protected void DisplayImportExportResultMessage(StringBuilder message, Boolean importMode) {
if (log.isDebugEnabled()){
log.debug(message.toString());
}
@@ -349,7 +347,7 @@
JOptionPane.INFORMATION_MESSAGE);
}
- private StringBuilder displayErrorMessage(Map<Integer, LimaException> exceptionsByLine) {
+ protected StringBuilder displayErrorMessage(Map<Integer, LimaException> exceptionsByLine) {
StringBuilder result = new StringBuilder();
if (exceptionsByLine != null) {
for (Map.Entry<Integer, LimaException> e:exceptionsByLine.entrySet()) {
@@ -406,7 +404,7 @@
* @param fromSource The imported target class
* @return the name of the imported/exported entities class.
*/
- private String getFromSourceMessage(Class fromSource) {
+ protected String getFromSourceMessage(Class fromSource) {
String message;
if (fromSource == null) {
message = "BACKUP"+"\n";
1
0
r3909 - in trunk/lima-business-api/src/main/java/org/chorem/lima/business: . exceptions
by dcosse@users.chorem.org 08 Aug '14
by dcosse@users.chorem.org 08 Aug '14
08 Aug '14
Author: dcosse
Date: 2014-08-09 01:31:21 +0200 (Sat, 09 Aug 2014)
New Revision: 3909
Url: http://forge.chorem.org/projects/lima/repository/revisions/3909
Log:
mprops
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/ExportResult.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistEntryBookException.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportBackupException.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoDataToImportException.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoFiscalPeriodFoundException.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotNumberAccountNumberException.java
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/ExportResult.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/ExportResult.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/ExportResult.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import java.io.Serializable;
import java.rmi.server.ExportException;
import java.util.ArrayList;
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/ExportResult.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportExportResults.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistEntryBookException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistEntryBookException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistEntryBookException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import org.chorem.lima.entity.EntryBook;
/**
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyExistEntryBookException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportBackupException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportBackupException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportBackupException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
/**
* Created by davidcosse on 31/07/14.
*/
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
/**
* Created by davidcosse on 06/08/14.
*/
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/ImportFileException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoDataToImportException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoDataToImportException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoDataToImportException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
/**
* Created by davidcosse on 06/08/14.
*/
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoDataToImportException.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoFiscalPeriodFoundException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoFiscalPeriodFoundException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoFiscalPeriodFoundException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
/**
* Created by davidcosse on 06/08/14.
*/
Property changes on: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NoFiscalPeriodFoundException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotNumberAccountNumberException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotNumberAccountNumberException.java 2014-08-08 23:25:18 UTC (rev 3908)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/NotNumberAccountNumberException.java 2014-08-08 23:31:21 UTC (rev 3909)
@@ -1,5 +1,27 @@
package org.chorem.lima.business.exceptions;
+/*
+ * #%L
+ * Lima :: business API
+ * %%
+ * Copyright (C) 2008 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
/**
* @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
*/
1
0
r3908 - in trunk: lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/celleditor lima-swing/src/main/java/org/chorem/lima/ui/common lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction lima-swing/src/main/java/org/chorem/lima/util
by dcosse@users.chorem.org 08 Aug '14
by dcosse@users.chorem.org 08 Aug '14
08 Aug '14
Author: dcosse
Date: 2014-08-09 01:25:18 +0200 (Sat, 09 Aug 2014)
New Revision: 3908
Url: http://forge.chorem.org/projects/lima/repository/revisions/3908
Log:
add serial ids
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteHorizontalAction.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteVerticalAction.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -52,9 +52,7 @@
Iterator<Account> itAccount = allAccounts.iterator();
while (itAccount.hasNext()) {
Account acc = itAccount.next();
- Iterator<Account> itAccount2 = allAccounts.iterator();
- while (itAccount2.hasNext()) {
- Account acc2 = itAccount2.next();
+ for (Account acc2 : allAccounts) {
if (!acc2.getAccountNumber().equals(acc.getAccountNumber()) &&
acc2.getAccountNumber().startsWith(acc.getAccountNumber())) {
itAccount.remove();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -61,7 +61,7 @@
protected static final long serialVersionUID = 1L;
- protected volatile boolean keyPressed;
+ protected volatile boolean keyPressed = false;
/** constructor */
public AccountTableCellEditor() {
@@ -91,8 +91,8 @@
* Vérifie si la cellule peut être éditable :
* seulement si il y a une frappe au clavier ou un double clic.
*
- * @param evt
- * @return
+ * @param evt the event
+ * @return true celle is editable otherwise not.
*/
@Override
public boolean isCellEditable(EventObject evt) {
@@ -115,7 +115,8 @@
}
}
keyPressed = false;
- return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
+ boolean result = !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
+ return result;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -110,8 +110,8 @@
* Vérifie si la cellule peut être éditable :
* seulement si il y a une frappe au clavier ou un double clic.
*
- * @param evt
- * @return
+ * @param evt the event
+ * @return true, cell is editable otherwise not.
*/
@Override
public boolean isCellEditable(EventObject evt) {
@@ -135,7 +135,8 @@
}
// Remet à faux pour la premiere lettre tapée au clavier
keyPressed = false;
- return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
+ boolean result = !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
+ return result;
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTableModel.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -40,7 +40,8 @@
* @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
*/
public abstract class AbstractLimaTableModel<E> extends AbstractTableModel {
-
+
+ private static final long serialVersionUID = -1125159257823536360L;
protected List<E> values;
protected List<Column<AbstractLimaTableModel<E>>> columns;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteHorizontalAction.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteHorizontalAction.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteHorizontalAction.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -33,6 +33,7 @@
*/
public class CellRouteHorizontalAction extends AbstractAction{
+ private static final long serialVersionUID = 6178936082032645524L;
JTable table;
protected int step;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteVerticalAction.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteVerticalAction.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/CellRouteVerticalAction.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -31,6 +31,8 @@
*/
public class CellRouteVerticalAction extends CellRouteHorizontalAction {
+ private static final long serialVersionUID = -4984679970177484506L;
+
public CellRouteVerticalAction(JTable table, boolean nextCell) {
super(table, nextCell);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -35,6 +35,8 @@
*/
public class LabelListCellRenderer extends BasicComboBoxRenderer {
+ private static final long serialVersionUID = -8893748200888932142L;
+
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/TableModelWithGroup.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -29,6 +29,8 @@
*/
public abstract class TableModelWithGroup<E> extends AbstractLimaTableModel<E> {
+ private static final long serialVersionUID = 2349944168938847283L;
+
public int indexGroupAt(int row) {
int countGroup = 0;
E precedingValue = get(0);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/AccountColumn.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -52,7 +52,6 @@
Account account = (Account) value;
boolean update = ((entry.getAccount()) == null != (account == null))
|| (entry.getAccount() != null
- && account != null
&& !entry.getAccount().getAccountNumber().equals(account.getAccountNumber()));
if (update) {
Account previousAccount = entry.getAccount();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2014-08-08 22:53:39 UTC (rev 3907)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2014-08-08 23:25:18 UTC (rev 3908)
@@ -136,7 +136,7 @@
email.setSubject("Project error notification : Lima");
// message description
- StringBuffer message = new StringBuffer();
+ StringBuilder message = new StringBuilder();
message.append(formatMessage("Project", "Lima " + config.getVersion()));
message.append(formatMessage("Date", new Date().toString()));
message.append(formatMessage("Title", errorInfo.getTitle()));
@@ -149,7 +149,7 @@
for (String propertyName : propertiesNames) {
// security, don't send string containing password :
if (!propertyName.contains("pass")) {
- message.append("\t" + propertyName + " : " + config.getOptions().getProperty(propertyName) + "\n");
+ message.append("\t").append(propertyName).append(" : ").append(config.getOptions().getProperty(propertyName)).append("\n");
}
}
@@ -160,6 +160,7 @@
message.append(formatMessage("Exception", out.toString()));
// send mail
+ email.setMsg(message.toString());
email.send();
JOptionPane.showMessageDialog(null, "A report message has been sent to " + emailTo);
1
0
08 Aug '14
Author: dcosse
Date: 2014-08-09 00:53:39 +0200 (Sat, 09 Aug 2014)
New Revision: 3907
Url: http://forge.chorem.org/projects/lima/repository/revisions/3907
Log:
refactoring sonar
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -58,14 +58,14 @@
protected static final Log log = LogFactory.getLog(LimaConfig.class);
- protected static LimaConfig instance;
+ protected static volatile LimaConfig instance;
protected static AccountingRules accountingRules;
- protected static ApplicationConfig config;
-
protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties";
+ protected static ApplicationConfig config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
+
public LimaConfig() {
try {
setOption("topia.service.migration", TopiaMigrationEngine.class.getName());
@@ -74,7 +74,6 @@
setOption(TopiaMigrationService.MIGRATION_SHOW_SQL, Boolean.TRUE.toString());
setOption(TopiaMigrationService.MIGRATION_SHOW_PROGRESSION, Boolean.TRUE.toString());
- LimaConfig.config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
LimaConfig.config.loadDefaultOptions(ServiceConfigOption.values());
LimaConfig.config.parse();
@@ -84,9 +83,9 @@
}
public static LimaConfig getInstance() {
- if (instance == null) {
- instance = new LimaConfig();
- instance.loadConfiguration();
+ if (LimaConfig.instance == null) {
+ LimaConfig.instance = new LimaConfig();
+ LimaConfig.instance.loadConfiguration();
}
return instance;
}
@@ -105,30 +104,35 @@
public AccountingRules getAccountingRules() {
if (accountingRules == null) {
- Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
- if (accountingRulesClass == null) {
+ loadAccountingRules();
+ }
+
+ return accountingRules;
+ }
+
+ protected static void loadAccountingRules() {
+ Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
+ if (accountingRulesClass == null) {
+ if (log.isErrorEnabled()) {
+ log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
+ }
+ accountingRules = new FranceAccountingRules();
+ } else {
+ try {
+ accountingRules = (AccountingRules) accountingRulesClass.newInstance();
+ } catch (Exception ex) {
if (log.isErrorEnabled()) {
- log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
+ log.error("Can't instantiate accounting rules", ex);
}
- accountingRules = new FranceAccountingRules();
- } else {
- try {
- accountingRules = (AccountingRules) accountingRulesClass.newInstance();
- } catch (Exception ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't instantiate accounting rules", ex);
- }
- }
}
}
-
- return accountingRules;
}
public void setAccountingRule(String accountingRule) {
- LimaConfig.accountingRules = null; // clear cache
LimaConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
+ // clear cache
+ loadAccountingRules();
}
public File getDataDir() {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -95,7 +95,6 @@
context.getTarget().getClass() + "#" + context.getMethod().getName());
}
-
ApplicationConfig config = LimaConfig.getInstance().getConfig();
LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(config.getFlatOptions(), CREATE_CONTEXT_FUNCTION);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -979,64 +979,4 @@
return entryBookFinancialTransactionByDate;
}
- //#######################################################################################################
-
-// @Override
-// public String importAsPDF(String datas,
-// ImportExportEntityEnum importExportEntityEnum,
-// boolean setMode) {
-//
-// StringBuilder result = new StringBuilder();
-//
-// PDDocument doc = null;
-// try {
-// String path = LimaConfig.getInstance().getReportsDir().getAbsolutePath();
-//
-// String filePathDefault = path + File.separator
-// + DocumentsEnum.VAT.getFileName() + "_default.pdf";
-// String filePathStructured = path + File.separator
-// + DocumentsEnum.VAT.getFileName() + "_structure.pdf";
-//
-// InputStream reportsStream = new FileInputStream(datas);
-// //DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
-// // load the document
-// doc = PDDocument.load(reportsStream);
-//
-// //save default vat document with empty boxes
-// if (setMode) {
-// doc.save(filePathDefault);
-// }
-//
-// //search for all PDFBox
-// List<PDField> FieldList = doc.getDocumentCatalog().getAcroForm().getFields();
-//
-// //display inside each box their name
-// for (PDField pdField : FieldList) {
-// pdField.setValue(pdField.getFullyQualifiedName());
-// }
-//
-// // save the structured document
-// doc.save(filePathStructured);
-//
-// //sets the new pdf url to be used as pdf document edited for reports
-// if (setMode) {
-// LimaConfig.getInstance().setVatPDFUrl(datas);
-// }
-// } catch (IOException ex) {
-// log.error("Can't read vat pdf", ex);
-// result.append("Can't read vat pdf");
-// } catch (COSVisitorException ex) {
-// log.error("Can't save vat pdf", ex);
-// result.append("Can't save vat pdf");
-// } finally {
-// try {
-// if (doc != null) {
-// doc.close();
-// }
-// } catch (Exception e) {
-// // Nothing to do
-// }
-// }
-// return result.toString();
-// }
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -22,16 +22,11 @@
* #L%
*/
-import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.chorem.lima.FinancialStatementWayEnum;
-import org.chorem.lima.business.api.AccountService;
-import org.chorem.lima.business.api.EntryBookService;
-import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.VatStatement;
@@ -50,32 +45,12 @@
*/
public abstract class AbstractLimaModel<E> extends AbstractImportModel<E> {
-
- protected static EntryBookService entryBookService;
-
- protected static FinancialTransactionService financialTransactionService;
-
- protected static AccountService accountService;
-
- protected static Boolean humanReadable;
-
protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
public AbstractLimaModel(char separator) {
super(separator);
}
- public AbstractLimaModel(char separator, EntryBookService entryBookService) {
- super(separator);
- AbstractLimaModel.entryBookService = entryBookService;
- }
-
- public AbstractLimaModel(char separator, AccountService accountService, FinancialTransactionService financialTransactionService, Boolean humanReadable) {
- super(separator);
- AbstractLimaModel.accountService = accountService;
- AbstractLimaModel.financialTransactionService = financialTransactionService;
- AbstractLimaModel.humanReadable = humanReadable;
- }
/**
* String to integer converter.
*/
@@ -228,33 +203,10 @@
}
};
- protected static final ValueFormatter<EntryBook> ENTRY_BOOK_TO_ENTRY_BOOK_CODE_FORMATTER = new ValueFormatter<EntryBook>() {
- @Override
- public String format(EntryBook value) {
- String result;
- if (value != null) {
- result = value.getCode();
- } else {
- result = "";
- }
- return result;
- }
- };
- protected static final ValueParser<EntryBook> ENTRY_BOOK_CODE_TO_ENTRY_BOOK_PARSER = new ValueParser<EntryBook>() {
- @Override
- public EntryBook parse(String value) {
- EntryBook result;
- if (StringUtils.isNotBlank(value)) {
- result = AbstractLimaModel.entryBookService.getEntryBookByCode(value);
- } else {
- result = null;
- }
- return result;
- }
- };
+
protected static final ValueParser<BigDecimal> BIG_DECIMAL_WITH_NULL_PARSER = new ValueParser<BigDecimal>() {
@Override
public BigDecimal parse(String value) throws ParseException {
@@ -294,45 +246,6 @@
}
};
- protected static final ValueParser<Account> ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER = new ValueParser<Account>() {
-
- @Override
- public Account parse(String value) {
- Account result;
- if (StringUtils.isNotBlank(value)) {
- result = AbstractLimaModel.accountService.getAccountByNumber(value);
- } else {
- result = null;
- }
- return result;
- }
- };
-
- protected static final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER = new ValueFormatter<FinancialTransaction>() {
- @Override
- public String format(FinancialTransaction value) {
- String result;
- if (value != null) {
- result = AbstractLimaModel.humanReadable ? AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
- } else {
- result = "";
- }
- return result;
- }
- };
-
- protected static final ValueParser<FinancialTransaction> FINANCIAL_TRANSACTION_ID_TO_FINANCIAL_TRANSACTION_PARSER = new ValueParser<FinancialTransaction>() {
-
- @Override
- public FinancialTransaction parse(String value) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
- FinancialTransaction result;
- result = AbstractLimaModel.financialTransactionService.getFinancialTransactionWithId(value);
- return result;
- }
- };
-
-
protected static final ValueFormatter<FinancialStatementWayEnum> FINANCIAL_STATEMENT_WAY_ENUM_VALUE_FORMATTER = new ValueFormatter<FinancialStatementWayEnum>() {
@Override
public String format(FinancialStatementWayEnum value) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -22,21 +22,35 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import org.apache.commons.lang3.StringUtils;
import org.chorem.lima.business.api.AccountService;
import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryImpl;
+import org.chorem.lima.entity.FinancialTransaction;
import org.nuiton.csv.ExportModel;
import org.nuiton.csv.ExportableColumn;
import org.nuiton.csv.ModelBuilder;
+import org.nuiton.csv.ValueFormatter;
+import org.nuiton.csv.ValueParser;
/**
* Created by davidcosse on 03/06/14.
*/
public class EntryModel extends AbstractLimaModel<Entry> implements ExportModel<Entry> {
+ protected FinancialTransactionService financialTransactionService;
+ protected AccountService accountService;
+ protected boolean humanReadable;
+
public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService, boolean humanReadable) {
- super(';', accountService, financialTransactionService, humanReadable);
+ super(';');
+ this.accountService = accountService;
+ this.financialTransactionService = financialTransactionService;
+ this.humanReadable = humanReadable;
newMandatoryColumn("account", Entry.PROPERTY_ACCOUNT, ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER);
newOptionalColumn("amount", Entry.PROPERTY_AMOUNT, BIG_DECIMAL_WITH_NULL_PARSER);
@@ -69,4 +83,42 @@
public Entry newEmptyInstance() {
return new EntryImpl();
}
+
+ protected final ValueParser<FinancialTransaction> FINANCIAL_TRANSACTION_ID_TO_FINANCIAL_TRANSACTION_PARSER = new ValueParser<FinancialTransaction>() {
+
+ @Override
+ public FinancialTransaction parse(String value) {
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
+ FinancialTransaction result;
+ result = financialTransactionService.getFinancialTransactionWithId(value);
+ return result;
+ }
+ };
+
+ protected final ValueParser<Account> ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER = new ValueParser<Account>() {
+
+ @Override
+ public Account parse(String value) {
+ Account result;
+ if (StringUtils.isNotBlank(value)) {
+ result = accountService.getAccountByNumber(value);
+ } else {
+ result = null;
+ }
+ return result;
+ }
+ };
+
+ protected final ValueFormatter<FinancialTransaction> FINANCIAL_TRANSACTION_TO_FINANCIAL_TRANSACTION_FORMATTER = new ValueFormatter<FinancialTransaction>() {
+ @Override
+ public String format(FinancialTransaction value) {
+ String result;
+ if (value != null) {
+ result = humanReadable ? AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
+ } else {
+ result = "";
+ }
+ return result;
+ }
+ };
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -22,20 +22,27 @@
* #L%
*/
+import org.apache.commons.lang3.StringUtils;
import org.chorem.lima.business.api.EntryBookService;
+import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FinancialTransactionImpl;
import org.nuiton.csv.ExportModel;
import org.nuiton.csv.ExportableColumn;
import org.nuiton.csv.ModelBuilder;
+import org.nuiton.csv.ValueFormatter;
+import org.nuiton.csv.ValueParser;
/**
* Created by davidcosse on 03/06/14.
*/
public class FinancialTransactionModel extends AbstractLimaModel<FinancialTransaction> implements ExportModel<FinancialTransaction> {
+ protected EntryBookService entryBookService;
+
public FinancialTransactionModel(EntryBookService entryBookService) {
- super(';', entryBookService);
+ super(';');
+ this.entryBookService = entryBookService;
newMandatoryColumn("id", FinancialTransaction.PROPERTY_TOPIA_ID);
newOptionalColumn("transactionDate", FinancialTransaction.PROPERTY_TRANSACTION_DATE, DATE_PARSER);
newOptionalColumn("entryBook", FinancialTransaction.PROPERTY_ENTRY_BOOK, ENTRY_BOOK_CODE_TO_ENTRY_BOOK_PARSER);
@@ -55,4 +62,31 @@
return new FinancialTransactionImpl();
}
+ protected ValueParser<EntryBook> ENTRY_BOOK_CODE_TO_ENTRY_BOOK_PARSER = new ValueParser<EntryBook>() {
+
+ @Override
+ public EntryBook parse(String value) {
+ EntryBook result;
+ if (StringUtils.isNotBlank(value)) {
+ result = entryBookService.getEntryBookByCode(value);
+ } else {
+ result = null;
+ }
+ return result;
+ }
+ };
+
+ protected static final ValueFormatter<EntryBook> ENTRY_BOOK_TO_ENTRY_BOOK_CODE_FORMATTER = new ValueFormatter<EntryBook>() {
+ @Override
+ public String format(EntryBook value) {
+ String result;
+ if (value != null) {
+ result = value.getCode();
+ } else {
+ result = "";
+ }
+ return result;
+ }
+ };
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -57,11 +57,11 @@
protected static final Log log = LogFactory.getLog(AccountTableCellEditor.class);
- private final JWideComboBox comboBox;
+ protected final JWideComboBox comboBox;
- private static final long serialVersionUID = 1L;
+ protected static final long serialVersionUID = 1L;
- private static boolean keyPressed;
+ protected volatile boolean keyPressed;
/** constructor */
public AccountTableCellEditor() {
@@ -114,7 +114,7 @@
});
}
}
- AccountTableCellEditor.keyPressed = false;
+ keyPressed = false;
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
}
@@ -133,7 +133,7 @@
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
// Met en place le curseur et la selection après la première lettre
edit.select(1, edit.getText().length());
- AccountTableCellEditor.keyPressed = true;
+ keyPressed = true;
}
// delegate popup list menu
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -40,6 +40,7 @@
*/
public class BigDecimalTableCellEditor extends StringTableCellEditor {
+ private static final long serialVersionUID = -3178887048291878246L;
protected String comma = "";
private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -52,7 +52,7 @@
private static final long serialVersionUID = 1L;
// private static EntryBookTableCellEditor editor;
- private static boolean keyPressed;
+ private volatile boolean keyPressed;
/** constructor */
public EntryBookTableCellEditor() {
@@ -134,7 +134,7 @@
}
}
// Remet à faux pour la premiere lettre tapée au clavier
- EntryBookTableCellEditor.keyPressed = false;
+ keyPressed = false;
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -40,14 +40,10 @@
import org.chorem.lima.ui.celleditor.StringTableCellEditor;
import org.jdesktop.swingx.JXTable;
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
-import javax.swing.KeyStroke;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableModel;
-import java.awt.Color;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -61,6 +57,7 @@
public abstract class AbstractLimaTable<H> extends JXTable {
private static final Log log = LogFactory.getLog(AbstractLimaTable.class);
+ private static final long serialVersionUID = -4195941654485008887L;
protected H handler;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-07 21:37:22 UTC (rev 3906)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-08 22:53:39 UTC (rev 3907)
@@ -99,6 +99,7 @@
public class ImportExport {
private static final Log log = LogFactory.getLog(ImportExport.class);
+ public static final int BUFFER_SIZE = 1024;
/** Parent view. */
protected Component viewComponent;
@@ -544,16 +545,20 @@
String data = exportedData.getExportData();
File file = createFile(JAVA_IO_TMPDIR + exportedData.getFromSource().getSimpleName(), charset, data);
if (file != null) {
- ZipEntry ze= new ZipEntry(file.getName());
- export.putNextEntry(ze);
- int len;
- byte[] buffer = new byte[1024];
- FileInputStream stream = new FileInputStream(file);
- while ((len = stream.read(buffer)) > 0) {
- export.write(buffer, 0, len);
+ FileInputStream stream = null;
+ try {
+ ZipEntry ze = new ZipEntry(file.getName());
+ export.putNextEntry(ze);
+ int len;
+ byte[] buffer = new byte[BUFFER_SIZE];
+ stream = new FileInputStream(file);
+ while ((len = stream.read(buffer)) > 0) {
+ export.write(buffer, 0, len);
+ }
+ } finally {
+ IOUtils.closeQuietly(stream);
+ FileUtils.forceDelete(file);
}
- IOUtils.closeQuietly(stream);
- FileUtils.forceDelete(file);
}
} else {
// export failed
@@ -596,17 +601,20 @@
ZipEntry entry;
while ((entry = zipInputStream.getNextEntry()) != null) {
- byte[] buffer = new byte[2048];
- String targetFileName= tmpDir + entry.getName() + "-" + determinant +".csv";
- FileOutputStream fileoutputstream = new FileOutputStream(targetFileName);
+ FileOutputStream fileoutputstream = null;
+ try {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ String targetFileName= tmpDir + entry.getName() + "-" + determinant +".csv";
+ fileoutputstream = new FileOutputStream(targetFileName);
- int n;
- while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
- fileoutputstream.write(buffer, 0, n);
+ int n;
+ while ((n = zipInputStream.read(buffer, 0, BUFFER_SIZE)) > -1) {
+ fileoutputstream.write(buffer, 0, n);
+ }
+ zipInputStream.closeEntry();
+ } finally {
+ IOUtils.closeQuietly(fileoutputstream);
}
- fileoutputstream.close();
-
- zipInputStream.closeEntry();
}
} catch (Exception e) {
result.addInitException(new ImportFileException(t("lima.ui.importexport.import.extractFileError")));
1
0
Author: dcosse
Date: 2014-08-07 23:37:22 +0200 (Thu, 07 Aug 2014)
New Revision: 3906
Url: http://forge.chorem.org/projects/lima/repository/revisions/3906
Log:
refactoring sonar
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.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/csv/AbstractLimaModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
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 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -74,9 +74,9 @@
setOption(TopiaMigrationService.MIGRATION_SHOW_SQL, Boolean.TRUE.toString());
setOption(TopiaMigrationService.MIGRATION_SHOW_PROGRESSION, Boolean.TRUE.toString());
- config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
- config.loadDefaultOptions(ServiceConfigOption.values());
- config.parse();
+ LimaConfig.config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME);
+ LimaConfig.config.loadDefaultOptions(ServiceConfigOption.values());
+ LimaConfig.config.parse();
} catch (ArgumentsParserException ex) {
throw new LimaTechnicalException("Can't read configuration", ex);
@@ -108,7 +108,7 @@
Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key);
if (accountingRulesClass == null) {
if (log.isErrorEnabled()) {
- log.error("No accounting rules defined for:" + accountingRulesClass);
+ log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key);
}
accountingRules = new FranceAccountingRules();
} else {
@@ -127,8 +127,8 @@
}
public void setAccountingRule(String accountingRule) {
- accountingRules = null; // clear cache
- config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
+ LimaConfig.accountingRules = null; // clear cache
+ LimaConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule);
}
public File getDataDir() {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -132,8 +132,6 @@
AccountTopiaDao accountDao = getDaoHelper().getAccountDao();
while (account == null && accountNumber.length() > 1) {
-
- accountNumber = accountNumber.substring(0);
account = accountDao.forAccountNumberEquals(accountNumber).findUniqueOrNull();
}
return account;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/AbstractLimaModel.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -65,6 +65,17 @@
super(separator);
}
+ public AbstractLimaModel(char separator, EntryBookService entryBookService) {
+ super(separator);
+ AbstractLimaModel.entryBookService = entryBookService;
+ }
+
+ public AbstractLimaModel(char separator, AccountService accountService, FinancialTransactionService financialTransactionService, Boolean humanReadable) {
+ super(separator);
+ AbstractLimaModel.accountService = accountService;
+ AbstractLimaModel.financialTransactionService = financialTransactionService;
+ AbstractLimaModel.humanReadable = humanReadable;
+ }
/**
* String to integer converter.
*/
@@ -195,7 +206,7 @@
public String format(Date value) {
String result;
if (value != null) {
- result = simpleDateFormat.format(value);
+ result = AbstractLimaModel.simpleDateFormat.format(value);
} else {
result = "";
}
@@ -211,7 +222,7 @@
public Date parse(String value) throws ParseException {
Date result = null;
if (!Strings.isNullOrEmpty(value)) {
- result = simpleDateFormat.parse(value);
+ result = AbstractLimaModel.simpleDateFormat.parse(value);
}
return result;
}
@@ -236,7 +247,7 @@
public EntryBook parse(String value) {
EntryBook result;
if (StringUtils.isNotBlank(value)) {
- result = entryBookService.getEntryBookByCode(value);
+ result = AbstractLimaModel.entryBookService.getEntryBookByCode(value);
} else {
result = null;
}
@@ -289,7 +300,7 @@
public Account parse(String value) {
Account result;
if (StringUtils.isNotBlank(value)) {
- result = accountService.getAccountByNumber(value);
+ result = AbstractLimaModel.accountService.getAccountByNumber(value);
} else {
result = null;
}
@@ -302,7 +313,7 @@
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = humanReadable ? simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
+ result = AbstractLimaModel.humanReadable ? AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate()) : value.getTopiaId();
} else {
result = "";
}
@@ -316,7 +327,7 @@
public FinancialTransaction parse(String value) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
FinancialTransaction result;
- result = financialTransactionService.getFinancialTransactionWithId(value);
+ result = AbstractLimaModel.financialTransactionService.getFinancialTransactionWithId(value);
return result;
}
};
@@ -402,7 +413,7 @@
public String format(FinancialTransaction value) {
String result;
if (value != null) {
- result = simpleDateFormat.format(value.getTransactionDate());
+ result = AbstractLimaModel.simpleDateFormat.format(value.getTransactionDate());
} else {
result = "";
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/EntryModel.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -36,10 +36,7 @@
public class EntryModel extends AbstractLimaModel<Entry> implements ExportModel<Entry> {
public EntryModel(AccountService accountService, FinancialTransactionService financialTransactionService, boolean humanReadable) {
- super(';');
- AbstractLimaModel.accountService = accountService;
- AbstractLimaModel.financialTransactionService = financialTransactionService;
- AbstractLimaModel.humanReadable = humanReadable;
+ super(';', accountService, financialTransactionService, humanReadable);
newMandatoryColumn("account", Entry.PROPERTY_ACCOUNT, ACCOUNT_NUMBER_TO_ACCOUNT_TRANSACTION_PARSER);
newOptionalColumn("amount", Entry.PROPERTY_AMOUNT, BIG_DECIMAL_WITH_NULL_PARSER);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/FinancialTransactionModel.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -35,8 +35,7 @@
public class FinancialTransactionModel extends AbstractLimaModel<FinancialTransaction> implements ExportModel<FinancialTransaction> {
public FinancialTransactionModel(EntryBookService entryBookService) {
- super(';');
- AbstractLimaModel.entryBookService = entryBookService;
+ super(';', entryBookService);
newMandatoryColumn("id", FinancialTransaction.PROPERTY_TOPIA_ID);
newOptionalColumn("transactionDate", FinancialTransaction.PROPERTY_TRANSACTION_DATE, DATE_PARSER);
newOptionalColumn("entryBook", FinancialTransaction.PROPERTY_ENTRY_BOOK, ENTRY_BOOK_CODE_TO_ENTRY_BOOK_PARSER);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -79,7 +79,7 @@
try {
conditionView.setSelected(true);
} catch (PropertyVetoException e) {
-
+ log.error(e);
}
conditionPanel.validate();
conditionPanel.repaint();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -227,7 +227,7 @@
helper.addOption(LimaConfig.Option.LOCALE);
helper.setOptionShortLabel(LimaConfig.Option.LOCALE.getLabel());
- JComboBox<Character> comboBoxSeparator = new JComboBox<Character>(LimaConfig.NUMBER_SEPARATOR.toArray(new Character[0]));
+ JComboBox<Character> comboBoxSeparator = new JComboBox<Character>(LimaConfig.NUMBER_SEPARATOR.toArray(new Character[LimaConfig.NUMBER_SEPARATOR.size()]));
DefaultCellEditor separatorEditor = new DefaultCellEditor(comboBoxSeparator);
comboBoxSeparator.setRenderer(new NumberSeparatorCellRenderer());
NumberSeparatorTableCellRenderer separatorRenderer = new NumberSeparatorTableCellRenderer();
@@ -236,7 +236,7 @@
helper.setOptionRenderer(separatorRenderer);
helper.setOptionEditor(separatorEditor);
- JComboBox<Integer> comboBoxDecimal = new JComboBox<Integer>(LimaConfig.NUMBER_DECIMALS.toArray(new Integer[0]));
+ JComboBox<Integer> comboBoxDecimal = new JComboBox<Integer>(LimaConfig.NUMBER_DECIMALS.toArray(new Integer[LimaConfig.NUMBER_DECIMALS.size()]));
DefaultCellEditor decimalEditor = new DefaultCellEditor(comboBoxDecimal);
helper.addOption(LimaConfig.Option.SCALE);
helper.setOptionShortLabel(LimaConfig.Option.SCALE.getLabel());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -139,6 +139,8 @@
String binding = "new-account";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -2627651616597622057L;
+
@Override
public void actionPerformed(ActionEvent e) {
addAccount();
@@ -149,6 +151,8 @@
binding = "remove-account";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 8244969229065970041L;
+
@Override
public void actionPerformed(ActionEvent e) {
removeAccount();
@@ -159,6 +163,8 @@
binding = "modify-account";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1287526862158662714L;
+
@Override
public void actionPerformed(ActionEvent e) {
updateAccount();
@@ -238,6 +244,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -4829115532909638962L;
+
@Override
public void actionPerformed(ActionEvent e) {
accountForm.dispose();
@@ -353,6 +361,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -2123621815991309210L;
+
@Override
public void actionPerformed(ActionEvent e) {
accountForm.dispose();
@@ -441,6 +451,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1756820018546487410L;
+
@Override
public void actionPerformed(ActionEvent e) {
form.performCancel();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -34,12 +34,10 @@
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.text.JTextComponent;
-import java.awt.Component;
+import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
@@ -116,7 +114,7 @@
});
}
}
- keyPressed = false;
+ AccountTableCellEditor.keyPressed = false;
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
}
@@ -135,7 +133,7 @@
JTextComponent edit = (JTextComponent) comboBox.getEditor().getEditorComponent();
// Met en place le curseur et la selection après la première lettre
edit.select(1, edit.getText().length());
- keyPressed = true;
+ AccountTableCellEditor.keyPressed = true;
}
// delegate popup list menu
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -40,15 +40,15 @@
public static String format(BigDecimal value) {
LimaConfig config = LimaContext.getContext().getConfig();
- String scale = "";
+ StringBuilder scale = new StringBuilder();
for (int i = 0; i < config.getScale(); i++) {
- scale += "0";
+ scale.append("0");
}
String currency = "";
if (config.getCurrency()) {
currency = " ¤";
}
- DecimalFormat formatter = new DecimalFormat("##0." + scale + currency);
+ DecimalFormat formatter = new DecimalFormat("##0." + scale.toString() + currency);
DecimalFormatSymbols symbol = new DecimalFormatSymbols();
//set decimalSeparator and thousandSeparator preferences
symbol.setDecimalSeparator(config.getDecimalSeparator());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -134,7 +134,7 @@
}
}
// Remet à faux pour la premiere lettre tapée au clavier
- keyPressed = false;
+ EntryBookTableCellEditor.keyPressed = false;
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 1;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -86,6 +86,8 @@
String binding = "new-entryBook";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -2195732334248213712L;
+
@Override
public void actionPerformed(ActionEvent e) {
addEntryBook();
@@ -96,6 +98,8 @@
binding = "remove-entryBook";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -4932713296274387513L;
+
@Override
public void actionPerformed(ActionEvent e) {
deleteEntryBook();
@@ -106,6 +110,8 @@
binding = "modify-entryBook";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -761841876399286500L;
+
@Override
public void actionPerformed(ActionEvent e) {
updateEntryBook();
@@ -153,6 +159,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -8206425963136985592L;
+
@Override
public void actionPerformed(ActionEvent e) {
entryBookForm.performCancel();
@@ -198,6 +206,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4869740774851185380L;
+
@Override
public void actionPerformed(ActionEvent e) {
entryBookForm.performCancel();
@@ -264,6 +274,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1659538823979223871L;
+
@Override
public void actionPerformed(ActionEvent e) {
form.performCancel();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -94,6 +94,8 @@
String binding = "close-FinancialPeriod";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4933544189561608564L;
+
@Override
public void actionPerformed(ActionEvent e) {
blockFinancialPeriod();
@@ -132,47 +134,54 @@
closedPeriodicEntryBook = financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook);
model.setValue(selectedRow, closedPeriodicEntryBook);
} catch (UnbalancedFinancialTransactionsException e) {
- String message = t("lima.ui.financialperiod.block.error.unbalanced.main");
+ StringBuilder message = new StringBuilder(t("lima.ui.financialperiod.block.error.unbalanced.main"));
for (FinancialTransaction transaction : e.getFinancialTransactions()) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.unbalanced.transaction",
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.unbalanced.transaction",
transaction.getTransactionDate(),
BigDecimalTableCellRenderer.format(transaction.getAmountDebit()),
- BigDecimalTableCellRenderer.format(transaction.getAmountCredit()));
+ BigDecimalTableCellRenderer.format(transaction.getAmountCredit())));
}
- errorHelper.showErrorMessage(message);
+ errorHelper.showErrorMessage(message.toString());
} catch (UnfilledEntriesException e) {
- String message = t("lima.ui.financialperiod.block.error.unfilled.main");
+ StringBuilder message = new StringBuilder(t("lima.ui.financialperiod.block.error.unfilled.main"));
for (Entry entry : e.getEntries()) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.unfilled.entry",
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.unfilled.entry",
entry.getFinancialTransaction().getTransactionDate(),
- BigDecimalTableCellRenderer.format(entry.getAmount()));
+ BigDecimalTableCellRenderer.format(entry.getAmount())));
if (entry.getAccount() == null) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.unfilled.noAccount");
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.unfilled.noAccount"));
}
if (StringUtils.isBlank(entry.getVoucher())) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.unfilled.noVoucher");
+ message.append("\n - " );
+ message.append(t("lima.ui.financialperiod.block.error.unfilled.noVoucher"));
}
if (StringUtils.isBlank(entry.getDescription())) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.unfilled.noDescription");
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.unfilled.noDescription"));
}
}
- errorHelper.showErrorMessage(message);
+ errorHelper.showErrorMessage(message.toString());
} catch (WithoutEntryBookFinancialTransactionsException e) {
- String message = t("lima.ui.financialperiod.block.error.withoutEntryBook.main");
+ StringBuilder message = new StringBuilder(t("lima.ui.financialperiod.block.error.withoutEntryBook.main"));
for (FinancialTransaction transaction : e.getFinancialTransactions()) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.withoutEntryBook.transaction",
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.withoutEntryBook.transaction",
transaction.getTransactionDate(),
- BigDecimalTableCellRenderer.format(transaction.getAmountCredit()));
+ BigDecimalTableCellRenderer.format(transaction.getAmountCredit())));
}
- errorHelper.showErrorMessage(message);
+ errorHelper.showErrorMessage(message.toString());
} catch (NotLockedClosedPeriodicEntryBooksException e) {
- String message = t("lima.ui.financialperiod.block.error.noLockedPreviousEntryBook.main");
+ StringBuilder message = new StringBuilder(t("lima.ui.financialperiod.block.error.noLockedPreviousEntryBook.main"));
for (ClosedPeriodicEntryBook previousClosedPeriodicEntryBook : e.getClosedPeriodicEntryBooks()) {
- message += "\n - " + t("lima.ui.financialperiod.block.error.noLockedPreviousEntryBook.previousEntryBook",
+ message.append("\n - ");
+ message.append(t("lima.ui.financialperiod.block.error.noLockedPreviousEntryBook.previousEntryBook",
previousClosedPeriodicEntryBook.getFinancialPeriod().getBeginDate(),
- previousClosedPeriodicEntryBook.getFinancialPeriod().getEndDate());
+ previousClosedPeriodicEntryBook.getFinancialPeriod().getEndDate()));
}
- errorHelper.showErrorMessage(message);
+ errorHelper.showErrorMessage(message.toString());
}
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -88,6 +88,8 @@
String binding = "add-FinancialStatementHeader";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK + InputEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -7788186392450704736L;
+
@Override
public void actionPerformed(ActionEvent e) {
addFinancialStatementHeader();
@@ -98,6 +100,8 @@
binding = "add-FinancialStatementMovement";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -2024337652917520114L;
+
@Override
public void actionPerformed(ActionEvent e) {
addFinancialStatementMovement();
@@ -108,6 +112,8 @@
binding = "update-FinancialStatement";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 38900830693943289L;
+
@Override
public void actionPerformed(ActionEvent e) {
updateFinancialStatement();
@@ -118,6 +124,8 @@
binding = "remove-FinancialStatement";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 5281128699359433458L;
+
@Override
public void actionPerformed(ActionEvent e) {
removeFinancialStatement();
@@ -128,6 +136,8 @@
binding = "import-FinancialStatement";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -8953401784332356894L;
+
@Override
public void actionPerformed(ActionEvent e) {
importFinancialStatementChart();
@@ -138,6 +148,8 @@
binding = "check-FinancialStatement";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4940041938090472686L;
+
@Override
public void actionPerformed(ActionEvent e) {
financialStatementChartCheck();
@@ -164,6 +176,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 743244863218861378L;
+
@Override
public void actionPerformed(ActionEvent e) {
financialStatementHeaderForm.performCancel();
@@ -209,6 +223,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4247772767239546785L;
+
@Override
public void actionPerformed(ActionEvent e) {
financialStatementMovementForm.performCancel();
@@ -266,6 +282,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 3175340724715264379L;
+
@Override
public void actionPerformed(ActionEvent e) {
financialStatementHeaderForm.performCancel();
@@ -288,6 +306,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -3722767598494135172L;
+
@Override
public void actionPerformed(ActionEvent e) {
financialStatementMovementForm.performCancel();
@@ -352,6 +372,8 @@
String binding = "dispose";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -8291208693591479867L;
+
@Override
public void actionPerformed(ActionEvent e) {
form.performCancel();
@@ -393,9 +415,6 @@
/**
* Permet d'afficher une boite de dialogue avec rapport
*
- * @param message
- * @param parent
- * @param title
*/
public void showReportDialog(String message, String title, Component parent) {
ReportDialogView reportDialogView = new ReportDialogView();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -150,6 +150,8 @@
binding = "new-transaction";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1664378625712266838L;
+
@Override
public void actionPerformed(ActionEvent e) {
addFinancialTransaction();
@@ -160,6 +162,8 @@
binding = "delete-transaction";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 7621389371928432410L;
+
@Override
public void actionPerformed(ActionEvent e) {
deleteSelectedTransaction();
@@ -170,6 +174,8 @@
binding = "copy-transaction";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -982724612254422140L;
+
@Override
public void actionPerformed(ActionEvent e) {
copyTransaction();
@@ -180,6 +186,8 @@
binding = "paste-transaction";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 3981745985282030673L;
+
@Override
public void actionPerformed(ActionEvent e) {
pasteTransaction();
@@ -190,6 +198,8 @@
binding = "new-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 6099897253355058899L;
+
@Override
public void actionPerformed(ActionEvent e) {
addEntry();
@@ -200,6 +210,8 @@
binding = "delete-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 5137178343047269716L;
+
@Override
public void actionPerformed(ActionEvent e) {
deleteSelectedEntry();
@@ -210,6 +222,8 @@
binding = "copy-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK + KeyEvent.ALT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1866038141590067940L;
+
@Override
public void actionPerformed(ActionEvent e) {
copyEntry();
@@ -220,6 +234,8 @@
binding = "paste-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK + KeyEvent.ALT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -3996645480884548643L;
+
@Override
public void actionPerformed(ActionEvent e) {
pasteEntry();
@@ -230,6 +246,8 @@
binding = "balance";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 5070872946843797639L;
+
@Override
public void actionPerformed(ActionEvent e) {
balanceTransaction();
@@ -240,6 +258,8 @@
binding = "assign-all";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK + KeyEvent.ALT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4993025324310374283L;
+
@Override
public void actionPerformed(ActionEvent e) {
assignAllEntries();
@@ -715,7 +735,6 @@
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow >= 0) {
- Entry entry = tableModel.get(indexSelectedRow);
TableCellEditor cellEditor = table.getCellEditor();
if (cellEditor != null) {
cellEditor.cancelCellEditing();
@@ -755,7 +774,6 @@
public void assignAllEntries() {
FinancialTransactionTable table = view.getFinancialTransactionTable();
FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel();
- ListSelectionModel selectionModel = table.getSelectionModel();
table.exit();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -72,8 +72,6 @@
/** Transaction service. */
protected final FinancialTransactionService financialTransactionService;
- protected Object clipBoard;
-
protected FinancialTransactionSearchViewHandler(FinancialTransactionSearchView view) {
this.view = view;
@@ -95,6 +93,8 @@
binding = "refresh";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0) , binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 5877340693755869036L;
+
@Override
public void actionPerformed(ActionEvent e) {
refresh();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -94,6 +94,8 @@
binding = "delete-transaction";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -226644303576583765L;
+
@Override
public void actionPerformed(ActionEvent e) {
deleteSelectedTransaction();
@@ -104,6 +106,8 @@
binding = "new-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -6435906445215486356L;
+
@Override
public void actionPerformed(ActionEvent e) {
addEntry();
@@ -114,6 +118,8 @@
binding = "delete-entry";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 4178423543503694499L;
+
@Override
public void actionPerformed(ActionEvent e) {
deleteSelectedEntry();
@@ -124,6 +130,8 @@
binding = "balance";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 1311386081937821318L;
+
@Override
public void actionPerformed(ActionEvent e) {
balanceTransaction();
@@ -134,6 +142,8 @@
binding = "refresh";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0) , binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -1045374983643252166L;
+
@Override
public void actionPerformed(ActionEvent e) {
refresh();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -104,6 +104,8 @@
String binding = "new-FiscalPeriod";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 3174253799898553603L;
+
@Override
public void actionPerformed(ActionEvent e) {
addFiscalPeriod();
@@ -466,7 +468,6 @@
selectedRow = listSelectionEvent.getLastIndex();
}
- FiscalPeriodTable table = view.getFiscalPeriodTable();
FiscalPeriodTableModel tableModel = view.getFiscalPeriodTableModel();
if (tableModel.getRowCount() != selectedRow) {
FiscalPeriod fiscalPeriodAt = tableModel.get(selectedRow);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -89,27 +89,27 @@
int ebSize = entryBooks.size();
if (ebSize > 0) {
setBackground(GREEN_BACKGROUND);
- String entryBooksString;
+ StringBuilder entryBooksString = new StringBuilder();
if (ebSize == 1) {
- entryBooksString = t("lima.home.entryBooks.info.one", ebSize)
- + "<br/>" + entryBooks.get(0).getLabel()
- + "<br/><br/><a href='#entrybookschart'>"
- + t("lima.home.entryBooks.modify") + "</a>";
+ entryBooksString.append(t("lima.home.entryBooks.info.one", ebSize));
+ entryBooksString.append("<br/>").append(entryBooks.get(0).getLabel());
+ entryBooksString.append("<br/><br/><a href='#entrybookschart'>");
+ entryBooksString.append(t("lima.home.entryBooks.modify")).append("</a>");
} else {
- entryBooksString = t("lima.home.entryBooks.info", ebSize) + "<ul>";
+ entryBooksString.append(t("lima.home.entryBooks.info", ebSize)).append("<ul>");
for (int i = 0; i < ebSize && i < 3; i++) {
// for (EntryBook entryBook : entryBooks) {
EntryBook entryBook = entryBooks.get(i);
- entryBooksString += "<li>" + entryBook.getCode() +
- " - " + entryBook.getLabel() + "</li>";
+ entryBooksString.append("<li>").append(entryBook.getCode());
+ entryBooksString.append(" - ").append(entryBook.getLabel()).append("</li>");
}
if (ebSize > 3) {
- entryBooksString += "<li> ... </li>";
+ entryBooksString.append("<li> ... </li>");
}
- entryBooksString += "</ul></p><p horizontal-align:'center'>"
- + "<a href='#entrybookschart'>"
- + t("lima.home.entryBooks.modify") + "</a>";
+ entryBooksString.append("</ul></p><p horizontal-align:'center'>");
+ entryBooksString.append("<a href='#entrybookschart'>");
+ entryBooksString.append(t("lima.home.entryBooks.modify")).append("</a>");
}
//set Text
setText(htmlBegin + entryBooksString + htmlEnd);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -128,6 +128,8 @@
binding = "lettering";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 397305388204489988L;
+
@Override
public void actionPerformed(ActionEvent e) {
addLetter();
@@ -138,6 +140,8 @@
binding = "un-lettering";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 6493175994438339351L;
+
@Override
public void actionPerformed(ActionEvent e) {
removeLetter();
@@ -148,6 +152,8 @@
binding = "balance";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = 5997811877503911744L;
+
@Override
public void actionPerformed(ActionEvent e) {
roundAndCreateEntry();
@@ -158,6 +164,8 @@
binding = "refresh";
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), binding);
actionMap.put(binding, new AbstractAction() {
+ private static final long serialVersionUID = -7192846839712951680L;
+
@Override
public void actionPerformed(ActionEvent e) {
updateAllEntries();
@@ -360,8 +368,7 @@
protected List<Entry> findAllEntries(LetteringFilterImpl filter){
if (filter != null) {
- List<Entry> entries =
- financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(filter);
+ List<Entry> entries = financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(filter);
return entries;
}
return null;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2014-08-07 20:17:41 UTC (rev 3905)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2014-08-07 21:37:22 UTC (rev 3906)
@@ -33,8 +33,7 @@
import org.jdesktop.swingx.treetable.TreeTableModel;
import javax.swing.tree.TreePath;
-import java.awt.Color;
-import java.awt.Component;
+import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
@@ -49,7 +48,7 @@
protected VatChartViewHandler handler;
//protected Color colorSelectionFocus;
- private Highlighter colorLine;
+ private transient Highlighter colorLine;
public VatChartTreeTable(VatChartViewHandler handler) {
this.handler = handler;
@@ -86,8 +85,7 @@
return highlighted;
}
};
- colorLine =
- new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ colorLine = new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorLine);
}
1
0
r3905 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business lima-swing/src/main/java/org/chorem/lima/ui/importexport lima-swing/src/main/resources/i18n
by dcosse@users.chorem.org 07 Aug '14
by dcosse@users.chorem.org 07 Aug '14
07 Aug '14
Author: dcosse
Date: 2014-08-07 22:17:41 +0200 (Thu, 07 Aug 2014)
New Revision: 3905
Url: http://forge.chorem.org/projects/lima/repository/revisions/3905
Log:
refactoring
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -240,7 +240,7 @@
ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao();
FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao();
- BigDecimal balance = new BigDecimal(0);
+ BigDecimal balance = BigDecimal.ZERO;
for (Entry entry : oldEntries) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -176,12 +176,12 @@
BigDecimal grossAmount =
financialStatementAmount.getGrossAmount();
if (grossAmount == null) {
- grossAmount = new BigDecimal(0);
+ grossAmount = BigDecimal.ZERO;
}
BigDecimal provisionDeprecationAmount =
financialStatementAmount.getProvisionDeprecationAmount();
if (provisionDeprecationAmount == null) {
- provisionDeprecationAmount = new BigDecimal(0);
+ provisionDeprecationAmount =BigDecimal.ZERO;
}
if (label == null) {
@@ -278,8 +278,8 @@
int n = list.size();
boolean even = true;
- BigDecimal currentAmountDebit = new BigDecimal(0);
- BigDecimal currentAmountCredit = new BigDecimal(0);
+ BigDecimal currentAmountDebit =BigDecimal.ZERO;
+ BigDecimal currentAmountCredit =BigDecimal.ZERO;
while (i < n) {
@@ -326,8 +326,8 @@
if (entryBook != null) {
entryBookCode = entryBook.getCode();
}
- BigDecimal amountDebit = new BigDecimal(0),
- amountCredit = new BigDecimal(0);
+ BigDecimal amountDebit = BigDecimal.ZERO,
+ amountCredit = BigDecimal.ZERO;
if (entry.isDebit()) {
amountDebit = entry.getAmount();
} else {
@@ -498,10 +498,10 @@
if (beginDate != null && endDate != null) {
try{
- BigDecimal currentAmountDebit = new BigDecimal(0);
- BigDecimal currentAmountCredit = new BigDecimal(0);
- BigDecimal currentSoldeDebit = new BigDecimal(0);
- BigDecimal currentSoldeCredit = new BigDecimal(0);
+ BigDecimal currentAmountDebit = BigDecimal.ZERO;
+ BigDecimal currentAmountCredit = BigDecimal.ZERO;
+ BigDecimal currentSoldeDebit = BigDecimal.ZERO;
+ BigDecimal currentSoldeCredit = BigDecimal.ZERO;
//create pages
int i = 0;
@@ -589,15 +589,15 @@
financialPeriodTopiaDao.findByDates(beginDate, endDate);
List<GeneralEntryBooksDatas> list = new ArrayList<GeneralEntryBooksDatas>();
- BigDecimal amountDebit = new BigDecimal(0);
- BigDecimal amountCredit = new BigDecimal(0);
+ BigDecimal amountDebit = BigDecimal.ZERO;
+ BigDecimal amountCredit = BigDecimal.ZERO;
for (FinancialPeriod financialPeriod : financialPeriods) {
List<ClosedPeriodicEntryBook> closedPeriodicEntryBookList =
closedPeriodicEntryBookTopiaDao.findAllByDates(
financialPeriod.getBeginDate(), financialPeriod.getEndDate());
- BigDecimal subAmountDebit = new BigDecimal(0);
- BigDecimal subAmountCredit = new BigDecimal(0);
+ BigDecimal subAmountDebit = BigDecimal.ZERO;
+ BigDecimal subAmountCredit = BigDecimal.ZERO;
for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBookList) {
BigDecimal debit = BigDecimal.ZERO;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -241,8 +241,8 @@
financialStatements = financialStatement.getSubFinancialStatements();
}
- BigDecimal grossAmount = new BigDecimal(0),
- provisionDeprecationAmount = new BigDecimal(0);
+ BigDecimal grossAmount = BigDecimal.ZERO,
+ provisionDeprecationAmount = BigDecimal.ZERO;
List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
for (FinancialStatement subFinancialStatement : financialStatements) {
@@ -343,16 +343,14 @@
Date selectedEndDate) {
FinancialStatementAmounts financialStatementAmounts =
new FinancialStatementAmountsImpl();
- BigDecimal amount = new BigDecimal(0);
- BigDecimal debitAmount = new BigDecimal(0);
- BigDecimal creditAmount = new BigDecimal(0);
- BigDecimal provisionDeprecationAmount = new BigDecimal(0);
+ BigDecimal amount = BigDecimal.ZERO;
+ BigDecimal debitAmount = BigDecimal.ZERO;
+ BigDecimal creditAmount = BigDecimal.ZERO;
+ BigDecimal provisionDeprecationAmount = BigDecimal.ZERO;
+
FinancialStatement masterFinancialStatement = financialStatement.getMasterFinancialStatement();
- FinancialStatementWayEnum financialStatementWayEnum = FinancialStatementWayEnum.BOTH;
- if (masterFinancialStatement != null) {
- financialStatementWayEnum = masterFinancialStatement.getWay();
- }
+ FinancialStatementWayEnum financialStatementWayEnum = masterFinancialStatement == null ? FinancialStatementWayEnum.BOTH : masterFinancialStatement.getWay();
// DEBIT & CREDIT ACCOUNTS LIST
Amounts amounts;
@@ -381,6 +379,17 @@
provisionDeprecationAmount = provisionDeprecationAmount.add(amounts.getCredit());
provisionDeprecationAmount = provisionDeprecationAmount.subtract(amounts.getDebit());
}
+ amount = computeAmount(amount, debitAmount, creditAmount, financialStatementWayEnum);
+
+ financialStatementAmounts.setGrossAmount(amount);
+ financialStatementAmounts.setLabel(financialStatement.getLabel());
+ financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+ financialStatementAmounts.setLevel(financialStatement.getLevel());
+
+ return financialStatementAmounts;
+ }
+
+ private BigDecimal computeAmount(BigDecimal amount, BigDecimal debitAmount, BigDecimal creditAmount, FinancialStatementWayEnum financialStatementWayEnum) {
switch (financialStatementWayEnum) {
case BOTH:
amount = amount.add(debitAmount);
@@ -395,21 +404,15 @@
amount = amount.add(debitAmount);
amount = amount.subtract(creditAmount);
}
-
- financialStatementAmounts.setGrossAmount(amount);
- financialStatementAmounts.setLabel(financialStatement.getLabel());
- financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
- financialStatementAmounts.setLevel(financialStatement.getLevel());
-
- return financialStatementAmounts;
+ return amount;
}
protected Amounts amountFromAccountList(String accountsNumberList,
Date selectedBeginDate,
Date selectedEndDate) {
Amounts amounts = new AmountsImpl();
- BigDecimal debit = new BigDecimal(0);
- BigDecimal credit = new BigDecimal(0);
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal credit = BigDecimal.ZERO;
Boolean substract = false;
//Remove Spaces
@@ -418,8 +421,8 @@
while (stQuote.hasMoreTokens()) {
String s = stQuote.nextToken();
List<Account> accountsList = accountService.stringToListAccounts(s);
- BigDecimal debitTemp = new BigDecimal(0);
- BigDecimal creditTemp = new BigDecimal(0);
+ BigDecimal debitTemp = BigDecimal.ZERO;
+ BigDecimal creditTemp = BigDecimal.ZERO;
for (Account account : accountsList) {
ReportsDatas reportsDatas =
reportService.generateAccountsReports(
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -37,8 +37,10 @@
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.ReportService;
+import org.chorem.lima.business.exceptions.AlreadyExistAccountException;
import org.chorem.lima.business.exceptions.AlreadyLockedFiscalPeriodException;
import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException;
+import org.chorem.lima.business.exceptions.InvalidAccountNumberException;
import org.chorem.lima.business.exceptions.LastUnlockedFiscalPeriodException;
import org.chorem.lima.business.exceptions.LimaException;
import org.chorem.lima.business.exceptions.LockedEntryBookException;
@@ -46,7 +48,9 @@
import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException;
import org.chorem.lima.business.exceptions.NoEmptyFiscalPeriodException;
import org.chorem.lima.business.exceptions.NoFoundFinancialPeriodException;
+import org.chorem.lima.business.exceptions.NotAllowedLabelException;
import org.chorem.lima.business.exceptions.NotBeginNextDayOfLastFiscalPeriodException;
+import org.chorem.lima.business.exceptions.NotNumberAccountNumberException;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
@@ -307,72 +311,28 @@
// -> 89 BILAN
// -> 890 Bilan d'ouverture
// -> 891 Bilan de cloture
+ Account endRetainedAccount = createRelated89TreeAccounts();
- //89 BILAN
- Account accountMaster = accountService.getAccountByNumber("89");
- if (accountMaster == null) {
- accountMaster = new AccountImpl();
- accountMaster.setAccountNumber("89");
- accountMaster.setLabel("BILAN");
- accountService.createAccount(accountMaster);
- }
- //890 Bilan d'ouverture
- Account beginRetainedAccount = accountService.getAccountByNumber("890");
- if (beginRetainedAccount == null) {
- beginRetainedAccount = new AccountImpl();
- beginRetainedAccount.setAccountNumber("890");
- beginRetainedAccount.setLabel("Bilan d'ouverture");
- accountService.createAccount(beginRetainedAccount);
- }
-
- //891 Bilan de cloture
- Account endRetainedAccount = accountService.getAccountByNumber("891");
- if (endRetainedAccount == null) {
- endRetainedAccount = new AccountImpl();
- endRetainedAccount.setAccountNumber("891");
- endRetainedAccount.setLabel("Bilan de clôture");
- endRetainedAccount = accountService.createAccount(endRetainedAccount);
- }
-
//look for the last financial period from the previous fiscal year
//check if the last financial period isn't blocked
- Collection<FinancialPeriod> fperiod = localFiscalPeriod.getFinancialPeriod();
- Iterator<FinancialPeriod> itr = fperiod.iterator();
FinancialPeriod lastFPeriod = null;
- while (itr.hasNext()) {
- lastFPeriod = itr.next();
- }
+ lastFPeriod = getLastFinancialPeriodFromPreviousYear(localFiscalPeriod, lastFPeriod);
-
Date beginDateNextFiscalPeriod = DateUtils.addDays(localFiscalPeriod.getEndDate(), 1);
FinancialPeriodTopiaDao financialPeriodDao = getDaoHelper().getFinancialPeriodDao();
- FinancialPeriod beginfinancialPeriod = null;
- try {
- beginfinancialPeriod = financialPeriodDao.findByDate(beginDateNextFiscalPeriod);
- } catch (TopiaNoResultException e) {
- throw new NoFoundFinancialPeriodException(beginDateNextFiscalPeriod, e);
- }
+ FinancialPeriod beginFinancialPeriod = findBeginFinancialPeriod(beginDateNextFiscalPeriod, financialPeriodDao);
- if (beginfinancialPeriod.isLocked()) {
- throw new LockedFinancialPeriodException(beginfinancialPeriod);
- }
+ validClosedPeriodicEntryBookNotLocked(entryBook, beginFinancialPeriod);
- ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookDao = getDaoHelper().getClosedPeriodicEntryBookDao();
- ClosedPeriodicEntryBook closedPeriodicEntryBook = closedPeriodicEntryBookDao.findByEntryBookAndFinancialPeriod(entryBook, beginfinancialPeriod);
-
- if (closedPeriodicEntryBook.isLocked()) {
- throw new LockedEntryBookException(closedPeriodicEntryBook);
- }
-
//holds entries of all closing transactions
- FinancialTransaction endfinancialTransaction = new FinancialTransactionImpl();
- if (lastFPeriod != null) {
+ FinancialTransaction endFinancialTransaction = new FinancialTransactionImpl();
+ if (lastFPeriod != null) {// TODO DCossé 07/08/14 if null endFinancialTransaction has no EntryBook and it's not valid
//Sets the endfinancialTransaction
- endfinancialTransaction.setEntryBook(entryBook);
- endfinancialTransaction.setTransactionDate(localFiscalPeriod.getEndDate());
- endfinancialTransaction = financialTransactionService.createFinancialTransaction(endfinancialTransaction);
+ endFinancialTransaction.setEntryBook(entryBook);
+ endFinancialTransaction.setTransactionDate(localFiscalPeriod.getEndDate());
+ endFinancialTransaction = financialTransactionService.createFinancialTransaction(endFinancialTransaction);
}
//holds entries of all opening transactions
@@ -380,7 +340,7 @@
//Sets the endfinancialTransaction
beginfinancialTransaction.setEntryBook(entryBook);
- beginfinancialTransaction.setTransactionDate(beginfinancialPeriod.getBeginDate());
+ beginfinancialTransaction.setTransactionDate(beginFinancialPeriod.getBeginDate());
beginfinancialTransaction = financialTransactionService.createFinancialTransaction(beginfinancialTransaction);
@@ -394,51 +354,7 @@
List<ReportsDatas> reportsDatasList = (List<ReportsDatas>) results.getReportsDatas();
for (ReportsDatas report : reportsDatasList) {
-
- //Account class from 1 to 5 and only non zero amount
- if (Integer.valueOf(report.getAccount().getAccountNumber().substring(0, 1)) < 6
- && !report.getAmountSolde().equals(BigDecimal.ZERO)) {
-
- //close accounts by removing amounts from all class 1 to 5 accounts
- Entry beginEntry = new EntryImpl();
- beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
- beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
- beginEntry.setFinancialTransaction(endfinancialTransaction);
- beginEntry.setAccount(report.getAccount());
- beginEntry.setAmount(report.getAmountSolde().abs());
- beginEntry.setDebit(!report.isSoldeDebit());
- financialTransactionService.createEntry(beginEntry);
-
- //save amounts inside account number 891
- beginEntry = new EntryImpl();
- beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
- beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
- beginEntry.setFinancialTransaction(endfinancialTransaction);
- beginEntry.setAccount(endRetainedAccount);
- beginEntry.setAmount(report.getAmountSolde().abs());
- beginEntry.setDebit(report.isSoldeDebit());
- financialTransactionService.createEntry(beginEntry);
-
- //open new year accounts if new year exists and a date has been found for the transaction
- //give back amounts from class 1 to 5 accounts
- beginEntry = new EntryImpl();
- beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
- beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
- beginEntry.setFinancialTransaction(beginfinancialTransaction);
- beginEntry.setAccount(report.getAccount());
- beginEntry.setAmount(report.getAmountSolde().abs());
- beginEntry.setDebit(report.isSoldeDebit());
- financialTransactionService.createEntry(beginEntry);
- //close account by removing amount from account number 890
- beginEntry = new EntryImpl();
- beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
- beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
- beginEntry.setFinancialTransaction(beginfinancialTransaction);
- beginEntry.setAccount(endRetainedAccount);
- beginEntry.setAmount(report.getAmountSolde().abs());
- beginEntry.setDebit(!report.isSoldeDebit());
- financialTransactionService.createEntry(beginEntry);
- }
+ processReport(endRetainedAccount, endFinancialTransaction, beginfinancialTransaction, calendar, report);
}
}
@@ -447,6 +363,124 @@
return fiscalPeriodBlocked;
}
+ protected void processReport(Account endRetainedAccount, FinancialTransaction endFinancialTransaction, FinancialTransaction beginfinancialTransaction, Calendar calendar, ReportsDatas report) throws LockedFinancialPeriodException, LockedEntryBookException {
+ //Account class from 1 to 5 and only non zero amount
+ if (Integer.valueOf(report.getAccount().getAccountNumber().substring(0, 1)) < 6
+ && !report.getAmountSolde().equals(BigDecimal.ZERO)) {
+
+ //close accounts by removing amounts from all class 1 to 5 accounts
+ Entry beginEntry = new EntryImpl();
+ beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
+ beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
+ beginEntry.setFinancialTransaction(endFinancialTransaction);
+ beginEntry.setAccount(report.getAccount());
+ beginEntry.setAmount(report.getAmountSolde().abs());
+ beginEntry.setDebit(!report.isSoldeDebit());
+ financialTransactionService.createEntry(beginEntry);
+
+ //save amounts inside account number 891
+ beginEntry = new EntryImpl();
+ beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
+ beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
+ beginEntry.setFinancialTransaction(endFinancialTransaction);
+ beginEntry.setAccount(endRetainedAccount);
+ beginEntry.setAmount(report.getAmountSolde().abs());
+ beginEntry.setDebit(report.isSoldeDebit());
+ financialTransactionService.createEntry(beginEntry);
+
+ //open new year accounts if new year exists and a date has been found for the transaction
+ //give back amounts from class 1 to 5 accounts
+ beginEntry = new EntryImpl();
+ beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
+ beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
+ beginEntry.setFinancialTransaction(beginfinancialTransaction);
+ beginEntry.setAccount(report.getAccount());
+ beginEntry.setAmount(report.getAmountSolde().abs());
+ beginEntry.setDebit(report.isSoldeDebit());
+ financialTransactionService.createEntry(beginEntry);
+ //close account by removing amount from account number 890
+ beginEntry = new EntryImpl();
+ beginEntry.setDescription(t("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
+ beginEntry.setVoucher(t("lima-business.financialtransaction.retainedearnings.voucher"));
+ beginEntry.setFinancialTransaction(beginfinancialTransaction);
+ beginEntry.setAccount(endRetainedAccount);
+ beginEntry.setAmount(report.getAmountSolde().abs());
+ beginEntry.setDebit(!report.isSoldeDebit());
+ financialTransactionService.createEntry(beginEntry);
+ }
+ }
+
+ protected FinancialTransaction createFinancialTransaction(EntryBook entryBook, Date transactionDate) throws LockedFinancialPeriodException, LockedEntryBookException {
+ FinancialTransaction endFinancialTransaction = financialTransactionService.createNewFinancialTransaction();
+ //Sets the endfinancialTransaction
+ endFinancialTransaction.setEntryBook(entryBook);
+ endFinancialTransaction.setTransactionDate(transactionDate);
+ endFinancialTransaction = financialTransactionService.createFinancialTransaction(endFinancialTransaction);
+
+ return endFinancialTransaction;
+ }
+
+ protected void validClosedPeriodicEntryBookNotLocked(EntryBook entryBook, FinancialPeriod beginFinancialPeriod) throws LockedEntryBookException {
+ ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookDao = getDaoHelper().getClosedPeriodicEntryBookDao();
+ ClosedPeriodicEntryBook closedPeriodicEntryBook = closedPeriodicEntryBookDao.findByEntryBookAndFinancialPeriod(entryBook, beginFinancialPeriod);
+ if (closedPeriodicEntryBook.isLocked()) {
+ throw new LockedEntryBookException(closedPeriodicEntryBook);
+ }
+ }
+
+ protected FinancialPeriod findBeginFinancialPeriod(Date beginDateNextFiscalPeriod, FinancialPeriodTopiaDao financialPeriodDao) throws NoFoundFinancialPeriodException, LockedFinancialPeriodException {
+ FinancialPeriod beginFinancialPeriod;
+ try {
+ beginFinancialPeriod = financialPeriodDao.findByDate(beginDateNextFiscalPeriod);
+ } catch (TopiaNoResultException e) {
+ throw new NoFoundFinancialPeriodException(beginDateNextFiscalPeriod, e);
+ }
+
+ if (beginFinancialPeriod.isLocked()) {
+ throw new LockedFinancialPeriodException(beginFinancialPeriod);
+ }
+ return beginFinancialPeriod;
+ }
+
+ protected FinancialPeriod getLastFinancialPeriodFromPreviousYear(FiscalPeriod localFiscalPeriod, FinancialPeriod lastFPeriod) {
+ Collection<FinancialPeriod> fperiod = localFiscalPeriod.getFinancialPeriod();
+ Iterator<FinancialPeriod> itr = fperiod.iterator();
+ while (itr.hasNext()) {
+ lastFPeriod = itr.next();
+ }
+ return lastFPeriod;
+ }
+
+ protected Account createRelated89TreeAccounts() throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException {
+ //89 BILAN
+ Account accountMaster = accountService.getAccountByNumber("89");
+ if (accountMaster == null) {
+ createAccount("89", "BILAN");
+ }
+
+ //890 Bilan d'ouverture
+ Account beginRetainedAccount = accountService.getAccountByNumber("890");
+ if (beginRetainedAccount == null) {
+ createAccount("890", "Bilan d'ouverture");
+ }
+
+ //891 Bilan de cloture
+ Account endRetainedAccount = accountService.getAccountByNumber("891");
+ if (endRetainedAccount == null) {
+ endRetainedAccount = createAccount("891", "Bilan de clôture");
+ }
+ return endRetainedAccount;
+ }
+
+ protected Account createAccount(String accountNumber, String label) throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException {
+ Account endRetainedAccount;
+ endRetainedAccount = new AccountImpl();
+ endRetainedAccount.setAccountNumber(accountNumber);
+ endRetainedAccount.setLabel(label);
+ endRetainedAccount = accountService.createAccount(endRetainedAccount);
+ return endRetainedAccount;
+ }
+
/**
* to delete a fiscal period
* <p/>
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -391,94 +391,122 @@
}
for (FinancialStatementImport financialStatementBean : financialStatementImports) {
- Binder<FinancialStatementImport, FinancialStatement> binder = BinderFactory.newBinder(FinancialStatementImport.class, FinancialStatement.class);
- FinancialStatement financialStatement = financialStatementService.newFinancialStatement();
- binder.copyExcluding(financialStatementBean, financialStatement, FinancialStatement.PROPERTY_MASTER_FINANCIAL_STATEMENT);
+ processFinancialStatementImport(result, orderedFinancialStatements, financialStatementBean);
+ }
- try{
- // full path to master
- String masterPath = financialStatementBean.getMasterFinancialStatement();
+ } catch (ImportRuntimeException e) {
+ result.addInitException(new ImportFileException(e.getMessage()));
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+ }
- if (StringUtils.isBlank(masterPath)) {
- // case of financialStatement is root
- // look if root exists
- // It can not have several FinancialStatement with the same from same path
- FinancialStatement rootFinancialStatement = orderedFinancialStatements.get(financialStatementBean.getLabel());
+ return results;
+ }
- if (rootFinancialStatement == null) {
- rootFinancialStatement = financialStatement;
- rootFinancialStatement = financialStatementService.createFinancialStatement(null, rootFinancialStatement);
- } else {
- // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
- // the sub financial statements
- Binder<FinancialStatement, FinancialStatement> rootBinder = BinderFactory.newBinder(FinancialStatement.class, FinancialStatement.class);
- rootBinder.copyExcluding(financialStatement, rootFinancialStatement, FinancialStatement.PROPERTY_SUB_FINANCIAL_STATEMENTS);
- }
- orderedFinancialStatements.put(rootFinancialStatement.getLabel(), rootFinancialStatement);
- } else {
- String[] masterNames = masterPath.split("/");
- String rootMasterName = masterNames[0];
+ protected void processFinancialStatementImport(ImportResult result, Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatementImport financialStatementBean) {
+ Binder<FinancialStatementImport, FinancialStatement> binder = BinderFactory.newBinder(FinancialStatementImport.class, FinancialStatement.class);
+ FinancialStatement financialStatement = financialStatementService.newFinancialStatement();
+ binder.copyExcluding(financialStatementBean, financialStatement, FinancialStatement.PROPERTY_MASTER_FINANCIAL_STATEMENT);
- FinancialStatement rootFinancialStatement = orderedFinancialStatements.get(rootMasterName);
+ try{
+ // full path to master
+ String masterPath = financialStatementBean.getMasterFinancialStatement();
- // case of not ordered import and subFinancialStatement is looking for it's master that has not been created yet
- if (rootFinancialStatement == null) {
- rootFinancialStatement = financialStatementService.newFinancialStatement();
- rootFinancialStatement.setLabel(rootMasterName);
- rootFinancialStatement = financialStatementService.createFinancialStatement(null, rootFinancialStatement);
- orderedFinancialStatements.put(rootMasterName, rootFinancialStatement);
- }
+ if (StringUtils.isBlank(masterPath)) {
+ // case of financialStatement is root
+ // look if root exists
+ // It can not have several FinancialStatement with the same from same path
+ FinancialStatement rootFinancialStatement = getRootFinancialStatement(orderedFinancialStatements, financialStatementBean, financialStatement);
+ orderedFinancialStatements.put(rootFinancialStatement.getLabel(), rootFinancialStatement);
+ } else {
+ String[] masterNames = masterPath.split("/");
+ String rootMasterName = masterNames[0];
- // explore branches to find the financialStatement's master one
- FinancialStatement branchesFinancialStatement = rootFinancialStatement;
- for (int i = 1; i < masterNames.length; i++) {// 0 is root
- String masterName = masterNames[i];
- branchesFinancialStatement = returnFinancialStatement(branchesFinancialStatement, masterName);
- }
+ FinancialStatement rootFinancialStatement = orderedFinancialStatements.get(rootMasterName);
- // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
- // the sub financial statements
- boolean alreadyCreated = false;
- if (branchesFinancialStatement != null && branchesFinancialStatement.getSubFinancialStatements() != null) {
- for (FinancialStatement bfs : branchesFinancialStatement.getSubFinancialStatements()) {
- if (bfs.getLabel().equals(financialStatement.getLabel())){
- Binder<FinancialStatement, FinancialStatement> rootBinder = BinderFactory.newBinder(FinancialStatement.class, FinancialStatement.class);
- rootBinder.copyExcluding(bfs, financialStatement, FinancialStatement.PROPERTY_SUB_FINANCIAL_STATEMENTS);
- alreadyCreated = true;
- break;
- }
- }
- }
+ // case of not ordered import and subFinancialStatement is looking for it's master that has not been created yet
+ rootFinancialStatement = createRootFinancialStatement(orderedFinancialStatements, rootMasterName, rootFinancialStatement);
- // if necessary financial statement is created
- if (!alreadyCreated) {
- // if the master finacial statement has been modified then the current one is replace by the new one.
- financialStatement = financialStatementService.createFinancialStatement(branchesFinancialStatement, financialStatement);
- FinancialStatement targetedRootFinancialStatement = returnRootFinancialStatement(financialStatement);
+ // explore branches to find the financialStatement's master one
+ FinancialStatement branchesFinancialStatement = rootFinancialStatement;
+ branchesFinancialStatement = getBrancheFinancialStatement(masterNames, branchesFinancialStatement);
- // replace modified root financial statement with new one
- if (orderedFinancialStatements.get(targetedRootFinancialStatement.getLabel()) != null) {
- orderedFinancialStatements.put(targetedRootFinancialStatement.getLabel(), targetedRootFinancialStatement);
- }
- }
+ // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
+ // the sub financial statements
+ boolean alreadyCreated = false;
+ alreadyCreated = propagetChangesToExistingFinancialStatement(financialStatement, branchesFinancialStatement, alreadyCreated);
- }
- result.increaseCreated();
- } catch (AlreadyExistFinancialStatement | NotAllowedLabelException e) {
- result.addException(e);
- }
+ // if necessary financial statement is created
+ if (!alreadyCreated) {
+ createRootFinancialStatement(orderedFinancialStatements, financialStatement, branchesFinancialStatement);
}
- } catch (ImportRuntimeException e) {
- result.addInitException(new ImportFileException(e.getMessage()));
- } finally {
- IOUtils.closeQuietly(contentStream);
}
+ result.increaseCreated();
+ } catch (AlreadyExistFinancialStatement | NotAllowedLabelException e) {
+ result.addException(e);
}
+ }
- return results;
+ private FinancialStatement getRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatementImport financialStatementBean, FinancialStatement financialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ FinancialStatement rootFinancialStatement = orderedFinancialStatements.get(financialStatementBean.getLabel());
+
+ if (rootFinancialStatement == null) {
+ rootFinancialStatement = financialStatement;
+ rootFinancialStatement = financialStatementService.createFinancialStatement(null, rootFinancialStatement);
+ } else {
+ // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
+ // the sub financial statements
+ Binder<FinancialStatement, FinancialStatement> rootBinder = BinderFactory.newBinder(FinancialStatement.class, FinancialStatement.class);
+ rootBinder.copyExcluding(financialStatement, rootFinancialStatement, FinancialStatement.PROPERTY_SUB_FINANCIAL_STATEMENTS);
+ }
+ return rootFinancialStatement;
}
+ private FinancialStatement getBrancheFinancialStatement(String[] masterNames, FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ for (int i = 1; i < masterNames.length; i++) {// 0 is root
+ String masterName = masterNames[i];
+ branchesFinancialStatement = returnFinancialStatement(branchesFinancialStatement, masterName);
+ }
+ return branchesFinancialStatement;
+ }
+
+ protected void createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, FinancialStatement financialStatement, FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ // if the master finacial statement has been modified then the current one is replace by the new one.
+ financialStatement = financialStatementService.createFinancialStatement(branchesFinancialStatement, financialStatement);
+ FinancialStatement targetedRootFinancialStatement = returnRootFinancialStatement(financialStatement);
+
+ // replace modified root financial statement with new one
+ if (orderedFinancialStatements.get(targetedRootFinancialStatement.getLabel()) != null) {
+ orderedFinancialStatements.put(targetedRootFinancialStatement.getLabel(), targetedRootFinancialStatement);
+ }
+ }
+
+ protected boolean propagetChangesToExistingFinancialStatement(FinancialStatement financialStatement, FinancialStatement branchesFinancialStatement, boolean alreadyCreated) {
+ if (branchesFinancialStatement != null && branchesFinancialStatement.getSubFinancialStatements() != null) {
+ for (FinancialStatement bfs : branchesFinancialStatement.getSubFinancialStatements()) {
+ if (bfs.getLabel().equals(financialStatement.getLabel())){
+ Binder<FinancialStatement, FinancialStatement> rootBinder = BinderFactory.newBinder(FinancialStatement.class, FinancialStatement.class);
+ rootBinder.copyExcluding(bfs, financialStatement, FinancialStatement.PROPERTY_SUB_FINANCIAL_STATEMENTS);
+ alreadyCreated = true;
+ break;
+ }
+ }
+ }
+ return alreadyCreated;
+ }
+
+ protected FinancialStatement createRootFinancialStatement(Map<String, FinancialStatement> orderedFinancialStatements, String rootMasterName, FinancialStatement rootFinancialStatement) throws AlreadyExistFinancialStatement, NotAllowedLabelException {
+ if (rootFinancialStatement == null) {
+ rootFinancialStatement = financialStatementService.newFinancialStatement();
+ rootFinancialStatement.setLabel(rootMasterName);
+ rootFinancialStatement = financialStatementService.createFinancialStatement(null, rootFinancialStatement);
+ orderedFinancialStatements.put(rootMasterName, rootFinancialStatement);
+ }
+ return rootFinancialStatement;
+ }
+
protected VatStatement returnVATStatement (VatStatement rootVATStatement, String subVATStatementLabel) throws AlreadyExistVatStatementException, NotAllowedLabelException {
Collection<VatStatement> subVatStatements = rootVATStatement.getSubVatStatements();
VatStatement targetedVATStatement = null;
@@ -535,99 +563,132 @@
// path, vatStatement
Map<String, VatStatement> orderedVATStatements = new HashMap<>();
- List<VatStatement> rootVatStatements = vatStatementService.getRootVatStatements();
- for (VatStatement vatStatement : rootVatStatements) {
- orderedVATStatements.put(vatStatement.getLabel(), vatStatement);
- }
+ orderVATStatements(orderedVATStatements);
for (VatStatementImport vatStatementBean : vatStatementImports) {
- Binder<VatStatementImport, VatStatement> binder = BinderFactory.newBinder(VatStatementImport.class, VatStatement.class);
- VatStatement vatStatement = vatStatementService.newVatStatement();
- binder.copyExcluding(vatStatementBean, vatStatement, VatStatement.PROPERTY_MASTER_VAT_STATEMENT);
+ importVatStatement(result, orderedVATStatements, vatStatementBean);
+ }
- try{
- // full path to master
- String masterPath = vatStatementBean.getMasterVatStatement();
+ } catch (ImportRuntimeException e) {
+ result.addInitException(new ImportFileException(e.getMessage()));
+ } finally {
+ IOUtils.closeQuietly(contentStream);
+ }
+ }
+ return results;
+ }
- if (StringUtils.isBlank(masterPath)) {
- // case of vatStatement is root
- // look if root exists
- // It can not have several vatStatement with the same from same path
- VatStatement rootVATStatement = orderedVATStatements.get(vatStatementBean.getLabel());
+ protected void importVatStatement(ImportResult result, Map<String, VatStatement> orderedVATStatements, VatStatementImport vatStatementBean) {
+ Binder<VatStatementImport, VatStatement> binder = BinderFactory.newBinder(VatStatementImport.class, VatStatement.class);
+ VatStatement vatStatement = vatStatementService.newVatStatement();
+ binder.copyExcluding(vatStatementBean, vatStatement, VatStatement.PROPERTY_MASTER_VAT_STATEMENT);
- if (rootVATStatement == null) {
- rootVATStatement = vatStatement;
- rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
- } else {
- // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
- // the sub vatStatements
- Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
- rootBinder.copyExcluding(vatStatement, rootVATStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
- }
- orderedVATStatements.put(rootVATStatement.getLabel(), rootVATStatement);
- } else {
- String[] masterNames = masterPath.split("/");
- String rootMasterName = masterNames[0];
+ try{
+ // full path to master
+ String masterPath = vatStatementBean.getMasterVatStatement();
- VatStatement rootVATStatement = orderedVATStatements.get(rootMasterName);
+ if (StringUtils.isBlank(masterPath)) {
+ // case of vatStatement is root
+ // look if root exists
+ // It can not have several vatStatement with the same from same path
+ VatStatement rootVATStatement = getRootVatStatement(orderedVATStatements, vatStatementBean, vatStatement);
+ orderedVATStatements.put(rootVATStatement.getLabel(), rootVATStatement);
+ } else {
+ String[] masterNames = masterPath.split("/");
+ String rootMasterName = masterNames[0];
- // case of not ordered import and subVATStatement is looking for it's master that has not been created yet
- if (rootVATStatement == null) {
- rootVATStatement = vatStatementService.newVatStatement();
- rootVATStatement.setLabel(rootMasterName);
- rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
- orderedVATStatements.put(rootMasterName, rootVATStatement);
- }
+ VatStatement rootVATStatement = orderedVATStatements.get(rootMasterName);
- // explore branches to find the vatStatement's master one
- VatStatement branchesVATStatement = rootVATStatement;
- for (int i = 1; i < masterNames.length; i++) {// 0 is root
- String masterName = masterNames[i];
- branchesVATStatement = returnVATStatement(branchesVATStatement, masterName);
- }
+ // case of not ordered import and subVATStatement is looking for it's master that has not been created yet
+ rootVATStatement = createRootVATStatement(orderedVATStatements, rootMasterName, rootVATStatement);
- // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
- // the sub vatStatements
- boolean alreadyCreated = false;
- if (branchesVATStatement != null && branchesVATStatement.getSubVatStatements() != null) {
- for (VatStatement bfs : branchesVATStatement.getSubVatStatements()) {
- if (bfs.getLabel().equals(vatStatement.getLabel())){
- Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
- rootBinder.copyExcluding(bfs, vatStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
- alreadyCreated = true;
- break;
- }
- }
- }
+ // explore branches to find the vatStatement's master one
+ VatStatement branchesVATStatement = rootVATStatement;
+ branchesVATStatement = getBrancheVatStatement(masterNames, branchesVATStatement);
- // if necessary vatStatement is created
- if (!alreadyCreated) {
- // if the master vatStatement has been modified then the current one is replace by the new one.
- vatStatement = vatStatementService.createVatStatement(branchesVATStatement, vatStatement);
- VatStatement targetedRootVATStatement = returnRootVATStatement(vatStatement);
+ // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
+ // the sub vatStatements
+ boolean alreadyCreated = false;
+ alreadyCreated = propagateVATChangeToBranche(vatStatement, branchesVATStatement, alreadyCreated);
- // replace modified root vatStatement with new one
- if (orderedVATStatements.get(targetedRootVATStatement.getLabel()) != null) {
- orderedVATStatements.put(targetedRootVATStatement.getLabel(), targetedRootVATStatement);
- }
- }
+ // if necessary vatStatement is created
+ if (!alreadyCreated) {
+ refreshMasterVATStatement(orderedVATStatements, vatStatement, branchesVATStatement);
- }
- result.increaseCreated();
- } catch (AlreadyExistVatStatementException | NotAllowedLabelException e) {
- result.addException(e);
- }
}
- } catch (ImportRuntimeException e) {
- result.addInitException(new ImportFileException(e.getMessage()));
- } finally {
- IOUtils.closeQuietly(contentStream);
}
+ result.increaseCreated();
+ } catch (AlreadyExistVatStatementException | NotAllowedLabelException e) {
+ result.addException(e);
}
- return results;
}
+ private void refreshMasterVATStatement(Map<String, VatStatement> orderedVATStatements, VatStatement vatStatement, VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ // if the master vatStatement has been modified then the current one is replace by the new one.
+ vatStatement = vatStatementService.createVatStatement(branchesVATStatement, vatStatement);
+ VatStatement targetedRootVATStatement = returnRootVATStatement(vatStatement);
+
+ // replace modified root vatStatement with new one
+ if (orderedVATStatements.get(targetedRootVATStatement.getLabel()) != null) {
+ orderedVATStatements.put(targetedRootVATStatement.getLabel(), targetedRootVATStatement);
+ }
+ }
+
+ private boolean propagateVATChangeToBranche(VatStatement vatStatement, VatStatement branchesVATStatement, boolean alreadyCreated) {
+ if (branchesVATStatement != null && branchesVATStatement.getSubVatStatements() != null) {
+ for (VatStatement bfs : branchesVATStatement.getSubVatStatements()) {
+ if (bfs.getLabel().equals(vatStatement.getLabel())){
+ Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
+ rootBinder.copyExcluding(bfs, vatStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
+ alreadyCreated = true;
+ break;
+ }
+ }
+ }
+ return alreadyCreated;
+ }
+
+ private VatStatement getBrancheVatStatement(String[] masterNames, VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ for (int i = 1; i < masterNames.length; i++) {// 0 is root
+ String masterName = masterNames[i];
+ branchesVATStatement = returnVATStatement(branchesVATStatement, masterName);
+ }
+ return branchesVATStatement;
+ }
+
+ private VatStatement createRootVATStatement(Map<String, VatStatement> orderedVATStatements, String rootMasterName, VatStatement rootVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ if (rootVATStatement == null) {
+ rootVATStatement = vatStatementService.newVatStatement();
+ rootVATStatement.setLabel(rootMasterName);
+ rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
+ orderedVATStatements.put(rootMasterName, rootVATStatement);
+ }
+ return rootVATStatement;
+ }
+
+ private VatStatement getRootVatStatement(Map<String, VatStatement> orderedVATStatements, VatStatementImport vatStatementBean, VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException {
+ VatStatement rootVATStatement = orderedVATStatements.get(vatStatementBean.getLabel());
+
+ if (rootVATStatement == null) {
+ rootVATStatement = vatStatement;
+ rootVATStatement = vatStatementService.createVatStatement(null, rootVATStatement);
+ } else {
+ // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted
+ // the sub vatStatements
+ Binder<VatStatement, VatStatement> rootBinder = BinderFactory.newBinder(VatStatement.class, VatStatement.class);
+ rootBinder.copyExcluding(vatStatement, rootVATStatement, VatStatement.PROPERTY_SUB_VAT_STATEMENTS);
+ }
+ return rootVATStatement;
+ }
+
+ protected void orderVATStatements(Map<String, VatStatement> orderedVATStatements) {
+ List<VatStatement> rootVatStatements = vatStatementService.getRootVatStatements();
+ for (VatStatement vatStatement : rootVatStatements) {
+ orderedVATStatements.put(vatStatement.getLabel(), vatStatement);
+ }
+ }
+
@Override
public ImportExportResults importBackup(String entryBooks, String financialTransactions, String fiscalPeriods, String accounts, String entries, String identity) throws AlreadyExistAccountException, InvalidAccountNumberException {
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 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -82,9 +82,9 @@
public ReportsDatas generateAccountsReports(Account account, Boolean thirdPartAccountsMode,
Date beginDate, Date endDate) {
- BigDecimal credit = new BigDecimal(0);
- BigDecimal debit = new BigDecimal(0);
- BigDecimal solde = new BigDecimal(0);
+ BigDecimal credit = BigDecimal.ZERO;
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal solde = BigDecimal.ZERO;
List<Entry> entries = new ArrayList<Entry>();
ReportsDatas reportsDatas = generateSubAccountReports(account,
@@ -133,9 +133,9 @@
protected ReportsDatas generateSubAccountReports(Account account,
Date beginDate, Date endDate) {
ReportsDatas reportsDatas = new ReportsDatasImpl();
- BigDecimal credit = new BigDecimal(0);
- BigDecimal debit = new BigDecimal(0);
- BigDecimal solde = new BigDecimal(0);
+ BigDecimal credit = BigDecimal.ZERO;
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal solde = BigDecimal.ZERO;
EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao();
@@ -184,9 +184,9 @@
public ReportsDatas generateSubAccountBalance(Account account,
Date beginDate, Date endDate, Boolean getEntries) {
ReportsDatas reportsDatas = new ReportsDatasImpl();
- BigDecimal credit = new BigDecimal(0);
- BigDecimal debit = new BigDecimal(0);
- BigDecimal solde = new BigDecimal(0);
+ BigDecimal credit = BigDecimal.ZERO;
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal solde = BigDecimal.ZERO;
EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao();
@@ -238,9 +238,9 @@
public ReportsDatas generateEntryBooksReports(EntryBook entryBook,
Date beginDate, Date endDate) {
ReportsDatas reportsDatas = new ReportsDatasImpl();
- BigDecimal credit = new BigDecimal(0);
- BigDecimal debit = new BigDecimal(0);
- BigDecimal solde = new BigDecimal(0);
+ BigDecimal credit = BigDecimal.ZERO;
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal solde = BigDecimal.ZERO;
// Get all entries with a topia query
EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao();
@@ -296,9 +296,9 @@
Boolean movementedFilter) {
BalanceTrial balanceTrial = new BalanceTrialImpl();
balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>());
- BigDecimal credit = new BigDecimal(0);
- BigDecimal debit = new BigDecimal(0);
- BigDecimal solde = new BigDecimal(0);
+ BigDecimal credit = BigDecimal.ZERO;
+ BigDecimal debit = BigDecimal.ZERO;
+ BigDecimal solde = BigDecimal.ZERO;
AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao();
//for each account create a balance sheet with a ReportsDatas
@@ -326,7 +326,7 @@
reportsDatas.setAccount(account);
BigDecimal amount = reportsDatas.getAmountSolde();
if (amount == null) {
- amount = new BigDecimal(0);
+ amount = BigDecimal.ZERO;
}
if (movementedFilter) {
if (!reportsDatas.getAmountCredit().equals(BigDecimal.ZERO)
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -205,8 +205,8 @@
Date selectedEndDate) {
VatStatementAmounts vatStatementAmounts = new VatStatementAmountsImpl();
- BigDecimal debitTemp = new BigDecimal(0);
- BigDecimal creditTemp = new BigDecimal(0);
+ BigDecimal debitTemp = BigDecimal.ZERO;
+ BigDecimal creditTemp = BigDecimal.ZERO;
String accountNumbersList = findAccountNumberByVatStatement(vatStatement);
@@ -260,7 +260,7 @@
List<VatStatement> vatStatements =
getChildrenVatStatement(vatStatement);
- BigDecimal amount = new BigDecimal(0);
+ BigDecimal amount = BigDecimal.ZERO;
List<VatStatementAmounts> subResult =
new ArrayList<VatStatementAmounts>();
for (VatStatement subVatStatement : vatStatements) {
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -96,6 +96,10 @@
return allExceptions;
}
+ /**
+ *
+ * @return the class of the targeted entities
+ */
public Class getFromSource() {
return fromSource;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-07 20:17:41 UTC (rev 3905)
@@ -29,6 +29,7 @@
import com.google.common.base.Strings;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
@@ -81,7 +82,6 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -134,18 +134,23 @@
* Call the appropriate method in business service.
*
* @param importExportMethode
- * @param file
+ * @param path
* @param verbose
*/
- public void importExport(ImportExportEnum importExportMethode, String file, boolean verbose) {
+ public void importExport(ImportExportEnum importExportMethode, String path, boolean verbose) {
final ImportExportEnum importExportMethodeF = importExportMethode;
final Charset defaultCharset = Charsets.UTF_8;
- if (Strings.isNullOrEmpty(file)) {
- file = chooseFile(importExportMethode.getImportMode(), importExportMethode);
+ String filePath = path;
+ if (Strings.isNullOrEmpty(filePath)) {
+ filePath = chooseFile(importExportMethode.getImportMode(), importExportMethode);
}
+ processImport(importExportMethode, verbose, importExportMethodeF, defaultCharset, filePath);
+
+ }
+
+ protected void processImport(ImportExportEnum importExportMethode, boolean verbose, final ImportExportEnum importExportMethod, final Charset defaultCharset, final String filePath) {
//if export cancel
- if (!Strings.isNullOrEmpty(file)) {
- final String filePath = file;
+ if (!Strings.isNullOrEmpty(filePath)) {
final Boolean verboseMode = verbose;
final Boolean importMode = importExportMethode.getImportMode();
@@ -154,7 +159,7 @@
@Override
protected ImportExportResults doInBackground() {
ImportExportResults results = new ImportExportResults();
- switch (importExportMethodeF) {
+ switch (importExportMethod) {
//####################################### CSV ##############################################
case CSV_ACCOUNTCHARTS_EXPORT:
@@ -237,6 +242,8 @@
content = loadFile(filePath, EncodingEnum.ISOLATIN1.getEncoding());
results.pushImportResults(importService.importEntriesFromEbp(content));
break;
+ default:
+ break;
}
return results;
}
@@ -261,86 +268,15 @@
} else {
if (importMode) {
- List<ImportResult> resultList = results.getImportResults();
- if (resultList != null) {
- if (log.isDebugEnabled()) {
- log.debug("importMode");
- log.debug("importExportMethodeF : " + importExportMethodeF);
- for (ImportResult result : resultList) {
- String importedEntity = result.getFromSource() == null ? "BACKUP" : result.getFromSource().getSimpleName();
- log.debug(importedEntity + " nbCreated: " + result.getNbCreated());
- log.debug(importedEntity + " nbUpdated: " + result.getNbUpdated());
- log.debug(importedEntity + " nbIgnored: " + result.getNbIgnored());
- Map<Integer, LimaException> exceptions = result.getAllExceptionsByLine();
- if (exceptions != null) {
- for (LimaException exception : exceptions.values()) {
- log.warn(exception.getCause());
- log.warn(exception.getStackTrace());
- }
- }
- }
- }
- if (log.isDebugEnabled()) {
- log.debug("import.terminated");
- }
-
- String message = t("lima.ui.importexport.import.terminated")+"\n";
- for (ImportResult result : resultList) {
- Class fromSource = result.getFromSource();
- message += "Import " + getFromSourceMessage(fromSource);
- message += t("lima.ui.importexport.import.nbCreated", result.getNbCreated())+"\n";
- message += t("lima.ui.importexport.import.nbUpdated", result.getNbUpdated())+"\n";
- message += t("lima.ui.importexport.import.nbIgnored", result.getNbIgnored())+"\n";
- Map<Integer, LimaException> exceptionsByLine = result.getAllExceptionsByLine();
- message = displayErrorMessage(message, exceptionsByLine);
- // message is null if import failed
- if (message == null) {
- break;
- }
- }
-
- if (message != null) {
- JOptionPane.showMessageDialog(
- waitView,
- message,
- t("lima.ui.importexport.import"),
- JOptionPane.INFORMATION_MESSAGE);
- }
+ List<ImportResult> importResults = results.getImportResults();
+ if (importResults != null) {
+ ComputeImportResultMessage(importResults);
}
} else {
List<ExportResult> exportResults = results.getExportResults();
if (exportResults != null) {
- if (log.isDebugEnabled()) {
- log.debug("export.terminated");
-
- }
- String message ="";
- for (ExportResult result : exportResults) {
- Class fromSource = result.getFromSource();
- message += "Export " + getFromSourceMessage(fromSource);
- List<ExportException> exportExceptions = result.getExportExceptions();
- if (exportExceptions != null && !exportExceptions.isEmpty()) {
- message += t("lima.ui.importexport.export.exception")+"\n";
- if (log.isErrorEnabled()) {
- for (ExportException exportException : exportExceptions) {
- log.error(exportException.getMessage());
- }
- }
- }
- }
-
- JOptionPane.showMessageDialog(
- waitView,
- t("lima.ui.importexport.export.terminated"),
- message,
- JOptionPane.INFORMATION_MESSAGE);
- } else {
- if (log.isDebugEnabled()) {
- log.debug("export.terminated");
- log.debug(t("lima.ui.importexport.no.result"));
- }
+ ComputeExportResultMessage(exportResults);
}
-
}
}
}
@@ -355,52 +291,120 @@
}
}
- private String displayErrorMessage(String message, Map<Integer, LimaException> exceptionsByLine) {
+ private void ComputeExportResultMessage(List<ExportResult> exportResults) {
+ StringBuilder message = new StringBuilder();
+ for (ExportResult result : exportResults) {
+ Class fromSource = result.getFromSource();
+ String messageFromSource = getFromSourceMessage(fromSource);
+ message.append("Export ");
+ message.append(messageFromSource);
+
+ List<ExportException> exportExceptions = result.getExportExceptions();
+ if (exportExceptions != null && !exportExceptions.isEmpty()) {
+ message.append(t("lima.ui.importexport.export.exceptions"));
+ }
+ }
+
+ DisplayImportExportResultMessage(message, false);
+ }
+
+ private void ComputeImportResultMessage(List<ImportResult> resultList) {
+ StringBuilder message = new StringBuilder();
+ message.append(t("lima.ui.importexport.import.terminated"));
+ StringBuilder errorMessage = null;
+ for (ImportResult result : resultList) {
+ Class fromSource = result.getFromSource();
+ message.append("Import ");
+ message.append(getFromSourceMessage(fromSource));
+ message.append(t("lima.ui.importexport.import.nbCreated", result.getNbCreated()));
+ message.append(t("lima.ui.importexport.import.nbUpdated", result.getNbUpdated()));
+ message.append(t("lima.ui.importexport.import.nbIgnored", result.getNbIgnored()));
+
+ Map<Integer, LimaException> exceptionsByLine = result.getAllExceptionsByLine();
+ errorMessage = displayErrorMessage(exceptionsByLine);
+ // message is null if import failed
+ if (errorMessage == null) {
+ break;
+ } else {
+ message.append(errorMessage.toString());
+ }
+ }
+
+ if (errorMessage != null) {
+ DisplayImportExportResultMessage(message, true);
+ }
+ }
+
+ private void DisplayImportExportResultMessage(StringBuilder message, Boolean importMode) {
+ if (log.isDebugEnabled()){
+ log.debug(message.toString());
+ }
+
+ String title = importMode ? t("lima.ui.importexport.import.terminated") : t("lima.ui.importexport.export.terminated");
+ JOptionPane.showMessageDialog(
+ waitView,
+ message.toString(),
+ title,
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ private StringBuilder displayErrorMessage(Map<Integer, LimaException> exceptionsByLine) {
+ StringBuilder result = new StringBuilder();
if (exceptionsByLine != null) {
- Set<Integer> lines = exceptionsByLine.keySet();
- for (Integer line : lines) {
- LimaException importException = exceptionsByLine.get(line);
- message = message + t("lima.ui.importexport.import.line", line);
+ for (Map.Entry<Integer, LimaException> e:exceptionsByLine.entrySet()) {
+ result.append(t("lima.ui.importexport.import.line", e.getKey()));
+ LimaException importException = e.getValue();
if (importException instanceof InvalidAccountNumberException) {
- message += t("lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException", ((InvalidAccountNumberException) importException).getAccountNumber())+"\n";
+ result.append(t("lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException", ((InvalidAccountNumberException) importException).getAccountNumber()));
} else if (importException instanceof NotNumberAccountNumberException) {
- message += t("lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException", ((NotNumberAccountNumberException) importException).getAccountNumber())+"\n";
+ result.append(t("lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException", ((NotNumberAccountNumberException) importException).getAccountNumber()));
} else if (importException instanceof NotAllowedLabelException) {
- message += t("lima.all.NotAllowedLabel", ((NotAllowedLabelException) importException).getLabel())+"\n";
+ result.append(t("lima.all.NotAllowedLabel", ((NotAllowedLabelException) importException).getLabel()));
} else if (importException instanceof MoreOneUnlockFiscalPeriodException) {
- message += t("lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException", ((MoreOneUnlockFiscalPeriodException) importException).getBeginDate(), ((MoreOneUnlockFiscalPeriodException) importException).getEndDate())+"\n";
+ result.append(t("lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException", ((MoreOneUnlockFiscalPeriodException) importException).getBeginDate(), ((MoreOneUnlockFiscalPeriodException) importException).getEndDate()));
} else if (importException instanceof BeginAfterEndFiscalPeriodException) {
- message += t("lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException", ((BeginAfterEndFiscalPeriodException) importException).getFiscalPeriod().getBeginDate(), ((BeginAfterEndFiscalPeriodException) importException).getFiscalPeriod().getEndDate())+"\n";
+ result.append(t("lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException", ((BeginAfterEndFiscalPeriodException) importException).getFiscalPeriod().getBeginDate(), ((BeginAfterEndFiscalPeriodException) importException).getFiscalPeriod().getEndDate()));
} else if (importException instanceof NotBeginNextDayOfLastFiscalPeriodException) {
- message += t("lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException", ((NotBeginNextDayOfLastFiscalPeriodException) importException).getFiscalPeriod().getBeginDate(), ((NotBeginNextDayOfLastFiscalPeriodException) importException).getFiscalPeriod().getEndDate())+"\n";
+ result.append(t("lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException", ((NotBeginNextDayOfLastFiscalPeriodException) importException).getFiscalPeriod().getBeginDate(), ((NotBeginNextDayOfLastFiscalPeriodException) importException).getFiscalPeriod().getEndDate()));
} else if (importException instanceof LockedFinancialPeriodException) {
- message += t("lima.financialTransaction.lockedFinancialPeriodException")+"\n";
+ result.append(t("lima.financialTransaction.lockedFinancialPeriodException"));
} else if (importException instanceof LockedEntryBookException) {
- message += t("lima.financialTransaction.lockedEntryBookException", ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getBeginDate(), ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getEndDate())+"\n";
+ result.append(t("lima.financialTransaction.lockedEntryBookException", ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getBeginDate(), ((LockedEntryBookException) importException).getClosedPeriodicEntryBook().getFinancialPeriod().getEndDate()));
} else if (importException instanceof AlreadyExistFinancialStatement) {
- message += t("lima.financialStatement.alreadyExistFinancialStatement", ((AlreadyExistFinancialStatement) importException).getFinancialStatementLabel())+"\n";
+ result.append(t("lima.financialStatement.alreadyExistFinancialStatement", ((AlreadyExistFinancialStatement) importException).getFinancialStatementLabel()));
} else if (importException instanceof AlreadyExistVatStatementException) {
- message += t("lima.vatStatement.alreadyExistVatStatement", ((AlreadyExistVatStatementException) importException).getVatStatementLabel())+"\n";
+ result.append(t("lima.vatStatement.alreadyExistVatStatement", ((AlreadyExistVatStatementException) importException).getVatStatementLabel()));
} else if (importException instanceof NoFiscalPeriodFoundException) {
- message += t("lima.import.entries.noFiscalPeriodFoundException")+"\n";
+ result.append(t("lima.import.entries.noFiscalPeriodFoundException"));
} else if (importException instanceof NoDataToImportException) {
errorHelper.showErrorMessage(t("lima.import.noDataToImportException"));
- return null;
+ log.warn(t("lima.import.noDataToImportException"));
+ result = null;
+ break;
} else if (importException instanceof ImportFileException){
errorHelper.showErrorMessage(((ImportFileException) importException).getDetailMessage());
- return null;
+ log.warn(((ImportFileException) importException).getDetailMessage());
+ result = null;
+ break;
} else {
- message +=t("lima.import.unknownError");
+ result.append(t("lima.import.unknownError"));
}
- //message += t("lima.ui.importexport.import.exceptions", (line))+"\n";
- if (log.isErrorEnabled()) {
- log.error(importException.getMessage());
+ try {
+ throw importException;
+ } catch (LimaException ex) {
+ log.error(ex);
}
+
}
}
- return message;
+ return result;
}
+ /**
+ * Return with entities have been imported/exported.
+ * @param fromSource The imported target class
+ * @return the name of the imported/exported entities class.
+ */
private String getFromSourceMessage(Class fromSource) {
String message;
if (fromSource == null) {
@@ -432,18 +436,18 @@
* open choose file dialog with appropriate file mode view
* folders for export or folders+files for import
*
- * @param importMode
- * @param importExportMethode
- * @return
+ * @param importMode true = import mode false = export
+ * @param importExportMethod Inport/export to process
+ * @return the targeted file path
*/
- public String chooseFile(Boolean importMode, ImportExportEnum importExportMethode) {
+ public String chooseFile(Boolean importMode, ImportExportEnum importExportMethod) {
String filePath = "";
JFileChooser chooser = new JFileChooser();
//Encoding option
- JComboBox comboBox = new JComboBox(EncodingEnum.descriptions());
+ JComboBox comboBox = new JComboBox<String>(EncodingEnum.descriptions());
- if (importExportMethode.getEncodingOption()) {
+ if (importExportMethod.getEncodingOption()) {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(new JLabel(t("lima.importexport.choiceencoding")), BorderLayout.WEST);
@@ -457,7 +461,7 @@
approveButtonText = t("lima.ui.importexport.import");
chooser.setDialogTitle(approveButtonText);
chooser.setApproveButtonText(approveButtonText);
- } else if (importExportMethode.equals(ImportExportEnum.CSV_ALL_EXPORT)) {
+ } else if (importExportMethod.equals(ImportExportEnum.CSV_ALL_EXPORT)) {
approveButtonText = t("lima.ui.importexport.export");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogTitle(approveButtonText);
@@ -479,16 +483,16 @@
/**
* Get csv datas in string and write file.
*
- * @param filePath
- * @param charset
- * @param datas
+ * @param filePath path to file
+ * @param charset charset to use
+ * @param data data to write on file
*/
- protected File createFile(String filePath, String charset, String datas) {
+ protected File createFile(String filePath, String charset, String data) {
File file = new File(filePath);
BufferedWriter out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
- out.write(datas);
+ out.write(data);
out.flush();
out.close();
} catch (IOException eee) {
@@ -502,11 +506,11 @@
}
/**
- * Open csv file and get his datas on a string.
+ * Open csv file and get his data on a string.
*
- * @param filePath
- * @param charset
- * @return
+ * @param filePath path to targeted file
+ * @param charset charset to use for import
+ * @return file contents
*/
protected String loadFile(String filePath, String charset) {
String result = null;
@@ -527,46 +531,63 @@
}
protected ImportExportResults exportBackup(String path, String charset){
- ImportExportResults results = exportService.exportBackup(charset);
+ ImportExportResults streamData = exportService.exportBackup(charset);
ZipOutputStream export = null;
+ FileOutputStream result = null;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
- FileOutputStream fos = new FileOutputStream(path + "/LIMA-BACKUP-"+ dateFormat.format(new Date()));
- export = new ZipOutputStream(fos);
- for (ExportResult result : results.getExportResults()) {
- File file = createFile(JAVA_IO_TMPDIR + result.getFromSource().getSimpleName(), charset, result.getExportData());
- if (file != null) {
- ZipEntry ze= new ZipEntry(file.getName());
- export.putNextEntry(ze);
- int len;
- byte[] buffer = new byte[1024];
- FileInputStream stream = new FileInputStream(file);
- while ((len = stream.read(buffer)) > 0) {
- export.write(buffer, 0, len);
+ result = new FileOutputStream(path + "/LIMA-BACKUP-"+ dateFormat.format(new Date()));
+ export = new ZipOutputStream(result);
+ for (ExportResult exportedData : streamData.getExportResults()) {
+ if (exportedData != null && StringUtils.isNotBlank(exportedData.getExportData())) {
+ String data = exportedData.getExportData();
+ File file = createFile(JAVA_IO_TMPDIR + exportedData.getFromSource().getSimpleName(), charset, data);
+ if (file != null) {
+ ZipEntry ze= new ZipEntry(file.getName());
+ export.putNextEntry(ze);
+ int len;
+ byte[] buffer = new byte[1024];
+ FileInputStream stream = new FileInputStream(file);
+ while ((len = stream.read(buffer)) > 0) {
+ export.write(buffer, 0, len);
+ }
+ IOUtils.closeQuietly(stream);
+ FileUtils.forceDelete(file);
}
- stream.close();
- FileUtils.forceDelete(file);
+ } else {
+ // export failed
+ break;
}
}
export.flush();
+
} catch (IOException e) {
- e.printStackTrace();
+ errorHelper.showErrorMessage(t("lima.ui.importexport.export.failed"));
+ log.error(t("lima.ui.importexport.export.failed"), e);
} finally {
IOUtils.closeQuietly(export);
+ IOUtils.closeQuietly(result);
}
+ return streamData;
+ }
+
+ protected ImportExportResults importAllFromZipFile(String filePath) {
+
+ String tmpDir = System.getProperty("java.io.tmpdir")+"/";
+ String determinant = String.valueOf(new Date().getTime());
+ ImportResult result = extractZipFile(filePath, tmpDir, determinant);
+ ImportExportResults results = processBackup(result, tmpDir, determinant);
return results;
}
- protected ImportExportResults importAllFromZipFile(String filePath) {
+ protected ImportResult extractZipFile(String filePath, String tmpDir, String determinant) {
ImportExportResults results = new ImportExportResults();
ImportResult result = results.createAddAndGetImportResult(null);
ZipInputStream zipInputStream = null;
- String tmpDir = System.getProperty("java.io.tmpdir")+"/";
FileInputStream inputStream = null;
// use to be sure to not load old streams.
- String date = String.valueOf(new Date().getTime());
try {
inputStream = new FileInputStream(filePath);
@@ -576,7 +597,8 @@
while ((entry = zipInputStream.getNextEntry()) != null) {
byte[] buffer = new byte[2048];
- FileOutputStream fileoutputstream = new FileOutputStream(tmpDir + entry.getName() + "-" + date +".csv");
+ String targetFileName= tmpDir + entry.getName() + "-" + determinant +".csv";
+ FileOutputStream fileoutputstream = new FileOutputStream(targetFileName);
int n;
while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
@@ -588,45 +610,57 @@
}
} catch (Exception e) {
result.addInitException(new ImportFileException(t("lima.ui.importexport.import.extractFileError")));
+ log.error(e.getStackTrace());
} finally {
IOUtils.closeQuietly(zipInputStream);
IOUtils.closeQuietly(inputStream);
}
- InputStream transactionsStream, entryBooksStream, fiscalPeriodsStream, entriesStream, accountsStream, identityStream;
+ return result;
+ }
+ protected ImportExportResults processBackup(ImportResult result, String tmpDir, String determinant) {
+ ImportExportResults results = null;
+ InputStream entryBooksStream = null, transactionsStream = null, fiscalPeriodsStream = null, accountsStream = null, entriesStream = null, identityStream = null;
if (result.getAllExceptionsByLine() == null || result.getAllExceptionsByLine().isEmpty()) {
try {
- entryBooksStream = new FileInputStream(tmpDir + EntryBook.class.getSimpleName() + "-" + date + ".csv");
+ entryBooksStream = new FileInputStream(tmpDir + EntryBook.class.getSimpleName() + "-" + determinant + ".csv");
String entryBooksStreamString = IOUtils.toString(entryBooksStream);
IOUtils.closeQuietly(entryBooksStream);
// import
- transactionsStream = new FileInputStream(tmpDir + FinancialTransaction.class.getSimpleName() + "-" + date + ".csv");
+ transactionsStream = new FileInputStream(tmpDir + FinancialTransaction.class.getSimpleName() + "-" + determinant + ".csv");
String transactionsStreamString = IOUtils.toString(transactionsStream);
IOUtils.closeQuietly(transactionsStream);
- fiscalPeriodsStream = new FileInputStream(tmpDir + FiscalPeriod.class.getSimpleName() + "-" + date + ".csv");
+ fiscalPeriodsStream = new FileInputStream(tmpDir + FiscalPeriod.class.getSimpleName() + "-" + determinant + ".csv");
String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
IOUtils.closeQuietly(fiscalPeriodsStream);
- accountsStream = new FileInputStream(tmpDir + Account.class.getSimpleName() + "-" + date + ".csv");
+ accountsStream = new FileInputStream(tmpDir + Account.class.getSimpleName() + "-" + determinant + ".csv");
String accountsStreamString = IOUtils.toString(accountsStream);
IOUtils.closeQuietly(accountsStream);
- entriesStream = new FileInputStream(tmpDir + Entry.class.getSimpleName() + "-" + date + ".csv");
+ entriesStream = new FileInputStream(tmpDir + Entry.class.getSimpleName() + "-" + determinant + ".csv");
String entriesStreamString = IOUtils.toString(entriesStream);
IOUtils.closeQuietly(entriesStream);
- identityStream = new FileInputStream(tmpDir + Identity.class.getSimpleName() + "-" + date + ".csv");
+ identityStream = new FileInputStream(tmpDir + Identity.class.getSimpleName() + "-" + determinant + ".csv");
String identityStreamString = IOUtils.toString(identityStream);
IOUtils.closeQuietly(identityStream);
- results= importService.importBackup(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, accountsStreamString, entriesStreamString, identityStreamString);
+ results = importService.importBackup(entryBooksStreamString, transactionsStreamString, fiscalPeriodsStreamString, accountsStreamString, entriesStreamString, identityStreamString);
} catch (Exception ex) {
if(log.isInfoEnabled()) {
log.info(ex);
}
result.addInitException(new ImportFileException(t("lima.ui.importexport.import.extractFileError")));
+ } finally {
+ IOUtils.closeQuietly(entryBooksStream);
+ IOUtils.closeQuietly(transactionsStream);
+ IOUtils.closeQuietly(fiscalPeriodsStream);
+ IOUtils.closeQuietly(accountsStream);
+ IOUtils.closeQuietly(entriesStream);
+ IOUtils.closeQuietly(identityStream);
}
}
return results;
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-08-07 20:17:41 UTC (rev 3905)
@@ -260,7 +260,7 @@
lima.financialStatements.check=
lima.financialStatements.check.nothing=
lima.financialStatements.check.warn=
-lima.financialTransaction.lockedEntryBookException=Entry can not be added as entry book is locked for period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.
+lima.financialTransaction.lockedEntryBookException=Entry can not be added as entry book is locked for period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.\n
lima.financialTransaction.lockedFinancialPeriodException=locked financial transaction
lima.financialstatement.accounts=Account list on debit and on credit
lima.financialstatement.addfinancialStatementHeadererror=Can't add financialStatementHeader
@@ -276,13 +276,13 @@
lima.financialstatement.provisiondeprecationaccounts=Provisions and deprecations accounts list
lima.financialstatement.subamount=Calculate a subamount
lima.financialstatementreport.listerror=Can't get entries list
-lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException=Fiscal period ending date must be after the begining one, begin\: %1$tm/%1$te/%1$tY end\: %1$tm/%1$te/%1$tY.
-lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException=Master account is not a digit between 1 to 8 \: %s" + account.getAccountNumber()
+lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException=Fiscal period ending date must be after the begining one, begin\: %1$tm/%1$te/%1$tY end\: %1$tm/%1$te/%1$tY.\n
+lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException=Master account is not a digit between 1 to 8 \: %s"\n
lima.fiscalPeriod.franceAccountingRules.lastUnlockedFiscalPeriodException=Current fiscal period must not be closed.
-lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException=The ante fiscal period is not locked\: concerned fiscal period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.
+lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException=The ante fiscal period is not locked\: concerned fiscal period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.\n
lima.fiscalPeriod.franceAccountingRules.noEmptyFiscalPeriodException=The fiscal period is not empty \!
-lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException=The new fiscal period must adjoining the last\: concerned fiscal period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.
-lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException=Account Number that doesn't start with 4 have to be numeric\: %s" + account.getAccountNumber()
+lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException=The new fiscal period must adjoining the last\: concerned fiscal period from %1$tm/%1$te/%1$tY to %1$tm/%1$te/%1$tY.\n
+lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException=Account Number that doesn't start with 4 have to be numeric\: %s"\n
lima.fiscalYears=
lima.fiscalperiod.unbalancedtransactions=Fiscal Period has unbalanced transactions
lima.help=
@@ -358,7 +358,7 @@
lima.identity.phoneNumber=Phone number
lima.identity.vatNumber=VAT number
lima.identity.zipCode=Zip code
-lima.import.entries.noFiscalPeriodFoundException=No fiscal period found.
+lima.import.entries.noFiscalPeriodFoundException=No fiscal period found.\n
lima.import.noDataToImportException=No data to import.
lima.import.unknownError=Unknown error.
lima.importexport.all=
@@ -368,9 +368,9 @@
lima.importexport.export=
lima.importexport.export.terminated=
lima.importexport.import=
-lima.importexport.import.alreadyExistFinancialStatement=Category with name %s exists for parent %s.
-lima.importexport.import.alreadyExistVatStatement=VAT statement with name %s exists for parents %s.
-lima.importexport.import.notAllowedLabel=Not allowed char in label\: %s.
+lima.importexport.import.alreadyExistFinancialStatement=Category with name %s exists for parent %s.\n
+lima.importexport.import.alreadyExistVatStatement=VAT statement with name %s exists for parents %s.\n
+lima.importexport.import.notAllowedLabel=Not allowed char in label\: %s.\n
lima.importexport.usevatpdf=
lima.init.closed=Lima closed at %1$s
lima.init.errorclosing=Error during Lima close
@@ -605,8 +605,8 @@
lima.ui.importexport.entrybook=Entry books import completed.
lima.ui.importexport.entrybooks=Entry books
lima.ui.importexport.export=Export
-lima.ui.importexport.export.exception=
-lima.ui.importexport.export.exceptions=Export failed.
+lima.ui.importexport.export.exceptions=Export failed.\n
+lima.ui.importexport.export.failed=Export failed \!
lima.ui.importexport.export.import.exceptions=Export has failed.
lima.ui.importexport.export.terminated=Export terminated
lima.ui.importexport.financialStatement=Financial transactions import completed.
@@ -619,10 +619,10 @@
lima.ui.importexport.import.backupException=could not import backup.
lima.ui.importexport.import.extractFileError=Could not extract file.
lima.ui.importexport.import.line=Line %d\:
-lima.ui.importexport.import.nbCreated=%d created
-lima.ui.importexport.import.nbIgnored=%d ignored
-lima.ui.importexport.import.nbUpdated=%d updated
-lima.ui.importexport.import.terminated=Import terminated
+lima.ui.importexport.import.nbCreated=%d created\n
+lima.ui.importexport.import.nbIgnored=%d ignored\n
+lima.ui.importexport.import.nbUpdated=%d updated\n
+lima.ui.importexport.import.terminated=Import terminated\n
lima.ui.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory
lima.ui.importexport.importcsv=
lima.ui.importexport.importebp=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-08-07 16:17:17 UTC (rev 3904)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-08-07 20:17:41 UTC (rev 3905)
@@ -243,8 +243,8 @@
lima.financialStatements.check=Vérification des comptes aux postes
lima.financialStatements.check.nothing=Introuvable \: %s - %s \n
lima.financialStatements.check.warn=Attention cette fonctionnalité n'est qu'une aide utilisateur.\n Certains comptes ne doivent pas être présent au bilan et compte de résultat.\n Il est donc normal que des comptes sont marqués comme introuvable.\n\n
-lima.financialTransaction.lockedEntryBookException=Impossible d'ajouter une entré car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.
-lima.financialTransaction.lockedFinancialPeriodException=La période financière est bloquée
+lima.financialTransaction.lockedEntryBookException=Impossible d'ajouter une entré car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY.\n
+lima.financialTransaction.lockedFinancialPeriodException=La période financière est bloquée\n
lima.financialstatement.accounts=Liste de comptes au crédit et au débit
lima.financialstatement.addfinancialStatementHeadererror=Erreur lors de l'ajout de l'entête sur la déclaration financière
lima.financialstatement.check=
@@ -259,13 +259,13 @@
lima.financialstatement.provisiondeprecationaccounts=Liste de comptes d'amortissement et provisions
lima.financialstatement.subamount=Calculer un sous-total
lima.financialstatementreport.listerror=Erreur lors de la récupération des données de la liste
-lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException=La date de début doit être avant la date de fin, debut\: %1$te/%1$tm/%1$tY fin\: %1$te/%1$tm/%1$tY.
-lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException=Le numéro du compte général n'est pas compris entre 1 et 8 \: %s
+lima.fiscalPeriod.defaultAccountingRules.beginAfterEndFiscalPeriodException=La date de début doit être avant la date de fin, debut\: %1$te/%1$tm/%1$tY fin\: %1$te/%1$tm/%1$tY.\n
+lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException=Le numéro du compte général n'est pas compris entre 1 et 8 \: %s\n
lima.fiscalPeriod.franceAccountingRules.lastUnlockedFiscalPeriodException=Impossible de clore la dernière période fiscale ouverte.
-lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException=Le nombre maximal d'exercices ouverts est déjà ateint\: periode fiscale concernée du %1$te/%1$tm/%1$tY au %1$te/%1$tm/%1$tY.
+lima.fiscalPeriod.franceAccountingRules.moreOneUnlockFiscalPeriodException=Le nombre maximal d'exercices ouverts est déjà ateint\: periode fiscale concernée du %1$te/%1$tm/%1$tY au %1$te/%1$tm/%1$tY.\n
lima.fiscalPeriod.franceAccountingRules.noEmptyFiscalPeriodException=La période fiscale à supprimer n'est pas vide \!
-lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException=La nouvelle période fiscale doit suivre la précédente\: periode fiscale concernée du %1$te/%1$tm/%1$tY au %1$te/%1$tm/%1$tY.
-lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException=Un numéro de compte ne commençant pas par 4 doit être numérique \: %s
+lima.fiscalPeriod.franceAccountingRules.notBeginNextDayOfLastFiscalPeriodException=La nouvelle période fiscale doit suivre la précédente\: periode fiscale concernée du %1$te/%1$tm/%1$tY au %1$te/%1$tm/%1$tY.\n
+lima.fiscalPeriod.franceAccountingRules.notNumberAccountNumberException=Un numéro de compte ne commençant pas par 4 doit être numérique \: %s\n
lima.fiscalYears=Exercices
lima.fiscalperiod.unbalancedtransactions=La période fiscale contient des transactions non équilibrées
lima.help=Aide
@@ -316,7 +316,7 @@
lima.identity.phoneNumber=n° Tel
lima.identity.vatNumber=n° TVA
lima.identity.zipCode=Code Postal
-lima.import.entries.noFiscalPeriodFoundException=Aucune periode fiscale trouvée.
+lima.import.entries.noFiscalPeriodFoundException=Aucune periode fiscale trouvée.\n
lima.import.noDataToImportException=Aucune donnée à importer.
lima.import.unknownError=Erreur inconnue.
lima.importexport.all=Tout
@@ -326,9 +326,9 @@
lima.importexport.export=Exporter
lima.importexport.export.terminated=Export terminé
lima.importexport.import=Importer
-lima.importexport.import.alreadyExistFinancialStatement=La transaction financière %s existe déjà sur le parent %s.
-lima.importexport.import.alreadyExistVatStatement=La transaction de TVA %s existe déjà sur le parent %s.
-lima.importexport.import.notAllowedLabel=Label non contenant un caractère interdit %s.
+lima.importexport.import.alreadyExistFinancialStatement=La transaction financière %s existe déjà sur le parent %s.\n
+lima.importexport.import.alreadyExistVatStatement=La transaction de TVA %s existe déjà sur le parent %s.\n
+lima.importexport.import.notAllowedLabel=Label non contenant un caractère interdit %s.\n
lima.importexport.usevatpdf=Êtes-vous sûr de vouloir utiliser ce pdf pour la déclaration de TVA ?
lima.init.closed=Lima fermé à %1$s
lima.init.errorclosing=Erreur lors de la fermeture
@@ -526,9 +526,9 @@
lima.ui.importexport.entrybooks=Journaux
lima.ui.importexport.export=Exporter
lima.ui.importexport.export.action=Export
-lima.ui.importexport.export.exception=
-lima.ui.importexport.export.exceptions=Echec de l'export.
-lima.ui.importexport.export.terminated=Export terminé
+lima.ui.importexport.export.exceptions=Echec de l'export.\n
+lima.ui.importexport.export.failed=Echec de l'export \!
+lima.ui.importexport.export.terminated=Export terminé\n
lima.ui.importexport.financialStatement=des déclaration financière terminé.
lima.ui.importexport.financialTransaction=des transaction financière terminé.
lima.ui.importexport.fiscalPeriod=des periodes fiscales terminé.
@@ -538,10 +538,10 @@
lima.ui.importexport.import.backupException=Echec de l'import du backup.
lima.ui.importexport.import.extractFileError=Le fichier n'est correct
lima.ui.importexport.import.line=Ligne %d\:
-lima.ui.importexport.import.nbCreated=%d créés
-lima.ui.importexport.import.nbIgnored=%d ignorés
-lima.ui.importexport.import.nbUpdated=%d mis à jours
-lima.ui.importexport.import.terminated=Import terminé
+lima.ui.importexport.import.nbCreated=%d créés\n
+lima.ui.importexport.import.nbIgnored=%d ignorés\n
+lima.ui.importexport.import.nbUpdated=%d mis à jours\n
+lima.ui.importexport.import.terminated=Import terminé\n
lima.ui.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima
lima.ui.importexport.importcsv=Import/Export CSV
lima.ui.importexport.importebp=Import/Export EBP
1
0
07 Aug '14
Author: dcosse
Date: 2014-08-07 18:17:17 +0200 (Thu, 07 Aug 2014)
New Revision: 3904
Url: http://forge.chorem.org/projects/lima/repository/revisions/3904
Log:
corrige le fait que l'ouverture du navigateur ne foncionne pas
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-08-06 15:56:15 UTC (rev 3903)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-08-07 16:17:17 UTC (rev 3904)
@@ -26,7 +26,6 @@
package org.chorem.lima.ui;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.config.ConfigUIHelper;
import org.apache.commons.logging.Log;
@@ -54,20 +53,14 @@
import org.nuiton.util.DesktopUtil;
import org.nuiton.widget.SwingSession;
-import javax.swing.DefaultCellEditor;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JEditorPane;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.plaf.BorderUIResource;
-import java.awt.Component;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
+import java.net.URI;
import java.net.URL;
import java.util.Locale;
@@ -501,9 +494,22 @@
log.debug("URL : " + url);
}
- SwingUtil.openLink(url);
+ openLink(url);
}
+ public static void openLink(String url) {
+
+ try {
+ URI uri = new URI(url);
+ DesktopUtil.browse(uri);
+ } catch (Exception e) {
+
+ if (log.isErrorEnabled()) {
+ log.error("Error while opening link", e);
+ }
+ }
+ }
+
/**
* Show a new closable tab.
*
1
0
r3903 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport
by dcosse@users.chorem.org 06 Aug '14
by dcosse@users.chorem.org 06 Aug '14
06 Aug '14
Author: dcosse
Date: 2014-08-06 17:56:15 +0200 (Wed, 06 Aug 2014)
New Revision: 3903
Url: http://forge.chorem.org/projects/lima/repository/revisions/3903
Log:
refs #1032 gestion des erreurs en cas de mauvais fichier en entr?\195?\169e
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-06 14:27:15 UTC (rev 3902)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-08-06 15:56:15 UTC (rev 3903)
@@ -31,6 +31,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaTechnicalException;
import org.chorem.lima.business.ExportResult;
import org.chorem.lima.business.ImportExportResults;
@@ -40,7 +41,6 @@
import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatement;
import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException;
import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException;
-import org.chorem.lima.business.exceptions.ImportBackupException;
import org.chorem.lima.business.exceptions.ImportFileException;
import org.chorem.lima.business.exceptions.InvalidAccountNumberException;
import org.chorem.lima.business.exceptions.LimaException;
@@ -119,6 +119,7 @@
//services
importService = LimaServiceFactory.getService(ImportService.class);
exportService = LimaServiceFactory.getService(ExportService.class);
+ errorHelper = new ErrorHelper(LimaConfig.getInstance());
//create the wait dialog panel
waitView = new ImportExportWaitView();
@@ -266,7 +267,7 @@
log.debug("importMode");
log.debug("importExportMethodeF : " + importExportMethodeF);
for (ImportResult result : resultList) {
- String importedEntity = result.getFromSource().getSimpleName();
+ String importedEntity = result.getFromSource() == null ? "BACKUP" : result.getFromSource().getSimpleName();
log.debug(importedEntity + " nbCreated: " + result.getNbCreated());
log.debug(importedEntity + " nbUpdated: " + result.getNbUpdated());
log.debug(importedEntity + " nbIgnored: " + result.getNbIgnored());
@@ -292,14 +293,19 @@
message += t("lima.ui.importexport.import.nbIgnored", result.getNbIgnored())+"\n";
Map<Integer, LimaException> exceptionsByLine = result.getAllExceptionsByLine();
message = displayErrorMessage(message, exceptionsByLine);
- message +="\n";
+ // message is null if import failed
+ if (message == null) {
+ break;
+ }
}
- JOptionPane.showMessageDialog(
- waitView,
- message,
- t("lima.ui.importexport.import"),
- JOptionPane.INFORMATION_MESSAGE);
+ if (message != null) {
+ JOptionPane.showMessageDialog(
+ waitView,
+ message,
+ t("lima.ui.importexport.import"),
+ JOptionPane.INFORMATION_MESSAGE);
+ }
}
} else {
List<ExportResult> exportResults = results.getExportResults();
@@ -354,7 +360,7 @@
Set<Integer> lines = exceptionsByLine.keySet();
for (Integer line : lines) {
LimaException importException = exceptionsByLine.get(line);
- message += t("lima.ui.importexport.import.line", line);
+ message = message + t("lima.ui.importexport.import.line", line);
if (importException instanceof InvalidAccountNumberException) {
message += t("lima.fiscalPeriod.franceAccountingRules.invalidAccountNumberException", ((InvalidAccountNumberException) importException).getAccountNumber())+"\n";
} else if (importException instanceof NotNumberAccountNumberException) {
@@ -378,9 +384,11 @@
} else if (importException instanceof NoFiscalPeriodFoundException) {
message += t("lima.import.entries.noFiscalPeriodFoundException")+"\n";
} else if (importException instanceof NoDataToImportException) {
- message += t("lima.import.noDataToImportException")+"\n";
+ errorHelper.showErrorMessage(t("lima.import.noDataToImportException"));
+ return null;
} else if (importException instanceof ImportFileException){
- message += ((ImportFileException) importException).getDetailMessage();
+ errorHelper.showErrorMessage(((ImportFileException) importException).getDetailMessage());
+ return null;
} else {
message +=t("lima.import.unknownError");
}
@@ -396,7 +404,7 @@
private String getFromSourceMessage(Class fromSource) {
String message;
if (fromSource == null) {
- message = "";
+ message = "BACKUP"+"\n";
} else if (fromSource.equals(Account.class)){
message = t("lima.ui.importexport.account")+"\n";
} else if (fromSource.equals(EntryBook.class)) {
@@ -557,6 +565,8 @@
ZipInputStream zipInputStream = null;
String tmpDir = System.getProperty("java.io.tmpdir")+"/";
FileInputStream inputStream = null;
+ // use to be sure to not load old streams.
+ String date = String.valueOf(new Date().getTime());
try {
inputStream = new FileInputStream(filePath);
@@ -566,7 +576,7 @@
while ((entry = zipInputStream.getNextEntry()) != null) {
byte[] buffer = new byte[2048];
- FileOutputStream fileoutputstream = new FileOutputStream(tmpDir + entry.getName() + ".csv");
+ FileOutputStream fileoutputstream = new FileOutputStream(tmpDir + entry.getName() + "-" + date +".csv");
int n;
while ((n = zipInputStream.read(buffer, 0, 2048)) > -1) {
@@ -584,30 +594,30 @@
}
InputStream transactionsStream, entryBooksStream, fiscalPeriodsStream, entriesStream, accountsStream, identityStream;
- if (result.getAllExceptionsByLine().isEmpty()) {
+ if (result.getAllExceptionsByLine() == null || result.getAllExceptionsByLine().isEmpty()) {
try {
- entryBooksStream = new FileInputStream(tmpDir + EntryBook.class.getSimpleName() +".csv");
+ entryBooksStream = new FileInputStream(tmpDir + EntryBook.class.getSimpleName() + "-" + date + ".csv");
String entryBooksStreamString = IOUtils.toString(entryBooksStream);
IOUtils.closeQuietly(entryBooksStream);
// import
- transactionsStream = new FileInputStream(tmpDir + FinancialTransaction.class.getSimpleName() +".csv");
+ transactionsStream = new FileInputStream(tmpDir + FinancialTransaction.class.getSimpleName() + "-" + date + ".csv");
String transactionsStreamString = IOUtils.toString(transactionsStream);
IOUtils.closeQuietly(transactionsStream);
- fiscalPeriodsStream = new FileInputStream(tmpDir + FiscalPeriod.class.getSimpleName() +".csv");
+ fiscalPeriodsStream = new FileInputStream(tmpDir + FiscalPeriod.class.getSimpleName() + "-" + date + ".csv");
String fiscalPeriodsStreamString = IOUtils.toString(fiscalPeriodsStream);
IOUtils.closeQuietly(fiscalPeriodsStream);
- accountsStream = new FileInputStream(tmpDir + Account.class.getSimpleName() +".csv");
+ accountsStream = new FileInputStream(tmpDir + Account.class.getSimpleName() + "-" + date + ".csv");
String accountsStreamString = IOUtils.toString(accountsStream);
IOUtils.closeQuietly(accountsStream);
- entriesStream = new FileInputStream(tmpDir + Entry.class.getSimpleName() +".csv");
+ entriesStream = new FileInputStream(tmpDir + Entry.class.getSimpleName() + "-" + date + ".csv");
String entriesStreamString = IOUtils.toString(entriesStream);
IOUtils.closeQuietly(entriesStream);
- identityStream = new FileInputStream(tmpDir + Identity.class.getSimpleName() + ".csv");
+ identityStream = new FileInputStream(tmpDir + Identity.class.getSimpleName() + "-" + date + ".csv");
String identityStreamString = IOUtils.toString(identityStream);
IOUtils.closeQuietly(identityStream);
@@ -616,7 +626,7 @@
if(log.isInfoEnabled()) {
log.info(ex);
}
- result.addException(new ImportBackupException(t("lima.ui.importexport.import.backupException"),ex));
+ result.addInitException(new ImportFileException(t("lima.ui.importexport.import.extractFileError")));
}
}
return results;
1
0