r3498 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/lettering
Author: mallon Date: 2012-07-06 15:19:17 +0200 (Fri, 06 Jul 2012) New Revision: 3498 Url: http://chorem.org/repositories/revision/lima/3498 Log: Correction concernant la gestion du filtre sur le lettrage des ?\195?\169critures (Boolean) et la requ?\195?\170te de chargement du tableau. Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-06 12:04:32 UTC (rev 3497) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-06 13:19:17 UTC (rev 3498) @@ -267,22 +267,22 @@ * @param filtreLettre lettering * */ @Override - public List<Entry> getAllEntrieByDatesAndAccountAndLettering(Date beginDate, Date endDate, Account account, String filtreLettre) throws LimaException { + public List<Entry> getAllEntrieByDatesAndAccountAndLettering(Date beginDate, Date endDate, Account account, Boolean filtreLettre) throws LimaException { List<FinancialTransaction> financialTransactions = null; List<Entry> entries = new ArrayList<Entry>(); - try{ + /* try{ FinancialTransactionDAO transactionDAO = getDaoHelper().getFinancialTransactionDAO(); financialTransactions = transactionDAO.findAllByDates(beginDate, endDate); }catch (Exception ex){ throw new LimaException("Can't get financial transactions", ex); - } + }*/ try { EntryDAO entryDAO = getDaoHelper().getEntryDAO(); - for (FinancialTransaction financialTransaction : financialTransactions){ - entries.addAll(entryDAO.findAllEntryByAccountAndLettering(financialTransaction, account, filtreLettre)); - } + //for (FinancialTransaction financialTransaction : financialTransactions){ + entries = entryDAO.findAllEntryByAccountAndLettering(beginDate, endDate, account, filtreLettre); + // } } catch (Exception ex) { throw new LimaException("Can't get entries", ex); } Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java =================================================================== --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-07-06 12:04:32 UTC (rev 3497) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-07-06 13:19:17 UTC (rev 3498) @@ -78,5 +78,5 @@ String getNewLetters() throws LimaException; - List<Entry> getAllEntrieByDatesAndAccountAndLettering(Date beginDate, Date endDate, Account account, String filtreLettre) throws LimaException; + List<Entry> getAllEntrieByDatesAndAccountAndLettering(Date beginDate, Date endDate, Account account, Boolean filtreLettre) throws LimaException; } Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-06 12:04:32 UTC (rev 3497) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-06 13:19:17 UTC (rev 3498) @@ -178,25 +178,37 @@ /** * Retourne toutes les entrées d'une transaction * pour un compte et un lettrage - * - * @param financialTransaction transaction sur laquelle les entrées sont filtrées + * @param beginDate debut de la période + * @param endDate fin de la période * @param account compte sur lequel les entrées sont filtrées * @param filtreLettre toutes (all), non-lettrées ("null") ou lettrées ("notNull") * @throws TopiaException * */ - public List<Entry> findAllEntryByAccountAndLettering(FinancialTransaction financialTransaction, Account account, String filtreLettre) throws TopiaException { + public List<Entry> findAllEntryByAccountAndLettering(Date beginDate, Date endDate, Account account, Boolean filtreLettre) throws TopiaException { List<Entry> entries = null; + /* String query = "FROM " + FinancialTransaction.class.getName() + " T"+ + " WHERE :beginDate <= T.transactionDate" + + " AND T.transactionDate <= :endDate" + + " ORDER BY T.transactionDate, T." + FinancialTransaction.TOPIA_CREATE_DATE;*/ - String query = "from " + Entry.class.getName() + " E " + - " where E.financialTransaction = :financialTransaction" + - " and E.account = :account "; - if (filtreLettre.equals("null")){ - query += " and E.lettering is null"; - }else if (filtreLettre.equals("notNull")){ - query += " and E.lettering is not null"; + String query = "Select E from " + Entry.class.getName() + " E, " + FinancialTransaction.class.getName() + " F" + + " where E.financialTransaction = F" + + " and E.account = :account "; + + if (filtreLettre != null){ + if (filtreLettre){ + query += " and E.lettering is null"; + }else if (!filtreLettre){ + query += " and E.lettering is not null"; + } } + System.out.println(query); - entries = context.findAll(query, "financialTransaction", financialTransaction, "account", account); + query += " and :beginDate <= F.transactionDate" + + " AND F.transactionDate <= :endDate"+ + " ORDER BY F.transactionDate, F." + FinancialTransaction.TOPIA_CREATE_DATE; + + entries = context.findAll(query, "account", account, "beginDate", beginDate, "endDate", endDate); return entries; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-06 12:04:32 UTC (rev 3497) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-06 13:19:17 UTC (rev 3498) @@ -64,7 +64,7 @@ <org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/> <JComboBox id="accountComboBox" model="{accountComboBoxModel}" renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), ( letteredCheckGroup.isSelected(noLettredEntryCheckBox.getModel()) || letteredCheckGroup.isSelected(lettredEntryCheckBox.getModel())))"/> <JButton id="backCount" text="lima.ui.account.buttonback" onActionPerformed="handler.back(accountComboBox)"/> <JButton id="nextCount" text="lima.ui.account.buttonnext" @@ -80,7 +80,7 @@ </cell> <cell> <JXDatePicker id="pickerDebut" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), ( letteredCheckGroup.isSelected(noLettredEntryCheckBox.getModel()) || letteredCheckGroup.isSelected(lettredEntryCheckBox.getModel())))"/> </cell> </row> <row> @@ -89,7 +89,7 @@ </cell> <cell> <JXDatePicker id="pickerFin" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), ( letteredCheckGroup.isSelected(noLettredEntryCheckBox.getModel()) || letteredCheckGroup.isSelected(lettredEntryCheckBox.getModel())))"/> </cell> </row> </Table> @@ -100,8 +100,8 @@ <Table> <row> <cell> - <JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup" value="notNull" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + <JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), letteredCheckGroup.isSelected(noLettredEntryCheckBox.getModel()))"/> </cell> <cell> <JLabel text="lima.ui.lettering.checkLettredEntry"/> @@ -109,8 +109,8 @@ </row> <row> <cell> - <JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup" value="null" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + <JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), letteredCheckGroup.isSelected(noLettredEntryCheckBox.getModel()))"/> </cell> <cell> <JLabel text="lima.ui.lettering.checkNoLettredEntry"/> @@ -118,8 +118,8 @@ </row> <row> <cell> - <JRadioButton id="allCheckBox" buttonGroup="letteredCheckGroup" value="all" - onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), (String)letteredCheckGroup.getSelectedValue())"/> + <JRadioButton id="allCheckBox" buttonGroup="letteredCheckGroup" + onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), (Account)accountComboBox.getSelectedItem(), null)"/> </cell> <cell> <JLabel text="lima.ui.lettering.checkAll"/> 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 2012-07-06 12:04:32 UTC (rev 3497) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-06 13:19:17 UTC (rev 3498) @@ -131,25 +131,25 @@ log.debug("Val select letter : " + view.getLetteredCheckGroup().getSelectedButton().getName()); //Load entry with the default dates, default account 4 and with no letter - updateAllEntries(defaultDateBegFiscalPeriod, defaultDateEndCurrent, (Account)view.getAccountComboBoxModel().getSelectedItem(), (String)view.getLetteredCheckGroup().getSelectedValue()); + updateAllEntries(defaultDateBegFiscalPeriod, defaultDateEndCurrent, (Account)view.getAccountComboBoxModel().getSelectedItem(), view.getLetteredCheckGroup().isSelected(view.getNoLettredEntryCheckBox().getModel())); if (log.isInfoEnabled()) { log.info("Nb entries model (After update all entries) : " + view.getTableModel().getNumberOfEntries()); } } - protected List<Entry> findAllEntries(Date selectedBeginDate, Date selectedEndDate, Account compte, String filtreLettre){ + protected List<Entry> findAllEntries(Date selectedBeginDate, Date selectedEndDate, Account compte, Boolean filtreLettre){ if (selectedBeginDate != null && selectedEndDate != null) { if (log.isInfoEnabled()) { log.info("FiltreLettre : " + filtreLettre); } List<Entry> entries = - financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(selectedBeginDate, selectedEndDate, compte, filtreLettre); + financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(selectedBeginDate, selectedEndDate, compte, filtreLettre); return entries; } return null; } - public void updateAllEntries(Date selectedBeginDate, Date selectedEndDate, Account compte, String filtreLettre) { + public void updateAllEntries(Date selectedBeginDate, Date selectedEndDate, Account compte, Boolean filtreLettre) { if (selectedBeginDate != null && selectedEndDate != null){ log.debug("updateAllEntries");
participants (1)
-
mallon@users.chorem.org