r2905 - in trunk/lima-business/src/main/java/org/chorem/lima/business: ejb utils
Author: jpepin Date: 2010-05-25 12:07:39 +0200 (Tue, 25 May 2010) New Revision: 2905 Url: http://chorem.org/repositories/revision/lima/2905 Log: Requ?\195?\170te affiche journaux/p?\195?\169riodefinanci?\195?\168re des exercices ouvert. Suppression comparateur inutile. Removed: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ClosedPeriodicEntryBookComparator.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-21 17:13:09 UTC (rev 2904) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-25 10:07:39 UTC (rev 2905) @@ -20,19 +20,16 @@ package org.chorem.lima.business.ejb; import java.util.ArrayList; -import java.util.Collections; import java.util.Date; import java.util.List; import javax.ejb.Stateless; -import org.apache.commons.collections.comparators.ComparatorChain; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountingRules; import org.chorem.lima.business.FinancialPeriodService; import org.chorem.lima.business.LimaConfig; import org.chorem.lima.business.LimaException; -import org.chorem.lima.business.utils.ClosedPeriodicEntryBookComparator; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO; import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl; @@ -41,9 +38,7 @@ import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialPeriodDAO; import org.chorem.lima.entity.FinancialPeriodImpl; -import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.FiscalPeriodDAO; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; @@ -313,11 +308,15 @@ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO = LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(transaction); - //TODO Get closed periodicentrybook from unlocked fiscalperiod - result = closedPeriodicEntryBookDAO.findAll(); - Collections.sort(result, new ClosedPeriodicEntryBookComparator()); - - //log.debug(transaction.find("select FinancialPeriod")); + //Get closedperiodicentrybook from unlocked fiscalperiod + TopiaQuery query = closedPeriodicEntryBookDAO.createQuery("E"); + query.addFrom(FiscalPeriod.class, "F") + .addInElements("E." + ClosedPeriodicEntryBook.FINANCIAL_PERIOD, + "F."+FiscalPeriod.FINANCIAL_PERIOD) + .add("F."+FiscalPeriod.LOCKED, Boolean.FALSE) + .addOrder(FiscalPeriod.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE); + result. + addAll(closedPeriodicEntryBookDAO.findAllByQuery(query)); // commit transaction.commitTransaction(); Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ClosedPeriodicEntryBookComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ClosedPeriodicEntryBookComparator.java 2010-05-21 17:13:09 UTC (rev 2904) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ClosedPeriodicEntryBookComparator.java 2010-05-25 10:07:39 UTC (rev 2905) @@ -1,34 +0,0 @@ -/* *##% Lima Swing - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%*/ - -package org.chorem.lima.business.utils; - -import java.util.Comparator; - -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.ClosedPeriodicEntryBook; - -public class ClosedPeriodicEntryBookComparator implements Comparator<ClosedPeriodicEntryBook>{ - - @Override - public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) { - return o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()); - - } - -}
participants (1)
-
jpepin@users.chorem.org