Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 1853 discussions
r3438 - trunk/lima-business/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org 04 Jun '12
by echatellier@users.chorem.org 04 Jun '12
04 Jun '12
Author: echatellier
Date: 2012-06-04 16:34:55 +0200 (Mon, 04 Jun 2012)
New Revision: 3438
Url: http://chorem.org/repositories/revision/lima/3438
Log:
Remove test comment
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-06-04 14:33:59 UTC (rev 3437)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-06-04 14:34:55 UTC (rev 3438)
@@ -89,7 +89,6 @@
// see http://openejb.apache.org/embedded-configuration.html
// http://openejb.apache.org/properties-listing.html
// for embedded configuration
- //props.setProperty("openejb.jndiname.format", "ejb/{interfaceClass.simpleName}");
container = EJBContainer.createEJBContainer(props);
}
1
0
r3437 - in trunk/lima-business/src: main/java/org/chorem/lima/service main/resources/META-INF test/resources/META-INF
by echatellier@users.chorem.org 04 Jun '12
by echatellier@users.chorem.org 04 Jun '12
04 Jun '12
Author: echatellier
Date: 2012-06-04 16:33:59 +0200 (Mon, 04 Jun 2012)
New Revision: 3437
Url: http://chorem.org/repositories/revision/lima/3437
Log:
Fix ejb module name to not being generated with application version.
Fix startup from command line.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml
trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-06-01 14:01:39 UTC (rev 3436)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-06-04 14:33:59 UTC (rev 3437)
@@ -58,7 +58,7 @@
protected static EJBContainer container;
/** EJB service namespace. */
- protected static final String NAMESPACE = "java:global/lima-business/";
+ protected static final String NAMESPACE = "java:global/lima/";
/**
* Init openejb container.
@@ -89,6 +89,7 @@
// see http://openejb.apache.org/embedded-configuration.html
// http://openejb.apache.org/properties-listing.html
// for embedded configuration
+ //props.setProperty("openejb.jndiname.format", "ejb/{interfaceClass.simpleName}");
container = EJBContainer.createEJBContainer(props);
}
Modified: trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml 2012-06-01 14:01:39 UTC (rev 3436)
+++ trunk/lima-business/src/main/resources/META-INF/ejb-jar.xml 2012-06-04 14:33:59 UTC (rev 3437)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Lima business
@@ -28,7 +29,12 @@
Interceptor based on : http://openejb.apache.org/examples-trunk/alternate-descriptors/
-->
-<ejb-jar>
+<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+ version="3.1">
+ <!-- Le nom est a fixer sinon, il est généré et contient la version -->
+ <module-name>lima</module-name>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
Modified: trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml 2012-06-01 14:01:39 UTC (rev 3436)
+++ trunk/lima-business/src/test/resources/META-INF/ejb-jar.xml 2012-06-04 14:33:59 UTC (rev 3437)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Lima business
@@ -28,7 +29,12 @@
Interceptor based on : http://openejb.apache.org/examples-trunk/alternate-descriptors/
-->
-<ejb-jar>
+<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+ version="3.1">
+ <!-- Le nom est a fixer sinon, il est généré et contient la version -->
+ <module-name>lima</module-name>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
1
0
r3436 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/accountsreports java/org/chorem/lima/ui/celleditor java/org/chorem/lima/ui/common java/org/chorem/lima/ui/entrybooksreports java/org/chorem/lima/ui/financialtransactionsearch resources/i18n
by echatellier@users.chorem.org 01 Jun '12
by echatellier@users.chorem.org 01 Jun '12
01 Jun '12
Author: echatellier
Date: 2012-06-01 16:01:39 +0200 (Fri, 01 Jun 2012)
New Revision: 3436
Url: http://chorem.org/repositories/revision/lima/3436
Log:
Entry book report refactoring
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountListRenderer.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.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-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2012-06-01 14:01:39 UTC (rev 3436)
@@ -76,7 +76,7 @@
<cell fill='horizontal' anchor="west">
<AccountComboBoxModel id="accountComboboxModel" />
<AccountComboBox id="accountComboBox" model="{accountComboboxModel}"
- renderer="{new org.chorem.lima.ui.common.AccountRenderer()}"
+ renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
onItemStateChanged="handler.accountChanged(event)" />
</cell>
<cell>
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 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/AccountTableCellEditor.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -29,7 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.ui.combobox.LeafAccountComboBoxModel;
-import org.chorem.lima.ui.common.AccountRenderer;
+import org.chorem.lima.ui.common.AccountListRenderer;
import org.chorem.lima.util.AccountToString;
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -70,7 +70,7 @@
comboBox = new JWideComboBox();
LeafAccountComboBoxModel accountComboBoxModel = new LeafAccountComboBoxModel();
comboBox.setModel(accountComboBoxModel);
- AccountRenderer accountRenderer = new AccountRenderer();
+ AccountListRenderer accountRenderer = new AccountListRenderer();
comboBox.setRenderer(accountRenderer);
AutoCompleteDecorator.decorate(comboBox, AccountToString.getInstance());
comboBox.getEditor().getEditorComponent().addKeyListener(this);
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountListRenderer.java (from rev 3429, trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountRenderer.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountListRenderer.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountListRenderer.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ * Lima Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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 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.ui.common;
+
+import org.chorem.lima.entity.Account;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import java.awt.Component;
+
+public class AccountListRenderer extends DefaultListCellRenderer {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+
+ JLabel label = (JLabel) super.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
+ if (value != null) {
+ Account account = (Account) value;
+ String accountLabel = account.getLabel();
+ int nbChars = 30;
+ if (accountLabel != null && accountLabel.length() > nbChars) {
+ accountLabel = accountLabel.substring(0, nbChars) + "…";
+ }
+ label.setText(account.getAccountNumber() + " - " + accountLabel);
+ }
+ return this;
+ }
+
+}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountRenderer.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountRenderer.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -1,64 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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 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.ui.common;
-
-import org.chorem.lima.entity.Account;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import java.awt.Component;
-
-public class AccountRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
-
- JLabel label = (JLabel) super.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus
- );
- if (value != null) {
- Account account = (Account) value;
- String accountLabel = account.getLabel();
- int nbChars = 30;
- if (accountLabel != null && accountLabel.length() > nbChars) {
- accountLabel = accountLabel.substring(0, nbChars) + "…";
- }
- label.setText(account.getAccountNumber() + " - " + accountLabel);
- }
- return this;
- }
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBookComboBox.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 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
@@ -25,69 +25,41 @@
package org.chorem.lima.ui.entrybooksreports;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.JComboBox;
+
import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
import org.chorem.lima.util.EntryBookToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-import javax.swing.JComboBox;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
public class EntryBookComboBox extends JComboBox implements KeyListener {
private static final long serialVersionUID = 1L;
- private static final Log log =
- LogFactory.getLog(EntryBookComboBox.class);
-
- protected EntryBooksReportsViewHandler handler;
-
- public EntryBookComboBox(EntryBooksReportsViewHandler handler) {
- this.handler = handler;
- EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
- setModel(entryBookComboBoxModel);
- setRenderer(LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class));
- setEditable(true);
+ public EntryBookComboBox() {
AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
getEditor().getEditorComponent().addKeyListener(this);
- addActionListener(this);
}
public void back() {
int row = getSelectedIndex();
- log.debug(row);
if (row > 0) {
getEditor().setItem(getItemAt(row - 1));
- handler.setEntryBook((EntryBook) getSelectedItem());
}
}
public void next() {
int size = getModel().getSize();
int row = getSelectedIndex();
- log.debug(row);
if (row < size - 1) {
getEditor().setItem(getItemAt(row + 1));
- handler.setEntryBook((EntryBook) getSelectedItem());
}
}
@Override
- public void actionPerformed(ActionEvent e) {
- Object object = getSelectedItem();
- if (object instanceof EntryBook) {
- handler.setEntryBook((EntryBook) getSelectedItem());
- }
- }
-
-
- @Override
public void keyPressed(KeyEvent e) {
}
@@ -96,7 +68,7 @@
public void keyReleased(KeyEvent e) {
Object object = getSelectedItem();
if (object instanceof EntryBook) {
- handler.setEntryBook((EntryBook) getSelectedItem());
+ fireActionEvent();
}
// delegate popup list menu
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
@@ -108,5 +80,4 @@
public void keyTyped(KeyEvent e) {
}
-
}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -1,162 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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 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.ui.entrybooksreports;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.enums.ComboBoxDatesEnum;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.jdesktop.swingx.JXDatePicker;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.ListCellRenderer;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-public class EntryBooksReportsPeriodSearchPanel extends JPanel {
-
- private static final Log log =
- LogFactory.getLog(EntryBooksReportsPeriodSearchPanel.class);
-
- protected EntryBooksReportsViewHandler handler;
-
- public EntryBooksReportsPeriodSearchPanel(EntryBooksReportsViewHandler handler) {
- this.handler = handler;
-
- //init date
- refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
- }
-
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
-
- switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
-
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- ListCellRenderer renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
-
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(renderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
-
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(renderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
- }
-
- }
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTable.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2008 - 2010 CodeLutin
+ * Copyright (C) 2008 - 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
@@ -49,8 +49,6 @@
/** serialVersionUID. */
private static final long serialVersionUID = 1L;
- protected EntryBooksReportsViewHandler handler;
-
protected EntryBooksReportsTableModel model;
private Highlighter colorReportsDatas;
@@ -61,9 +59,8 @@
/**
*/
- public EntryBooksReportsTable(EntryBooksReportsViewHandler handler, EntryBooksReportsTableModel model) {
+ public EntryBooksReportsTable(EntryBooksReportsTableModel model) {
- this.handler = handler;
this.model = model;
addKeyListener(this);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -38,7 +38,6 @@
import static org.nuiton.i18n.I18n._;
-
/**
* Entry book table model.
* By : $Author$
@@ -52,15 +51,15 @@
private static final Log log = LogFactory.getLog(EntryBooksReportsTableModel.class);
/** data cache */
- protected ReportsDatas cacheDataList;
+ protected ReportsDatas reportData;
@Override
public int getRowCount() {
int result = 0;
// just prevent too much result
- if (cacheDataList != null && cacheDataList.getListEntry() != null) {
- result = cacheDataList.getListEntry().size();
+ if (reportData != null && reportData.getListEntry() != null) {
+ result = reportData.getListEntry().size();
}
return result;
@@ -135,8 +134,8 @@
@Override
public Object getValueAt(int row, int column) {
Object result = null;
- if (cacheDataList.getListEntry() != null) {
- Entry currentRow = cacheDataList.getListEntry().get(row);
+ if (reportData.getListEntry() != null) {
+ Entry currentRow = reportData.getListEntry().get(row);
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("dd MMMMM yyyy");
@@ -178,18 +177,11 @@
}
public Entry getElementAt(int row) {
- return cacheDataList.getListEntry().get(row);
+ return reportData.getListEntry().get(row);
}
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- // Just read, no write
- return false;
- }
-
- public void refresh(ReportsDatas datasList) {
- cacheDataList = datasList;
+ public void setReportDatas(ReportsDatas datasList) {
+ reportData = datasList;
fireTableDataChanged();
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2012-06-01 14:01:39 UTC (rev 3436)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2008 - 2010 CodeLutin
+ Copyright (C) 2008 - 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
@@ -27,27 +27,17 @@
<import>
javax.swing.ListSelectionModel
org.chorem.lima.enums.ComboBoxDatesEnum
- org.chorem.lima.ui.combobox.EntryBookComboBoxModel
- org.chorem.lima.ui.entrybooksreports.EntryBookComboBox
- org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTable
- org.chorem.lima.ui.entrybooksreports.EntryBooksReportsTableModel
+ org.jdesktop.swingx.JXDatePicker
</import>
- <EntryBooksReportsViewHandler id="handler"
- javaBean="new EntryBooksReportsViewHandler(this)"/>
- <Boolean id="selectedRow" javaBean="false"/>
- <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBook"/>
- <EntryBooksReportsTableModel id="modelTable"/>
- <script>
- <![CDATA[
- EntryBooksReportsPeriodSearchPanel periodSearchPanel = new EntryBooksReportsPeriodSearchPanel(handler);
- EntryBookComboBox comboBox = new EntryBookComboBox(handler);
-
+ <EntryBooksReportsViewHandler id="handler" constructorParams="this"/>
+
+ <script><![CDATA[
void $afterCompleteSetup() {
+ handler.init();
}
-
- ]]>
- </script>
+ ]]></script>
+
<row weightx="1" weighty="0" anchor="center">
<cell fill='both'>
<Table>
@@ -55,11 +45,26 @@
<cell anchor="west">
<JComboBox id="periodComboBox"
javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/>
+ onActionPerformed="handler.periodTypeChanged()"/>
</cell>
<cell>
- <EntryBooksReportsPeriodSearchPanel javaBean="periodSearchPanel"/>
+ <CardLayout id="periodTypeLayout" />
+ <JPanel id="periodTypeContainer" layout="{periodTypeLayout}">
+ <org.chorem.lima.ui.common.FiscalPeriodComboBoxModel id="fiscalPeriodModel" />
+ <JComboBox id="fiscalPeriodComboBox" model="{fiscalPeriodModel}"
+ renderer="{new org.chorem.lima.ui.common.FiscalPeriodListRenderer()}"
+ onItemStateChanged="handler.periodsChanged(event)" constraints='"FISCAL_PERIOD"' />
+ <org.chorem.lima.ui.common.FinancialPeriodComboBoxModel id="financialPeriodModel" />
+ <JComboBox id="financialPeriodComboBox" model="{financialPeriodModel}"
+ renderer="{new org.chorem.lima.ui.common.FinancialPeriodListRenderer()}"
+ onItemStateChanged="handler.periodsChanged(event)" constraints='"FINANCIAL_PERIOD"' />
+ <JPanel constraints='"PERIOD"'>
+ <JLabel text="lima.common.begindate" />
+ <JXDatePicker id="periodBeginDatePicker" onActionPerformed="handler.periodDatesChanged()" />
+ <JLabel text="lima.common.enddate" />
+ <JXDatePicker id="periodEndDatePicker" onActionPerformed="handler.periodDatesChanged()" />
+ </JPanel>
+ </JPanel>
</cell>
</row>
</Table>
@@ -68,15 +73,18 @@
<JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/>
</cell>
<cell anchor="west">
- <JComboBox javaBean='comboBox'/>
+ <org.chorem.lima.ui.common.EntryBookComboBoxModel id="entryBookModel" />
+ <EntryBookComboBox id="entryBookCombo" model="{entryBookModel}"
+ renderer="{new org.chorem.lima.ui.common.EntryBookListRenderer()}"
+ onItemStateChanged="handler.entryBookChanged(event)"/>
</cell>
<cell>
<JButton id="back" text="lima.common.buttonback"
- onActionPerformed="comboBox.back()"/>
+ onActionPerformed="entryBookCombo.back()"/>
</cell>
<cell>
<JButton id="next" text="lima.common.buttonnext"
- onActionPerformed="comboBox.next()"/>
+ onActionPerformed="entryBookCombo.next()"/>
</cell>
<cell>
<EnumEditor id='DocumentEditor'
@@ -90,13 +98,11 @@
<row>
<cell fill="both" weightx="1" weighty="1" columns="7">
<JScrollPane>
- <EntryBooksReportsTable
- id="table" sortable="false" rowHeight="24"
- constructorParams="getHandler(), getModelTable()"
- model="{getModelTable()}"
+ <EntryBooksReportsTableModel id="entryBookReportsTableModel" />
+ <EntryBooksReportsTable id="reportTable" sortable="false" rowHeight="24"
+ constructorParams="entryBookReportsTableModel"
+ model="{entryBookReportsTableModel}"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
- <ListSelectionModel
- javaBean="getTable().getSelectionModel()"/>
</JScrollPane>
</cell>
</row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -28,22 +28,27 @@
import static org.nuiton.i18n.I18n._;
import java.awt.Desktop;
+import java.awt.event.ItemEvent;
import java.io.IOException;
-import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import javax.swing.JComboBox;
import javax.swing.JOptionPane;
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaConfig;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.DocumentService;
+import org.chorem.lima.business.api.EntryBookService;
+import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.HttpServerService;
@@ -52,122 +57,187 @@
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.enums.ComboBoxDatesEnum;
import org.chorem.lima.service.LimaServiceFactory;
/**
* Handler associated with accounts reports view.
+ *
* By : $Author$
*/
public class EntryBooksReportsViewHandler implements ServiceListener {
- protected EntryBooksReportsView view;
-
- protected EntryBooksReportsTable table;
-
- protected EntryBooksReportsTableModel tableModel;
-
/** log. */
private static final Log log = LogFactory.getLog(EntryBooksReportsViewHandler.class);
+ protected EntryBooksReportsView view;
+
/** Services. */
protected ReportService reportService;
-
protected DocumentService documentService;
-
+ protected EntryBookService entryBookService;
protected FiscalPeriodService fiscalPeriodService;
+ protected FinancialPeriodService financialPeriodService;
- /** Account. */
- protected EntryBook selectedEntryBook;
-
- /** Begin Date. */
- protected Date selectedBeginDate;
-
- /** EndDate. */
- protected Date selectedEndDate;
-
- protected int port;
-
private static SimpleDateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd");
- protected EntryBooksReportsViewHandler(EntryBooksReportsView view) {
+ public EntryBooksReportsViewHandler(EntryBooksReportsView view) {
this.view = view;
reportService = LimaServiceFactory.getService(ReportService.class);
- port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
documentService = LimaServiceFactory.getService(DocumentService.class);
+ reportService = LimaServiceFactory.getService(ReportService.class);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
LimaServiceFactory.addServiceListener(ImportService.class, this);
LimaServiceFactory.addServiceListener(FinancialTransactionService.class, this);
}
- public void setBeginDate(Date date) {
- selectedBeginDate = date;
- refresh();
+ /**
+ * Init data models and displayed objects.
+ */
+ public void init() {
+
+ // init data models
+ List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
+ view.getEntryBookModel().setObjects(entryBooks);
+ List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ view.getFiscalPeriodModel().setObjects(fiscalPeriod);
+ List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
+ view.getFinancialPeriodModel().setObjects(financialPeriod);
+
+ // init date periods
+ initDatePeriods();
}
+
+ /**
+ * Init date pickers objects with contextual dates.
+ */
+ private void initDatePeriods() {
- public void setEndDate(Date date) {
- selectedEndDate = date;
- refresh();
+ // get begin date
+ Date beginDate = DateUtils.truncate(new Date(), Calendar.YEAR);
+ view.getPeriodBeginDatePicker().setDate(beginDate);
+
+ // get end date
+ Date endDate = new Date();
+ view.getPeriodEndDatePicker().setDate(endDate);
}
+ public void periodTypeChanged() {
+ JComboBox periodComboBox = view.getPeriodComboBox();
+ ComboBoxDatesEnum type = ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem());
- public void setEntryBook(EntryBook entryBook) {
- selectedEntryBook = entryBook;
- refresh();
+ // show corresponding component in layout
+ view.getPeriodTypeLayout().show(view.getPeriodTypeContainer(), type.name());
}
- public ReportsDatas getDataList() {
+ protected void periodsChanged(ItemEvent event) {
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ refreshData();
+ }
+ }
+
+ protected void entryBookChanged(ItemEvent event) {
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ refreshData();
+ }
+ }
+
+ protected void periodDatesChanged() {
+ refreshData();
+ }
+
+ /*public ReportsDatas getDataList() {
ReportsDatas results = null;
if (selectedEntryBook != null) {
results = reportService.generateEntryBooksReports(
selectedEntryBook, selectedBeginDate, selectedEndDate);
}
return results;
- }
+ }*/
- public void refresh() {
+ /**
+ * Refresh table data depending on item selected on combo boxes.
+ */
+ protected void refreshData() {
+
+ Date beginDate = null;
+ Date endDate = null;
- if (selectedBeginDate != null && selectedEndDate != null && selectedEntryBook != null) {
- tableModel = view.getModelTable();
+ JComboBox periodComboBox = view.getPeriodComboBox();
+ ComboBoxDatesEnum type = ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem());
+ switch (type) {
+ case PERIOD:
+ beginDate = view.getPeriodBeginDatePicker().getDate();
+ endDate = view.getPeriodEndDatePicker().getDate();
+ break;
+ case FINANCIAL_PERIOD: {
+ FinancialPeriod period = (FinancialPeriod)view.getFinancialPeriodComboBox().getSelectedItem();
+ if (period != null) {
+ beginDate = period.getBeginDate();
+ endDate = period.getEndDate();
+ }
+ break;
+ }
+ case FISCAL_PERIOD: {
+ FiscalPeriod period = (FiscalPeriod)view.getFiscalPeriodComboBox().getSelectedItem();
+ if (period != null) {
+ beginDate = period.getBeginDate();
+ endDate = period.getEndDate();
+ }
+ break;
+ }
+ }
+
+ EntryBook entryBook = (EntryBook)view.getEntryBookCombo().getModel().getSelectedItem();
+
+ if (beginDate != null && endDate != null && entryBook != null) {
+ ReportsDatas results = reportService.generateEntryBooksReports(entryBook,
+ beginDate, endDate);
+
+ EntryBooksReportsTableModel dataModel = view.getEntryBookReportsTableModel();
+ dataModel.setReportDatas(results);
+ }
+ }
- ReportsDatas datasList = getDataList();
+ public void createDocument() {
- tableModel.refresh(datasList);
+ // FIXME echatellier 20120601 duplicated code
+ Date beginDate = null;
+ Date endDate = null;
- /**
- * set text and amounts of labels credit, debit, solde
- */
-
- if (datasList != null) {
- // set amounts credit, debit and solde
- view.amountCreditLabel.setText(
- String.valueOf(datasList.getAmountCredit()));
- view.amountDebitLabel.setText(
- String.valueOf(datasList.getAmountDebit()));
- BigDecimal amountSolde = datasList.getAmountSolde();
- view.amountSoldeLabel.setText(String.valueOf(amountSolde));
-
- if (BigDecimal.ZERO.equals(amountSolde)) {
- view.soldeLabel.setText(_("lima.common.solde"));
- } else {
- // set label solde: credit or debit
- if (datasList.getSoldeDebit()) {
- view.soldeLabel.setText(_("lima.common.soldedebit"));
- } else {
- view.soldeLabel.setText(_("lima.common.soldecredit"));
- }
+ JComboBox periodComboBox = view.getPeriodComboBox();
+ ComboBoxDatesEnum type = ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem());
+ switch (type) {
+ case PERIOD:
+ beginDate = view.getPeriodBeginDatePicker().getDate();
+ endDate = view.getPeriodEndDatePicker().getDate();
+ break;
+ case FINANCIAL_PERIOD: {
+ FinancialPeriod period = (FinancialPeriod)view.getFinancialPeriodComboBox().getSelectedItem();
+ if (period != null) {
+ beginDate = period.getBeginDate();
+ endDate = period.getEndDate();
}
+ break;
}
+ case FISCAL_PERIOD: {
+ FiscalPeriod period = (FiscalPeriod)view.getFiscalPeriodComboBox().getSelectedItem();
+ if (period != null) {
+ beginDate = period.getBeginDate();
+ endDate = period.getEndDate();
+ }
+ break;
+ }
}
- }
+
+ if (beginDate != null && endDate != null) {
-
- public void createDocument() {
-
- if (selectedBeginDate != null && selectedEndDate != null) {
-
//looks for all blocked fiscal periods
List<FiscalPeriod> blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
@@ -175,8 +245,8 @@
boolean error = true;
for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) {
- if (blockedFiscalPeriod.getBeginDate().equals(selectedBeginDate)
- && blockedFiscalPeriod.getEndDate().equals(selectedEndDate)
+ if (blockedFiscalPeriod.getBeginDate().equals(beginDate)
+ && blockedFiscalPeriod.getEndDate().equals(endDate)
&& blockedFiscalPeriod.getLocked()) {
error = false;
}
@@ -187,24 +257,25 @@
JOptionPane.showMessageDialog(
view,
_("lima.entrybooksreports.documentcreationfiscalerror"),
- _("lima.common.error"),
+ _("lima.entrybooksreports.documentcreationfiscaltitle"),
JOptionPane.ERROR_MESSAGE);
} else {
+ int port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort();
FormatsEnum selectedEnum = (FormatsEnum) view.getDocumentEditor().getSelectedItem();
String address = LimaConfig.getInstance().getHostAdress();
try {
String url = "http://" + address + ":" + port + "/?beginDate="
- + dateFormat.format(selectedBeginDate)
- + "&endDate=" + dateFormat.format(selectedEndDate)
+ + dateFormat.format(beginDate)
+ + "&endDate=" + dateFormat.format(endDate)
+ "&format=" + selectedEnum.getExtension() + "&model="
+ DocumentsEnum.ENTRYBOOKS.getFileName();
Desktop.getDesktop().browse(new URI(url));
String url2 = "http://" + address + ":" + port + "/?beginDate="
- + dateFormat.format(selectedBeginDate)
- + "&endDate=" + dateFormat.format(selectedEndDate)
+ + dateFormat.format(beginDate)
+ + "&endDate=" + dateFormat.format(endDate)
+ "&format=" + selectedEnum.getExtension() + "&model="
+ DocumentsEnum.GENERAL_ENTRYBOOK.getFileName();
Desktop.getDesktop().browse(new URI(url2));
@@ -219,10 +290,9 @@
}
@Override
- public void notifyMethod(String serviceName, String methodeName) {
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("importEntryBook") || methodeName.contains("importAll")) {
- refresh();
+ public void notifyMethod(String serviceName, String methodName) {
+ if (serviceName.contains("FinancialTransaction") || methodName.contains("importEntryBook") || methodName.contains("importAll")) {
+ refreshData();
}
}
-
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2012-06-01 14:01:39 UTC (rev 3436)
@@ -29,7 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.ui.combobox.AccountComboBoxModel;
-import org.chorem.lima.ui.common.AccountRenderer;
+import org.chorem.lima.ui.common.AccountListRenderer;
import org.chorem.lima.util.AccountToString;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
@@ -50,7 +50,7 @@
public AccountSearchComboBox(FinancialTransactionSearchViewHandler handler) {
this.handler = handler;
AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel();
- AccountRenderer accountRenderer = new AccountRenderer();
+ AccountListRenderer accountRenderer = new AccountListRenderer();
setModel(accountComboBoxModel);
setRenderer(accountRenderer);
setEditable(true);
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 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-06-01 14:01:39 UTC (rev 3436)
@@ -95,6 +95,7 @@
lima.entries.writetransaction=Write entries
lima.entrybooksreports.documentcreationerror=Enable to create document
lima.entrybooksreports.documentcreationfiscalerror=Can't create document on an open fiscal year
+lima.entrybooksreports.documentcreationfiscaltitle=
lima.entrybooksreports.listerror=Can't get entries list
lima.enum.comboboxaccount.account=Account
lima.enum.comboboxaccount.accountlist=Account list
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 2012-06-01 09:27:45 UTC (rev 3435)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-06-01 14:01:39 UTC (rev 3436)
@@ -95,6 +95,7 @@
lima.entries.writetransaction=Saisir des écritures
lima.entrybooksreports.documentcreationerror=Erreur lors de la création du document
lima.entrybooksreports.documentcreationfiscalerror=Impossible de créer un document quand la période fiscale est ouverte
+lima.entrybooksreports.documentcreationfiscaltitle=
lima.entrybooksreports.listerror=Erreur lors de la récupération des données de la liste
lima.enum.comboboxaccount.account=Compte
lima.enum.comboboxaccount.accountlist=Liste de comptes
1
0
01 Jun '12
Author: echatellier
Date: 2012-06-01 11:27:45 +0200 (Fri, 01 Jun 2012)
New Revision: 3435
Url: http://chorem.org/repositories/revision/lima/3435
Log:
Fix typo
Modified:
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
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 2012-05-30 14:06:48 UTC (rev 3434)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-06-01 09:27:45 UTC (rev 3435)
@@ -94,7 +94,7 @@
lima.entries.searchunbalancedtransaction=Entrées incorrectes
lima.entries.writetransaction=Saisir des écritures
lima.entrybooksreports.documentcreationerror=Erreur lors de la création du document
-lima.entrybooksreports.documentcreationfiscalerror=Impossible de créedr un document quand la période fiscale est ouverte
+lima.entrybooksreports.documentcreationfiscalerror=Impossible de créer un document quand la période fiscale est ouverte
lima.entrybooksreports.listerror=Erreur lors de la récupération des données de la liste
lima.enum.comboboxaccount.account=Compte
lima.enum.comboboxaccount.accountlist=Liste de comptes
1
0
r3434 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org 30 May '12
by echatellier@users.chorem.org 30 May '12
30 May '12
Author: echatellier
Date: 2012-05-30 16:06:48 +0200 (Wed, 30 May 2012)
New Revision: 3434
Url: http://chorem.org/repositories/revision/lima/3434
Log:
Fix queries
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
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-05-30 14:01:56 UTC (rev 3433)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-05-30 14:06:48 UTC (rev 3434)
@@ -109,9 +109,9 @@
Date endDate) throws TopiaException {
String query = getEquilibredTransactionQuery(beginDate, endDate) +
// concerne le compte
- " AND E.entryBook = :entryBook" +
+ " AND E = :entryBook" +
// fix order
- " ORDER BY, E.financialTransaction.beginDate, E.financialTransaction.topiaId";
+ " ORDER BY E.financialTransaction.transactionDate, E.financialTransaction.topiaId";
List<Entry> entries = context.find(query, "beginDate", beginDate,
"endDate", endDate, "entryBook", entryBook);
@@ -133,7 +133,7 @@
String query = "SELECT E.debit, sum(E.amount) " +
getEquilibredTransactionQuery(beginDate, endDate) +
// concerne le compte
- " AND E.entryBook = :entryBook" +
+ " AND E = :entryBook" +
" GROUP BY E.debit";
List<Object[]> result = context.find(query, "beginDate", beginDate,
1
0
r3433 - trunk/lima-business/src/main/java/org/chorem/lima/service
by echatellier@users.chorem.org 30 May '12
by echatellier@users.chorem.org 30 May '12
30 May '12
Author: echatellier
Date: 2012-05-30 16:01:56 +0200 (Wed, 30 May 2012)
New Revision: 3433
Url: http://chorem.org/repositories/revision/lima/3433
Log:
Remove openejb sysout
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-05-30 10:33:35 UTC (rev 3432)
+++ trunk/lima-business/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2012-05-30 14:01:56 UTC (rev 3433)
@@ -89,7 +89,6 @@
// see http://openejb.apache.org/embedded-configuration.html
// http://openejb.apache.org/properties-listing.html
// for embedded configuration
- props.setProperty("openejb.nobanner", "false");
container = EJBContainer.createEJBContainer(props);
}
1
0
r3432 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/test/java/org/chorem/lima/business/accountingrules lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org 30 May '12
by echatellier@users.chorem.org 30 May '12
30 May '12
Author: echatellier
Date: 2012-05-30 12:33:35 +0200 (Wed, 30 May 2012)
New Revision: 3432
Url: http://chorem.org/repositories/revision/lima/3432
Log:
Remove last topiaquery
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.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/VatStatementServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/TestAccountingRules.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FiscalPeriodDAOImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -40,8 +40,6 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
import java.util.ArrayList;
import java.util.Calendar;
@@ -50,6 +48,11 @@
import static org.nuiton.i18n.I18n._;
+/**
+ * Surcharge des regles par defaut pour application à la comptabilité française.
+ *
+ * @author echatellier
+ */
public class FranceAccountingRules extends DefaultAccountingRules {
protected static final Log log = LogFactory.getLog(FranceAccountingRules.class);
@@ -119,10 +122,7 @@
//Checks if is not the first fiscalperiod to create
if (fiscalPeriodDAO.count() != 0) {
- TopiaQuery query = fiscalPeriodDAO.createQuery();
- query.addOrderDesc(FiscalPeriod.PROPERTY_END_DATE);
- //get the last fiscal period
- FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.findByQuery(query);
+ FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.getLastFiscalPeriod();
//check the new fiscal period adjoining the last
Date dateLastFiscalPeriod = lastFiscalPeriod.getEndDate();
@@ -173,19 +173,16 @@
/**
* Règles de vérification de fermeture d'un exercice, appliquées à la comptabilité française.
+ *
+ * On ne peut pas clore la dernière period comptable ouverte.
*/
@Override
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod) throws LimaException {
try {
FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
- TopiaQuery query = fiscalPeriodDAO.createQuery();
- fiscalPeriodDAO.findAllByQuery(query);
- query.addWhere(FiscalPeriod.PROPERTY_LOCKED, Op.EQ, false);
- query.addOrder(FiscalPeriod.PROPERTY_END_DATE);
-
FiscalPeriod oldestUnBlockedFiscalPeriod =
- fiscalPeriodDAO.findByQuery(query);
+ fiscalPeriodDAO.getLastUnlockedFiscalPeriod();
//Check if the fiscal period to block is the oldest
if (!oldestUnBlockedFiscalPeriod.equals(fiscalPeriod)) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -50,7 +50,6 @@
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementDAO;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
import javax.ejb.Local;
import javax.ejb.Remote;
@@ -255,10 +254,8 @@
FinancialStatementDAO financialStatementDAO =
getDaoHelper().getFinancialStatementDAO();
- TopiaQuery query = financialStatementDAO.createQuery();
- query.addOrder(FinancialStatement.TOPIA_CREATE_DATE);
List<FinancialStatement> listFinancialStatements =
- financialStatementDAO.findAllByQuery(query);
+ financialStatementDAO.findAllOrderedByCreateDate();
// For all Financialstatements
for (FinancialStatement financialStatement : listFinancialStatements) {
@@ -332,10 +329,8 @@
// Get all Vatstatements
VatStatementDAO vatStatementDAO = getDaoHelper().getVatStatementDAO();
- TopiaQuery query = vatStatementDAO.createQuery();
- query.addOrder(VatStatement.TOPIA_CREATE_DATE);
List<VatStatement> listVatStatements =
- vatStatementDAO.findAllByQuery(query);
+ vatStatementDAO.findAllOrderedByCreateDate();
// For all Vatstatements
for (VatStatement vatStatement : listVatStatements) {
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 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -45,11 +45,8 @@
import org.chorem.lima.entity.EntryBookDAO;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialPeriodDAO;
-import org.chorem.lima.entity.FiscalPeriod;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-
/**
* Gestion des périodes intermédiaires durant l'exercice.
* Chaque timeSpan sera fixe, et devra correspondre à un mois complet.
@@ -114,13 +111,8 @@
List<FinancialPeriod> result = null;
try {
-
FinancialPeriodDAO financialPeriodDAO = getDaoHelper().getFinancialPeriodDAO();
-
- TopiaQuery query = financialPeriodDAO.createQuery()
- .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
-
- result = financialPeriodDAO.findAllByQuery(query);
+ result = financialPeriodDAO.findAllOrderByBeginDate();
} catch (Exception ex) {
throw new LimaException("Can't get periods", ex);
}
@@ -135,14 +127,8 @@
List<FinancialPeriod> result = null;
try {
-
FinancialPeriodDAO financialPeriodDAO = getDaoHelper().getFinancialPeriodDAO();
-
- TopiaQuery query = financialPeriodDAO.createQuery()
- .addEquals(FinancialPeriod.PROPERTY_LOCKED, Boolean.FALSE)
- .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
-
- result = financialPeriodDAO.findAllByQuery(query);
+ result = financialPeriodDAO.findAllUnlockedOrderByBeginDate();
} catch (Exception ex) {
throw new LimaException("Can't create period", ex);
}
@@ -158,12 +144,7 @@
try {
FinancialPeriodDAO financialPeriodDAO = getDaoHelper().getFinancialPeriodDAO();
-
- TopiaQuery query = financialPeriodDAO.createQuery()
- .addBetween(FinancialPeriod.PROPERTY_BEGIN_DATE, beginDate, endDate)
- .addOrder(FinancialPeriod.PROPERTY_BEGIN_DATE);
-
- result = financialPeriodDAO.findAllByQuery(query);
+ result = financialPeriodDAO.findByDates(beginDate, endDate);
} catch (Exception ex) {
throw new LimaException("Can't get period", ex);
}
@@ -201,9 +182,7 @@
ClosedPeriodicEntryBook closedPeriodicEntryBook = null;
try {
-
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO = getDaoHelper().getClosedPeriodicEntryBookDAO();
-
closedPeriodicEntryBook = closedPeriodicEntryBookDAO.findByEntryBookAndFinancialPeriod(entryBook, financialPeriod);
} catch (Exception ex) {
throw new LimaException("Can't get closed periodic", ex);
@@ -218,33 +197,8 @@
List<ClosedPeriodicEntryBook> result = null;
try {
-
- ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO
- = getDaoHelper().getClosedPeriodicEntryBookDAO();
-
- //Get closedperiodicentrybook from unlocked fiscalperiod
- TopiaQuery query = closedPeriodicEntryBookDAO.createQuery("E");
- query.addFrom(FiscalPeriod.class, "F")
- .addInElements("E." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
- "F." + FiscalPeriod.PROPERTY_FINANCIAL_PERIOD)
- .addEquals("F." + FiscalPeriod.PROPERTY_LOCKED, Boolean.FALSE);
- String orderProperty =
- TopiaQuery.getProperty("E", ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
- FinancialPeriod.PROPERTY_BEGIN_DATE);
- query.addOrder(orderProperty);
-
- //IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION
- String loadEntryBookProperty =
- TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK,
- EntryBook.PROPERTY_LABEL);
- query.addLoad(loadEntryBookProperty);
- String loadFinancialPeriodProperty =
- TopiaQuery.getProperty(ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD,
- FinancialPeriod.PROPERTY_BEGIN_DATE);
- query.addLoad(loadFinancialPeriodProperty);
-
- //call query
- result = closedPeriodicEntryBookDAO.findAllByQuery(query);
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO = getDaoHelper().getClosedPeriodicEntryBookDAO();
+ result = closedPeriodicEntryBookDAO.findAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod();
} catch (Exception ex) {
throw new LimaException("Can't get closed periodics", ex);
}
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 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -25,6 +25,19 @@
package org.chorem.lima.business.ejb;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+
import org.apache.commons.lang3.StringUtils;
import org.chorem.lima.FinancialStatementWayEnum;
import org.chorem.lima.beans.Amounts;
@@ -42,22 +55,7 @@
import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.entity.FinancialStatementDAO;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
-import javax.ejb.EJB;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import static org.nuiton.i18n.I18n._;
-
@Stateless
@Remote(FinancialStatementService.class)
@TransactionAttribute
@@ -162,13 +160,8 @@
List<FinancialStatement> financialStatements = null;
try {
-
FinancialStatementDAO financialStatementDAO = getDaoHelper().getFinancialStatementDAO();
-
- TopiaQuery query = financialStatementDAO.createQuery();
- query.addEquals(FinancialStatement.PROPERTY_MASTER_FINANCIAL_STATEMENT, masterFinancialStatement)
- .addOrder(FinancialStatement.TOPIA_CREATE_DATE);
- financialStatements = financialStatementDAO.findAllByQuery(query);
+ financialStatements = financialStatementDAO.findChildrenFinancialStatement(masterFinancialStatement);
} catch (Exception ex) {
throw new LimaException("Can't get childreen statements", ex);
}
@@ -503,28 +496,4 @@
}
return result.toString();
}
-
- protected List<FinancialStatement> findFinancialStatementByAccountNumber(String accountNumber) throws TopiaException {
-
- FinancialStatementDAO financialStatementDAO = getDaoHelper().getFinancialStatementDAO();
- TopiaQuery query = financialStatementDAO.createQuery();
-
- String accountProperty =
- TopiaQuery.getProperty(FinancialStatement.PROPERTY_ACCOUNTS);
- String creditAccountProperty =
- TopiaQuery.getProperty(FinancialStatement.PROPERTY_CREDIT_ACCOUNTS);
- String debitAccountProperty =
- TopiaQuery.getProperty(FinancialStatement.PROPERTY_DEBIT_ACCOUNTS);
- String provisionDeprecationProperty =
- TopiaQuery.getProperty(FinancialStatement.PROPERTY_PROVISION_DEPRECATION_ACCOUNTS);
- String likeCondition = " " + Op.LIKE + " '%" + accountNumber + "%'";
-
- query.addWhere(accountProperty + likeCondition
- + " OR " + creditAccountProperty + likeCondition
- + " OR " + debitAccountProperty + likeCondition
- + " OR " + provisionDeprecationProperty + likeCondition);
-
- return financialStatementDAO.findAllByQuery(query);
- }
-
}
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-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -35,7 +35,6 @@
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
-import org.chorem.lima.FinancialStatementWayEnum;
import org.chorem.lima.beans.FinancialTransactionSearch;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaConfig;
@@ -55,8 +54,6 @@
import org.chorem.lima.entity.FinancialTransactionDAO;
import org.chorem.lima.entity.FiscalPeriod;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
/**
* Cette classe permet la création d'une transaction comptable dans l'application.
@@ -345,95 +342,27 @@
@Override
public List<Object> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch) throws LimaException {
List<Object> result = new ArrayList<Object>();
- List<FinancialTransaction> financialTransactions;
try {
- FinancialTransactionDAO financialTransactionDAO = getDaoHelper().getFinancialTransactionDAO();
- TopiaQuery query = financialTransactionDAO.createQuery("T");
-
- String dateProperty = TopiaQuery.getProperty(FinancialTransaction.PROPERTY_TRANSACTION_DATE);
- String accountNumberProperty = TopiaQuery.getProperty(Entry.PROPERTY_ACCOUNT, Account.PROPERTY_ACCOUNT_NUMBER);
-
- query.addDistinct();
- query.addLeftJoin("T." + FinancialTransaction.PROPERTY_ENTRY, "E", true);
- //Load for lazy
- query.addLoad(FinancialTransaction.PROPERTY_ENTRY_BOOK);
- // .addLoad(FinancialTransaction.PROPERTY_FINANCIAL_PERIOD);
-
- Date beginDate = financialTransactionSearch.getBeginDate();
- Date endDate = financialTransactionSearch.getEndDate();
- if (beginDate != null && endDate != null) {
- query.addBetween(dateProperty, beginDate, endDate);
- } else if (beginDate != null) {
- query.addEquals(dateProperty, beginDate);
- }
- String voucher = financialTransactionSearch.getVoucher();
- if (voucher != null) {
- query.addWhere("E.voucher", Op.LIKE, "%" + voucher + "%");
- }
- String description = financialTransactionSearch.getDescription();
- if (description != null) {
- query.addWhere("E.description", Op.LIKE, "%" + description + "%");
- }
- String letter = financialTransactionSearch.getLettering();
- if (letter != null) {
- query.addEquals("E.lettering", letter);
- }
- Account account = financialTransactionSearch.getAccount();
+ // first search on account dao
String accountsList = financialTransactionSearch.getAccountList();
- if (account != null) {
- query.addEquals("E.account", account);
- } else if (accountsList != null) {
+ List<Account> accounts = null;
+ if (accountsList != null) {
AccountDAO accountDAO = getDaoHelper().getAccountDAO();
- List<Account> accounts =
- accountDAO.stringToListAccounts(accountsList, false);
- StringBuffer accountNumbers = new StringBuffer("0,");
- int max = accounts.size();
- for (int i = 1; i <= max; i++) {
- accountNumbers.append(accounts.get(i - 1).getAccountNumber());
- if (i != max) {
- accountNumbers.append(",");
- }
- }
- if (accounts.size() > 0) {
- query.addWhere("E." + accountNumberProperty + " in (" + accountNumbers + ")");
- }
-
+ accounts = accountDAO.stringToListAccounts(accountsList, false);
}
- EntryBook entryBook = financialTransactionSearch.getEntryBook();
- String amount = financialTransactionSearch.getAmount();
- String amount2 = financialTransactionSearch.getAmount2();
- String operator = financialTransactionSearch.getOperator();
- FinancialStatementWayEnum fStWayEnum = financialTransactionSearch.getAmountWayEnum();
- if (entryBook != null) {
- query.addEquals("T." + FinancialTransaction.PROPERTY_ENTRY_BOOK, entryBook);
- }
- if (amount != null) {
- if (amount2 != null) {
- BigDecimal value1 = new BigDecimal(amount);
- BigDecimal value2 = new BigDecimal(amount2);
- query.addBetween("E.amount", value1, value2);
- } else if (operator != null) {
- query.addWhere("E.amount" + " " + operator + " " + amount);
- }
- switch (fStWayEnum) {
- case CREDIT:
- query.addEquals("E.debit", false);
- break;
- case DEBIT:
- query.addEquals("E.debit", true);
- break;
- }
- }
- financialTransactions = financialTransactionDAO.findAllByQuery(query);
+ // next on financial transaction dao
+ FinancialTransactionDAO financialTransactionDAO = getDaoHelper().getFinancialTransactionDAO();
+ List<FinancialTransaction> financialTransactions = financialTransactionDAO.searchFinancialTransaction(
+ financialTransactionSearch, accounts);
+
+ // merge result with sub entries
EntryDAO entryDAO = getDaoHelper().getEntryDAO();
for (FinancialTransaction financialTransaction : financialTransactions) {
result.add(financialTransaction);
- TopiaQuery query2 = entryDAO.createQuery();
- query2.addEquals(Entry.PROPERTY_FINANCIAL_TRANSACTION, financialTransaction);
- List<Entry> entries = entryDAO.findAllByQuery(query2);
+ List<Entry> entries = entryDAO.findAllByFinancialTransaction(financialTransaction);
result.addAll(entries);
}
} catch (Exception ex) {
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 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -67,7 +67,6 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
/**
* Gestion des exercices.
@@ -201,11 +200,8 @@
try {
FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
- TopiaQuery query = fiscalPeriodDAO.createQuery();
- query.addOrderDesc(FiscalPeriod.PROPERTY_END_DATE);
-
//get the last fiscal period
- result = fiscalPeriodDAO.findByQuery(query);
+ result = fiscalPeriodDAO.getLastFiscalPeriod();
} catch (Exception ex) {
throw new LimaException("Can't get period", ex);
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 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -46,10 +46,7 @@
import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.VatStatement;
import org.chorem.lima.entity.VatStatementDAO;
-import org.chorem.lima.entity.VatStatementImpl;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
/**
* Permet d'implémenter le plan de la déclaration de TVA
@@ -125,12 +122,8 @@
try {
VatStatementDAO vatStatementDAO = getDaoHelper().getVatStatementDAO();
-
- TopiaQuery query = vatStatementDAO.createQuery();
- query.addEquals("masterVatStatement", masterVatStatement)
- .addOrder(VatStatement.TOPIA_CREATE_DATE);
- vatStatements = vatStatementDAO.findAllByQuery(query);
- } catch (Exception ex) {
+ vatStatements = vatStatementDAO.getChildrenVatStatement(masterVatStatement);
+ } catch (TopiaException ex) {
throw new LimaException("Can't get vat statements", ex);
}
return vatStatements;
@@ -145,7 +138,7 @@
VatStatementDAO vatStatementHeaderDAO = getDaoHelper().getVatStatementDAO();
//update
vatStatementHeaderDAO.update(vatStatement);
- } catch (Exception ex) {
+ } catch (TopiaException ex) {
throw new LimaException("Can't update vat statement", ex);
}
}
@@ -212,24 +205,10 @@
try {
VatStatementDAO vatStatementDAO = getDaoHelper().getVatStatementDAO();
- TopiaQuery query = vatStatementDAO.createQuery();
+ VatStatement vatStatement2 = vatStatementDAO.findVatStatementByLabel(vatStatement.getLabel());
- String labelProperty =
- TopiaQuery.getProperty(VatStatement.PROPERTY_LABEL);
-
- //not to be used causing query exception with ' character
- //query.addWhere(labelProperty + " " + Op.LIKE + " '%" +
- // vatStatement.getLabel() + "%'");
-
- query.addWhere(labelProperty, Op.LIKE, vatStatement.getLabel());
- query.setMaxResults(1);
-
- log.debug("query to find account by VAT " + query);
-
- List<VatStatement> vatStatementsList = vatStatementDAO.findAllByQuery(query);
-
- if (vatStatementsList.size() > 0) {
- accountNumbersList = vatStatementsList.get(0).getAccounts();
+ if (vatStatement2 != null) {
+ accountNumbersList = vatStatement2.getAccounts();
}
} catch (TopiaException ex) {
throw new LimaException("Can't find accountNumber by vatStatement", ex);
@@ -275,32 +254,13 @@
@Override
public VatStatement findVatStatementByString(String label) throws LimaException {
- VatStatement vatStatement = new VatStatementImpl();
+ VatStatement vatStatement = null;
try {
VatStatementDAO vatStatementDAO = getDaoHelper().getVatStatementDAO();
- TopiaQuery query = vatStatementDAO.createQuery();
+ vatStatement = vatStatementDAO.findVatStatementByLabel(label);
- String labelProperty =
- TopiaQuery.getProperty(VatStatement.PROPERTY_LABEL);
-
- //not to be used causing query exception with ' character
- //query.addWhere(labelProperty + " " + Op.LIKE + " '%" +
- // vatStatement.getLabel() + "%'");
-
- query.addWhere(labelProperty, Op.LIKE, label);
- query.setMaxResults(1);
-
- log.debug("query to find account by VAT " + query);
-
- List<VatStatement> vatStatementsList =
- vatStatementDAO.findAllByQuery(query);
-
- if (vatStatementsList.size() > 0) {
- vatStatement = vatStatementsList.get(0);
- }
-
} catch (TopiaException ex) {
throw new LimaException("Can't find vatstatement", ex);
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/TestAccountingRules.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/TestAccountingRules.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/TestAccountingRules.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -32,7 +32,6 @@
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.junit.Ignore;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
import java.util.ArrayList;
import java.util.Calendar;
@@ -73,10 +72,7 @@
//Checks if is not the first fiscalperiod to create
if (fiscalPeriodDAO.count() != 0) {
- TopiaQuery query = fiscalPeriodDAO.createQuery();
- query.addOrderDesc(FiscalPeriod.PROPERTY_END_DATE);
- //get the last fiscal period
- FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.findByQuery(query);
+ FiscalPeriod lastFiscalPeriod = fiscalPeriodDAO.getLastFiscalPeriod();
//check the new fiscal period adjoining the last
Date dateLastFiscalPeriod = lastFiscalPeriod.getEndDate();
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -161,11 +161,6 @@
}
//search all account start with accountnumber
else {
- /*TopiaQuery query = createQuery();
- String subAccountsProperty = TopiaQuery.getProperty(Account.PROPERTY_SUB_ACCOUNTS);
- query.addWhere("not exists elements (" + subAccountsProperty + ")")
- .addWhere(Account.PROPERTY_ACCOUNT_NUMBER, Op.LIKE, s + "%");
- List<Account> accountsResult = (List<Account>) findAllByQuery(query);*/
String query = "FROM " + Account.class.getName() + " a WHERE NOT IN (" +
"FROM " + Account.class.getName() + " b where b.accountNumber like a.accountNumber+'%')" +
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -115,7 +115,7 @@
" WHERE :begindate <= financialPeriod.beginDate " +
" AND financialPeriod.beginDate <= :endDate" +
" ORDER BY entryBook.code";
- return context.find(query, 0d, 0d, "beginDate", beginDate, "endDate", endDate);
+ return context.find(query, "beginDate", beginDate, "endDate", endDate);
}
/**
@@ -135,7 +135,7 @@
" WHERE :begindate <= financialPeriod.beginDate " +
" AND financialPeriod.beginDate <= :endDate" +
" AND entryBook = :entryBook";
- return context.find(query, 0d, 0d, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook);
+ return context.find(query, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook);
}
/**
@@ -156,7 +156,23 @@
" AND financialPeriod.beginDate <= :endDate" +
" AND entryBook = :entryBook" +
" AND locked = true";
- return context.find(query, 0d, 0d, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook);
+ return context.find(query, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook);
}
+ /**
+ * Retourne les ClosedPeriodicEntryBook clos de toutes les exercive encore ouvert.
+ *
+ * @return les ClosedPeriodicEntryBook
+ * @throws TopiaException
+ */
+ public List<ClosedPeriodicEntryBook> findAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws TopiaException {
+ String query = "FROM " + ClosedPeriodicEntryBook.class.getName() + " C" +
+ ", " + FiscalPeriod.class.getName() + " F" +
+ " WHERE E.financialPeriod IN ELEMENTS (F.financialPeriod)" +
+ " ORDER BY E.financialPeriod.beginDate";
+
+ List<ClosedPeriodicEntryBook> result = context.find(query);
+ return result;
+ }
+
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialPeriodDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -67,11 +67,43 @@
String query = "FROM " + FinancialPeriod.class.getName() +
" WHERE :beginDate <= beginDate" +
- " AND beginDate <= :endDate";
+ " AND beginDate <= :endDate" +
+ " ORDER by beginDate";
// add unique result here
List<FinancialPeriod> financialPeriod = context.find(query, "beginDate", beginDate, "endDate", endDate);
return financialPeriod;
}
+ /**
+ * Retourne toutes les periodes ordonnées par date de debut de periode.
+ *
+ * @return all period ordered
+ * @throws TopiaException
+ */
+ public List<FinancialPeriod> findAllOrderByBeginDate() throws TopiaException {
+ String query = "FROM " + FinancialPeriod.class.getName() +
+ " ORDER BY beginDate";
+
+ // add unique result here
+ List<FinancialPeriod> financialPeriod = context.find(query);
+ return financialPeriod;
+ }
+
+ /**
+ * Retourne toutes les periodes ordonnées par date de debut de periode.
+ *
+ * @return all period ordered
+ * @throws TopiaException
+ */
+ public List<FinancialPeriod> findAllUnlockedOrderByBeginDate() throws TopiaException {
+ String query = "FROM " + FinancialPeriod.class.getName() +
+ " WHERE locked = false" +
+ " ORDER BY beginDate";
+
+ // add unique result here
+ List<FinancialPeriod> financialPeriod = context.find(query);
+ return financialPeriod;
+ }
+
}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -0,0 +1,66 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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 java.util.List;
+
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Ajout de requetes specifiques aux {@link FinancialStatement} sur le DAO.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FinancialStatementDAOImpl<E extends FinancialStatement> extends FinancialStatementDAOAbstract<FinancialStatement> {
+
+ /**
+ * Find all {@code FinancialStatement} ordered by topia create date.
+ * @throws TopiaException
+ */
+ public List<FinancialStatement> findAllOrderedByCreateDate() throws TopiaException {
+ String query = "FROM " + FinancialStatement.class.getName() +
+ " ORDER BY " + FinancialStatement.TOPIA_CREATE_DATE;
+ List<FinancialStatement> result = context.find(query);
+ return result;
+ }
+
+ /**
+ * Find all {@code FinancialStatement} ordered by topia create date.
+ * @throws TopiaException
+ */
+ public List<FinancialStatement> findChildrenFinancialStatement(FinancialStatement financialStatement) throws TopiaException {
+ String query = "FROM " + FinancialStatement.class.getName() +
+ " WHERE masterFinancialStatement = :masterFinancialStatement" +
+ " ORDER BY " + FinancialStatement.TOPIA_CREATE_DATE;
+ List<FinancialStatement> result = context.find(query, "masterFinancialStatement", financialStatement);
+ return result;
+ }
+
+} //FinancialStatementDAO
Property changes on: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -25,9 +25,14 @@
package org.chorem.lima.entity;
+import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.apache.commons.collections.CollectionUtils;
+import org.chorem.lima.FinancialStatementWayEnum;
+import org.chorem.lima.beans.FinancialTransactionSearch;
import org.nuiton.topia.TopiaException;
/**
@@ -239,4 +244,123 @@
return result;
}
+ /**
+ * Search financial transaction.
+ *
+ * @param financialTransactionSearch search parameters
+ * @param accounts search accounts
+ * @return financial transaction
+ * @throws TopiaException
+ */
+ public List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch,
+ List<Account> accounts) throws TopiaException {
+ String query = "SELECT T FROM " + FinancialTransaction.class.getName() + " T"+
+ " LEFT JOIN T.entry AS E" +
+ " WHERE TRUE "; // to not manage first where in all condition
+
+ List<Object> args = new ArrayList<Object>();
+
+ // dates
+ Date beginDate = financialTransactionSearch.getBeginDate();
+ Date endDate = financialTransactionSearch.getEndDate();
+ if (beginDate != null && endDate != null) {
+ query += " AND :beginDate <= T.transactionDate" +
+ " AND T.transactionDate <= :endDate";
+ args.add("beginDate");
+ args.add(beginDate);
+ args.add("endDate");
+ args.add(endDate);
+ } else if (beginDate != null) {
+ query += " AND :beginDate = T.transactionDate";
+ args.add(beginDate);
+ args.add("beginDate");
+ }
+
+ // voucher
+ String voucher = financialTransactionSearch.getVoucher();
+ if (voucher != null) {
+ query += " AND E.voucher LIKE :voucher";
+ args.add("voucher");
+ args.add("%" + voucher + "%");
+ }
+
+ // description
+ String description = financialTransactionSearch.getDescription();
+ if (description != null) {
+ query += " AND E.description LIKE :description";
+ args.add("description");
+ args.add("%" + description + "%");
+ }
+
+ // letter
+ String lettering = financialTransactionSearch.getLettering();
+ if (lettering != null) {
+ query += " AND E.lettering = :lettering";
+ args.add("lettering");
+ args.add("%" + lettering + "%");
+ }
+
+ // accounts
+ Account account = financialTransactionSearch.getAccount();
+ String accountsList = financialTransactionSearch.getAccountList();
+ if (account != null) {
+ query += " AND E.account = :account";
+ args.add("account");
+ args.add(account);
+ } else if (CollectionUtils.isNotEmpty(accounts)) {
+ StringBuffer accountNumbers = new StringBuffer();
+ for (int i = 0; i < accounts.size(); i++) {
+ accountNumbers.append(accounts.get(i - 1).getAccountNumber());
+ if (i < accounts.size() - 1) {
+ accountNumbers.append(",");
+ }
+ }
+ if (accounts.size() > 0) {
+ query += " AND E.accountNumber in (" + accountNumbers + ")";
+ }
+
+ }
+
+ // entry book
+ EntryBook entryBook = financialTransactionSearch.getEntryBook();
+ if (entryBook != null) {
+ query += " AND T." + FinancialTransaction.PROPERTY_ENTRY_BOOK + " = :entryBook";
+ args.add("entryBook");
+ args.add(entryBook);
+ }
+
+ // amounts
+ String amount = financialTransactionSearch.getAmount();
+ String amount2 = financialTransactionSearch.getAmount2();
+ String operator = financialTransactionSearch.getOperator();
+ FinancialStatementWayEnum fStWayEnum = financialTransactionSearch.getAmountWayEnum();
+ if (amount != null) {
+ if (amount2 != null) {
+ BigDecimal value1 = new BigDecimal(amount);
+ BigDecimal value2 = new BigDecimal(amount2);
+ query += " AND :amount <= E.amount AND E.amount <= :amount2";
+ args.add("amount");
+ args.add(amount);
+ args.add("amount2");
+ args.add(amount2);
+ } else if (operator != null) {
+ query += " AND E.amount " + operator + " :amount";
+ args.add("amount");
+ args.add(amount);
+ }
+ switch (fStWayEnum) {
+ case CREDIT:
+ query += " AND E.debit = false";
+ break;
+ case DEBIT:
+ query += " AND E.debit = true";
+ break;
+ }
+ }
+
+ // perform query
+ List<FinancialTransaction> result = context.find(query, args.toArray());
+ return result;
+ }
+
} //FinancialTransactionDAO
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FiscalPeriodDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FiscalPeriodDAOImpl.java 2012-05-28 08:33:31 UTC (rev 3431)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FiscalPeriodDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -74,4 +74,43 @@
}
return result;
}
+
+ /**
+ * Get last fiscal period (higher end date).
+ *
+ * @return last fiscal period
+ * @throws TopiaException
+ */
+ public FiscalPeriod getLastFiscalPeriod() throws TopiaException {
+ String query = "FROM " + FiscalPeriod.class.getName() +
+ " ORDER BY endDate";
+
+ List<FiscalPeriod> fiscalPeriods = context.find(query);
+ FiscalPeriod result = null;
+ if (!fiscalPeriods.isEmpty()) {
+ result = fiscalPeriods.get(0);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get last non locked fiscal period (higher end date).
+ *
+ * @return last fiscal period
+ * @throws TopiaException
+ */
+ public FiscalPeriod getLastUnlockedFiscalPeriod() throws TopiaException {
+ String query = "FROM " + FiscalPeriod.class.getName() +
+ " WHERE locked = false" +
+ " ORDER BY endDate";
+
+ List<FiscalPeriod> fiscalPeriods = context.find(query);
+ FiscalPeriod result = null;
+ if (!fiscalPeriods.isEmpty()) {
+ result = fiscalPeriods.get(0);
+ }
+
+ return result;
+ }
}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java 2012-05-30 10:33:35 UTC (rev 3432)
@@ -0,0 +1,90 @@
+/*
+ * #%L
+ * Lima callao
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * 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 java.util.List;
+
+import org.nuiton.topia.TopiaException;
+
+
+/**
+ * Ajout de requetes specifiques aux {@code VatStatement} sur le DAO.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class VatStatementDAOImpl<E extends VatStatement> extends VatStatementDAOAbstract<VatStatement> {
+
+ /**
+ * Find all {@code VatStatement} ordered by topia create date.
+ * @throws TopiaException
+ */
+ public List<VatStatement> findAllOrderedByCreateDate() throws TopiaException {
+ String query = "FROM " + VatStatement.class.getName() +
+ " ORDER BY " + VatStatement.TOPIA_CREATE_DATE;
+ List<VatStatement> result = context.find(query);
+ return result;
+ }
+
+ /**
+ * Get masterVatStatement children statement.
+ *
+ * @param masterVatStatement master VatStatement
+ * @return children VatStatement
+ * @throws TopiaException
+ */
+ public List<VatStatement> getChildrenVatStatement(VatStatement masterVatStatement) throws TopiaException {
+ String query = "FROM " + VatStatement.class.getName() +
+ " WHERE masterVatStatement = :masterVatStatement" +
+ " ORDER BY " + VatStatement.TOPIA_CREATE_DATE;
+ List<VatStatement> result = context.find(query, "masterVatStatement", masterVatStatement);
+ return result;
+ }
+
+ /**
+ * Recherche un statement par equivalence de label.
+ *
+ * TODO voir a quoi ca sert vraiment.
+ *
+ * @param label label
+ * @return statement like label
+ * @throws TopiaException
+ */
+ public VatStatement findVatStatementByLabel(String label) throws TopiaException {
+ String query = "FROM " + VatStatement.class.getName() +
+ " WHERE label LIKE :label";
+ List<VatStatement> statements = context.find(query, "label", "%" + label + "%");
+ VatStatement result = null;
+ if (!statements.isEmpty()) {
+ result = statements.get(0);
+ }
+ return result;
+ }
+
+} //VatStatementDAO
Property changes on: trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
Author: maven-release
Date: 2012-05-28 10:33:31 +0200 (Mon, 28 May 2012)
New Revision: 3431
Url: http://chorem.org/repositories/revision/lima/3431
Log:
updates to mavenpom 3.3.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-05-16 15:50:57 UTC (rev 3430)
+++ trunk/pom.xml 2012-05-28 08:33:31 UTC (rev 3431)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.3.1</version>
+ <version>3.3.2</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r3430 - in trunk/lima-swing/src/main/java/org/chorem/lima: ui/financialstatementchart ui/financialtransactionsearch ui/fiscalperiod util
by echatellier@users.chorem.org 16 May '12
by echatellier@users.chorem.org 16 May '12
16 May '12
Author: echatellier
Date: 2012-05-16 17:50:57 +0200 (Wed, 16 May 2012)
New Revision: 3430
Url: http://chorem.org/repositories/revision/lima/3430
Log:
Remove another "helper" class.
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
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 2012-05-16 14:25:36 UTC (rev 3429)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2012-05-16 15:50:57 UTC (rev 3430)
@@ -27,7 +27,10 @@
import static org.nuiton.i18n.I18n._;
+import java.awt.Component;
+
import javax.swing.JOptionPane;
+import javax.swing.JTextArea;
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
@@ -41,8 +44,9 @@
import org.chorem.lima.enums.ImportExportEnum;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.importexport.ImportExport;
-import org.chorem.lima.util.DialogHelper;
+import org.chorem.lima.util.ReportDialogView;
import org.jdesktop.swingx.JXTreeTable;
+import org.nuiton.util.Resource;
/**
* Handler associated with account view.
@@ -244,8 +248,26 @@
public void financialStatementChartCheck() {
String result = financialStatementService.checkFinancialStatementChart();
- DialogHelper.showReportDialog(result, _("lima.financialstatement.check"), view);
+ showReportDialog(result, _("lima.financialstatement.check"), view);
}
+
+ /**
+ * 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();
+ reportDialogView.setIconImage(Resource.getIcon("icons/lima.png").getImage());
+ JTextArea textArea = reportDialogView.getTextArea();
+ textArea.setText(message);
+ reportDialogView.setSize(600, 400);
+ reportDialogView.setTitle(title);
+ reportDialogView.setLocationRelativeTo(parent);
+ reportDialogView.setVisible(true);
+ }
@Override
public void notifyMethod(String serviceName, String methodName) {
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 2012-05-16 14:25:36 UTC (rev 3429)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-05-16 15:50:57 UTC (rev 3430)
@@ -45,7 +45,6 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.chorem.lima.util.DialogHelper;
/**
* Handler associated with financial transaction view.
@@ -206,19 +205,12 @@
if (response == JOptionPane.YES_OPTION) {
- try {
- tableModel.removeObject(selectedValue, indexSelectedRow);
- //select the upper line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow - 1, indexSelectedRow - 1);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't remove transaction or entry", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }
+ tableModel.removeObject(selectedValue, indexSelectedRow);
+ //select the upper line
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow - 1, indexSelectedRow - 1);
}
} else {
if (log.isWarnEnabled()) {
@@ -238,24 +230,17 @@
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
- try {
- //copy + paste the description
- String description = (String) tableModel.getValueAt(indexSelectedRow, 4);
- int index = tableModel.addEmptyEntry(selectedValue, description, indexSelectedRow);
- //select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow + 1, indexSelectedRow + 1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add emptyentry", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }
+ //copy + paste the description
+ String description = (String) tableModel.getValueAt(indexSelectedRow, 4);
+ int index = tableModel.addEmptyEntry(selectedValue, description, indexSelectedRow);
+ //select the new line
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
} else {
if (log.isWarnEnabled()) {
log.warn("Call addentry selected transaction without selection");
@@ -282,22 +267,15 @@
if (indexSelectedRow != -1) {
Object selectedValue = tableModel.getElementAt(indexSelectedRow);
if (clipBoard instanceof Entry) {
- try {
- int index = tableModel.addEntry(selectedValue, (Entry) clipBoard, indexSelectedRow);
- //select the new line
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(
- indexSelectedRow + 1, indexSelectedRow + 1);
- //focus on second column
- table.changeSelection(index, 1, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't past entry", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }
+ int index = tableModel.addEntry(selectedValue, (Entry) clipBoard, indexSelectedRow);
+ //select the new line
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(
+ indexSelectedRow + 1, indexSelectedRow + 1);
+ //focus on second column
+ table.changeSelection(index, 1, false, false);
+ table.requestFocusInWindow();
}
}
@@ -310,22 +288,15 @@
table = view.getFinancialTransactionSearchTable();
tableModel = view.getFinancialTransactionSearchTableModel();
- try {
- int index = tableModel.addFinancialTransaction();
- //select the new line
- int numberRow = table.getRowCount();
- ListSelectionModel selectionModel =
- table.getSelectionModel();
- selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1);
- //focus on first column
- table.changeSelection(index, 0, false, false);
- table.requestFocusInWindow();
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add financialtransaction", eee);
- }
- DialogHelper.showErrorMessageDialog(view, eee);
- }
+ int index = tableModel.addFinancialTransaction();
+ //select the new line
+ int numberRow = table.getRowCount();
+ ListSelectionModel selectionModel =
+ table.getSelectionModel();
+ selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1);
+ //focus on first column
+ table.changeSelection(index, 0, false, false);
+ table.requestFocusInWindow();
}
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 2012-05-16 14:25:36 UTC (rev 3429)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2012-05-16 15:50:57 UTC (rev 3430)
@@ -48,7 +48,6 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.util.DialogHelper;
import org.jdesktop.swingx.JXTable;
import org.nuiton.util.DateUtil;
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-05-16 14:25:36 UTC (rev 3429)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2012-05-16 15:50:57 UTC (rev 3430)
@@ -1,97 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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 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.util;
-
-import org.nuiton.util.Resource;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTextArea;
-import java.awt.Component;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author ore
- * @author Rémi Chapelet
- * @deprecated with no replacement, use JOptionPane directly
- */
-@Deprecated
-public class DialogHelper {
-
- /**
- * Use instead: JOptionPane.showMessageDialog (String message,String titre,int type)
- * <p/>
- * for e.g:
- * JOptionPane.showMessageDialog(
- * view,
- * _("lima.importexport.export.terminated"),
- * _("lima.importexport.export"),
- * JOptionPane.INFORMATION_MESSAGE);
- *
- * @param message
- * @deprecated since 0.5, prefer use the method {@link #showErrorMessageDialog(Component, Throwable)}
- */
- @Deprecated
- public static void showMessageDialog(String message) {
- JFrame f = new JFrame();
- f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JOptionPane.showMessageDialog(
- f,
- message,
- _("lima.common.error"),
- JOptionPane.ERROR_MESSAGE);
- f.dispose();
- }
-
- public static void showErrorMessageDialog(Component view, Throwable e) {
- JOptionPane.showMessageDialog(
- view,
- e.getMessage(),
- _("lima.common.error"),
- JOptionPane.ERROR_MESSAGE);
- }
-
- /**
- * Permet d'afficher une boite de dialogue avec rapport
- *
- * @param message
- * @param parent
- * @param title
- */
- public static void showReportDialog(String message, String title, Component parent) {
- ReportDialogView reportDialogView = new ReportDialogView();
- reportDialogView.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JTextArea textArea = reportDialogView.getTextArea();
- textArea.setText(message);
- reportDialogView.setSize(600, 400);
- reportDialogView.setTitle(title);
- reportDialogView.setLocationRelativeTo(parent);
- reportDialogView.setVisible(true);
- }
-
-
-}
1
0
r3429 - in trunk/lima-business-api: . src/main/java/org/chorem/lima/business
by echatellier@users.chorem.org 16 May '12
by echatellier@users.chorem.org 16 May '12
16 May '12
Author: echatellier
Date: 2012-05-16 16:25:36 +0200 (Wed, 16 May 2012)
New Revision: 3429
Url: http://chorem.org/repositories/revision/lima/3429
Log:
Declare exception as ApplicationException to not being imbricated into EJBException
Modified:
trunk/lima-business-api/pom.xml
trunk/lima-business-api/src/main/java/org/chorem/lima/business/LimaException.java
Modified: trunk/lima-business-api/pom.xml
===================================================================
--- trunk/lima-business-api/pom.xml 2012-05-16 13:55:59 UTC (rev 3428)
+++ trunk/lima-business-api/pom.xml 2012-05-16 14:25:36 UTC (rev 3429)
@@ -21,6 +21,11 @@
<artifactId>lima-callao</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<!-- ************************************************************* -->
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/LimaException.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/LimaException.java 2012-05-16 13:55:59 UTC (rev 3428)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/LimaException.java 2012-05-16 14:25:36 UTC (rev 3429)
@@ -25,6 +25,8 @@
package org.chorem.lima.business;
+import javax.ejb.ApplicationException;
+
/**
* Lima exception.
*
@@ -34,6 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
+@ApplicationException
public class LimaException extends RuntimeException {
/**
1
0