Cash-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
- 70 discussions
r23 - in branches/alpha3-periodicity: . cash-business/src/main/java/org/chorem/cash/impl
by fdesbois@users.chorem.org 26 Aug '09
by fdesbois@users.chorem.org 26 Aug '09
26 Aug '09
Author: fdesbois
Date: 2009-08-26 12:25:57 +0200 (Wed, 26 Aug 2009)
New Revision: 23
Modified:
branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
branches/alpha3-periodicity/pom.xml
Log:
Change mavenpom and nuiton libraries versions
Modified: branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
===================================================================
--- branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-24 09:38:34 UTC (rev 22)
+++ branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-26 10:25:57 UTC (rev 23)
@@ -3,7 +3,7 @@
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
+ * it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
@@ -12,9 +12,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
- * You should have received a copy of the GNU General Public
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
*/
package org.chorem.cash.impl;
Modified: branches/alpha3-periodicity/pom.xml
===================================================================
--- branches/alpha3-periodicity/pom.xml 2009-08-24 09:38:34 UTC (rev 22)
+++ branches/alpha3-periodicity/pom.xml 2009-08-26 10:25:57 UTC (rev 23)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
</parent>
<groupId>org.chorem</groupId>
@@ -132,9 +132,14 @@
<packaging>pom</packaging>
<properties>
+
+ <!-- Redmine configuration -->
+ <projectId>cash</projectId>
+ <platform>chorem.org</platform>
+
<!-- Nuiton librairies -->
- <topia.version>2.2.0-rc-5-SNAPSHOT</topia.version>
- <generator.version>1.0.0-rc-3</generator.version>
+ <topia.version>2.2.0</topia.version>
+ <generator.version>1.0.0</generator.version>
<jrst.version>1.0.0</jrst.version>
<!-- ChoReg -->
@@ -181,59 +186,6 @@
<url>http://www.chorem.org/repositories/browse/cash/trunk</url>
</scm>
- <issueManagement>
- <system>redmine</system>
- <url>http://www.chorem.org/projects/cash/issues</url>
- </issueManagement>
-
- <ciManagement>
- <system>hudson</system>
- <url>http://hudson.chorem.org</url>
- </ciManagement>
-
- <!--Any mailing lists for the project-->
- <mailingLists>
- <mailingList>
- <name>cash-commits</name>
- <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</subscribe>
- <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</unsubscribe>
- <post>cash-commits(a)$list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-commits/</archive>
- </mailingList>
-
- <mailingList>
- <name>cash-devel</name>
- <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</subscribe>
- <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</unsubscribe>
- <post>cash-devel(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-devel/</archive>
- </mailingList>
-
- <mailingList>
- <name>cash-users</name>
- <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</subscribe>
- <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</unsubscribe>
- <post>cash-users(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-users/</archive>
- </mailingList>
- </mailingLists>
-
- <!--Distribution-->
- <distributionManagement>
- <repository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/release</url>
- </repository>
- <snapshotRepository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/snapshot</url>
- </snapshotRepository>
- <site>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/redmine-chorem/project-site/cash</url>
- </site>
- </distributionManagement>
-
<repositories>
<!-- depot des releases nuiton -->
<repository>
1
0
Author: fdesbois
Date: 2009-08-24 11:38:34 +0200 (Mon, 24 Aug 2009)
New Revision: 22
Added:
branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/FrequencyEndCondition.java
branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/SubmitContext.java
Removed:
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/cancel.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/address.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/address2.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/apply.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/blabla.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/cellphone.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/delete.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/email.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/fax.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/internet.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/internet2.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/phone.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/reference.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/delete.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/delete_icon.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/earth.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/edit_icon.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/first.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/iaction.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/last.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/maximize.gif
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/mini_cross.gif
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/mini_tick.gif
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/minimize.gif
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movedown.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movetobottom.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movetotop.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/moveup.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/next.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/previous.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/tick.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/pollen.png
Modified:
branches/alpha3-periodicity/cash-business/pom.xml
branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
branches/alpha3-periodicity/cash-business/src/main/xmi/cash.zargo
branches/alpha3-periodicity/cash-ui/nbactions.xml
branches/alpha3-periodicity/cash-ui/pom.xml
branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/ListEntries.java
branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/EntryForm.java
branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.properties
branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.tml
branches/alpha3-periodicity/cash-ui/src/main/webapp/META-INF/context.xml
branches/alpha3-periodicity/cash-ui/src/main/webapp/PreviewTable.tml
branches/alpha3-periodicity/cash-ui/src/main/webapp/css/common.css
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/add.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/cancel.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/clock.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/edit.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/info.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movedown.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movetobottom.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movetotop.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/moveup.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/reload.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/remove.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/save.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/showdetails.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/stop.png
branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/warning.png
branches/alpha3-periodicity/pom.xml
Log:
Change icons size and other stuff for UI
Modified: branches/alpha3-periodicity/cash-business/pom.xml
===================================================================
--- branches/alpha3-periodicity/cash-business/pom.xml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-business/pom.xml 2009-08-24 09:38:34 UTC (rev 22)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.chorem</groupId>
<artifactId>cash</artifactId>
- <version>1.0.0-alpha-2-SNAPSHOT</version>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.chorem.cash</groupId>
Modified: branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
===================================================================
--- branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-24 09:38:34 UTC (rev 22)
@@ -26,30 +26,20 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.cash.CashException;
import org.chorem.cash.CashModelDAOHelper;
import org.chorem.cash.ContextUtilCash;
import org.chorem.cash.business.EntryHelper;
-import org.chorem.cash.business.PeriodicHelper;
-import org.chorem.cash.business.PeriodicHelperByMonth;
import org.chorem.cash.business.Periodicity;
-import org.chorem.cash.business.ReferenceHelper;
-import org.chorem.cash.dto.Category;
import org.chorem.cash.dto.Entry;
import org.chorem.cash.dto.Reference;
-import org.chorem.cash.persistence.CategoryEntity;
-import org.chorem.cash.persistence.CategoryEntityDAO;
import org.chorem.cash.persistence.EntryEntity;
import org.chorem.cash.persistence.EntryEntityDAO;
import org.chorem.cash.persistence.EntryFrequencyEntity;
import org.chorem.cash.services.ServiceEntry;
import org.chorem.cash.services.ServiceEntryAbstract;
-import org.chorem.exceptions.ConvertException;
-import org.chorem.utils.DateUtils;
import org.chorem.utils.PeriodDates;
import org.chorem.utils.ServiceHelper;
import org.nuiton.topia.TopiaContext;
@@ -89,9 +79,9 @@
EntryFrequencyEntity frequency = oldEntry.getEntryFrequencyEntity();
- if (frequency != null && (entry.getPeriodicity() == null || "".equals(entry.getPeriodicity()))) { // Entite anciennement periodique mais l'entree courante devient indépendante
+ if (frequency != null && (entry.getFrequencyId() == null || "".equals(entry.getFrequencyId()))) { // Entite anciennement periodique mais l'entree courante devient indépendante
- if (frequency.getUnlimited()) { // Cas illimite : une seule entite en base
+ if (frequency.getUnlimited()) { // Cas illimite
// On recupere l'ancienne version de l'entite (avec sa frequence)
Calendar calendar = new GregorianCalendar();
@@ -117,6 +107,9 @@
newAfterEntry.setEntryDate(calendar.getTime());
EntryHelper.createUpdateEntry(newAfterEntry, transaction, log);
+
+ entry.setFrequencyId("");
+ entry.setPeriodicity("");
} else if (frequency.getNbTimes() > 0) {
}
@@ -197,7 +190,42 @@
return result;
}
+ /**
+ * FIXME clone entry
+ * @param entry
+ * @return
+ */
@Override
+ public Entry getNewEntry(Entry entry) {
+ Entry result = new Entry();
+ result.setId(entry.getId());
+ result.setLibelle(entry.getLibelle());
+ result.setCategory(entry.getCategory());
+ result.setAmount(entry.getAmount());
+ result.setComment(entry.getComment());
+ result.setEntryDate(entry.getEntryDate());
+
+ result.setReferences(new ArrayList<Reference>(entry.getReferences())); // Clone references ?
+
+ // principal for frequency
+ result.setFrequencyId(entry.getFrequencyId());
+ result.setCurrentDate(entry.getCurrentDate());
+
+ // for frequency
+ result.setPeriodicity(entry.getPeriodicity());
+ result.setInterval(entry.getInterval());
+ result.setNbTimes(entry.getNbTimes());
+ result.setUnlimited(entry.getUnlimited());
+ result.setDay(entry.getDay());
+ result.setDayOfWeek(entry.getDayOfWeek());
+
+ // for ui
+ result.setShowFrequency(entry.getShowFrequency());
+
+ return result;
+ }
+
+ @Override
public Map<String, List<Entry>> getEntriesBetweenDates(PeriodDates period) throws CashException {
TopiaContext transaction = null;
Map<String, List<Entry>> results = new HashMap<String, List<Entry>>();
Modified: branches/alpha3-periodicity/cash-business/src/main/xmi/cash.zargo
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/nbactions.xml
===================================================================
--- branches/alpha3-periodicity/cash-ui/nbactions.xml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/nbactions.xml 2009-08-24 09:38:34 UTC (rev 22)
@@ -4,6 +4,8 @@
<actionName>CUSTOM-Tomcat embedded</actionName>
<displayName>Tomcat embedded</displayName>
<goals>
+ <goal>clean</goal>
+ <goal>install</goal>
<goal>tomcat:run</goal>
<goal>-Dtapestry.compress-whitespace=false</goal>
<goal>-Dorg.apache.tapestry.disable-caching=true</goal>
Modified: branches/alpha3-periodicity/cash-ui/pom.xml
===================================================================
--- branches/alpha3-periodicity/cash-ui/pom.xml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/pom.xml 2009-08-24 09:38:34 UTC (rev 22)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.chorem</groupId>
<artifactId>cash</artifactId>
- <version>1.0.0-alpha-2-SNAPSHOT</version>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.chorem.cash</groupId>
Added: branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/FrequencyEndCondition.java
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/FrequencyEndCondition.java (rev 0)
+++ branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/FrequencyEndCondition.java 2009-08-24 09:38:34 UTC (rev 22)
@@ -0,0 +1,33 @@
+/**
+ * *##% Ca$h Web Interface
+ * Copyright (C) 2009 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 Lesser 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>. ##%*
+ */
+
+package org.chorem.cash.ui.base;
+
+/**
+ * FrequencyEndCondition.java
+ *
+ * @author fdesbois
+ * @version $Revision: 3 $
+ *
+ * Last update: $Date: 2009-07-31 16:54:15 +0200 (ven 31 jui 2009) $
+ * by : $Author: fdesbois $
+ */
+public enum FrequencyEndCondition {
+ UNLIMITED, UNTIL_DATE, NB_TIMES
+}
Modified: branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/ListEntries.java
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/ListEntries.java 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/base/ListEntries.java 2009-08-24 09:38:34 UTC (rev 22)
@@ -25,6 +25,7 @@
import java.util.List;
import org.chorem.cash.dto.Category;
import org.chorem.cash.dto.Entry;
+import org.chorem.cash.services.ServiceEntry;
import org.chorem.utils.DateUtils;
/**
@@ -42,7 +43,7 @@
* Last update: $Date: 2009-08-13 09:14:50 +0200 (Thu, 13 Aug 2009) $
* by : $Author: fdesbois $
*/
-public class ListEntries implements Serializable {
+public class ListEntries implements Serializable, Cloneable {
private Category category;
@@ -62,6 +63,18 @@
this.libelle = "";
}
+ public ListEntries(ListEntries listEntries, ServiceEntry service) {
+ this.category = listEntries.getCategory();
+ this.month = listEntries.getMonth();
+ this.amount = listEntries.getAmount();
+ this.libelle = listEntries.getLibelle();
+ this.entries = new ArrayList<Entry>();
+ for (Entry entry : listEntries.getEntries()) {
+ Entry newEntry = service.getNewEntry(entry);
+ this.entries.add(newEntry);
+ }
+ }
+
/**
* Total calcule au moment de son acces pour permettre les mises a jour depuis formulaires.
* @return le montant total de toutes les entrees de la liste
@@ -114,12 +127,12 @@
* Suppression d'une entree
* @param entryId identifiant de l'entree a supprimer
*/
- public void removeEntry(String entryId) {
+ /*public void removeEntry(String entryId) {
Entry entry = getEntry(entryId);
if (entry != null) {
entries.remove(entry);
}
- }
+ }*/
/**
* Accesseur pour recuperer une seule entree identifier par le parametre donne.
Modified: branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/EntryForm.java
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/EntryForm.java 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/EntryForm.java 2009-08-24 09:38:34 UTC (rev 22)
@@ -21,6 +21,7 @@
import java.text.DecimalFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.InjectContainer;
@@ -33,12 +34,15 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.PageRenderLinkSource;
import org.chorem.cash.CashException;
+import org.chorem.cash.business.Periodicity;
import org.chorem.cash.dto.Entry;
import org.chorem.cash.services.ServiceEntry;
import org.chorem.cash.ui.base.DataLoader;
+import org.chorem.cash.ui.base.FrequencyEndCondition;
import org.chorem.cash.ui.base.ListEntries;
import org.chorem.cash.ui.pages.PreviewTable;
import org.chorem.cash.ui.utils.ErrorHelper;
+import org.chorem.utils.DateUtils;
import org.slf4j.Logger;
/**
@@ -68,12 +72,6 @@
private ClientMessages clientMessages;
/**
- * Page dans laquelle est utiliser le composant EntryForm. Il s'agit du tableau previsionnel afficher par mois.
- */
- @InjectContainer
- private PreviewTable previewTable;
-
- /**
* PageRender pour garder l'identifiant de la liste entries, utiliser comme contexte de la page PreviewTable.
*/
@Inject
@@ -89,8 +87,8 @@
* Parametre d'entree du composant. List des entrees fournie (et persister) par la page PreviewTable.
* Le cache est desactive pour recuperer la ListEntries depuis PreviewTable a chaque demande du composant.
*/
- @Parameter(cache = false)
- private ListEntries listEntries;
+ @Parameter(cache = false, required = true)
+ private ListEntries listEntriesParameter;
/**
* Entree courante pour affichage des lignes du formulaire
@@ -99,20 +97,23 @@
private Entry entry;
/**
- * Liste des entrees (recuperer depuis la ListEntries passe en parametre)
+ * Liste des entrees persistante pour modifications (copier de la ListEntries passe en parametre)
*/
- private List<Entry> entries;
+ @Persist
+ private ListEntries listEntries;
/**
* Flag pour detecter l'activation du bouton d'ajout d'une ligne de formulaire
*/
- private boolean addEntrySelected;
+ private boolean editSelected;
/**
* Flag pour detecter l'activation du bouton de retour en arriere (rechargement de la page PreviewTable)
*/
private boolean cancelFormSelected;
+ //private boolean clockFormSelected;
+
/**
* Formulaire pour l'ajout/modification des entrees
*/
@@ -125,6 +126,9 @@
@InjectComponent
private Zone entryFormComponent;
+ @Property
+ private int indexEntry;
+
/**
* Liste des identifiants des entrees a supprimer une fois le formulaire soumis. (sauvegarde)
*/
@@ -132,16 +136,104 @@
private List<String> entriesDeleted;
public ListEntries getListEntries() {
- return this.listEntries;
+ if (listEntries == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("GET ENTRIES FROM CONTAINER");
+ }
+ listEntries = new ListEntries(listEntriesParameter, serviceEntry);
+ }
+ return listEntries;
}
public List<Entry> getEntries() {
- if (entries == null) {
- entries = getListEntries().getEntries();
+ return getListEntries().getEntries();
+ }
+
+
+ public double getEntryAmount() {
+ return entry.getAmount();
+ }
+
+ @Log
+ public void setEntryAmount(double amount) {
+ if (!listEntries.getCategory().getCredit() && amount > 0) {
+ amount = -amount;
}
- return entries;
+ entry.setAmount(amount);
}
+ public Date getEntryDate() {
+ if (getPeriodic()) {
+ return entry.getCurrentDate();
+ }
+ return entry.getEntryDate();
+ }
+
+ public void setEntryDate(Date date) {
+ if (getPeriodic()) {
+ entry.setCurrentDate(date);
+ } else {
+ entry.setEntryDate(date);
+ }
+ }
+
+ public FrequencyEndCondition getFrequencyEndCondition() {
+ if (entry.getUnlimited()) {
+ return FrequencyEndCondition.UNLIMITED;
+ } else if (entry.getNbTimes() > 0) {
+ return FrequencyEndCondition.NB_TIMES;
+ } else if (entry.getUntilDate() != null) {
+ return FrequencyEndCondition.UNTIL_DATE;
+ }
+ return FrequencyEndCondition.UNLIMITED;
+ }
+
+ @Log
+ public void setFrequencyEndCondition(FrequencyEndCondition frequencyEnd) {
+ switch (frequencyEnd) {
+ case UNLIMITED:
+ entry.setUnlimited(true);
+ entry.setUntilDate(null);
+ entry.setNbTimes(0);
+ break;
+ case NB_TIMES:
+ entry.setUnlimited(false);
+ entry.setUntilDate(null);
+ break;
+ case UNTIL_DATE:
+ entry.setUnlimited(false);
+ entry.setNbTimes(0);
+ break;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("FREQUENCY_END : " + frequencyEnd);
+ log.debug("ENTRY : " + entry);
+ log.debug("ENTRY : unlimited=" + entry.getUnlimited() + ", untilDate=" + entry.getUntilDate() + ", nbTimes=" + entry.getNbTimes());
+ }
+ }
+
+ public FrequencyEndCondition getFrequencyUnlimited() {
+ return FrequencyEndCondition.UNLIMITED;
+ }
+
+ public FrequencyEndCondition getFrequencyUntilDate() {
+ return FrequencyEndCondition.UNTIL_DATE;
+ }
+
+ public FrequencyEndCondition getFrequencyNbTimes() {
+ return FrequencyEndCondition.NB_TIMES;
+ }
+
+ public boolean getPeriodic() {
+ return entry.getPeriodicity() != null && !entry.getPeriodicity().isEmpty();
+ }
+
+ public void setPeriodic(boolean periodic) {
+ if (!periodic) {
+ entry.setFrequencyId("");
+ }
+ }
+
/**
* Chargement des donnees du composant. Si la ListEntries provenant de PreviewTable est vide, un message est afficher a l'utilisateur
* via le composant ClientMessages.
@@ -151,26 +243,17 @@
public void loadData() {
clientMessages.clean();
entriesDeleted = new ArrayList<String>();
- if (getListEntries() != null && getEntries().size() == 0) {
+
+ // listEntries persistant different de la listEntries en parametre
+ if (listEntries != null && !listEntries.getKey().equals(listEntriesParameter.getKey())) {
+ listEntries = null;
+ }
+
+ if (getEntries().size() == 0) {
clientMessages.addInfo("Aucune entrée existante, clickez sur le + pour en ajouter une nouvelle");
}
}
- /**
- * Suppression d'une ligne de formulaire. Une entree est supprimable si elle a deja ete sauvegarde.
- * @param entryId identifiant de l'entree a supprimer.
- * @return un MultiZoneUpdate gerer par le composant ClientMessages (rafraichissement du formulaire et de la zone de messages)
- */
- @Log
- Object onActionFromRemoveEntry(String entryId) {
- clientMessages.clean();
- if (entryId != null) {
- clientMessages.addInfo("La suppression sera effective uniquement après sauvegarde");
- getListEntries().removeEntry(entryId);
- entriesDeleted.add(entryId);
- }
- return clientMessages.zoneManager("entryFormComponent", entryFormComponent.getBody());
- }
/**
* Action sur le bouton d'ajout d'une entree au formulaire. Une nouvelle entree vide est ajouter a la ListEntries.
@@ -183,36 +266,108 @@
if (log.isDebugEnabled()) {
log.debug("DATE : " + entry.getEntryDate());
}
- addEntrySelected = true;
+ editSelected = true;
}
+ @Log
+ void onSelectedFromShowPeriodicity(int index) {
+ entry = getEntries().get(index);
+
+ if (entry.getShowFrequency()) {
+ entry.setShowFrequency(false);
+ } else {
+ entry.setShowFrequency(true);
+ if (!getPeriodic()) {
+ entry.setPeriodicity(Periodicity.MONTHLY.toString());
+ entry.setCurrentDate(entry.getEntryDate());
+ }
+ }
+
+ getEntries().set(index, entry);
+ editSelected = true;
+ }
+
+
+ @Log
+ Object onChangeFromAddPeriodicity(int index, String value) { // Checkbox
+ entry = getEntries().get(index);
+
+ String periodicity = entry.getPeriodicity();
+ if (log.isDebugEnabled()) {
+ log.debug("PERIODICITY : " + periodicity);
+ }
+
+ if (entry.getShowFrequency()) {
+ entry.setShowFrequency(false);
+ } else if (!entry.getShowFrequency() && !getPeriodic()) {
+ entry.setShowFrequency(true);
+ }
+
+ if (getPeriodic()) {
+ entry.setPeriodicity(null);
+ } else {
+ entry.setPeriodicity(Periodicity.MONTHLY.toString());
+ entry.setCurrentDate(entry.getEntryDate());
+ }
+
+ getEntries().set(index, entry);
+ return clientMessages.getGlobalZone();
+ }
+
/**
+ * Suppression d'une ligne de formulaire. Une entree est supprimable si elle a deja ete sauvegarde.
+ * @param entryId identifiant de l'entree a supprimer.
+ * @return un MultiZoneUpdate gerer par le composant ClientMessages (rafraichissement du formulaire et de la zone de messages)
+ */
+ @Log
+ void onSelectedFromDeleteEntry(int index) {
+ String entryId = getEntries().get(index).getId();
+ clientMessages.addInfo("La suppression sera effective uniquement après sauvegarde");
+ getEntries().remove(index);
+ entriesDeleted.add(entryId);
+ editSelected = true;
+ }
+
+ @Log
+ void onSelectedFromRemoveEntry(int index) {
+ getEntries().remove(index);
+ editSelected = true;
+ }
+
+ /**
* Action sur le bouton d'annulation qui activera le rechargement de la page. Les actions en cours (suppression/ajout/modification) ne
* seront pas pris en compte.
*/
+ @Log
void onSelectedFromCancelForm() {
- cancelFormSelected = true;
+ listEntries = null;
+ clientMessages.addInfo("Rechargement des données depuis la dernière sauvegarde");
+ editSelected = true;
}
/**
- * Succes du formulaire (les champs libelle et amount doivent etre valides).
- * Trois cas de soumissions :
- * - Cancel : Rechargement de la page PreviewTable ;
- * - AddEntry : Ajout d'une ligne pour une nouvelle entree dans le formulaire ;
- * - Save : Sauvegarde des ajouts/modifications/suppressions effectues par l'utilisateur.
+ * Succes du formulaire. Appele lors d'une action sur le formulaire (addEntry, cancelForm, removeEntry, deleteEntry, showPeriodicity, saveEntries).
+ * Sauvegarde des données uniquement lors de l'action sur le bouton saveEntries (editSelected = false).
* @return la page PreviewTable si annulation ou sauvegarde effectue avec succes. La zone global du composant sinon.
* @see org.chorem.cash.ui.components.ClientMessages
*/
@Log
Object onSuccessFromEntryForm() {
- clientMessages.clean();
+ //clientMessages.clean();
entryForm.clearErrors();
- if (cancelFormSelected) {
- return pageRender.createPageRenderLinkWithContext(PreviewTable.class, getListEntries().getKey());
- }
- if (!addEntrySelected) {
+ /*if (cancelFormSelected) {
+ //return pageRender.createPageRenderLinkWithContext(PreviewTable.class, getListEntries().getKey());
+ listEntries = null;
+ if (log.isDebugEnabled()) {
+ log.debug("CANCEL FORM");
+ }
+ clientMessages.addInfo("Rechargement des données depuis la dernière sauvegarde");
+ return clientMessages.zoneManager("entryFormComponent", entryFormComponent);
+ }*/
+ if (!editSelected) {
try {
int index = 1;
+
for (Entry current : getEntries()) {
if (current.getEntryDate() != null && current.getLibelle() != null) {
serviceEntry.createUpdateEntry(current);
@@ -220,7 +375,7 @@
entryForm.recordError("Champs incorrects pour entree " + index);
}
index++;
- }
+ }
for (String entryId : entriesDeleted) {
serviceEntry.deleteEntry(entryId);
@@ -239,7 +394,8 @@
}
}
}
- return clientMessages.getGlobalZone().getBody();//clientMessages.zoneManager("entryFormComponent", entryForm);
+ //return clientMessages.getGlobalZone().getBody();//clientMessages.zoneManager("entryFormComponent", entryForm);
+ return clientMessages.zoneManager("entryFormComponent", entryForm);
}
/**
Added: branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/SubmitContext.java
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/SubmitContext.java (rev 0)
+++ branches/alpha3-periodicity/cash-ui/src/main/java/org/chorem/cash/ui/components/SubmitContext.java 2009-08-24 09:38:34 UTC (rev 22)
@@ -0,0 +1,129 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.chorem.cash.ui.components;
+
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.corelib.base.AbstractField;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.FormSupport;
+import org.apache.tapestry5.services.Heartbeat;
+import org.apache.tapestry5.services.Request;
+
+/**
+ * Corresponds to <input type="submit">, a client-side element that can force the
+ * enclosing form to submit. The submit responsible for the form submission will post a
+ * notification that allows the application to know that it was the responsible entity. The
+ * notification is named "selected" and has a String context.
+ */
+public final class SubmitContext extends AbstractField
+{
+ static final String SELECTED_EVENT = "selected";
+
+ /**
+ * If true, then any notification sent by the component will be deferred until the end of
+ * the form submission (this is usually desirable).
+ */
+ @Parameter
+ private boolean _defer = true;
+
+ @Parameter
+ private String _context;
+
+ @Environmental
+ private FormSupport _formSupport;
+
+ @Environmental
+ private Heartbeat _heartbeat;
+
+ @Inject
+ private ComponentResources _resources;
+
+ @Inject
+ private Request _request;
+
+ public SubmitContext()
+ {
+ }
+
+ SubmitContext(Request request)
+ {
+ _request = request;
+ }
+
+ void beginRender(MarkupWriter writer)
+ {
+ // write a hidden input for the context
+ //String elementName = getElementName();
+ String elementName = getControlName(); //Modified to work with 5.0.12
+ writer.element("input", "type", "hidden", "name", elementName + "X", "value", _context);
+ writer.end();
+
+ // now the submit
+ writer.element("input", "type", "submit", "name", elementName, "id", getClientId());
+ _resources.renderInformalParameters(writer);
+ }
+
+ void afterRender(MarkupWriter writer)
+ {
+ writer.end();
+ }
+
+ //protected void processSubmission(FormSupport formSupport, String elementName)
+ @Override
+ protected void processSubmission(String elementName) //Modified to work with 5.0.12
+ {
+ String value = _request.getParameter(elementName);
+ final String context = _request.getParameter(elementName + "X");
+
+ if (value == null)
+ return;
+
+ Runnable sendNotification = new Runnable()
+ {
+ public void run()
+ {
+ _resources.triggerEvent(SELECTED_EVENT, new Object[] {context}, null);
+ }
+ };
+
+ // When not deferred, don't wait, fire the event now (actually, at the end of the current
+ // heartbeat). This is most likely because the Submit is inside a Loop and some contextual
+ // information will change if we defer. Another option might be to wait until the next
+ // heartbeak?
+
+ if (_defer)
+ _formSupport.defer(sendNotification);
+ else
+ _heartbeat.defer(sendNotification);
+
+ }
+
+ // For testing:
+
+ void setDefer(boolean defer)
+ {
+ _defer = defer;
+ }
+
+ void setup(ComponentResources resources, FormSupport support, Heartbeat heartbeat)
+ {
+ _resources = resources;
+ _formSupport = support;
+ _heartbeat = heartbeat;
+ }
+}
Modified: branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.properties
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.properties 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.properties 2009-08-24 09:38:34 UTC (rev 22)
@@ -0,0 +1,12 @@
+
+periodicity=Fr\u00E9quence de r\u00E9p\u00E9tition (P\u00E9riodicit\u00E9)
+periodicity-bymonth=Entr\u00E9e r\u00E9p\u00E9t\u00E9e par mois : choisissez tous les combien de mois (intervalle) et la condition de fin (illimit\u00E9, date de fin ou nombre de fois)
+frequencyInterval-label=Tous les
+addPeriodicity-label=P\u00E9riodique ?
+
+entry-add-submit=Ajouter une nouvelle entr\u00E9e
+entry-remove-submit=Supprimer la nouvelle entr\u00E9e
+entry-delete-submit=Supprimer l'entr\u00E9e
+entries-save-submit=Sauvegarder les entr\u00E9es
+entries-cancel-submit=Annuler toutes les modifications
+periodicity-show-submit=Afficher la gestion p\u00E9riodique de l'entr\u00E9e
\ No newline at end of file
Modified: branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.tml
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.tml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/resources/org/chorem/cash/ui/components/EntryForm.tml 2009-08-24 09:38:34 UTC (rev 22)
@@ -16,23 +16,56 @@
<form t:type="form" t:id="entryForm" t:zone="${globalZoneId}">
<t:errors />
<t:if test="listEntries">
- <t:loop source="entries" value="entry" volatile="true">
+ <t:loop source="entries" value="entry" volatile="true" t:index="indexEntry">
<p>
- <t:label for="libelle" /> : <input t:type="textfield" t:id="libelle" t:value="entry.libelle" />
- <t:label for="amount" /> : <input t:type="textfield" t:id="amount" t:value="entry.amount" />
- <t:label for="date" /> : <input t:type="datefield" t:id="date" t:value="entry.entryDate" />
+ <t:label for="libelle" /> : <input t:type="textfield" t:id="libelle" t:value="entry.libelle"/>
+ <t:label for="amount" /> : <input t:type="textfield" t:id="amount" t:value="entryAmount" />
+ <t:label for="date" /> : <input t:type="datefield" t:id="date" t:value="entryDate"/>
+ <t:label for="addPeriodicity" />
+ <input t:type="checkbox" t:id="addPeriodicity" value="periodic"
+ t:mixins="zoneUpdater" t:event="change" t:zone="${globalZoneId}" t:context="indexEntry" />
+
+ <input t:type="submitContext" class="ico clock" value="ShowPeriodicity" title="${message:periodicity-show-submit}" t:id="showPeriodicity" t:context="indexEntry" />
+
<t:if test="entry.id">
- <a t:type="actionlink" class="img" t:id="removeEntry" t:context="entry.id" t:zone="entryFormMessages" title="${message:remove-entry}">
- <img src="${asset:context:/img/icons/crystal/cancel.png}" alt="${message:remove-entry}"/>
- </a>
+ <input t:type="submitContext" class="ico delete" value="DeleteEntry" title="${message:entry-delete-submit}" t:id="deleteEntry" t:context="indexEntry" />
+ <p:else>
+ <input t:type="submitContext" class="ico remove" value="RemoveEntry" title="${message:entry-remove-submit}" t:id="removeEntry" t:context="indexEntry" />
+ </p:else>
</t:if>
</p>
+ <t:if t:test="entry.showFrequency">
+ <fieldset>
+ <legend>${message:periodicity}</legend>
+ <p>${message:periodicity-bymonth}</p>
+ <p>
+ <t:label for="frequencyInterval" />
+ <input t:type="textfield" class="interval" t:id="frequencyInterval" value="entry.interval" /> mois
+ </p>
+ <t:radiogroup t:id="frequencyEndCondition" t:value="frequencyEndCondition">
+ <p>
+ <t:radio t:id="frequencyUnlimited" />
+ <t:label for="frequencyUnlimited" />
+ </p>
+ <p>
+ <t:radio t:id="frequencyUntilDate" />
+ <t:label for="frequencyUntilDate" />
+ <input t:type="datefield" t:id="entryUntilDate" value="entry.untilDate" />
+ </p>
+ <p>
+ <t:radio t:id="frequencyNbTimes" />
+ <t:label for="frequencyNbTimes" />
+ <input t:type="textfield" t:id="entryNbTimes" value="entry.nbTimes" />
+ </p>
+ </t:radiogroup>
+ </fieldset>
+ </t:if>
</t:loop>
</t:if>
<p class="actions">
- <input t:type="submit" class="cancel" value="${message:cancel-form}" t:id="cancelForm" />
- <input t:type="submit" class="save" value="${message:save-entries}" t:id="saveEntries" />
- <input t:type="submit" class="add" value="${message:add-entry}" t:id="addEntry" />
+ <input t:type="submit" class="ico cancel" value="CancelEntries" title="${message:entries-cancel-submit}" t:id="cancelForm" />
+ <input t:type="submit" class="ico save" value="SaveEntries" title="${message:entries-save-submit}" t:id="saveEntries" />
+ <input t:type="submit" class="ico add" value="AddEntry" title="${message:entry-add-submit}" t:id="addEntry" />
</p>
</form>
</div>
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/META-INF/context.xml
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/webapp/META-INF/context.xml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/webapp/META-INF/context.xml 2009-08-24 09:38:34 UTC (rev 22)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Context antiJARLocking="true" path="/cash"/>
+<Context antiJARLocking="true" path="/cash-branche"/>
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/PreviewTable.tml
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/webapp/PreviewTable.tml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/webapp/PreviewTable.tml 2009-08-24 09:38:34 UTC (rev 22)
@@ -14,7 +14,7 @@
<t:if test="formFlag">
<fieldset>
<legend><strong><em>${entriesEditable.category.name}</em></strong> pour le mois <strong>${entriesEditable.month}</strong></legend>
- <t:entryForm t:listEntries="entriesEditable" />
+ <t:entryForm t:listEntriesParameter="entriesEditable" />
</fieldset>
<p:else>
<fieldset>
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/css/common.css
===================================================================
--- branches/alpha3-periodicity/cash-ui/src/main/webapp/css/common.css 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/cash-ui/src/main/webapp/css/common.css 2009-08-24 09:38:34 UTC (rev 22)
@@ -74,33 +74,38 @@
}
/* Boutons caches par des images */
-input.add {
- background: url(../img/icons/crystal/add.png) no-repeat center center;
+input.ico {
border: 0 none;
font-size: 0;
- width: 32px;
- height: 32px;
+ width: 24px;
+ height: 24px;
cursor: pointer;
}
+input.add {
+ background: url(../img/icons/crystal/add.png) no-repeat center center;
+}
+
input.save {
background: url(../img/icons/crystal/save.png) no-repeat center center;
- border: 0 none;
- font-size: 0;
- width: 32px;
- height: 32px;
- cursor: pointer;
}
input.cancel {
background: url(../img/icons/crystal/reload.png) no-repeat center center;
- border: 0 none;
- font-size: 0;
- width: 32px;
- height: 32px;
- cursor: pointer;
}
+input.clock {
+ background: url(../img/icons/crystal/clock.png) no-repeat center center;
+}
+
+input.remove {
+ background: url(../img/icons/crystal/remove.png) no-repeat center center;
+}
+
+input.delete {
+ background: url(../img/icons/crystal/cancel.png) no-repeat center center;
+}
+
/* Configuration du BlockManager */
div.component {
border: 2px outset #000000;
@@ -194,6 +199,10 @@
margin: 8px;
}
+#entryFormComponent input.interval {
+ width: 30px;
+}
+
div.zoneFlash {
padding: 10px;
border: 1px solid black;
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/cancel.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/add.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/address.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/address2.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/apply.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/blabla.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/cancel.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/cellphone.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/clock.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/delete.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/edit.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/email.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/fax.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/info.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/internet.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/internet2.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movedown.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movetobottom.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/movetotop.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/moveup.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/phone.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/reference.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/reload.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/remove.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/save.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/showdetails.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/stop.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/crystal/warning.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/delete.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/delete_icon.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/earth.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/edit_icon.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/first.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/iaction.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/last.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/maximize.gif
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/mini_cross.gif
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/mini_tick.gif
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/minimize.gif
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movedown.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movetobottom.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/movetotop.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/moveup.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/next.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/previous.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/icons/tick.png
===================================================================
(Binary files differ)
Deleted: branches/alpha3-periodicity/cash-ui/src/main/webapp/img/pollen.png
===================================================================
(Binary files differ)
Modified: branches/alpha3-periodicity/pom.xml
===================================================================
--- branches/alpha3-periodicity/pom.xml 2009-08-24 09:22:24 UTC (rev 21)
+++ branches/alpha3-periodicity/pom.xml 2009-08-24 09:38:34 UTC (rev 22)
@@ -9,12 +9,12 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.0-rc-5-SNAPSHOT</version>
+ <version>1.0.0</version>
</parent>
<groupId>org.chorem</groupId>
<artifactId>cash</artifactId>
- <version>1.0.0-alpha-2-SNAPSHOT</version>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
<modules>
<module>cash-ui</module>
@@ -135,8 +135,7 @@
<!-- Nuiton librairies -->
<topia.version>2.2.0-rc-5-SNAPSHOT</topia.version>
<generator.version>1.0.0-rc-3</generator.version>
- <jrst.version>1.0.0-rc-4-SNAPSHOT</jrst.version>
- <skin.version>1.0.0-rc-2-SNAPSHOT</skin.version>
+ <jrst.version>1.0.0</jrst.version>
<!-- ChoReg -->
<choreg.version>1.0.0-alpha-2-SNAPSHOT</choreg.version>
@@ -154,6 +153,24 @@
<chenillekit.version>1.0.2</chenillekit.version>
</properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.jrst</groupId>
+ <artifactId>doxia-module-jrst</artifactId>
+ <version>${jrst.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
1
0
Author: fdesbois
Date: 2009-08-24 11:22:24 +0200 (Mon, 24 Aug 2009)
New Revision: 21
Added:
branches/alpha3-periodicity/
Log:
create branche for test and implentation of periodicity
Property changes on: branches/alpha3-periodicity
___________________________________________________________________
Added: svn:mergeinfo
+
1
0
Author: fdesbois
Date: 2009-08-24 11:21:01 +0200 (Mon, 24 Aug 2009)
New Revision: 20
Removed:
branches/aplha3-periodicity/
Log:
supr branche
1
0
Author: fdesbois
Date: 2009-08-24 11:07:44 +0200 (Mon, 24 Aug 2009)
New Revision: 19
Added:
branches/aplha3-periodicity/
branches/aplha3-periodicity/pom.xml
Removed:
branches/aplha3-periodicity/pom.xml
Log:
Create branche for periodicity tests and implementation + change pom dependency for mavenpom
Property changes on: branches/aplha3-periodicity
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: branches/aplha3-periodicity/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-11 08:54:04 UTC (rev 7)
+++ branches/aplha3-periodicity/pom.xml 2009-08-24 09:07:44 UTC (rev 19)
@@ -1,285 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
- <parent>
- <groupId>org.nuiton</groupId>
- <artifactId>mavenpom</artifactId>
- <version>1.0.0-rc-5-SNAPSHOT</version>
- </parent>
-
- <groupId>org.chorem</groupId>
- <artifactId>cash</artifactId>
- <version>1.0.0-alpha-1-SNAPSHOT</version>
-
- <modules>
- <module>cash-ui</module>
- <module>cash-business</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.chorem.choreg</groupId>
- <artifactId>choreg</artifactId>
- <version>${choreg.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.chorem</groupId>
- <artifactId>chorem-commons</artifactId>
- <version>${choreg.version}</version>
- </dependency>
- <dependency>
- <groupId>org.chorem</groupId>
- <artifactId>oasis-ciq-api</artifactId>
- <version>${choreg.version}</version>
- </dependency>
- <dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-persistence</artifactId>
- <version>${topia.version}</version>
- </dependency>
- <dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-soa</artifactId>
- <version>${topia.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>${lang.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.4.0</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tapestry</groupId>
- <artifactId>tapestry-core</artifactId>
- <version>${tapestry.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.chenillekit</groupId>
- <artifactId>chenillekit-tapestry</artifactId>
- <version>${chenillekit.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.8.0.GA</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
- <name>Ca$h</name>
- <description>Gestion de la trésorerie avec vue prévisionnelle</description>
- <inceptionYear>2009</inceptionYear>
-
- <!-- Developpers, contributors... -->
- <developers>
- <developer>
- <id>fdesbois</id>
- <name>Florian DESBOIS</name>
- <email>fdesbois(a)codelutin.com</email>
- <organization>Code Lutin</organization>
- <organizationUrl>http://www.codelutin.com/</organizationUrl>
- <timezone>+1</timezone>
- <roles>
- <role>Analyste</role>
- <role>Développeur</role>
- </roles>
- </developer>
- </developers>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <packaging>pom</packaging>
-
- <properties>
- <!-- Nuiton librairies -->
- <topia.version>2.2.0-rc-5-SNAPSHOT</topia.version>
- <generator.version>1.0.0-rc-3</generator.version>
- <jrst.version>1.0.0-rc-4-SNAPSHOT</jrst.version>
- <skin.version>1.0.0-rc-2-SNAPSHOT</skin.version>
-
- <!-- ChoReg -->
- <choreg.version>1.0.0-alpha-1-SNAPSHOT</choreg.version>
-
- <!-- commons-lang for ToPIA -->
- <lang.version>2.4</lang.version>
- <!-- Hibernate for ToPIA -->
- <hibernate.version>3.3.1.GA</hibernate.version>
-
- <!-- test -->
- <junit.version>4.6</junit.version>
-
- <!-- ui -->
- <tapestry.version>5.1.0.5</tapestry.version>
- <chenillekit.version>1.0.2</chenillekit.version>
- </properties>
-
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
-
- <scm>
- <connection>scm:svn:http://svn.chorem.org/svn/cash/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://publish@svn.chorem.org/var/lib/svn/svn-chorem/cash/trunk</developerConnection>
- <url>http://www.chorem.org/repositories/browse/cash/trunk</url>
- </scm>
-
- <issueManagement>
- <system>redmine</system>
- <url>http://www.chorem.org/projects/cash/issues</url>
- </issueManagement>
-
- <ciManagement>
- <system>hudson</system>
- <url>http://hudson.chorem.org</url>
- </ciManagement>
-
- <!--Any mailing lists for the project-->
- <mailingLists>
- <mailingList>
- <name>cash-commits</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-commits</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-commits</unsubscribe>
- <post>cash-commits(a)$list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-commits/</archive>
- </mailingList>
-
- <mailingList>
- <name>cash-devel</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-devel</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-devel</unsubscribe>
- <post>cash-devel(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-devel/</archive>
- </mailingList>
-
- <mailingList>
- <name>cash-users</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-users</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-users</unsubscribe>
- <post>cash-users(a)list.chorem.org</post>
- <archive>http://list.chorem.org/pipermail/cash-users/</archive>
- </mailingList>
- </mailingLists>
-
- <!--Distribution-->
- <distributionManagement>
- <repository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/release</url>
- </repository>
- <snapshotRepository>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/maven/snapshot</url>
- </snapshotRepository>
- <site>
- <id>nuiton</id>
- <url>scpexe://chorem.org/var/lib/redmine-chorem/project-site/cash</url>
- </site>
- </distributionManagement>
-
- <repositories>
- <!-- depot des releases nuiton -->
- <repository>
- <id>nuiton.release</id>
- <name>NuitonReleaseRepository</name>
- <url>http://maven.nuiton.org/release</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <checksumPolicy>warn</checksumPolicy>
- </releases>
- </repository>
-
- <!-- depot des snapshots nuiton -->
- <repository>
- <id>nuiton.snapshot</id>
- <name>NuitonSnapshotRepository</name>
- <url>http://maven.nuiton.org/snapshot</url>
- <snapshots>
- <checksumPolicy>fail</checksumPolicy>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
-
- <repository>
- <id>chenillekit</id>
- <url>http://www.chenillekit.org/mvnrepo/release</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <!-- depot des releases nuiton -->
- <pluginRepository>
- <id>nuiton.release</id>
- <name>NuitonReleaseRepository</name>
- <url>http://maven.nuiton.org/release</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <checksumPolicy>warn</checksumPolicy>
- </releases>
- </pluginRepository>
-
- <!-- depot des snapshots nuiton -->
- <pluginRepository>
- <id>nuiton.snapshot</id>
- <name>NuitonSnapshotRepository</name>
- <url>http://maven.nuiton.org/snapshot</url>
- <snapshots>
- <checksumPolicy>fail</checksumPolicy>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
-
-</project>
-
Copied: branches/aplha3-periodicity/pom.xml (from rev 16, trunk/pom.xml)
===================================================================
--- branches/aplha3-periodicity/pom.xml (rev 0)
+++ branches/aplha3-periodicity/pom.xml 2009-08-24 09:07:44 UTC (rev 19)
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <groupId>org.chorem</groupId>
+ <artifactId>cash</artifactId>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
+
+ <modules>
+ <module>cash-ui</module>
+ <module>cash-business</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.chorem.choreg</groupId>
+ <artifactId>choreg</artifactId>
+ <version>${choreg.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.chorem</groupId>
+ <artifactId>chorem-commons</artifactId>
+ <version>${choreg.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.chorem</groupId>
+ <artifactId>oasis-ciq-api</artifactId>
+ <version>${choreg.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ <version>${topia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-soa</artifactId>
+ <version>${topia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-core</artifactId>
+ <version>${tapestry.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.chenillekit</groupId>
+ <artifactId>chenillekit-tapestry</artifactId>
+ <version>${chenillekit.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.8.0.GA</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>Ca$h</name>
+ <description>Gestion de la trésorerie avec vue prévisionnelle</description>
+ <inceptionYear>2009</inceptionYear>
+
+ <!-- Developpers, contributors... -->
+ <developers>
+ <developer>
+ <id>fdesbois</id>
+ <name>Florian DESBOIS</name>
+ <email>fdesbois(a)codelutin.com</email>
+ <organization>Code Lutin</organization>
+ <organizationUrl>http://www.codelutin.com/</organizationUrl>
+ <timezone>+1</timezone>
+ <roles>
+ <role>Analyste</role>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>pom</packaging>
+
+ <properties>
+ <!-- Nuiton librairies -->
+ <topia.version>2.2.0-rc-5-SNAPSHOT</topia.version>
+ <generator.version>1.0.0-rc-3</generator.version>
+ <jrst.version>1.0.0</jrst.version>
+
+ <!-- ChoReg -->
+ <choreg.version>1.0.0-alpha-2-SNAPSHOT</choreg.version>
+
+ <!-- commons-lang for ToPIA -->
+ <lang.version>2.4</lang.version>
+ <!-- Hibernate for ToPIA -->
+ <hibernate.version>3.3.1.GA</hibernate.version>
+
+ <!-- test -->
+ <junit.version>4.6</junit.version>
+
+ <!-- ui -->
+ <tapestry.version>5.1.0.5</tapestry.version>
+ <chenillekit.version>1.0.2</chenillekit.version>
+ </properties>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.jrst</groupId>
+ <artifactId>doxia-module-jrst</artifactId>
+ <version>${jrst.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <scm>
+ <connection>scm:svn:http://svn.chorem.org/svn/cash/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://publish@svn.chorem.org/var/lib/svn/svn-chorem/cash/trunk</developerConnection>
+ <url>http://www.chorem.org/repositories/browse/cash/trunk</url>
+ </scm>
+
+ <issueManagement>
+ <system>redmine</system>
+ <url>http://www.chorem.org/projects/cash/issues</url>
+ </issueManagement>
+
+ <ciManagement>
+ <system>hudson</system>
+ <url>http://hudson.chorem.org</url>
+ </ciManagement>
+
+ <!--Any mailing lists for the project-->
+ <mailingLists>
+ <mailingList>
+ <name>cash-commits</name>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</unsubscribe>
+ <post>cash-commits(a)$list.chorem.org</post>
+ <archive>http://list.chorem.org/pipermail/cash-commits/</archive>
+ </mailingList>
+
+ <mailingList>
+ <name>cash-devel</name>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</unsubscribe>
+ <post>cash-devel(a)list.chorem.org</post>
+ <archive>http://list.chorem.org/pipermail/cash-devel/</archive>
+ </mailingList>
+
+ <mailingList>
+ <name>cash-users</name>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</unsubscribe>
+ <post>cash-users(a)list.chorem.org</post>
+ <archive>http://list.chorem.org/pipermail/cash-users/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <!--Distribution-->
+ <distributionManagement>
+ <repository>
+ <id>nuiton</id>
+ <url>scpexe://chorem.org/var/lib/maven/release</url>
+ </repository>
+ <snapshotRepository>
+ <id>nuiton</id>
+ <url>scpexe://chorem.org/var/lib/maven/snapshot</url>
+ </snapshotRepository>
+ <site>
+ <id>nuiton</id>
+ <url>scpexe://chorem.org/var/lib/redmine-chorem/project-site/cash</url>
+ </site>
+ </distributionManagement>
+
+ <repositories>
+ <!-- depot des releases nuiton -->
+ <repository>
+ <id>nuiton.release</id>
+ <name>NuitonReleaseRepository</name>
+ <url>http://maven.nuiton.org/release</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </repository>
+
+ <!-- depot des snapshots nuiton -->
+ <repository>
+ <id>nuiton.snapshot</id>
+ <name>NuitonSnapshotRepository</name>
+ <url>http://maven.nuiton.org/snapshot</url>
+ <snapshots>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+
+ <repository>
+ <id>chenillekit</id>
+ <url>http://www.chenillekit.org/mvnrepo/release</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <!-- depot des releases nuiton -->
+ <pluginRepository>
+ <id>nuiton.release</id>
+ <name>NuitonReleaseRepository</name>
+ <url>http://maven.nuiton.org/release</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </pluginRepository>
+
+ <!-- depot des snapshots nuiton -->
+ <pluginRepository>
+ <id>nuiton.snapshot</id>
+ <name>NuitonSnapshotRepository</name>
+ <url>http://maven.nuiton.org/snapshot</url>
+ <snapshots>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+</project>
+
1
0
Author: fdesbois
Date: 2009-08-20 18:33:26 +0200 (Thu, 20 Aug 2009)
New Revision: 18
Modified:
trunk/cash-business/src/test/resources/TopiaContextCash.properties
Log:
Change h2data destination to target folder
Modified: trunk/cash-business/src/test/resources/TopiaContextCash.properties
===================================================================
--- trunk/cash-business/src/test/resources/TopiaContextCash.properties 2009-08-20 16:14:29 UTC (rev 17)
+++ trunk/cash-business/src/test/resources/TopiaContextCash.properties 2009-08-20 16:33:26 UTC (rev 18)
@@ -6,6 +6,6 @@
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:~/h2data/test/cash
+hibernate.connection.url=jdbc:h2:file:target/h2data/cash
1
0
r17 - in trunk/cash-business/src: main/java/org/chorem/cash/business main/java/org/chorem/cash/impl main/java/org/chorem/cash/persistence main/xmi test/java/org/chorem/cash/impl
by fdesbois@users.chorem.org 20 Aug '09
by fdesbois@users.chorem.org 20 Aug '09
20 Aug '09
Author: fdesbois
Date: 2009-08-20 18:14:29 +0200 (Thu, 20 Aug 2009)
New Revision: 17
Added:
trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelper.java
trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelperByMonth.java
trunk/cash-business/src/main/java/org/chorem/cash/persistence/EntryEntityDAOImpl.java
Modified:
trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java
trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
trunk/cash-business/src/main/xmi/cash.zargo
trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java
Log:
- Implementation for frequency
- get for tree frequency types (unlimited, untilDate, nbTimes)
- createUpdate for particular case modify only current occurence (unlimited)
Modified: trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java 2009-08-19 10:12:28 UTC (rev 16)
+++ trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -20,17 +20,18 @@
package org.chorem.cash.business;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.chorem.cash.CashModelDAOHelper;
import org.chorem.cash.ContextUtilCash;
+import org.chorem.cash.dto.Category;
import org.chorem.cash.dto.Entry;
import org.chorem.cash.dto.Reference;
import org.chorem.cash.persistence.CategoryEntity;
+import org.chorem.cash.persistence.CategoryEntityDAO;
import org.chorem.cash.persistence.EntryEntity;
import org.chorem.cash.persistence.EntryEntityDAO;
import org.chorem.cash.persistence.EntryFrequencyEntity;
@@ -57,7 +58,7 @@
*/
public class EntryHelper {
- public static Entry getEntry(EntryEntity entity) throws ConvertException {
+ public static Entry getEntry(EntryEntity entity, Date current) throws ConvertException {
Entry entry = Convert.toDTO(entity, EntryEntity.class, Entry.class);
entry.setId(ContextUtilCash.convertId(entity.getTopiaId()));
CategoryEntity category = entity.getCategoryEntity();
@@ -79,13 +80,62 @@
entry.setUnlimited(frequency.getUnlimited());
entry.setUntilDate(frequency.getUntilDate());
entry.setPeriodicity(frequency.getPeriodicity());
- entry.setMonths(frequency.getMonths());
+ entry.setCurrentDate(current);
+
+ //entry.setMonths(frequency.getMonths());
}
return entry;
}
+
+ public static EntryEntity createUpdateEntry(Entry entry, TopiaContext transaction, Log log)
+ throws TopiaException, IllegalArgumentException, EntityException {
+ for (Reference reference : entry.getReferences()) {
+ ReferenceHelper.createUpdateReference(reference, transaction, log);
+ }
+
+ EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
+
+ Map<String, Object> saveParams = new HashMap<String, Object>();
+
+ saveParams.put(EntryEntity.LIBELLE, entry.getLibelle());
+
+ Category entryCategory = entry.getCategory();
+ if (entryCategory != null) {
+ CategoryEntityDAO categDAO = CashModelDAOHelper.getCategoryEntityDAO(transaction);
+ CategoryEntity category = ServiceHelper.getEntity(categDAO, entryCategory.getId(), log);
+ saveParams.put(EntryEntity.CATEGORY_ENTITY, category);
+ } else {
+ throw new IllegalArgumentException("Null parameter Category");
+ }
+
+ // Modify amount sign if credit is false
+ if (!entry.getCategory().getCredit()) {
+ double amount = entry.getAmount();
+ if (amount > 0) { // no modification if already negatif
+ entry.setAmount(-amount);
+ }
+ }
+
+ saveParams.put(EntryEntity.AMOUNT, entry.getAmount());
+ saveParams.put(EntryEntity.COMMENT, entry.getComment());
+ saveParams.put(EntryEntity.ENTRY_DATE, entry.getEntryDate());
+
+ if (entry.getPeriodicity() != null && !entry.getPeriodicity().isEmpty()) {
+ EntryFrequencyEntity frequency = EntryHelper.createUpdateFrequency(entry, transaction, log);
+
+ saveParams.put(EntryEntity.ENTRY_FREQUENCY_ENTITY, frequency);
+ }
+
+ EntryEntity entity = ServiceHelper.createUpdateEntity(dao, entry.getId(), null, saveParams, log);
+
+ entry.setId(ContextUtilCash.convertId(entity.getTopiaId()));
+
+ return entity;
+ }
+
public static EntryFrequencyEntity createUpdateFrequency(Entry entry, TopiaContext transaction, Log log)
throws IllegalArgumentException, TopiaException, EntityException {
@@ -98,15 +148,6 @@
saveParams.put(EntryFrequencyEntity.NB_TIMES, entry.getNbTimes());
} else if (entry.getUnlimited()) {
saveParams.put(EntryFrequencyEntity.UNLIMITED, entry.getUnlimited());
-
- int firstMonth = DateUtils.getMonth(entry.getEntryDate());
- Collection<Integer> months = getMonthsIntervals(entry.getInterval(), firstMonth);
-
- if (log.isDebugEnabled()) {
- log.debug(months);
- }
-
- saveParams.put(EntryFrequencyEntity.MONTHS, months);
} else if (entry.getUntilDate() != null) {
saveParams.put(EntryFrequencyEntity.UNTIL_DATE, entry.getUntilDate());
}
@@ -121,23 +162,37 @@
return entity;
}
- private static Collection<Integer> getMonthsIntervals(int interval, int firstMonth) {
+ public static int[] getMonthsIntervals(int interval, int firstMonth) {
int max = 12 / interval;
- //int[] results = new int[max];
- List<Integer> results = new ArrayList<Integer>();
+ int[] results = new int[max];
+ //List<Integer> results = new ArrayList<Integer>();
- //results[0] = firstMonth;
- results.add(new Integer(firstMonth));
+ results[0] = firstMonth;
+ //results.add(new Integer(firstMonth));
//results.set(0, new Integer(firstMonth));
for (int i = 1; i < max; i++) {
- int curr = results.get(i-1).intValue();
- int res = ( curr + interval ) % 12;
- results.add(new Integer(res));
- //results[i] = ( results[i-1] + interval ) % 12;
+ //int curr = results.get(i-1).intValue();
+ //int res = ( curr + interval ) % 12;
+ //results.add(new Integer(res));
+ results[i] = ( results[i-1] + interval ) % 12;
}
return results;
}
+
+ public static void addEntryForMonth(EntryEntity entity, Date currentDate, Map<String, List<Entry>> results, String pattern) throws ConvertException {
+ /*if (log.isDebugEnabled() && entity.getEntryFrequencyEntity() != null) {
+ log.debug("PERIODIC ENTRY : beginDate = " + entity.getEntryDate() + " _ current = " + currentDate);
+ }*/
+ Entry result = EntryHelper.getEntry(entity, currentDate);
+ String month = DateUtils.formatDate(currentDate, pattern);
+ List<Entry> current = results.get(month);
+ if (current == null) {
+ current = new ArrayList<Entry>();
+ results.put(month, current);
+ }
+ current.add(result);
+ }
}
Added: trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelper.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelper.java (rev 0)
+++ trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelper.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -0,0 +1,112 @@
+/**
+ * *##% Ca$h Business
+ * Copyright (C) 2009 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 Lesser 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>. ##%*
+ */
+
+package org.chorem.cash.business;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.cash.persistence.EntryEntity;
+import org.chorem.cash.persistence.EntryFrequencyEntity;
+import org.chorem.utils.PeriodDates;
+
+/**
+ * PeriodicHelper.java
+ *
+ * Created on 2009-08-20
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public abstract class PeriodicHelper<T> {
+
+ protected static final Log log = LogFactory.getLog(PeriodicHelper.class);
+
+ protected PeriodDates period;
+
+ private Calendar calendarEnd;
+
+ protected Calendar calendar;
+
+ protected EntryEntity entity;
+
+ private int interval;
+
+ private int calendarField;
+
+ protected T results;
+
+ public PeriodicHelper(EntryEntity entity, PeriodDates period) {
+ init(entity);
+ this.period = period;
+ }
+
+ public PeriodicHelper(EntryEntity entity, Date endDate) {
+ init(entity);
+ this.calendarEnd = new GregorianCalendar();
+ this.calendarEnd.setTime(endDate);
+ }
+
+ private void init(EntryEntity entity) {
+ this.entity = entity;
+ this.calendar = new GregorianCalendar();
+ this.calendar.setTime(entity.getEntryDate());
+ EntryFrequencyEntity frequency = entity.getEntryFrequencyEntity();
+ Periodicity periodicity = Periodicity.valueOf(frequency.getPeriodicity());
+ this.interval = frequency.getInterval();
+ this.calendarField = getField(periodicity);
+ }
+
+ private int getField(Periodicity rule) {
+ switch (rule) {
+ case MONTHLY: return Calendar.MONTH;
+ }
+ return Calendar.MONTH;
+ }
+
+ public T execute(T start) throws Exception {
+
+ calendar.add(calendarField, interval);
+ boolean beforeEnd = period != null ? period.beforeEnd(calendar) : calendar.before(calendarEnd);
+
+ while (beforeEnd && predicat()) {
+ if (log.isDebugEnabled()) {
+ log.debug("PREDICAT : beforeEnd = " + beforeEnd + " _ predicat = " + predicat());
+ log.debug("PERIODIC ENTRY : current = " + calendar.getTime());
+ }
+ boolean afterBegin = period != null ? period.afterBegin(calendar) : true;
+ if (afterBegin) {
+ start = action(start); //addEntryForMonth(periodicEntry, calendar.getTime(), results, period.getPattern());
+ }
+ calendar.add(calendarField, interval);
+ beforeEnd = period != null ? period.beforeEnd(calendar) : calendar.before(calendarEnd);
+ }
+ return start;
+ }
+
+ public abstract boolean predicat();
+
+ public abstract T action(T start) throws Exception;
+
+}
Property changes on: trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision
Added: trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelperByMonth.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelperByMonth.java (rev 0)
+++ trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelperByMonth.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -0,0 +1,51 @@
+/**
+ * *##% Ca$h Business
+ * Copyright (C) 2009 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 Lesser 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>. ##%*
+ */
+
+package org.chorem.cash.business;
+
+import java.util.List;
+import java.util.Map;
+import org.chorem.cash.dto.Entry;
+import org.chorem.cash.persistence.EntryEntity;
+import org.chorem.utils.PeriodDates;
+
+/**
+ * PeriodicHelperByMonth.java
+ *
+ * Created on 2009-08-20
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public abstract class PeriodicHelperByMonth extends PeriodicHelper<Map<String, List<Entry>>> {
+
+ public PeriodicHelperByMonth(EntryEntity entity, PeriodDates period) {
+ super(entity, period);
+ }
+
+ @Override
+ public Map<String, List<Entry>> action(Map<String, List<Entry>> start) throws Exception {
+ EntryHelper.addEntryForMonth(entity, calendar.getTime(), start, period.getPattern());
+ return start;
+ }
+
+}
Property changes on: trunk/cash-business/src/main/java/org/chorem/cash/business/PeriodicHelperByMonth.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision
Modified: trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-19 10:12:28 UTC (rev 16)
+++ trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -26,12 +26,16 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.cash.CashException;
import org.chorem.cash.CashModelDAOHelper;
import org.chorem.cash.ContextUtilCash;
import org.chorem.cash.business.EntryHelper;
+import org.chorem.cash.business.PeriodicHelper;
+import org.chorem.cash.business.PeriodicHelperByMonth;
import org.chorem.cash.business.Periodicity;
import org.chorem.cash.business.ReferenceHelper;
import org.chorem.cash.dto.Category;
@@ -44,6 +48,7 @@
import org.chorem.cash.persistence.EntryFrequencyEntity;
import org.chorem.cash.services.ServiceEntry;
import org.chorem.cash.services.ServiceEntryAbstract;
+import org.chorem.exceptions.ConvertException;
import org.chorem.utils.DateUtils;
import org.chorem.utils.PeriodDates;
import org.chorem.utils.ServiceHelper;
@@ -76,54 +81,51 @@
try {
transaction = context.beginTransaction();
- for (Reference reference : entry.getReferences()) {
- ReferenceHelper.createUpdateReference(reference, transaction, log);
- }
-
EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
- Map<String, Object> saveParams = new HashMap<String, Object>();
-
- saveParams.put(EntryEntity.LIBELLE, entry.getLibelle());
+ if (entry.getId() != null && !entry.getId().isEmpty()) { // L'entree existe
- Category entryCategory = entry.getCategory();
- if (entryCategory != null) {
- CategoryEntityDAO categDAO = CashModelDAOHelper.getCategoryEntityDAO(transaction);
- CategoryEntity category = ServiceHelper.getEntity(categDAO, entryCategory.getId(), log);
- saveParams.put(EntryEntity.CATEGORY_ENTITY, category);
- } else {
- ContextUtilCash.serviceException(transaction, "Category must be specified to create or update an entry",
- new IllegalArgumentException("Null parameter Category"));
- }
+ EntryEntity oldEntry = ServiceHelper.getEntity(dao, entry.getId(), log);
- // Modify amount sign if credit is false
- if (!entry.getCategory().getCredit()) {
- double amount = entry.getAmount();
- if (amount > 0) { // no modification if already negatif
- entry.setAmount(-amount);
- }
- }
+ EntryFrequencyEntity frequency = oldEntry.getEntryFrequencyEntity();
- saveParams.put(EntryEntity.AMOUNT, entry.getAmount());
- saveParams.put(EntryEntity.COMMENT, entry.getComment());
- saveParams.put(EntryEntity.ENTRY_DATE, entry.getEntryDate());
+ if (frequency != null && (entry.getPeriodicity() == null || "".equals(entry.getPeriodicity()))) { // Entite anciennement periodique mais l'entree courante devient indépendante
- if (entry.getPeriodicity() != null && !entry.getPeriodicity().isEmpty()) {
+ if (frequency.getUnlimited()) { // Cas illimite : une seule entite en base
- String periodicity = entry.getPeriodicity();
- if (Periodicity.valueOf(periodicity).equals(Periodicity.MONTHLY)) {
+ // On recupere l'ancienne version de l'entite (avec sa frequence)
+ Calendar calendar = new GregorianCalendar();
- EntryFrequencyEntity frequency = EntryHelper.createUpdateFrequency(entry, transaction, log);
+ // On cree une nouvelle entree pour la periodicite avant l'occurence courante
+ Entry newBeforeEntry = EntryHelper.getEntry(oldEntry, null);
+ newBeforeEntry.setId("");
+ // On va modifier la frequence en changeant le unlimited par une date de fin (untilDate)
+ // La date de fin est calcule en fonction de la date de l'occurence passe en parametre du service
+ calendar.setTime(entry.getCurrentDate());
+ calendar.add(Calendar.MONTH, -entry.getInterval()); // PERIODICITY = MONTHLY
+ newBeforeEntry.setUntilDate(calendar.getTime());
+ newBeforeEntry.setUnlimited(false);
- saveParams.put(EntryEntity.ENTRY_FREQUENCY_ENTITY, frequency);
+ EntryHelper.createUpdateEntry(newBeforeEntry, transaction, log);
+
+ // On cree une nouvelle entree pour la periodicite apres l'occurence courante
+ Entry newAfterEntry = EntryHelper.getEntry(oldEntry, null);
+ newAfterEntry.setId("");
+ // On va modifier la nouvelle entree en changeant la date de debut (entryDate)
+ calendar.setTime(entry.getCurrentDate());
+ calendar.add(Calendar.MONTH, entry.getInterval()); // PERIODICITY = MONTHLY
+ newAfterEntry.setEntryDate(calendar.getTime());
+
+ EntryHelper.createUpdateEntry(newAfterEntry, transaction, log);
+ } else if (frequency.getNbTimes() > 0) {
+
+ }
}
}
- EntryEntity entity = ServiceHelper.createUpdateEntity(dao, entry.getId(), null, saveParams, log);
+ EntryHelper.createUpdateEntry(entry, transaction, log);
- entry.setId(ContextUtilCash.convertId(entity.getTopiaId()));
-
transaction.commitTransaction();
transaction.closeContext();
} catch (Exception eee) {
@@ -141,7 +143,7 @@
EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
EntryEntity entity = ServiceHelper.getEntity(dao, entryId, log);
- result = EntryHelper.getEntry(entity);
+ result = EntryHelper.getEntry(entity, null);
transaction.closeContext();
} catch (Exception eee) {
@@ -160,7 +162,7 @@
EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
for (EntryEntity entity : dao.findAllWithOrder(EntryEntity.ENTRY_DATE)) {
- Entry result = EntryHelper.getEntry(entity);
+ Entry result = EntryHelper.getEntry(entity, null);
results.add(result);
}
@@ -204,44 +206,87 @@
EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
- List<EntryEntity> entries = transaction.find(
- "FROM " + EntryEntity.class.getName() +
- " WHERE " + EntryEntity.ENTRY_DATE + " BETWEEN :dateFrom AND :dateThru" +
- " AND " + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NULL " +
- " ORDER BY " + EntryEntity.ENTRY_DATE,
- "dateFrom", period.getFromDate(),
- "dateThru", period.getThruDate());
+ List<EntryEntity> entries = dao.findAllBetweenDates(period.getFromDate(), period.getThruDate());
- /*List<EntryEntity> periodicEntries = new ArrayList<EntryEntity>();
- for (Date monthDate : period.getMonths()) {
- List<EntryEntity> queryResults = transaction.find(
- "FROM " + EntryEntity.class.getName() +
- " WHERE " + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NOT NULL " +
- " AND " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.UNLIMITED + " = :ok" +
- " AND :month IN " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.MONTHS +
- " ORDER BY " + EntryEntity.ENTRY_DATE,
- "ok", true,
- "month", DateUtils.getMonth(monthDate));
- periodicEntries.addAll(queryResults);
- }*/
+ for (EntryEntity entity : entries) {
+ EntryHelper.addEntryForMonth(entity, entity.getEntryDate(), results, period.getPattern());
+ }
+ List<EntryEntity> periodicEntries = dao.findUnlimitedPeriodicEntries();
+
+ for (EntryEntity periodicEntry : periodicEntries) {
+ EntryFrequencyEntity frequency = periodicEntry.getEntryFrequencyEntity();
+
+ /*if (frequency.getUnlimited()) {
+ PeriodicHelperByMonth helper = new PeriodicHelperByMonth(periodicEntry, period) {
+ @Override
+ public boolean predicat() {
+ return true;
+ }
+ };
+ results = helper.execute(results);
+ } else if (frequency.getNbTimes() > 0) {
+ PeriodicHelperByMonth helper = new PeriodicHelperByMonth(periodicEntry, period) {
+ private int count = 0;
+
+ @Override
+ public boolean predicat() {
+ return count < entity.getEntryFrequencyEntity().getNbTimes();
+ }
+ };
+ results = helper.execute(results);
+ } else if (frequency.getUntilDate() != null) {
+ PeriodicHelperByMonth helper = new PeriodicHelperByMonth(periodicEntry, period) {
+ @Override
+ public boolean predicat() {
+ Date untilDate = entity.getEntryFrequencyEntity().getUntilDate();
+ return calendar.getTime().before(untilDate) || untilDate.equals(calendar.getTime());
+ }
+ };
+ results = helper.execute(results);
+ }*/
+
+
+ Calendar calendar = new GregorianCalendar();
+ calendar.setTime(periodicEntry.getEntryDate());
+ // Si entryDate est contenu dans la periode, l'entree sera deja dans la liste des entries
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+
+ Periodicity periodicity = Periodicity.valueOf(frequency.getPeriodicity());
+
+ if (frequency.getUnlimited()) {
+ while (period.beforeEnd(calendar)) {
+ if (period.afterBegin(calendar)) {
+ EntryHelper.addEntryForMonth(periodicEntry, calendar.getTime(), results, period.getPattern());
+ }
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+ }
+ } else if (frequency.getNbTimes() > 0) {
+ int count = 0;
+ while (period.beforeEnd(calendar) && count < frequency.getNbTimes()) {
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+ if (period.afterBegin(calendar)) {
+ EntryHelper.addEntryForMonth(periodicEntry, calendar.getTime(), results, period.getPattern());
+ }
+ count++;
+ }
+ } else if (frequency.getUntilDate() != null) {
+ Date untilDate = frequency.getUntilDate();
+ while (period.beforeEnd(calendar) && (calendar.getTime().before(untilDate) || untilDate.equals(calendar.getTime()))) {
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+ if (period.afterBegin(calendar)) {
+ EntryHelper.addEntryForMonth(periodicEntry, calendar.getTime(), results, period.getPattern());
+ }
+ }
+ }
+ }
+
if (log.isDebugEnabled()) {
log.debug("NbEntries find : " + entries.size());
- //log.debug("NbPeriodicEntries find : " + periodicEntries.size());
+ log.debug("NbPeriodicEntries find : " + periodicEntries.size());
+ log.debug("Results added : " + results.size() + " _ keys = " + results.keySet());
}
- for (EntryEntity entity : entries) {
- Entry result = EntryHelper.getEntry(entity);
-
- String entityDate = DateUtils.formatDate(entity.getEntryDate(), period.getPattern());
- List<Entry> current = results.get(entityDate);
- if (current == null) {
- current = new ArrayList<Entry>();
- results.put(entityDate, current);
- }
- current.add(result);
- }
-
transaction.closeContext();
} catch (Exception eee) {
ContextUtilCash.serviceException(transaction, "Unable to get entries between dates " + period.getFromDate() + " and " +
@@ -250,6 +295,8 @@
return results;
}
+
+
@Override
public double getSumBeforeDate(Date date) throws CashException {
TopiaContext transaction = null;
@@ -257,16 +304,50 @@
try {
transaction = context.beginTransaction();
- List results = transaction.find(
- "SELECT SUM(amount) FROM " + EntryEntity.class.getName() +
- " WHERE " + EntryEntity.ENTRY_DATE + " < :date",
- "date", date);
-
- // le find renvoie une liste obligatoirement non null mais non vide (1 seul element potentiellement = null)
- if (results.get(0) != null) {
- total = (Double)results.get(0);
+ EntryEntityDAO dao = CashModelDAOHelper.getEntryEntityDAO(transaction);
+
+ total = dao.sumAmountsBeforeDate(date);
+
+ if (log.isDebugEnabled()) {
+ log.debug("TOTAL before UnlimitedPeriodicEntries : " + total);
}
+ // Recherche sur les entites periodiques sans limite
+ for (EntryEntity periodicEntry : dao.findUnlimitedPeriodicEntries()) {
+
+ /*PeriodicHelper<Double> helper = new PeriodicHelper<Double>(periodicEntry, date) {
+ @Override
+ public boolean predicat() {
+ return true;
+ }
+
+ @Override
+ public Double action(Double start) throws Exception {
+ Double dd = new Double(entity.getAmount());
+ start += dd;
+ return start;
+ }
+ };
+
+ total = helper.execute(total);*/
+
+ EntryFrequencyEntity frequency = periodicEntry.getEntryFrequencyEntity();
+ Calendar calendar = new GregorianCalendar();
+ calendar.setTime(periodicEntry.getEntryDate());
+ // Si entryDate est avant la date, la somme sera deja compte dans le total
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+ int count = 0;
+ while (calendar.getTime().before(date)) {
+ count++;
+ total += periodicEntry.getAmount();
+ calendar.add(Calendar.MONTH, frequency.getInterval());
+ }
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("TOTAL after UnlimitedPeriodicEntries : " + total);
+ }
+
transaction.closeContext();
} catch (Exception eee) {
ContextUtilCash.serviceException(transaction, "Unable to get sum before " + date, eee);
Added: trunk/cash-business/src/main/java/org/chorem/cash/persistence/EntryEntityDAOImpl.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/persistence/EntryEntityDAOImpl.java (rev 0)
+++ trunk/cash-business/src/main/java/org/chorem/cash/persistence/EntryEntityDAOImpl.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -0,0 +1,81 @@
+/**
+ * *##% Ca$h Business
+ * Copyright (C) 2009 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 Lesser 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>. ##%*
+ */
+
+package org.chorem.cash.persistence;
+
+import java.util.Date;
+import java.util.List;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * ServiceCategoryImpl.java
+ *
+ * Created on 2009-08-20
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class EntryEntityDAOImpl<E extends EntryEntity> extends EntryEntityDAOAbstract<E> {
+
+ @Override
+ public List<EntryEntity> findUnlimitedPeriodicEntries() throws TopiaException {
+ List<EntryEntity> periodicEntries = getContext().find(
+ "FROM " + EntryEntity.class.getName() +
+ " WHERE " + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NOT NULL " +
+ " AND " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.UNLIMITED + " = :bool" +
+ " ORDER BY " + EntryEntity.ENTRY_DATE,
+ "bool", true);
+ return periodicEntries;
+ }
+
+ @Override
+ public List<EntryEntity> findAllBetweenDates(Date dateFrom, Date dateThru) throws TopiaException {
+ List<EntryEntity> entries = getContext().find(
+ "FROM " + EntryEntity.class.getName() +
+ " WHERE " + EntryEntity.ENTRY_DATE + " BETWEEN :dateFrom AND :dateThru" +
+ /*" AND (" +
+ "(" + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NULL) " +
+ " OR ( " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.UNLIMITED + " = :bool " +
+ ")" +
+ ")" +*/
+ " ORDER BY " + EntryEntity.ENTRY_DATE,
+ "dateFrom", dateFrom,
+ "dateThru", dateThru);
+ return entries;
+ }
+
+ @Override
+ public double sumAmountsBeforeDate(Date date) throws TopiaException {
+ double total = 0;
+ List results = getContext().find(
+ "SELECT SUM(amount) FROM " + EntryEntity.class.getName() +
+ " WHERE " + EntryEntity.ENTRY_DATE + " < :date",
+ "date", date);
+
+ // le find renvoie une liste obligatoirement non null mais non vide (1 seul element potentiellement = null)
+ if (results.get(0) != null) {
+ total = (Double)results.get(0);
+ }
+ return total;
+ }
+
+}
Property changes on: trunk/cash-business/src/main/java/org/chorem/cash/persistence/EntryEntityDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision
Modified: trunk/cash-business/src/main/xmi/cash.zargo
===================================================================
(Binary files differ)
Modified: trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java
===================================================================
--- trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java 2009-08-19 10:12:28 UTC (rev 16)
+++ trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java 2009-08-20 16:14:29 UTC (rev 17)
@@ -88,11 +88,11 @@
Category categ = ServiceCategoryImplTest.addParentCategory(serviceCateg, "CATEG", 1, true);
- Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ);
+ Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ, 0);
- Entry entry2 = createEntry(instance, "SECOND", DateUtils.createDate(5, 12, 2009), 78.24, categ);
+ Entry entry2 = createEntry(instance, "SECOND", DateUtils.createDate(5, 12, 2009), 78.24, categ, 0);
- Entry entry3 = createEntry(instance, "THIRD", DateUtils.createDate(15, 12, 2009), 258.44, categ);
+ Entry entry3 = createEntry(instance, "THIRD", DateUtils.createDate(15, 12, 2009), 258.44, categ, 0);
try {
List<Entry> list = instance.getEntries();
@@ -105,11 +105,12 @@
fail("CashException");
}
- Date today = new Date();
- Date afterSixMonth = DateUtils.createDateAfterToday(0, 6, 0);
- log.debug("DATES : " + today + " _ " + afterSixMonth);
+ Date date1 = DateUtils.createDate(20, 8, 2009);
+ //Date afterSixMonth = DateUtils.createDateAfterToday(0, 6, 0);
+ Date date2 = DateUtils.createDate(20, 2, 2010);
+ log.debug("DATES : " + date1 + " _ " + date2);
- PeriodDates period = new PeriodDates(today, afterSixMonth);
+ PeriodDates period = new PeriodDates(date1, date2);
period.setPattern(DateUtils.MONTH_PATTERN);
log.info("RANGETIME : " + period + " _ pattern [" + period.getPattern() + "]");
@@ -140,7 +141,7 @@
}
- /*@Test
+ @Test
public void testCreateUpdateEntry() throws Exception {
log.info("createUpdateEntry");
@@ -149,35 +150,43 @@
ServiceCategoryImpl serviceCateg = new ServiceCategoryImpl();
Category categ = ServiceCategoryImplTest.addParentCategory(serviceCateg, "CATEG", 1, true);
- Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ);
+ Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ, 0);
- log.debug("PERIODIC ENTRY : MONTHLY -> unlimited, interval = " + 3 + ", date = 12/07/2009");
+ Entry entry2 = createEntry(instance, "SECOND", DateUtils.createDate(12,9,2008), 152.14, categ, 5); // PERIODIC interval = 5
+ /*Date date2 = DateUtils.createDate(12,9,2008);
+ int interval = 5;
+ log.debug("PERIODIC ENTRY : MONTHLY -> unlimited, interval = " + interval + ", date = " + date2);
Entry entry2 = instance.getNewEntry();
entry2.setLibelle("SECOND");
entry2.setAmount(152.14);
- entry2.setEntryDate(DateUtils.createDate(12,7,2009));
+ entry2.setEntryDate(date2);
entry2.setCategory(categ);
- entry2.setPeriodicity(Periodicity.MONTHLY.toString());
- entry2.setUnlimited(true);
- entry2.setInterval(3);
-
try {
instance.createUpdateEntry(entry2);
assertNotNull(entry2.getId());
} catch (CashException eee) {
log.error("Erreur createUpdateEntry : " + eee.getMessage());
fail("CashException");
- }
+ }*/
+ Date from = DateUtils.createDate(12, 8, 2008);
+ Date thru = DateUtils.createDate(15, 10, 2009);
+ PeriodDates period = new PeriodDates(from, thru);
+ period.setPattern(DateUtils.MONTH_PATTERN);
+
+ log.debug("GET ENTRIES BETWEEN : " + period);
+
try {
- Entry result = instance.getEntry(entry2.getId());
- assertNotNull(result);
- assertNotNull(result.getMonths());
- assertEquals(result.getMonths().size(), 4);
+ Map<String, List<Entry>> results = instance.getEntriesBetweenDates(period);
+ assertNotNull(results);
+ assertEquals(results.size(), 4);
+ List<Entry> list = results.get("02/2009");
+ assertNotNull(list);
+ assertEquals(list.size(), 1);
} catch (CashException eee) {
- log.error("Erreur getEntry : " + eee.getMessage());
+ log.error("Erreur getEntriesBetweenDates : " + eee.getMessage());
fail("CashException");
}
@@ -189,7 +198,7 @@
fail("CashException");
}
- }*/
+ }
@Test
public void testGetSumBeforeDate() throws Exception {
@@ -200,31 +209,33 @@
Category categ = ServiceCategoryImplTest.addParentCategory(serviceCateg, "CATEG", 1, true);
Category categ2 = ServiceCategoryImplTest.addParentCategory(serviceCateg, "CATEG2", 2, false);
- Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ);
+ Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ, 1);
- Entry entry2 = createEntry(instance, "SECOND", DateUtils.createDate(5, 12, 2009), 78.24, categ);
+ Entry entry2 = createEntry(instance, "SECOND", DateUtils.createDate(5, 12, 2009), -78.24, categ2, 0);
- Entry entry3 = createEntry(instance, "THIRD", DateUtils.createDate(15, 12, 2009), 258.44, categ);
+ Entry entry3 = createEntry(instance, "THIRD", DateUtils.createDate(15, 12, 2009), 258.44, categ, 0);
- Entry entry4 = createEntry(instance, "FOURTH", DateUtils.createDate(2, 1, 2010), -68.12, categ2);
+ Entry entry4 = createEntry(instance, "FOURTH", DateUtils.createDate(2, 1, 2010), 68.12, categ, 0);
Date date1 = DateUtils.createDate(31,12,2009);
try {
double total1 = instance.getSumBeforeDate(date1);
+ log.debug("CALCUL : 15 * 4 - 78.24 + 258.44");
log.debug("TOTAL1 : " + total1);
- assertEquals(total1, 351.68, 0.01);
+ assertEquals(total1, 240.2, 0.01);
} catch (CashException eee) {
log.error("Erreur getSumBeforeDate : " + eee.getMessage());
fail("CashException");
}
- Date date2 = DateUtils.createDate(8,12,2009);
+ Date date2 = DateUtils.createDate(8,11,2009);
try {
double total2 = instance.getSumBeforeDate(date2);
+ log.debug("CALCUL : 15 * 3");
log.debug("TOTAL2 : " + total2);
- assertEquals(total2, 93.24, 0.01);
+ assertEquals(total2, 45, 0.01);
} catch (CashException eee) {
log.error("Erreur getSumBeforeDate : " + eee.getMessage());
fail("CashException");
@@ -234,8 +245,9 @@
try {
double total3 = instance.getSumBeforeDate(date3);
+ log.debug("CALCUL : 15 * 5 - 78.24 + 258.44 + 68.12");
log.debug("TOTAL3 : " + total3);
- assertEquals(total3, 283.56, 0.01);
+ assertEquals(total3, 323.32, 0.01);
} catch (CashException eee) {
log.error("Erreur getSumBeforeDate : " + eee.getMessage());
fail("CashException");
@@ -264,14 +276,30 @@
}
- private Entry createEntry(ServiceEntry service, String libelle, Date entryDate, double amount, Category categ) {
- log.debug("CREATE ENTRY : " + libelle + " _ " + entryDate + " _ " + amount);
+ /**
+ * Helper to create Entry for test. If interval > 0, entry is MONTHLY periodic unlimited.
+ * @param service ServiceEntry instance to use to create the entry
+ * @param libelle For the entry name
+ * @param entryDate begin date
+ * @param amount amount
+ * @param categ category (must be created before)
+ * @param interval for periodicity (MONTHLY _ UNLIMITED)
+ * @return the new Entry created
+ */
+ private Entry createEntry(ServiceEntry service, String libelle, Date entryDate, double amount, Category categ, int interval) {
+ log.debug("CREATE ENTRY : " + libelle + " _ " + entryDate + " _ " + amount + " _ periodic : " + (interval > 0) + "(" + interval +")");
Entry entry = service.getNewEntry();
entry.setLibelle(libelle);
entry.setAmount(amount);
entry.setEntryDate(entryDate);
entry.setCategory(categ);
+ if (interval > 0) {
+ entry.setPeriodicity(Periodicity.MONTHLY.toString());
+ entry.setUnlimited(true);
+ entry.setInterval(interval);
+ }
+
try {
service.createUpdateEntry(entry);
assertNotNull(entry.getId());
1
0
Author: fdesbois
Date: 2009-08-19 12:12:28 +0200 (Wed, 19 Aug 2009)
New Revision: 16
Modified:
trunk/pom.xml
Log:
Change url for mailing lists
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-19 09:44:44 UTC (rev 15)
+++ trunk/pom.xml 2009-08-19 10:12:28 UTC (rev 16)
@@ -178,24 +178,24 @@
<mailingLists>
<mailingList>
<name>cash-commits</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-commits</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-commits</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-commits</unsubscribe>
<post>cash-commits(a)$list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/cash-commits/</archive>
</mailingList>
<mailingList>
<name>cash-devel</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-devel</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-devel</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-devel</unsubscribe>
<post>cash-devel(a)list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/cash-devel/</archive>
</mailingList>
<mailingList>
<name>cash-users</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/cash-users</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/cash-users</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/cash-users</unsubscribe>
<post>cash-users(a)list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/cash-users/</archive>
</mailingList>
1
0
Author: fdesbois
Date: 2009-08-19 11:44:44 +0200 (Wed, 19 Aug 2009)
New Revision: 15
Modified:
trunk/cash-business/src/main/xmi/cash.zargo
Log:
- Begin implementation for periodicity
- Change rank icons in UI
- Change scope for Oasis CIQ Api and XMLBeans (better for embedded mode)
Modified: trunk/cash-business/src/main/xmi/cash.zargo
===================================================================
(Binary files differ)
1
0
r14 - in trunk: . cash-business/src/main/java/org/chorem/cash/business cash-business/src/main/java/org/chorem/cash/impl cash-business/src/test/java/org/chorem/cash/impl cash-ui/src/main/java/org/chorem/cash/ui/components cash-ui/src/main/resources/org/chorem/cash/ui/components cash-ui/src/main/webapp/img/icons/crystal
by fdesbois@users.chorem.org 19 Aug '09
by fdesbois@users.chorem.org 19 Aug '09
19 Aug '09
Author: fdesbois
Date: 2009-08-19 10:10:53 +0200 (Wed, 19 Aug 2009)
New Revision: 14
Added:
trunk/cash-business/src/main/java/org/chorem/cash/business/Periodicity.java
trunk/cash-ui/src/main/webapp/img/icons/crystal/clock.png
trunk/cash-ui/src/main/webapp/img/icons/crystal/movedown.png
trunk/cash-ui/src/main/webapp/img/icons/crystal/movetobottom.png
trunk/cash-ui/src/main/webapp/img/icons/crystal/movetotop.png
trunk/cash-ui/src/main/webapp/img/icons/crystal/moveup.png
Modified:
trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java
trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java
trunk/cash-ui/src/main/java/org/chorem/cash/ui/components/CategoryComponent.java
trunk/cash-ui/src/main/resources/org/chorem/cash/ui/components/CategoryComponent.tml
trunk/pom.xml
Log:
- Begin implementation for periodicity
- Change rank icons in UI
- Change scope for Oasis CIQ Api and XMLBeans (better for embedded mode)
Modified: trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/cash-business/src/main/java/org/chorem/cash/business/EntryHelper.java 2009-08-19 08:10:53 UTC (rev 14)
@@ -20,7 +20,12 @@
package org.chorem.cash.business;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.apache.commons.logging.Log;
import org.chorem.cash.CashModelDAOHelper;
import org.chorem.cash.ContextUtilCash;
import org.chorem.cash.dto.Entry;
@@ -28,9 +33,14 @@
import org.chorem.cash.persistence.CategoryEntity;
import org.chorem.cash.persistence.EntryEntity;
import org.chorem.cash.persistence.EntryEntityDAO;
+import org.chorem.cash.persistence.EntryFrequencyEntity;
+import org.chorem.cash.persistence.EntryFrequencyEntityDAO;
import org.chorem.cash.persistence.ReferenceEntity;
import org.chorem.exceptions.ConvertException;
+import org.chorem.exceptions.EntityException;
import org.chorem.utils.Convert;
+import org.chorem.utils.DateUtils;
+import org.chorem.utils.ServiceHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
@@ -58,7 +68,76 @@
for (ReferenceEntity ref : entity.getReferences()) {
references.add(ReferenceHelper.getReference(ref));
}
+
+ EntryFrequencyEntity frequency = entity.getEntryFrequencyEntity();
+ if (frequency != null) {
+
+ String frequencyId = ContextUtilCash.convertId(frequency.getTopiaId());
+ entry.setFrequencyId(frequencyId);
+ entry.setInterval(frequency.getInterval());
+ entry.setNbTimes(frequency.getNbTimes());
+ entry.setUnlimited(frequency.getUnlimited());
+ entry.setUntilDate(frequency.getUntilDate());
+ entry.setPeriodicity(frequency.getPeriodicity());
+ entry.setMonths(frequency.getMonths());
+
+ }
+
return entry;
}
+
+ public static EntryFrequencyEntity createUpdateFrequency(Entry entry, TopiaContext transaction, Log log)
+ throws IllegalArgumentException, TopiaException, EntityException {
+
+ Map<String, Object> saveParams = new HashMap<String, Object>();
+
+ saveParams.put(EntryFrequencyEntity.PERIODICITY, entry.getPeriodicity());
+ saveParams.put(EntryFrequencyEntity.INTERVAL, entry.getInterval());
+
+ if (!entry.getUnlimited() && entry.getNbTimes() > 0) {
+ saveParams.put(EntryFrequencyEntity.NB_TIMES, entry.getNbTimes());
+ } else if (entry.getUnlimited()) {
+ saveParams.put(EntryFrequencyEntity.UNLIMITED, entry.getUnlimited());
+
+ int firstMonth = DateUtils.getMonth(entry.getEntryDate());
+ Collection<Integer> months = getMonthsIntervals(entry.getInterval(), firstMonth);
+
+ if (log.isDebugEnabled()) {
+ log.debug(months);
+ }
+
+ saveParams.put(EntryFrequencyEntity.MONTHS, months);
+ } else if (entry.getUntilDate() != null) {
+ saveParams.put(EntryFrequencyEntity.UNTIL_DATE, entry.getUntilDate());
+ }
+
+ EntryFrequencyEntityDAO dao = CashModelDAOHelper.getEntryFrequencyEntityDAO(transaction);
+
+ EntryFrequencyEntity entity = ServiceHelper.createUpdateEntity(dao, entry.getFrequencyId(), null, saveParams, log);
+
+ String id = ContextUtilCash.convertId(entity.getTopiaId());
+ entry.setFrequencyId(id);
+
+ return entity;
+ }
+
+ private static Collection<Integer> getMonthsIntervals(int interval, int firstMonth) {
+ int max = 12 / interval;
+ //int[] results = new int[max];
+ List<Integer> results = new ArrayList<Integer>();
+
+ //results[0] = firstMonth;
+ results.add(new Integer(firstMonth));
+ //results.set(0, new Integer(firstMonth));
+
+ for (int i = 1; i < max; i++) {
+ int curr = results.get(i-1).intValue();
+ int res = ( curr + interval ) % 12;
+ results.add(new Integer(res));
+ //results[i] = ( results[i-1] + interval ) % 12;
+ }
+
+ return results;
+ }
}
Added: trunk/cash-business/src/main/java/org/chorem/cash/business/Periodicity.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/business/Periodicity.java (rev 0)
+++ trunk/cash-business/src/main/java/org/chorem/cash/business/Periodicity.java 2009-08-19 08:10:53 UTC (rev 14)
@@ -0,0 +1,14 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.chorem.cash.business;
+
+/**
+ *
+ * @author fdesbois
+ */
+public enum Periodicity {
+ MONTHLY
+}
Modified: trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java
===================================================================
--- trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/cash-business/src/main/java/org/chorem/cash/impl/ServiceEntryImpl.java 2009-08-19 08:10:53 UTC (rev 14)
@@ -32,6 +32,7 @@
import org.chorem.cash.CashModelDAOHelper;
import org.chorem.cash.ContextUtilCash;
import org.chorem.cash.business.EntryHelper;
+import org.chorem.cash.business.Periodicity;
import org.chorem.cash.business.ReferenceHelper;
import org.chorem.cash.dto.Category;
import org.chorem.cash.dto.Entry;
@@ -40,6 +41,7 @@
import org.chorem.cash.persistence.CategoryEntityDAO;
import org.chorem.cash.persistence.EntryEntity;
import org.chorem.cash.persistence.EntryEntityDAO;
+import org.chorem.cash.persistence.EntryFrequencyEntity;
import org.chorem.cash.services.ServiceEntry;
import org.chorem.cash.services.ServiceEntryAbstract;
import org.chorem.utils.DateUtils;
@@ -106,7 +108,18 @@
saveParams.put(EntryEntity.COMMENT, entry.getComment());
saveParams.put(EntryEntity.ENTRY_DATE, entry.getEntryDate());
+ if (entry.getPeriodicity() != null && !entry.getPeriodicity().isEmpty()) {
+ String periodicity = entry.getPeriodicity();
+ if (Periodicity.valueOf(periodicity).equals(Periodicity.MONTHLY)) {
+
+ EntryFrequencyEntity frequency = EntryHelper.createUpdateFrequency(entry, transaction, log);
+
+ saveParams.put(EntryEntity.ENTRY_FREQUENCY_ENTITY, frequency);
+ }
+
+ }
+
EntryEntity entity = ServiceHelper.createUpdateEntity(dao, entry.getId(), null, saveParams, log);
entry.setId(ContextUtilCash.convertId(entity.getTopiaId()));
@@ -194,12 +207,27 @@
List<EntryEntity> entries = transaction.find(
"FROM " + EntryEntity.class.getName() +
" WHERE " + EntryEntity.ENTRY_DATE + " BETWEEN :dateFrom AND :dateThru" +
+ " AND " + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NULL " +
" ORDER BY " + EntryEntity.ENTRY_DATE,
"dateFrom", period.getFromDate(),
"dateThru", period.getThruDate());
+ /*List<EntryEntity> periodicEntries = new ArrayList<EntryEntity>();
+ for (Date monthDate : period.getMonths()) {
+ List<EntryEntity> queryResults = transaction.find(
+ "FROM " + EntryEntity.class.getName() +
+ " WHERE " + EntryEntity.ENTRY_FREQUENCY_ENTITY + " IS NOT NULL " +
+ " AND " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.UNLIMITED + " = :ok" +
+ " AND :month IN " + EntryEntity.ENTRY_FREQUENCY_ENTITY + "." + EntryFrequencyEntity.MONTHS +
+ " ORDER BY " + EntryEntity.ENTRY_DATE,
+ "ok", true,
+ "month", DateUtils.getMonth(monthDate));
+ periodicEntries.addAll(queryResults);
+ }*/
+
if (log.isDebugEnabled()) {
log.debug("NbEntries find : " + entries.size());
+ //log.debug("NbPeriodicEntries find : " + periodicEntries.size());
}
for (EntryEntity entity : entries) {
@@ -245,4 +273,5 @@
}
return total;
}
+
}
Modified: trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java
===================================================================
--- trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/cash-business/src/test/java/org/chorem/cash/impl/ServiceEntryImplTest.java 2009-08-19 08:10:53 UTC (rev 14)
@@ -26,6 +26,7 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.cash.CashException;
import org.chorem.cash.ContextUtilCash;
+import org.chorem.cash.business.Periodicity;
import org.chorem.cash.dto.Category;
import org.chorem.cash.dto.Entry;
import org.chorem.cash.services.ServiceEntry;
@@ -73,77 +74,8 @@
@After
public void tearDown() {
}
-
+
/**
- * Test of createUpdateEntry method, of class ServiceEntryImpl.
- */
- /*@Test
- public void testCreateUpdateEntry() throws Exception {
- System.out.println("createUpdateEntry");
- Entry entry = null;
- ServiceEntryImpl instance = new ServiceEntryImpl();
- instance.createUpdateEntry(entry);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
- }*/
-
- /**
- * Test of getEntry method, of class ServiceEntryImpl.
- */
- /*@Test
- public void testGetEntry() throws Exception {
- System.out.println("getEntry");
- String entryId = "";
- ServiceEntryImpl instance = new ServiceEntryImpl();
- Entry expResult = null;
- Entry result = instance.getEntry(entryId);
- assertEquals(expResult, result);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
- }*/
-
- /**
- * Test of getEntries method, of class ServiceEntryImpl.
- */
- /*@Test
- public void testGetEntries() throws Exception {
- System.out.println("getEntries");
- ServiceEntryImpl instance = new ServiceEntryImpl();
- List expResult = null;
- List result = instance.getEntries();
- assertEquals(expResult, result);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
- }*/
-
- /**
- * Test of deleteEntry method, of class ServiceEntryImpl.
- */
- /*@Test
- public void testDeleteEntry() throws Exception {
- System.out.println("deleteEntry");
- String entryId = "";
- ServiceEntryImpl instance = new ServiceEntryImpl();
- instance.deleteEntry(entryId);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
- }*/
-
- /**
- * Test of getNewEntry method, of class ServiceEntryImpl.
- */
- /*@Test
- public void testGetNewEntry() {
- System.out.println("getNewEntry");
- ServiceEntryImpl instance = new ServiceEntryImpl();
- Entry expResult = null;
- Entry result = instance.getNewEntry();
- assertEquals(expResult, result);
- // TODO review the generated test code and remove the default call to fail.
- fail("The test case is a prototype.");
- }*/
-
- /**
* Test of getEntriesBetweenDates method, of class ServiceEntryImpl.
*/
@Test
@@ -208,6 +140,57 @@
}
+ /*@Test
+ public void testCreateUpdateEntry() throws Exception {
+ log.info("createUpdateEntry");
+
+ ServiceEntryImpl instance = new ServiceEntryImpl();
+
+ ServiceCategoryImpl serviceCateg = new ServiceCategoryImpl();
+ Category categ = ServiceCategoryImplTest.addParentCategory(serviceCateg, "CATEG", 1, true);
+
+ Entry entry1 = createEntry(instance, "FIRST", DateUtils.createDate(5, 9, 2009), 15.00, categ);
+
+ log.debug("PERIODIC ENTRY : MONTHLY -> unlimited, interval = " + 3 + ", date = 12/07/2009");
+
+ Entry entry2 = instance.getNewEntry();
+ entry2.setLibelle("SECOND");
+ entry2.setAmount(152.14);
+ entry2.setEntryDate(DateUtils.createDate(12,7,2009));
+ entry2.setCategory(categ);
+
+ entry2.setPeriodicity(Periodicity.MONTHLY.toString());
+ entry2.setUnlimited(true);
+ entry2.setInterval(3);
+
+ try {
+ instance.createUpdateEntry(entry2);
+ assertNotNull(entry2.getId());
+ } catch (CashException eee) {
+ log.error("Erreur createUpdateEntry : " + eee.getMessage());
+ fail("CashException");
+ }
+
+ try {
+ Entry result = instance.getEntry(entry2.getId());
+ assertNotNull(result);
+ assertNotNull(result.getMonths());
+ assertEquals(result.getMonths().size(), 4);
+ } catch (CashException eee) {
+ log.error("Erreur getEntry : " + eee.getMessage());
+ fail("CashException");
+ }
+
+ try {
+ instance.deleteEntry(entry1.getId());
+ instance.deleteEntry(entry2.getId());
+ } catch (CashException eee) {
+ log.error("Erreur deleteEntry : " + eee.getMessage());
+ fail("CashException");
+ }
+
+ }*/
+
@Test
public void testGetSumBeforeDate() throws Exception {
log.info("getSumBeforeDate");
Modified: trunk/cash-ui/src/main/java/org/chorem/cash/ui/components/CategoryComponent.java
===================================================================
--- trunk/cash-ui/src/main/java/org/chorem/cash/ui/components/CategoryComponent.java 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/cash-ui/src/main/java/org/chorem/cash/ui/components/CategoryComponent.java 2009-08-19 08:10:53 UTC (rev 14)
@@ -22,7 +22,6 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.ajax.MultiZoneUpdate;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Log;
@@ -31,7 +30,6 @@
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.corelib.components.Grid;
-import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.BeanModelSource;
import org.chorem.cash.CashException;
Modified: trunk/cash-ui/src/main/resources/org/chorem/cash/ui/components/CategoryComponent.tml
===================================================================
--- trunk/cash-ui/src/main/resources/org/chorem/cash/ui/components/CategoryComponent.tml 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/cash-ui/src/main/resources/org/chorem/cash/ui/components/CategoryComponent.tml 2009-08-19 08:10:53 UTC (rev 14)
@@ -51,16 +51,16 @@
</p:nameCell>
<p:actionsCell>
<a t:type="actionlink" class="img" t:id="moveUpCategory" t:context="indexCategory" t:zone="${zoneId}" title="${message:moveup-category}">
- <img src="${asset:context:/img/icons/moveup.png}" alt="${message:moveup-category}"/>
+ <img src="${asset:context:/img/icons/crystal/moveup.png}" alt="${message:moveup-category}"/>
</a>
<a t:type="actionlink" class="img" t:id="moveDownCategory" t:context="indexCategory" t:zone="${zoneId}" title="${message:movedown-category}">
- <img src="${asset:context:/img/icons/movedown.png}" alt="${message:movedown-category}"/>
+ <img src="${asset:context:/img/icons/crystal/movedown.png}" alt="${message:movedown-category}"/>
</a>
<a t:type="actionlink" class="img" t:id="moveToTopCategory" t:context="indexCategory" t:zone="${zoneId}" title="${message:movetotop-category}">
- <img src="${asset:context:/img/icons/movetotop.png}" alt="${message:movetotop-category}"/>
+ <img src="${asset:context:/img/icons/crystal/movetotop.png}" alt="${message:movetotop-category}"/>
</a>
<a t:type="actionlink" class="img" t:id="moveToBottomCategory" t:context="indexCategory" t:zone="${zoneId}" title="${message:movetobottom-category}">
- <img src="${asset:context:/img/icons/movetobottom.png}" alt="${message:movetobottom-category}"/>
+ <img src="${asset:context:/img/icons/crystal/movetobottom.png}" alt="${message:movetobottom-category}"/>
</a>
<a t:type="actionlink" class="img" t:id="editCategory" t:context="indexCategory" t:zone="${zoneId}" title="${message:edit-category}">
<img src="${asset:context:/img/icons/crystal/edit.png}" alt="${message:edit-category}"/>
Added: trunk/cash-ui/src/main/webapp/img/icons/crystal/clock.png
===================================================================
(Binary files differ)
Property changes on: trunk/cash-ui/src/main/webapp/img/icons/crystal/clock.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cash-ui/src/main/webapp/img/icons/crystal/movedown.png
===================================================================
(Binary files differ)
Property changes on: trunk/cash-ui/src/main/webapp/img/icons/crystal/movedown.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cash-ui/src/main/webapp/img/icons/crystal/movetobottom.png
===================================================================
(Binary files differ)
Property changes on: trunk/cash-ui/src/main/webapp/img/icons/crystal/movetobottom.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cash-ui/src/main/webapp/img/icons/crystal/movetotop.png
===================================================================
(Binary files differ)
Property changes on: trunk/cash-ui/src/main/webapp/img/icons/crystal/movetotop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cash-ui/src/main/webapp/img/icons/crystal/moveup.png
===================================================================
(Binary files differ)
Property changes on: trunk/cash-ui/src/main/webapp/img/icons/crystal/moveup.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-17 16:45:27 UTC (rev 13)
+++ trunk/pom.xml 2009-08-19 08:10:53 UTC (rev 14)
@@ -38,7 +38,6 @@
<groupId>org.chorem</groupId>
<artifactId>oasis-ciq-api</artifactId>
<version>${choreg.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.nuiton.topia</groupId>
@@ -59,7 +58,6 @@
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.4.0</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
1
0