Author: dcosse Date: 2014-06-12 18:07:45 +0200 (Thu, 12 Jun 2014) New Revision: 3833 Url: http://forge.chorem.org/projects/lima/repository/revisions/3833 Log: #934 refactoring sur dao suppression methodes d?\195?\169preci?\195?\169es Removed: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/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/ReportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java trunk/pom.xml 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -27,13 +27,18 @@ import static org.nuiton.i18n.I18n.t; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.StringTokenizer; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; +import org.apache.commons.lang3.StringUtils; import org.chorem.lima.business.AccountingRules; import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaConfig; @@ -242,9 +247,9 @@ Account result; try { // DAO - AccountTopiaDao AccountTopiaDao = getDaoHelper().getAccountDao(); + AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); accountingRules.updateAccountRules(account); - result = AccountTopiaDao.update(account); + result = accountDao.update(account); } catch (Exception ex) { throw new LimaException("Can't update account", ex); @@ -252,4 +257,71 @@ return result; } + + @Override + public List<Account> stringToListAccounts(String selectedAccounts) throws TopiaException { + Set<Account> accounts = new HashSet<Account>(); + if (selectedAccounts != null) { + AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); + //Remove Spaces + String result = StringUtils.deleteWhitespace(selectedAccounts); + + Boolean first = true; + // TODO DCossé 12/06/14 separator can be anything as accounts are text field + StringTokenizer stStar = new StringTokenizer(result, "-"); + while (stStar.hasMoreTokens()) { + String subString = stStar.nextToken(); + + //Split comma + // TODO DCossé 12/06/14 separator can be anything as accounts are text field + StringTokenizer stComma = new StringTokenizer(subString, ","); + while (stComma.hasMoreTokens()) { + String s = stComma.nextToken(); + //if intervall account + if (s.contains("..") && !s.endsWith("..")) { + //Split .. + String stringDoubleDot[] = s.split("\\.\\."); + + List<Account> resultInterval = accountDao.findIntervalAccountByNumber(stringDoubleDot[0], stringDoubleDot[1]); + + //if first add accounts, else remove + if (first) { + accounts.addAll(resultInterval); + } else { + accounts.removeAll(resultInterval); + } + } + //else one account + else { + + Account account = accountDao.forAccountNumberEquals(s).findUniqueOrNull(); + + //if exist + if (account != null) { + //if first + if (first) { + accounts.add(account); + } else { + accounts.remove(account); + } + } + //search all account start with accountnumber + else { + List<Account> accountsResult = accountDao.findLeafAccounts(s); + if (accountsResult != null) { + //if first + if (first) { + accounts.addAll(accountsResult); + } else { + accounts.removeAll(accountsResult); + } + } + } + } + } + first = false; + } + } + return new ArrayList<Account>(accounts); + } } 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -50,6 +50,7 @@ import org.chorem.lima.beans.FinancialStatementDatasImpl; import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.FinancialStatementService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.entity.Account; @@ -66,6 +67,9 @@ @EJB private ReportService reportService; + @EJB + private AccountService accountService; + protected static final Log log = LogFactory.getLog(FinancialStatementServiceImpl.class); @Override @@ -80,7 +84,7 @@ FinancialStatement masterfinancialStatementUpdate = null; if (masterFinancialStatement != null) { - masterfinancialStatementUpdate = financialStatementTopiaDao.findByLabel(masterFinancialStatement.getLabel()); + masterfinancialStatementUpdate = financialStatementTopiaDao.forLabelEquals(masterFinancialStatement.getLabel()).findAnyOrNull(); } // check if parent account exist; @@ -230,9 +234,7 @@ List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>(); for (FinancialStatement subFinancialStatement : financialStatements) { - FinancialStatementAmounts financialStatementAmounts = - financialStatementAmounts(subFinancialStatement, - selectedBeginDate, selectedEndDate); + FinancialStatementAmounts financialStatementAmounts = financialStatementAmounts(subFinancialStatement, selectedBeginDate, selectedEndDate); if (!subFinancialStatement.isHeader()) { //on calcul grossAmount = @@ -350,16 +352,14 @@ Amounts amounts; String accountsString = financialStatement.getAccounts(); if (accountsString != null && !accountsString.equals("")) { - amounts = amountFromAccountList(accountsString, - selectedBeginDate, selectedEndDate); + amounts = amountFromAccountList(accountsString, selectedBeginDate, selectedEndDate); debitAmount = debitAmount.add(amounts.getDebit()); creditAmount = creditAmount.add(amounts.getCredit()); } // DEBIT ACCOUNTS LIST String debitAccountsString = financialStatement.getDebitAccounts(); if (debitAccountsString != null && !debitAccountsString.equals("")) { - amounts = amountFromAccountList(debitAccountsString, - selectedBeginDate, selectedEndDate); + amounts = amountFromAccountList(debitAccountsString, selectedBeginDate, selectedEndDate); debitAmount = debitAmount.add(amounts.getDebit()); } //CREDIT ACCOUNTS LIST @@ -373,9 +373,7 @@ String provisionDeprecationAccountsString = financialStatement.getProvisionDeprecationAccounts(); if (provisionDeprecationAccountsString != null && !provisionDeprecationAccountsString.equals("")) { - amounts = amountFromAccountList( - provisionDeprecationAccountsString, selectedBeginDate, - selectedEndDate); + amounts = amountFromAccountList(provisionDeprecationAccountsString, selectedBeginDate, selectedEndDate); provisionDeprecationAmount = provisionDeprecationAmount.add(amounts.getCredit()); provisionDeprecationAmount = @@ -420,13 +418,16 @@ StringTokenizer stQuote = new StringTokenizer(result, "-"); while (stQuote.hasMoreTokens()) { String s = stQuote.nextToken(); - List<Account> accountsList = accountTopiaDao.stringToListAccounts(s, false); + //List<Account> accountsList = accountTopiaDao.stringToListAccounts(s, false); + List<Account> accountsList = accountService.stringToListAccounts(s); BigDecimal debitTemp = new BigDecimal(0); BigDecimal creditTemp = new BigDecimal(0); for (Account account : accountsList) { ReportsDatas reportsDatas = reportService. - generateAccountsReports(account, true, - selectedBeginDate, selectedEndDate); + generateAccountsReports( + account, + true, + selectedBeginDate, selectedEndDate); if (reportsDatas.getSoldeDebit()) { debitTemp = debitTemp.add(reportsDatas.getAmountSolde()); } else { @@ -471,20 +472,20 @@ for (FinancialStatement financialStatement : financialStatementsList) { accountsList.removeAll( - accountTopiaDao.stringToListAccounts( - financialStatement.getAccounts(), true)); + accountService.stringToListAccounts( + financialStatement.getAccounts())); accountsList.removeAll( - accountTopiaDao.stringToListAccounts( - financialStatement.getCreditAccounts(), true)); + accountService.stringToListAccounts( + financialStatement.getCreditAccounts())); accountsList.removeAll( - accountTopiaDao.stringToListAccounts( - financialStatement.getDebitAccounts(), true)); + accountService.stringToListAccounts( + financialStatement.getDebitAccounts())); accountsList.removeAll( - accountTopiaDao.stringToListAccounts( - financialStatement.getProvisionDeprecationAccounts(), true)); + accountService.stringToListAccounts( + financialStatement.getProvisionDeprecationAccounts())); } for (Account account : accountsList) { 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -432,8 +432,7 @@ calendar.setTime(fiscalPeriod.getEndDate()); //Sets entries - BalanceTrial results = reportService.generateBalanceTrial(localFiscalPeriod.getBeginDate(), - localFiscalPeriod.getEndDate(), null, false, false); + BalanceTrial results = reportService.generateBalanceTrial(localFiscalPeriod.getBeginDate(),localFiscalPeriod.getEndDate(), null, false, false); List<ReportsDatas> reportsDatasList = (List<ReportsDatas>) results.getReportsDatas(); 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -319,6 +319,7 @@ List<Account> accounts; //Remove Spaces + // TODO DCossé 12/06/14 selectedAccounts is allways NULL String result = StringUtils.deleteWhitespace(selectedAccounts); //if no filter account if (result == null || result.equals("")) { @@ -326,7 +327,7 @@ } //build list account from selectedAccounts else { - accounts = accountTopiaDao.stringToListAccounts( result, false); + accounts = accountService.stringToListAccounts(result); } Collections.sort(accounts, new AccountComparator()); @@ -387,11 +388,7 @@ Date endDate, String selectedAccounts, Boolean movementedFilter) throws LimaException { - return generateBalanceTrial(beginDate, - endDate, - selectedAccounts, - true, - movementedFilter); + return generateBalanceTrial(beginDate, endDate, selectedAccounts, true, movementedFilter); } /** @@ -419,9 +416,7 @@ //FIXME echatellier 44 is hardcoded and depends on //french rule ? if (account.getAccountNumber().startsWith("44")) { - list.add(generateBalanceTrial(fp.getBeginDate(), - fp.getEndDate(), account.getAccountNumber(), - true, false)); + list.add(generateBalanceTrial(fp.getBeginDate(), fp.getEndDate(), account.getAccountNumber(), true, false)); } } } 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -40,10 +40,10 @@ import org.chorem.lima.beans.VatStatementDatas; import org.chorem.lima.beans.VatStatementDatasImpl; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.business.api.VatStatementService; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.AccountTopiaDao; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementTopiaDao; import org.nuiton.topia.persistence.TopiaException; @@ -61,6 +61,9 @@ @EJB private ReportService reportService; + @EJB + private AccountService accountService; + @Override public void createVatStatement(VatStatement masterVatStatement, VatStatement vatStatement) throws LimaException { @@ -228,8 +231,7 @@ String accountNumbersList = findAccountNumberByVatStatement(vatStatement); - AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); - List<Account> accountsList = accountTopiaDao.stringToListAccounts(accountNumbersList, false); + List<Account> accountsList = accountService.stringToListAccounts(accountNumbersList); for (Account account : accountsList) { ReportsDatas reportsDatas = reportService. Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -220,4 +220,15 @@ account4.setLabel("Unsaved account"); accountService.removeAccount(account4); } + + @Test + public void testStringToListAccounts() throws Exception { + List<Account> accounts = accountService.stringToListAccounts("50..511"); + Assert.assertEquals(5, accounts.size()); + + accounts = accountService.stringToListAccounts("60..99"); + Assert.assertEquals(0, accounts.size()); + + context.close(); + } } \ No newline at end of file Deleted: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -1,68 +0,0 @@ -/* - * #%L - * $Id: AccountDAOTest.java 3585 2012-08-08 14:52:14Z tchemit $ - * $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-business/src/test/java/org/chorem/... $ - * %% - * Copyright (C) 2012 Codelutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.entity; - -import org.chorem.lima.business.AbstractLimaTest; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.nuiton.topia.persistence.TopiaException; - -import java.util.List; - -/** - * Test for AccountDAO class. - * - * @author chatellier - * @version $Revision: 3585 $ - * - * Last update : $Date: 2012-08-08 16:52:14 +0200 (mer. 08 août 2012) $ - * By : $Author: tchemit $ - */ -public class AccountDAOTest extends AbstractLimaTest { - - @Before - public void initTest() throws Exception { - initTestDatabase(); - } - - /** - * Test la recherche de compte par interval. - * @throws TopiaException - */ - @Test - public void testStringToListAccounts() throws Exception { - initTestWithAccounts(); - - AccountTopiaDao accountDAO = context.newPersistenceContext().getAccountDao(); - - List<Account> accounts = accountDAO.stringToListAccounts("50..511", false); - Assert.assertEquals(5, accounts.size()); - - accounts = accountDAO.stringToListAccounts("60..99", false); - Assert.assertEquals(0, accounts.size()); - - context.close(); - } -} Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java =================================================================== --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -96,4 +96,6 @@ Account updateAccount(Account account) throws LimaException; void removeAccount(Account account) throws LimaException; + + List<Account> stringToListAccounts(String selectedAccounts) throws TopiaException; } 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-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountTopiaDao.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -26,17 +26,12 @@ package org.chorem.lima.entity; import com.google.common.collect.Maps; -import org.apache.commons.lang3.StringUtils; import org.nuiton.topia.persistence.HqlAndParametersBuilder; import org.nuiton.topia.persistence.TopiaException; -import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; public class AccountTopiaDao extends AbstractAccountTopiaDao<Account> { @@ -88,7 +83,7 @@ * @return account list * @throws TopiaException */ - protected List<Account> findIntervalAccountByNumber(String accountNumberLow, + public List<Account> findIntervalAccountByNumber(String accountNumberLow, String accountNumberHigh) throws TopiaException { HqlAndParametersBuilder<Account> builder = newHqlAndParametersBuilder(); builder.addGreaterOrEquals(Account.PROPERTY_ACCOUNT_NUMBER, accountNumberLow); @@ -112,80 +107,13 @@ return accounts; } - /** - * @deprecated since 0.6, business method, need to be moved out of dao - */ - @Deprecated - public List<Account> stringToListAccounts(String selectedAccounts, - Boolean leafAccountsMode) throws TopiaException { - Set<Account> accounts = new HashSet<Account>(); - if (selectedAccounts != null) { - //Remove Spaces - String result = StringUtils.deleteWhitespace(selectedAccounts); - - Boolean first = true; - StringTokenizer stStar = new StringTokenizer(result, "-"); - while (stStar.hasMoreTokens()) { - String subString = stStar.nextToken(); - - //Split comma - StringTokenizer stComma = new StringTokenizer(subString, ","); - while (stComma.hasMoreTokens()) { - String s = stComma.nextToken(); - //if intervall account - if (s.contains("..") && !s.endsWith("..")) { - //Split .. - String stringDoubleDot[] = s.split("\\.\\."); - - List<Account> resultIntervall = - findIntervalAccountByNumber(stringDoubleDot[0], stringDoubleDot[1]); - - //if first add accounts, else remove - if (first) { - accounts.addAll(resultIntervall); - } else { - accounts.removeAll(resultIntervall); - } - } - //else one account - else { - Account account; - if (leafAccountsMode) { - account = findLeafAccountByNumber(s); - } else { - account = forAccountNumberEquals(s).findUniqueOrNull(); - } - //if exist - if (account != null) { - //if first - if (first) { - accounts.add(account); - } else { - accounts.remove(account); - } - } - //search all account start with accountnumber - else { - String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" + - "FROM " + Account.class.getName() + " b where b.accountNumber like a.accountNumber+'%')" + - " AND a.accountNumber LIKE :s"; - Map<String, Object> args = Maps.newLinkedHashMap(); - args.put("s",s); - List<Account> accountsResult = findAll(query, args); - if (accountsResult != null) { - //if first - if (first) { - accounts.addAll(accountsResult); - } else { - accounts.removeAll(accountsResult); - } - } - } - } - } - first = false; - } - } - return new ArrayList(accounts); + public List<Account> findLeafAccounts(String accountNumber) throws TopiaException { + String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" + + "FROM " + Account.class.getName() + " b WHERE b.accountNumber LIKE a.accountNumber+'%')" + + " AND a.accountNumber LIKE :accountNumber"; + Map<String, Object> args = Maps.newLinkedHashMap(); + args.put("accountNumber",accountNumber); + List<Account> accountsResult = findAll(query, args); + return accountsResult; } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -24,6 +24,7 @@ * #L% */ +import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; @@ -37,8 +38,6 @@ import javax.swing.*; import javax.swing.event.ListSelectionEvent; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -91,7 +90,7 @@ public void setEntryBook(ListSelectionEvent event) { JList entryBookList = view.getEntryBookList(); - List selectedValuesList = new ArrayList(Arrays.asList(entryBookList.getSelectedValues())); + List<EntryBook> selectedValuesList = Lists.newArrayList(entryBookList.getSelectedValuesList()); condition.setEntryBooks(selectedValuesList); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -24,6 +24,7 @@ * #L% */ +import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; @@ -38,8 +39,6 @@ import javax.swing.*; import javax.swing.event.ListSelectionEvent; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -94,7 +93,7 @@ public void setFinancialPeriod(ListSelectionEvent event) { JList financialPeriodList = view.getFinancialPeriodList(); - List selectedValuesList = new ArrayList(Arrays.asList(financialPeriodList.getSelectedValues())); + List<FinancialPeriod> selectedValuesList = Lists.newArrayList(financialPeriodList.getSelectedValuesList()); condition.setFinancialPeriods(selectedValuesList); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -24,6 +24,7 @@ * #L% */ +import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.Condition; @@ -37,8 +38,6 @@ import javax.swing.*; import javax.swing.event.ListSelectionEvent; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; @@ -92,7 +91,7 @@ public void setFiscalPeriod(ListSelectionEvent event) { JList fiscalPeriodList = view.getFiscalPeriodList(); - List selectedValuesList = new ArrayList(Arrays.asList(fiscalPeriodList.getSelectedValues())); + List<FiscalPeriod> selectedValuesList = Lists.newArrayList(fiscalPeriodList.getSelectedValuesList()); condition.setFiscalPeriods(selectedValuesList); } Modified: trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java =================================================================== --- trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java 2014-06-12 16:07:45 UTC (rev 3833) @@ -29,12 +29,11 @@ import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; +import org.junit.Assert; import org.junit.Test; import com.google.common.collect.Lists; -import junit.framework.Assert; - /** * @author David Cossé */ Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-06-12 09:02:50 UTC (rev 3832) +++ trunk/pom.xml 2014-06-12 16:07:45 UTC (rev 3833) @@ -183,7 +183,7 @@ <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion> <launch4jPluginVersion>1.5.0.0</launch4jPluginVersion> - <jaxxVersion>2.8.7</jaxxVersion> + <jaxxVersion>2.8.8-SNAPSHOT</jaxxVersion> <openEjbVersion>4.6.0.2</openEjbVersion> <slf4jVersion>1.7.7</slf4jVersion> <swingxVersion>1.6.5-1</swingxVersion>