Billy-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
August 2009
- 2 participants
- 15 discussions
r15 - trunk/billy-ui/src/main/java/org/chorem/billy/ui/services
by fdesbois@users.chorem.org 31 Aug '09
by fdesbois@users.chorem.org 31 Aug '09
31 Aug '09
Author: fdesbois
Date: 2009-08-31 19:13:20 +0200 (Mon, 31 Aug 2009)
New Revision: 15
Modified:
trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java
Log:
Comment contribute to startup and shutdown for registering Billy services (no services are registered in ChoReg)
Modified: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-31 16:37:34 UTC (rev 14)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-31 17:13:20 UTC (rev 15)
@@ -86,23 +86,22 @@
* @param configuration Tapestry configuration to contribution
* @param servicePerson test
*/
- public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration)
- {
+ /* public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration) {
try {
configuration.add("BillyStartup", new BillyManager());
} catch (NoClassDefFoundError eee) {
System.out.println("AppModule.contributeRegistryStartup() : ChoremRegistry unavailable");
}
- }
+ }*/
@EagerLoad
public RegistryShutdownListener buildBillyShutdown(@InjectService("RegistryShutdownHub") RegistryShutdownHub hub) {
RegistryShutdownListener listener = new ContextShutdown();
- try {
+ /*try {
listener = new BillyManager();
} catch (NoClassDefFoundError eee) {
System.out.println("AppModule.buildBillyShutdown() : ChoremRegistry unavailable");
- }
+ }*/
hub.addRegistryShutdownListener(listener);
return listener;
}
Modified: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java 2009-08-31 16:37:34 UTC (rev 14)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java 2009-08-31 17:13:20 UTC (rev 15)
@@ -1,5 +1,5 @@
/**
- * *##% Bonzoms Web Interface
+ * *##% Billy Web Interface
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -29,13 +29,13 @@
import org.chorem.choreg.ChoremUIService;
/**
- * BonzomsManager.java
+ * BillyManager.java
*
* Created on 2009-07-28
*
- * BonzomsManager manage registration uis services for ChoReg. Services are register when Tapestry start (run() method), and
+ * BillyManager manage registration uis services for ChoReg. Services are register when Tapestry start (run() method), and
* unregister when Tapestry shutdown (registryDidShutdown() method).
- * BonzomsManager use RegisterBonzomsServices class from Bonzoms-business to manage business services for ChoReg.
+ * BillyManager use RegisterBillyServices class from Billy-business to manage business services for ChoReg.
*
* <pre>
* Proprietes pour configuration du serveur UI :
1
0
Author: fdesbois
Date: 2009-08-31 18:37:34 +0200 (Mon, 31 Aug 2009)
New Revision: 14
Modified:
trunk/pom.xml
Log:
Add missing version for JRst
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-31 13:40:46 UTC (rev 13)
+++ trunk/pom.xml 2009-08-31 16:37:34 UTC (rev 14)
@@ -179,7 +179,7 @@
<dependency>
<groupId>org.nuiton.jrst</groupId>
<artifactId>doxia-module-jrst</artifactId>
- <version>${jrst.version}</version>
+ <version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
1
0
Author: tchemit
Date: 2009-08-31 15:40:46 +0200 (Mon, 31 Aug 2009)
New Revision: 13
Modified:
trunk/
trunk/pom.xml
Log:
mavenpom 1.0.2 is not yet released
Property changes on: trunk
___________________________________________________________________
Added: svn:ignore
+ target
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-31 13:24:00 UTC (rev 12)
+++ trunk/pom.xml 2009-08-31 13:40:46 UTC (rev 13)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.2</version>
+ <version>1.0.2-SNAPSHOT</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: tchemit
Date: 2009-08-31 15:24:00 +0200 (Mon, 31 Aug 2009)
New Revision: 12
Modified:
trunk/pom.xml
Log:
use mavenpom 1.0.2
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-31 13:18:03 UTC (rev 11)
+++ trunk/pom.xml 2009-08-31 13:24:00 UTC (rev 12)
@@ -1,6 +1,6 @@
<?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>
+ <modelVersion>4.0.0</modelVersion>
<!-- ************************************************************* -->
<!-- *** POM Relationships *************************************** -->
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.1</version>
+ <version>1.0.2</version>
</parent>
<groupId>org.chorem</groupId>
@@ -55,9 +55,9 @@
<version>${lang.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.4.0</version>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.4.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
@@ -81,10 +81,10 @@
<artifactId>chenillekit-tapestry</artifactId>
<version>${chenillekit.version}</version>
<exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -109,6 +109,14 @@
<description>Gestion des factures</description>
<inceptionYear>2009</inceptionYear>
+ <licenses>
+ <license>
+ <name>General Public License (GPL)</name>
+ <url>${maven.license.file}</url>
+ <distribution>local</distribution>
+ </license>
+ </licenses>
+
<!-- Developpers, contributors... -->
<developers>
<developer>
@@ -140,8 +148,7 @@
<!-- Nuiton librairies -->
<topia.version>2.2.0</topia.version>
<generator.version>1.0.0</generator.version>
- <jrst.version>1.0.0</jrst.version>
-
+
<!-- ChoReg -->
<choreg.version>1.0.0-alpha-2-SNAPSHOT</choreg.version>
@@ -156,6 +163,10 @@
<!-- ui -->
<tapestry.version>5.1.0.5</tapestry.version>
<chenillekit.version>1.0.2</chenillekit.version>
+
+ <!-- license to use -->
+ <license.licenseName>gpl_v3</license.licenseName>
+
</properties>
<build>
1
0
r11 - trunk/billy-ui/src/main/java/org/chorem/billy/ui/services
by tchemit@users.chorem.org 31 Aug '09
by tchemit@users.chorem.org 31 Aug '09
31 Aug '09
Author: tchemit
Date: 2009-08-31 15:18:03 +0200 (Mon, 31 Aug 2009)
New Revision: 11
Added:
trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java
Modified:
trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
Log:
[FIX] #31 CLassCastException H2Dialect en Dialect (build hibernate factory at init time)
here use the bonzoms init logic (but I don't known if it is good ? :))
Modified: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-31 13:17:15 UTC (rev 10)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-31 13:18:03 UTC (rev 11)
@@ -79,14 +79,30 @@
configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
}
+ /**
+ * Contribution to Tapestry Startup. Execution of BonzomsManager to registration ChoremServices and ChoremUIServices for ChoReg.
+ * Catch NoClassDefFoundError when ChoReg is not deployed in application server.
+ *
+ * @param configuration Tapestry configuration to contribution
+ * @param servicePerson test
+ */
+ public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration)
+ {
+ try {
+ configuration.add("BillyStartup", new BillyManager());
+ } catch (NoClassDefFoundError eee) {
+ System.out.println("AppModule.contributeRegistryStartup() : ChoremRegistry unavailable");
+ }
+ }
+
@EagerLoad
public RegistryShutdownListener buildBillyShutdown(@InjectService("RegistryShutdownHub") RegistryShutdownHub hub) {
RegistryShutdownListener listener = new ContextShutdown();
- /*try {
- listener = new BonzomsManager();
+ try {
+ listener = new BillyManager();
} catch (NoClassDefFoundError eee) {
- System.out.println("AppModule.buildBonzomsShutdown() : ChoremRegistry unavailable");
- }*/
+ System.out.println("AppModule.buildBillyShutdown() : ChoremRegistry unavailable");
+ }
hub.addRegistryShutdownListener(listener);
return listener;
}
Added: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java (rev 0)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java 2009-08-31 13:18:03 UTC (rev 11)
@@ -0,0 +1,102 @@
+/**
+ * *##% Bonzoms 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.billy.ui.services;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
+import org.chorem.billy.RegisterBillyServices;
+import org.chorem.choreg.ChoremConvert;
+import org.chorem.choreg.ChoremRegistry;
+import org.chorem.choreg.ChoremRegistryImpl;
+import org.chorem.choreg.ChoremUIService;
+
+/**
+ * BonzomsManager.java
+ *
+ * Created on 2009-07-28
+ *
+ * BonzomsManager manage registration uis services for ChoReg. Services are register when Tapestry start (run() method), and
+ * unregister when Tapestry shutdown (registryDidShutdown() method).
+ * BonzomsManager use RegisterBonzomsServices class from Bonzoms-business to manage business services for ChoReg.
+ *
+ * <pre>
+ * Proprietes pour configuration du serveur UI :
+ *
+ * org.chorem.choreg.ui.server.port=8081 #default = 8080
+ * org.chorem.choreg.ui.server.contextpath=bonzoms #default = bonzoms-ui-1.0.x (version used)
+ * org.chorem.choreg.ui.server.host=XXX.XXX.XXX #default = localhost
+ * </pre>
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author: fdesbois $
+ */
+public class BillyManager implements Runnable, RegistryShutdownListener {
+
+ public static final String CONFIG_KEY_UI_SERVER_HOST = "org.chorem.choreg.ui.server.host";
+
+ public static final String CONFIG_KEY_UI_SERVER_PORT = "org.chorem.choreg.ui.server.port";
+
+ public static final String CONFIG_KEY_UI_SERVER_CONTEXT_PATH = "org.chorem.choreg.ui.server.contextpath";
+
+ public static final String CONFIG_DEFAULT_UI_SERVER_HOST = "localhost";
+
+ public static final String CONFIG_DEFAULT_UI_SERVER_PORT = "8080";
+
+ private static final Log log = LogFactory.getLog(BillyManager.class);
+
+ private static ChoremRegistry choreg = ChoremRegistryImpl.getInstance();
+
+ @Override
+ public void run() {
+ RegisterBillyServices.startup();
+//
+// if (log.isInfoEnabled()) {
+// log.info("Bonzoms registration uis services");
+// }
+// register(ServiceUIPerson.getReferenceServiceClass(), new ServiceUIPerson(config));
+// register(ServiceUIOrganization.getReferenceServiceClass(), new ServiceUIOrganization(config));
+ }
+
+ @Override
+ public void registryDidShutdown() {
+ RegisterBillyServices.shutdown();
+ }
+
+ private void register(Class<?> serviceClass, ChoremUIService service) {
+ String sid = ChoremConvert.toSid(serviceClass);
+ choreg.register(sid, service);
+ if (log.isDebugEnabled()) {
+ log.debug(sid + " registered for ui");
+ }
+ }
+
+ private void unregister(Class<?> serviceClass) {
+ String sid = ChoremConvert.toSid(serviceClass);
+ choreg.unregister(sid);
+ if (log.isDebugEnabled()) {
+ log.debug(sid + " unregistered");
+ }
+ }
+
+}
Property changes on: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/BillyManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0
31 Aug '09
Author: tchemit
Date: 2009-08-31 15:17:15 +0200 (Mon, 31 Aug 2009)
New Revision: 10
Modified:
trunk/billy-business/src/main/java/org/chorem/billy/RegisterBillyServices.java
Log:
[FIX] #31 CLassCastException H2Dialect en Dialect (build hibernate factory at init time)
Modified: trunk/billy-business/src/main/java/org/chorem/billy/RegisterBillyServices.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/RegisterBillyServices.java 2009-08-31 13:09:50 UTC (rev 9)
+++ trunk/billy-business/src/main/java/org/chorem/billy/RegisterBillyServices.java 2009-08-31 13:17:15 UTC (rev 10)
@@ -28,6 +28,7 @@
import org.chorem.choreg.ChoremRegistry;
import org.chorem.choreg.ChoremRegistryImpl;
import org.chorem.choreg.ChoremService;
+import org.nuiton.topia.framework.TopiaContextImpl;
/**
* RegisterBillyServices.java
@@ -40,30 +41,36 @@
* Last update: $Date$
* by : $Author$
*/
-public class RegisterBillyServices implements Runnable, ServletContextListener {
+public class RegisterBillyServices implements ServletContextListener {
+//public class RegisterBillyServices implements Runnable, ServletContextListener {
private static final Log log = LogFactory.getLog(RegisterBillyServices.class);
private static final ChoremRegistry registry = ChoremRegistryImpl.getInstance();
- @Override
- public void run() {
+ public static void startup() {
if (log.isInfoEnabled()) {
- log.info("Cash registration business services");
+ log.info("Billy registration business services");
}
- //register(ServicePerson.class, new ServicePersonXPIL());
- }
+ // fix H2Dialect ClassCastException (force load of dialect class)
+ try {
+ // force le chargement de la factory hibernate
+ ((TopiaContextImpl) ContextUtilBilly.getRootContext()).getHibernateFactory();
+ } catch (Exception e) {
+ log.error(e);
+ }
- @Override
- public void contextInitialized(ServletContextEvent arg0) {
- run();
+
}
- @Override
- public void contextDestroyed(ServletContextEvent arg0) {
+ /**
+ * Shutdown ChoReg registration for business services. ToPIA root context is closed after unregistration.
+ */
+ public static void shutdown() {
+
+// unregister(ServicePerson.class);
+// unregister(ServiceOrganization.class);
- //unregister(ServicePerson.class);
-
try {
ContextUtilBilly.closeRootContext();
} catch (BillyException eee) {
@@ -72,8 +79,36 @@
}
}
}
+
+// @Override
+// public void run() {
+// if (log.isInfoEnabled()) {
+// log.info("Cash registration business services");
+// }
+// //register(ServicePerson.class, new ServicePersonXPIL());
+// }
- private void register(Class serviceClass, ChoremService service) {
+ @Override
+ public void contextInitialized(ServletContextEvent arg0) {
+ startup();
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent arg0) {
+
+ shutdown();
+ //unregister(ServicePerson.class);
+
+// try {
+// ContextUtilBilly.closeRootContext();
+// } catch (BillyException eee) {
+// if (log.isErrorEnabled()) {
+// log.error("Error when closing Root Context", eee);
+// }
+// }
+ }
+
+ private void register(Class<?> serviceClass, ChoremService service) {
String sid = ChoremConvert.toSid(serviceClass);
registry.register(sid, service);
if (log.isDebugEnabled()) {
@@ -81,7 +116,7 @@
}
}
- private void unregister(Class serviceClass) {
+ private void unregister(Class<?> serviceClass) {
String sid = ChoremConvert.toSid(serviceClass);
registry.unregister(sid);
if (log.isDebugEnabled()) {
1
0
Author: tchemit
Date: 2009-08-31 15:09:50 +0200 (Mon, 31 Aug 2009)
New Revision: 9
Modified:
trunk/billy-business/src/main/resources/TopiaContextBilly.properties
Log:
[FIX] #30 java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token
Modified: trunk/billy-business/src/main/resources/TopiaContextBilly.properties
===================================================================
--- trunk/billy-business/src/main/resources/TopiaContextBilly.properties 2009-08-28 12:01:57 UTC (rev 8)
+++ trunk/billy-business/src/main/resources/TopiaContextBilly.properties 2009-08-31 13:09:50 UTC (rev 9)
@@ -8,4 +8,5 @@
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:file:~/h2data/billy
-
+# fix java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token
+hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory
1
0
Author: fdesbois
Date: 2009-08-28 14:01:57 +0200 (Fri, 28 Aug 2009)
New Revision: 8
Added:
trunk/billy-business/src/main/java/org/chorem/billy/external/ImportUrl.java
trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceForm.java
trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceList.java
trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/Index.properties
trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceForm.properties
trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceList.properties
trunk/billy-ui/src/main/webapp/InvoiceForm.tml
trunk/billy-ui/src/main/webapp/InvoiceList.tml
Removed:
trunk/billy-business/src/main/java/org/chorem/billy/external/ImportReferenceUrl.java
Modified:
trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java
trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java
trunk/billy-business/src/main/java/org/chorem/billy/external/ImportXPIL.java
trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java
trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java
trunk/billy-business/src/main/xmi/billy.zargo
trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java
trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
trunk/billy-ui/src/main/java/org/chorem/billy/ui/utils/ErrorHelper.java
trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.properties
trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.tml
trunk/billy-ui/src/main/webapp/css/common.css
Log:
Implementation for UI with client from xPIL (InvoiceForm and InvoiceList)
Modified: trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -21,10 +21,12 @@
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
+import org.chorem.billy.BillyException;
import org.chorem.billy.BillyModelDAOHelper;
import org.chorem.billy.ContextUtilBilly;
import org.chorem.billy.dto.Client;
import org.chorem.billy.dto.ClientPerson;
+import org.chorem.billy.external.ImportUrl;
import org.chorem.billy.persistence.ClientEntity;
import org.chorem.billy.persistence.ClientEntityDAO;
import org.chorem.exceptions.EntityException;
@@ -76,7 +78,7 @@
return entity;
}
- public static ClientPerson getClientPerson(ClientEntity entity, Client client) {
+ public static ClientPerson getClientPerson(ClientEntity entity, Client client) throws BillyException {
ClientPerson person = new ClientPerson();
person.setName(entity.getPersonName());
person.setSource(entity.getSource());
@@ -90,9 +92,17 @@
client = new Client();
client.setName(entity.getName());
client.setSiret(entity.getSiret());
- client.setSource(entity.getSource());
+ client.setSource(entity.getSource());
}
-
+
+ if (client.getSource() != null && !client.getSource().isEmpty()) {
+ try {
+ ImportUrl importUrl = new ImportUrl();
+ client = importUrl.setClientUrl(client);
+ } catch (NoClassDefFoundError eee) {
+ }
+ }
+
person.setClient(client);
return person;
Modified: trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -19,6 +19,7 @@
package org.chorem.billy.business;
+import org.chorem.billy.BillyException;
import org.chorem.billy.ContextUtilBilly;
import org.chorem.billy.dto.ClientPerson;
import org.chorem.billy.dto.Invoice;
@@ -40,7 +41,7 @@
*/
public class InvoiceHelper {
- public static Invoice getInvoice(InvoiceEntity entity) throws ConvertException {
+ public static Invoice getInvoice(InvoiceEntity entity) throws ConvertException, BillyException {
Invoice invoice = Convert.toDTO(entity, InvoiceEntity.class, Invoice.class);
invoice.setId(ContextUtilBilly.convertId(entity.getTopiaId()));
Deleted: trunk/billy-business/src/main/java/org/chorem/billy/external/ImportReferenceUrl.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/external/ImportReferenceUrl.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/external/ImportReferenceUrl.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -1,66 +0,0 @@
-/**
- * *##% Billy 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.billy.external;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.billy.BillyException;
-import org.chorem.billy.ContextUtilBilly;
-import org.chorem.choreg.ChoremRegistry;
-import org.chorem.choreg.ChoremRegistryImpl;
-import org.chorem.choreg.Link;
-import org.chorem.choreg.exceptions.NoServiceException;
-
-/**
- * ImportReferenceUrl.java
- *
- * Created on 2009-08-26
- *
- * @author fdesbois
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-public class ImportReferenceUrl {
-
- private static ChoremRegistry choreg;
-
- private static final Log log = LogFactory.getLog(ImportReferenceUrl.class);
-
- public ImportReferenceUrl() {
- choreg = ChoremRegistryImpl.getInstance();
- }
-
- /*public Reference setReferenceUrl(Reference reference) throws CashException {
- try {
- String url = choreg.findViewUrl(null, reference.getSource());
- reference.setUrl(url);
- } catch (NoServiceException eee) {
- if (log.isWarnEnabled()) {
- log.warn(eee.getMessage());
- }
- } catch (Exception eee) {
- ContextUtilCash.serviceException(null,
- "An error occured when retrieve url for reference '" + reference.getSource() + "' from ChoremRegistry", eee);
- }
- return reference;
- }*/
-}
Copied: trunk/billy-business/src/main/java/org/chorem/billy/external/ImportUrl.java (from rev 2, trunk/billy-business/src/main/java/org/chorem/billy/external/ImportReferenceUrl.java)
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/external/ImportUrl.java (rev 0)
+++ trunk/billy-business/src/main/java/org/chorem/billy/external/ImportUrl.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,71 @@
+/**
+ * *##% Billy 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.billy.external;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.billy.BillyException;
+import org.chorem.billy.ContextUtilBilly;
+import org.chorem.billy.dto.Client;
+import org.chorem.choreg.ChoremRegistry;
+import org.chorem.choreg.ChoremRegistryImpl;
+import org.chorem.choreg.exceptions.NoServiceException;
+
+/**
+ * ImportReferenceUrl.java
+ *
+ * Created on 2009-08-26
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ImportUrl {
+
+ private static ChoremRegistry choreg;
+
+ private static final Log log = LogFactory.getLog(ImportUrl.class);
+
+ public ImportUrl() {
+ choreg = ChoremRegistryImpl.getInstance();
+ }
+
+ public Client setClientUrl(Client client) throws BillyException {
+ try {
+ String viewUrl = choreg.findViewUrl(null, client.getSource());
+ client.setViewUrl(viewUrl);
+ /*String formUrl = choreg.findFormUrl(null, client.getSource());
+ client.setFormUrl(formUrl);
+ String listUrl = choreg.findListUrl(null, client.getSource(), null);
+ client.setFormUrl(listUrl);*/
+
+ } catch (NoServiceException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn(eee.getMessage());
+ }
+ } catch (Exception eee) {
+ ContextUtilBilly.serviceException(null,
+ "An error occured when retrieve url for client '" + client.getSource() + "' from ChoremRegistry", eee);
+ }
+ return client;
+ }
+}
Property changes on: trunk/billy-business/src/main/java/org/chorem/billy/external/ImportUrl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision
Added: svn:mergeinfo
+
Modified: trunk/billy-business/src/main/java/org/chorem/billy/external/ImportXPIL.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/external/ImportXPIL.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/external/ImportXPIL.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -73,8 +73,7 @@
* - Person Type include personName, personSourceId, membershipOrganisations with subDivisionNames
* - Organisation Type include organisationName, organisationSourceId, subDivisionNames
* </pre>
- * Person document includes organisationSourceId in membershipOrganisations.
- * Two steps : Check all files and use maps to store data from PartyDocument. Then routing maps for convert PartyDocument into DTO objects.
+ * Person document includes organisationSourceId in membershipOrganisations.
* @return list of ClientOrganization which contains SubDivisions and Persons (Clients)
* @throws BillyException
*/
@@ -83,13 +82,7 @@
try {
List<InputStream> streams = choreg.findAll(null, FormatType.OASIS_CIQ_XPIL, InputStream.class, null);
- /* First : Creation of two maps */
-
- // Key = organizationId, value = List persons PartyDocument
- //Map<String, List<PartyDocument>> persons = new HashMap<String, List<PartyDocument>>();
- // Key = organizationId, value = organization PartyDocument
- //Map<String, PartyDocument> organizations = new HashMap<String, PartyDocument>();
-
+ // Map to search and store clients
Map<String, Client> clients = new HashMap<String, Client>();
for (InputStream stream : streams) {
@@ -111,7 +104,7 @@
client = new Client();
client.setSource(organizationId);
clients.put(organizationId, client);
- results.add(client);
+ results.add(client); // Add to result new client
}
Map<String, List<ClientPerson>> services = client.getServices();
@@ -123,7 +116,6 @@
Memberships.Membership.Organisation orga = membership.getOrganisation();
for (Memberships.Membership.Organisation.SubDivisionName sub : orga.getSubDivisionNameArray()) {
- //SubDivision division = getSubDivisionFromOrganization(organization, sub.getStringValue());
String subDivisionName = sub.getStringValue();
List<ClientPerson> persons = services.get(subDivisionName);
@@ -140,33 +132,12 @@
person.setClient(client);
persons.add(person);
-
}
-
- /*List<PartyDocument> partys = persons.get(organizationId);
- if (partys == null) {
- partys = new ArrayList<PartyDocument>();
- persons.put(organizationId, partys);
- }
- partys.add(doc);*/
}
} else if (XNLHelper.hasOrganisationNames(partyName)) {
// ORGANIZATION FILE
String organizationId = XPILHelper.getMainIdentifier(party);
- /*Client client = clients.get(organizationId);
- if (client == null) {
- client = new Client();
- client.setSource(organizationId);
- clients.put(organizationId, client);
- }
-
-
- Map<String, List<ClientPerson>> services = client.getServices();
- if (services == null) {
- services = new HashMap<String, List<ClientPerson>>();
- client.setServices(services);
- }*/
Client client = clients.get(organizationId);
if (client == null) {
client = new Client();
@@ -186,108 +157,24 @@
// Add subdivisions for organization
for (SimplifiedNameElement name : XNLHelper.getSubDivisionNames(partyName)) {
// Create subdivision DTO
- //SubDivision division = new SubDivision();
String subDivisionName = name.getValue();
List<ClientPerson> persons = services.get(subDivisionName);
if (persons == null) {
persons = new ArrayList<ClientPerson>();
services.put(subDivisionName, persons);
}
-
- //division.setName(name.getValue());
- //division.setClientOrganization(organization);
- //organization.addSubDivision(division);
}
- //clients.put(organizationId, organization);
-
-
- //organizations.put(organizationId, doc);
}
}
- /*for (String clientId : clients.keySet()) {
- Client client = clients.get(clientId);
- results.add(client);
- }*/
- //results = clients.
- /* Second : Interpret map data to convert into DTO object */
- /*for (String organizationId : organizations.keySet()) {
- PartyType party = organizations.get(organizationId).getParty();
- PartyNameType partyName = party.getPartyName();
-
- // Create clientOrganization DTO
- Client organization = new Client();
- organization.setSource(organizationId);
- organization.setName(XNLHelper.getOrganisationSimpleName(partyName));
-
- // Add subdivisions for organization
- for (SimplifiedNameElement name : XNLHelper.getSubDivisionNames(partyName)) {
- // Create subdivision DTO
- SubDivision division = new SubDivision();
- division.setName(name.getValue());
- division.setClientOrganization(organization);
- organization.addSubDivision(division);
- }
-
- // Get personDocuments from Map with key = organizationId
- List<PartyDocument> personDocuments = persons.get(organizationId);
-
- // Add persons to subdivision from organization
- for (PartyDocument personDoc : personDocuments) {
-
- PartyType personParty = personDoc.getParty();
- PartyNameType personName = personParty.getPartyName();
-
- // Create client (person) DTO
- Client client = new Client();
- String personId = XPILHelper.getMainIdentifier(party);
- client.setPersonSource(personId);
- client.setPersonName(XNLHelper.getPersonSimpleName(personName));
-
- Memberships.Membership.Organisation orga = getMembershipOrganisation(personParty, organizationId);
- // Add to divisions from organization
- for (Memberships.Membership.Organisation.SubDivisionName sub : orga.getSubDivisionNameArray()) {
- SubDivision division = getSubDivisionFromOrganization(organization, sub.getStringValue());
- if (division != null) {
- //client.addDivision(division);
- division.addClient(client);
- }
- }
-
- }
-
- results.add(organization);
- }*/
-
} catch (NoServiceException eee) {
- if (log.isInfoEnabled()) {
- log.info("No service available for xPIL format to retrieve existing Organisations and Persons clients for Billy");
+ if (log.isWarnEnabled()) {
+ log.warn("No service available for xPIL format to retrieve existing Organisations and Persons clients for Billy");
}
} catch (Exception eee) {
ContextUtilBilly.serviceException(null, "An error occured when retrieve XPIL clients from ChoremRegistry", eee);
}
return results;
}
-/*
- private SubDivision getSubDivisionFromOrganization(ClientOrganization organization, String subDivisionName) {
- for (SubDivision division : organization.getSubDivision()) {
- if (division.getName().equals(subDivisionName)) {
- return division;
- }
- }
- return null;
- }
-
- private Memberships.Membership.Organisation getMembershipOrganisation(PartyType partyType, String organizationId) {
-
- for (Memberships.Membership membership : partyType.getMemberships().getMembershipArray()) {
- Memberships.Membership.MembershipElement element = membership.getMembershipElementArray(0);
- if (element.getStringValue().equals(organizationId)) {
- return membership.getOrganisation();
- }
- }
- return null;
-
- }*/
}
Modified: trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -31,6 +31,7 @@
import org.chorem.billy.business.ClientHelper;
import org.chorem.billy.dto.Client;
import org.chorem.billy.dto.ClientPerson;
+import org.chorem.billy.external.ImportUrl;
import org.chorem.billy.external.ImportXPIL;
import org.chorem.billy.persistence.ClientEntity;
import org.chorem.billy.persistence.ClientEntityDAO;
@@ -231,17 +232,18 @@
private List<Client> importXpilReferences(List<Client> input) throws BillyException {
try {
ImportXPIL xpil = new ImportXPIL();
+ ImportUrl importUrl = new ImportUrl();
if (log.isInfoEnabled()) {
log.info("ImportXPIL...");
}
- if (clientsImportedCache == null) {
+ //if (clientsImportedCache == null) {
if (log.isDebugEnabled()) {
log.debug("New imports, create Cache");
}
clientsImportedCache = xpil.findAll();
- }
+ //}
int nbPersonsImported = 0;
int nbPersonsFromXpil = 0;
@@ -251,11 +253,17 @@
Client clientFind = getClient(input, client);
if (clientFind == null) { // new Client from xPIL
input.add(client);
+ importUrl.setClientUrl(client); // Url for Client from xPIL (already set if clientFind from DB)
if (log.isDebugEnabled()) {
- log.debug("Add Client : " + client.getSource() + " _ " + client.getSiret());
+ log.debug("Add Client : " + client.getName() + " _ " + client.getSiret() + " _ " + client.getSource());
}
} else { // Client already exist
+ // MAJ CLIENT
+ clientFind.setSource(client.getSource());
+ clientFind.setSiret(client.getSiret());
+ clientFind.setName(client.getName());
+
Map<String, List<ClientPerson>> servicesFind = clientFind.getServices();
for (String serviceName : client.getServices().keySet()) {
@@ -277,9 +285,14 @@
if (personFind == null) { // new ClientPerson from xPIL
personsFind.add(person);
if (log.isDebugEnabled()) {
- log.debug("Add Person : " + person.getSource() + " _ " + person.getEmail());
+ log.debug("Add Person : " + person.getName() + " _ " + person.getEmail() + " _ " + person.getSource());
}
nbPersonsImported++;
+ } else {
+ // MAJ PERSON
+ personFind.setSource(person.getSource());
+ personFind.setName(person.getName());
+ personFind.setEmail(person.getEmail());
}
}
}
@@ -289,53 +302,13 @@
}
}
- /*for (ClientOrganization organization : clientsImportedCache) {
-
- ClientOrganization organizationFind = getClientOrganization(input, organization);
- if (organizationFind == null) {
- //organizationFind = organization;
- input.add(organization);
- if (log.isDebugEnabled()) {
- log.debug("ClientOrganization : " + organization.getSource());
- }
- } else {
- // TODO MAJ Organization parameter if needed
-
- for (SubDivision division : organization.getSubDivision()) {
- //division.
- SubDivision divisionFind = getDivision(organizationFind, division);
-
- if (divisionFind == null) {
- //divisionFind = division;
- organizationFind.addSubDivision(division);
- if (log.isDebugEnabled()) {
- log.debug("SubDivision : " + division.getName());
- }
- } else {
- // TODO MAJ SubDivision parameter if needed
-
- for (Client client : division.getClient()) {
- //division.
- Client clientFind = getClient(divisionFind, client);
- if (clientFind == null) {
- divisionFind.addClient(client);
- if (log.isDebugEnabled()) {
- log.debug("Client : " + client.getPersonSource());
- }
- }
- }
- }
- }
-
+ /*ImportUrl importUrl = new ImportUrl();
+ for (Client client : input) {
+ if (client.getSource() != null && !client.getSource().isEmpty()) {
+ importUrl.setClientUrl(client);
}
-
}*/
- /*ImportReferenceUrl importUrl = new ImportReferenceUrl();
- for (Reference reference : input) {
- importUrl.setReferenceUrl(reference);
- }*/
-
if (log.isInfoEnabled()) {
if (nbPersonsFromXpil != 0) {
log.info("...clients imported");
@@ -356,20 +329,26 @@
private Client getClient(List<Client> input, Client client) {
for (Client in : input) {
- if (client.getSource().equals(in.getSource())) {
+ boolean sameSource = client.getSource().equals(in.getSource());
+ boolean sameName = client.getName().equals(in.getName());
+ // TODO siret comparison
+ // boolean sameSiret = client.getSiret().equals(in.getSiret());
+ if (sameSource || sameName) {
return in;
}
- // TODO siret comparison
}
return null;
}
private ClientPerson getClientPerson(List<ClientPerson> input, ClientPerson person) {
for (ClientPerson in : input) {
- if (person.getSource().equals(in.getSource())) {
+ boolean sameSource = person.getSource().equals(in.getSource());
+ boolean sameName = person.getName().equals(in.getName());
+ // TODO email comparison
+ // boolean sameEmail = client.getEmail().equals(in.getEmail());
+ if (sameSource || sameName) {
return in;
}
- // TODO email comparison
}
return null;
}
Modified: trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -31,7 +31,10 @@
import org.chorem.billy.ContextUtilBilly;
import org.chorem.billy.business.ClientHelper;
import org.chorem.billy.business.InvoiceHelper;
+import org.chorem.billy.dto.Client;
+import org.chorem.billy.dto.ClientPerson;
import org.chorem.billy.dto.Invoice;
+import org.chorem.billy.external.ImportUrl;
import org.chorem.billy.persistence.ClientEntity;
import org.chorem.billy.persistence.InvoiceEntity;
import org.chorem.billy.persistence.InvoiceEntityDAO;
@@ -149,7 +152,31 @@
@Override
public Invoice getNewInvoice() {
- return new Invoice();
+ Invoice invoice = new Invoice();
+ ClientPerson person = new ClientPerson();
+ person.setClient(new Client());
+ invoice.setClientPerson(person);
+ return invoice;
}
+ @Override
+ public Invoice getInvoice(String invoiceId) throws BillyException {
+ Invoice result = null;
+ TopiaContext transaction = null;
+ try {
+ transaction = context.beginTransaction();
+
+ InvoiceEntityDAO dao = BillyModelDAOHelper.getInvoiceEntityDAO(transaction);
+
+ InvoiceEntity entity = ServiceHelper.getEntity(dao, invoiceId, log);
+
+ result = InvoiceHelper.getInvoice(entity);
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ ContextUtilBilly.serviceException(transaction, "Unable to get invoice with id = " + invoiceId, eee);
+ }
+ return result;
+ }
+
}
Modified: trunk/billy-business/src/main/xmi/billy.zargo
===================================================================
(Binary files differ)
Modified: trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java
===================================================================
--- trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -100,11 +100,11 @@
fail("BillyException : " + eee.getMessage());
}
- try {
+ /*try {
instance.deleteClient(client);
} catch (BillyException eee) {
fail("BillyException : " + eee.getMessage());
- }
+ }*/
}
/**
@@ -179,12 +179,12 @@
fail("BillyException : " + eee.getMessage());
}
- try {
+ /*try {
instance.deleteClient(client1);
instance.deleteClient(client2);
} catch (BillyException eee) {
fail("BillyException : " + eee.getMessage());
- }
+ }*/
}
Added: trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceForm.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceForm.java (rev 0)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceForm.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,316 @@
+/**
+ * *##% Billy 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.billy.ui.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.OptionModel;
+import org.apache.tapestry5.SelectModel;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Log;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.corelib.components.Form;
+import org.apache.tapestry5.internal.OptionModelImpl;
+import org.apache.tapestry5.internal.SelectModelImpl;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.services.PropertyAccess;
+import org.chorem.billy.BillyException;
+import org.chorem.billy.dto.Client;
+import org.chorem.billy.dto.ClientPerson;
+import org.chorem.billy.dto.Invoice;
+import org.chorem.billy.services.ServiceClient;
+import org.chorem.billy.services.ServiceInvoice;
+import org.chorem.billy.ui.base.DataLoader;
+import org.chorem.billy.ui.base.GenericSelectModel;
+import org.chorem.billy.ui.components.Layout;
+import org.chorem.billy.ui.utils.ErrorHelper;
+import org.slf4j.Logger;
+
+/**
+ * InvoiceForm.java
+ *
+ * Created on 2009-08-27 by fdesbois
+ *
+ * @author fdesbois
+ * @version $Revision: 8 $
+ *
+ * Last update: $Date: 2009-08-13 09:14:50 +0200 (Thu, 13 Aug 2009) $
+ * by : $Author: fdesbois $
+ */
+public class InvoiceForm implements DataLoader {
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private ServiceInvoice serviceInvoice;
+
+ @Inject
+ private ServiceClient serviceClient;
+
+ @InjectComponent
+ private Layout layout;
+
+ @Persist
+ private List<Client> clients;
+
+ @Persist
+ private Invoice invoice;
+
+ private String invoiceId;
+
+ @InjectComponent
+ private Form monForm;
+
+ @Inject
+ private PropertyAccess propertyAccess;
+
+ private GenericSelectModel<Client> companiesSelectModel;
+
+ private SelectModel servicesSelectModel;
+
+ private GenericSelectModel<ClientPerson> personsSelectModel;
+
+ void onActivate(EventContext ec) {
+ if (ec.getCount() > 0) {
+ this.invoiceId = ec.get(String.class, 0);
+ }
+ }
+
+ String onPassivate() {
+ return this.invoiceId;
+ }
+
+ @Override
+ @Log
+ public void loadData() {
+ layout.clean();
+ clients = null;
+ getClients();
+ invoice = null;
+ getInvoice();
+ }
+
+ public List<Client> getClients() {
+ if (clients == null) {
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("BUSINESS_REQUEST [getClients]");
+ }
+ clients = serviceClient.getClients();
+ if (log.isDebugEnabled()) {
+ log.debug("Nb clients : " + clients.size());
+ }
+ } catch (BillyException eee) {
+ layout.addErrors(ErrorHelper.getMessages("Impossible de charger les liste des clients", eee));
+ }
+ }
+ return clients;
+ }
+
+ public Invoice getInvoice() {
+ if (invoice == null) {
+ if (invoiceId != null && !invoiceId.isEmpty()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Chargement d'une facture existante id = " + invoiceId);
+ }
+ try {
+ invoice = serviceInvoice.getInvoice(invoiceId);
+ } catch (BillyException eee) {
+ layout.addErrors(ErrorHelper.getMessages("Impossible de charger les liste des clients", eee));
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Préparation nouvelle facture");
+ }
+ invoice = serviceInvoice.getNewInvoice();
+ }
+ }
+ return invoice;
+ }
+
+ public void setInvoice(Invoice invoice) {
+ this.invoice = invoice;
+ }
+
+ public GenericSelectModel<Client> getCompaniesSelectModel() {
+ if (companiesSelectModel == null) {
+ companiesSelectModel = new GenericSelectModel<Client>(getClients(), Client.class, "name", "name", propertyAccess);
+ }
+ return companiesSelectModel;
+ }
+
+ public SelectModel getServicesSelectModel() {
+ if (servicesSelectModel == null) {
+ List<OptionModel> options = new ArrayList<OptionModel>();
+
+ String clientName = getInvoice().getClientPerson().getClient().getName();
+
+ if (clientName != null && !clientName.isEmpty()) {
+
+ Client client = getCompaniesSelectModel().findObject(clientName);
+
+ Map<String, List<ClientPerson>> services = client.getServices();
+ for (String serviceName : services.keySet()) {
+
+ options.add(new OptionModelImpl(serviceName));
+ }
+ } /*else {
+ options.add(new OptionModelImpl("Sélectionnez une société !", ""));
+ }*/
+
+ servicesSelectModel = new SelectModelImpl(null, options);
+ }
+ return servicesSelectModel;
+ }
+
+ public GenericSelectModel<ClientPerson> getPersonsSelectModel() {
+ if (personsSelectModel == null) {
+
+ ClientPerson person = getInvoice().getClientPerson();
+ String clientName = person.getClient().getName();
+ String serviceName = person.getSubDivisionName();
+ List<ClientPerson> persons = new ArrayList<ClientPerson>();
+ if (serviceName != null && !serviceName.isEmpty()) {
+ Client client = getCompaniesSelectModel().findObject(clientName);
+ persons = client.getServices().get(serviceName);
+ //personsSelectModel = new GenericSelectModel<ClientPerson>(persons, ClientPerson.class, "name", "id", propertyAccess);
+ } /*else {
+ personsSelectModel = new GenericSelectModel<ClientPerson>(new ArrayList<ClientPerson>(), ClientPerson.class, "name", "id", propertyAccess);
+ personsSelectModel.getOptions().add(new OptionModelImpl("Sélectionnez un service !", ""));
+ } */
+ personsSelectModel = new GenericSelectModel<ClientPerson>(persons, ClientPerson.class, "name", "name", propertyAccess);
+
+ }
+ return personsSelectModel;
+ }
+
+ /*@InjectComponent
+ private Zone clientFormZone;
+
+ @Persist
+ @Property
+ private String companyName;
+
+ @Persist
+ @Property
+ private String serviceName;
+
+ @Persist
+ @Property
+ private String personId;
+
+ @Log
+ Object onChangeFromCompanies(String value) {
+ Client client = getCompaniesSelectModel().findObject(value);
+ getInvoice().getClientPerson().setClient(client);
+ return clientFormZone.getBody();
+ }
+
+ @Log
+ Object onChangeFromServices(String value) {
+ getInvoice().getClientPerson().setSubDivisionName(value);
+ return clientFormZone.getBody();
+ }
+
+ @Log
+ void onChangeFromPersons(String value) {
+ ClientPerson person = getPersonsSelectModel().findObject(value);
+ getInvoice().setClientPerson(person);
+ }*/
+
+ @Property
+ private String personName;
+
+ @Property
+ private String clientName;
+
+ @Property
+ private String serviceName;
+
+ void onPrepareFromMonForm() {
+ if (clientName == null) {
+ clientName = getInvoice().getClientPerson().getClient().getName();
+ }
+ if (serviceName == null) {
+ serviceName = getInvoice().getClientPerson().getSubDivisionName();
+ }
+ if (personName == null) {
+ personName = getInvoice().getClientPerson().getName();
+ }
+ }
+
+ private boolean editSelected;
+
+ void onSelectedFromCompanyChange() {
+ editSelected = true;
+ }
+
+ void onSelectedFromServiceChange() {
+ editSelected = true;
+ }
+
+ @Log
+ Object onSuccessFromMonForm() {
+ if (clientName != null) {
+ Client client = getCompaniesSelectModel().findObject(clientName);
+ if (log.isDebugEnabled()) {
+ log.debug("Client = " + client);
+ }
+ ClientPerson person = getInvoice().getClientPerson();
+ person.setClient(client);
+ person.setSubDivisionName(serviceName);
+ if (personName != null) {
+ ClientPerson selectedPerson = getPersonsSelectModel().findObject(personName);
+ getInvoice().setClientPerson(selectedPerson);
+ if (log.isDebugEnabled()) {
+ log.debug("Person id = " + selectedPerson.getId());
+ log.debug("Person name = " + selectedPerson.getName());
+ }
+ }
+ }
+
+ if (!editSelected) {
+
+ try {
+ serviceInvoice.createUpdateInvoice(invoice);
+ } catch (BillyException eee) {
+ List<String> errors = ErrorHelper.getMessages("Un erreur est survenue, sauvegarde impossible de la facture !",eee);
+ for (String error : errors) {
+ monForm.recordError(error);
+ }
+ }
+ return monForm.getHasErrors() ? monForm : InvoiceList.class;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("CHANGE ACTION");
+ }
+
+
+
+
+ }
+ return monForm;
+ }
+
+}
Added: trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceList.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceList.java (rev 0)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/pages/InvoiceList.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,93 @@
+/**
+ * *##% Billy 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.billy.ui.pages;
+
+import java.util.List;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.billy.BillyException;
+import org.chorem.billy.dto.Invoice;
+import org.chorem.billy.services.ServiceInvoice;
+import org.chorem.billy.ui.base.DataLoader;
+import org.chorem.billy.ui.components.Layout;
+import org.chorem.billy.ui.utils.ErrorHelper;
+import org.slf4j.Logger;
+
+/**
+ * InvoiceForm.java
+ *
+ * Created on 2009-08-27 by fdesbois
+ *
+ * @author fdesbois
+ * @version $Revision: 8 $
+ *
+ * Last update: $Date: 2009-08-13 09:14:50 +0200 (Thu, 13 Aug 2009) $
+ * by : $Author: fdesbois $
+ */
+public class InvoiceList implements DataLoader {
+
+
+ @InjectComponent
+ private Layout layout;
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private ServiceInvoice serviceInvoice;
+
+ @Persist
+ private List<Invoice> invoices;
+
+ @Property
+ private Invoice invoice;
+
+ @Override
+ public void loadData() {
+ invoices = null;
+ getInvoices();
+ }
+
+ public List<Invoice> getInvoices() {
+ if (invoices == null) {
+ try {
+ invoices = serviceInvoice.getAllInvoices();
+ if (log.isDebugEnabled()) {
+ for (Invoice current : invoices) {
+ log.debug(current.toString());
+ }
+ }
+ } catch (BillyException eee) {
+ layout.addErrors(ErrorHelper.getMessages("Une erreur est survenue, impossible de charger toutes les factures", eee));
+ }
+ }
+ return invoices;
+ }
+
+ void onActionFromDelInvoice(String invoiceId) {
+ try {
+ serviceInvoice.deleteInvoice(invoiceId);
+ } catch (BillyException eee) {
+ log.error("Erreur lors de la suppression de la facture avec pour identifiant = " + invoiceId);
+ }
+ }
+}
Modified: trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/services/AppModule.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -56,7 +56,8 @@
// Use service builder methods (example below) when the implementation
// is provided inline, or requires more initialization than simply
// invoking the constructor.
-
+ binder.bind(ServiceClient.class, ServiceClientImpl.class);
+ binder.bind(ServiceInvoice.class, ServiceInvoiceImpl.class);
}
@@ -79,7 +80,7 @@
}
@EagerLoad
- public RegistryShutdownListener buildCashShutdown(@InjectService("RegistryShutdownHub") RegistryShutdownHub hub) {
+ public RegistryShutdownListener buildBillyShutdown(@InjectService("RegistryShutdownHub") RegistryShutdownHub hub) {
RegistryShutdownListener listener = new ContextShutdown();
/*try {
listener = new BonzomsManager();
Modified: trunk/billy-ui/src/main/java/org/chorem/billy/ui/utils/ErrorHelper.java
===================================================================
--- trunk/billy-ui/src/main/java/org/chorem/billy/ui/utils/ErrorHelper.java 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-ui/src/main/java/org/chorem/billy/ui/utils/ErrorHelper.java 2009-08-28 12:01:57 UTC (rev 8)
@@ -51,8 +51,8 @@
public static List<String> getMessages(String message, Exception eee, int precision) {
List<String> results = new ArrayList<String>();
switch (precision) {
- case 2: results.add("Error : " + eee.getCause().getClass().getName() + " : " + eee.getCause().getMessage());
- case 1: results.add("Error : " + eee.getMessage());
+ case 1: results.add("Error : " + eee.getCause().getClass().getName() + " : " + eee.getCause().getMessage());
+ //case 1: results.add("Error : " + eee.getMessage())
case 0: results.add(message);
}
Collections.reverse(results);
Modified: trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.properties
===================================================================
--- trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.properties 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.properties 2009-08-28 12:01:57 UTC (rev 8)
@@ -1,3 +1,2 @@
-menu-references=References
-menu-entry=Pr\u00E9visionnel
-menu-category=Cat\u00E9gories
\ No newline at end of file
+menu-invoice-form=Nouvelle facture
+menu-invoice-list=Liste des factures
\ No newline at end of file
Modified: trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.tml
===================================================================
--- trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.tml 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-ui/src/main/resources/org/chorem/billy/ui/components/Layout.tml 2009-08-28 12:01:57 UTC (rev 8)
@@ -9,7 +9,7 @@
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<t:if test="hasBorder()">
- <title>Ca$h : ${pageTitle}</title>
+ <title>Billy : ${pageTitle}</title>
<link rel="stylesheet" type="text/css" href="${asset:context:}/css/main.css" />
<link rel="stylesheet" type="text/css" href="${asset:context:}/css/window/default.css" />
<link rel="stylesheet" type="text/css" href="${asset:context:}/css/window/alphacube.css" />
@@ -19,7 +19,7 @@
<body>
<div id='layout'>
<t:if test="hasBorder()">
- <div id="header">CA$H</div>
+ <div id="header">BILLY</div>
<ul id="lang">
<li><t:actionlink t:id="langFrLink"><img src="${asset:context:img/flag_fr.png}" alt="Français"/></t:actionlink></li>
<li><t:actionlink t:id="langEnLink"><img src="${asset:context:img/flag_en.png}" alt="English" /></t:actionlink></li>
@@ -27,9 +27,8 @@
<div id="left_side">
<div id="menu">
<ul>
- <li><t:pagelink t:id="entryLink" t:page="previewTable">${message:menu-entry}</t:pagelink></li>
- <li><t:pagelink t:id="categoryLink" t:page="categoryManager">${message:menu-category}</t:pagelink></li>
- <li><t:pagelink t:id="referenceLink" t:page="reference/list">${message:menu-references}</t:pagelink></li>
+ <li><t:pagelink t:id="invoiceLink" t:page="invoiceList">${message:menu-invoice-list}</t:pagelink></li>
+ <li><t:pagelink t:id="formLink" t:page="invoiceForm">${message:menu-invoice-form}</t:pagelink></li>
</ul>
</div>
<img src="${asset:context:/img/7ter.jpg}" alt="petits lutins"/>
Added: trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/Index.properties
===================================================================
--- trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/Index.properties (rev 0)
+++ trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/Index.properties 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1 @@
+welcome=Bienvenue sur l'application Billy. Billy permet de g\u00E9rer les factures d'une soci\u00E9t\u00E9.
\ No newline at end of file
Added: trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceForm.properties
===================================================================
--- trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceForm.properties (rev 0)
+++ trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceForm.properties 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,3 @@
+h1=Ajout / modification d'une facture
+title-page=Ajout / modification d'une facture
+submit-label=Enregistrer
\ No newline at end of file
Added: trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceList.properties
===================================================================
--- trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceList.properties (rev 0)
+++ trunk/billy-ui/src/main/resources/org/chorem/billy/ui/pages/InvoiceList.properties 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,6 @@
+title-page=Liste des factures
+h1=Liste de toutes les factures
+edit-invoice=Modifier cette facture
+add-invoice=Ajouter une nouvelle facture
+del-invoice=Supprimer cette facture
+del-confirm=Suppression d\u00E9finitive de la facture. Etes vous s\u00FBr de vouloir continuer ?
\ No newline at end of file
Added: trunk/billy-ui/src/main/webapp/InvoiceForm.tml
===================================================================
--- trunk/billy-ui/src/main/webapp/InvoiceForm.tml (rev 0)
+++ trunk/billy-ui/src/main/webapp/InvoiceForm.tml 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,71 @@
+<!-- InvoiceForm.tml
+
+ Author: fdesbois
+ Revision: $Revision: 5 $
+
+ Last update: $Date: 2009-07-31 16:58:45 +0200 (Fri, 31 Jul 2009) $
+ by $Author: fdesbois $
+-->
+<t:layout t:ident="invoiceForm" t:pageTitle="${message:title-page}"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
+
+ <h1>${message:h1}</h1>
+ <t:zone t:id="invoiceFormZone" id="invoiceFormZone" update="show">
+ <form t:type="form" t:id="monForm" t:zone="invoiceFormZone"><t:errors />
+ <div class="clearfix" id="billy-form-invoice">
+ <div class="fleft">
+ <p><t:label for="companies" /> : </p>
+ <p><t:label for="services" /> : </p>
+ <p><t:label for="persons" /> : </p>
+ <p><t:label for="invoiceNumber" /> : </p>
+ <p><t:label for="amount" /> : </p>
+ <p><t:label for="invoiceDate" /> : </p>
+ <p><t:label for="hopeDate" /> : </p>
+ <p><t:label for="effectiveDate" /> : </p>
+ </div>
+ <div class="fleft">
+ <p>
+ <input t:type="select" t:id="companies" t:model="companiesSelectModel" t:value="clientName" />
+ <input t:type="submit" t:id="companyChange" t:value="OK" />
+ </p>
+ <p>
+ <input t:type="select" t:id="services" t:model="servicesSelectModel" t:value="serviceName" />
+ <input t:type="submit" t:id="serviceChange" t:value="OK" />
+ </p>
+ <p><input t:type="select" t:id="persons" t:model="personsSelectModel" t:value="personName" /></p>
+ <p><input t:type="textfield" t:id="invoiceNumber" t:value="invoice.invoiceNumber" /></p>
+ <p><input t:type="textfield" t:id="amount" t:value="invoice.amount" /></p>
+ <p><input t:type="datefield" class="date" t:id="invoiceDate" t:value="invoice.invoiceDate" /></p>
+ <p><input t:type="datefield" class="date" t:id="hopeDate" t:value="invoice.hopeDate" /></p>
+ <p><input t:type="datefield" class="date" t:id="effectiveDate" t:value="invoice.effectiveDate" /></p>
+ </div>
+ </div>
+ <p><input t:type="submit" class="ico save" t:id="saveInvoice" t:value="${message:submit-label}" /></p>
+ </form>
+
+
+
+
+
+
+
+ <!--t:beaneditform t:id="invoiceForm" t:object="invoice"
+ t:submitLabel="message:submit-label"
+ add="companies, services, persons"
+ include="invoiceNumber, invoiceDate, amount, hopeDate, effectiveDate"
+ reorder="companies, services, persons, invoiceNumber" t:zone="invoiceFormZone">
+ <p:companies>
+ <input t:type="select" t:id="companies" t:model="companiesSelectModel" t:value="invoice.clientPerson.client.name" />
+ <input t:type="submit" t:id="companyChange" t:value="OK" />
+ </p:companies>
+ <p:services>
+ <input t:type="select" t:id="services" t:model="servicesSelectModel" t:value="invoice.clientPerson.subDivisionName" />
+ <input t:type="submit" t:id="serviceChange" t:value="OK" />
+ </p:services>
+ <p:persons>
+ <input t:type="select" t:id="persons" t:model="personsSelectModel" t:value="invoice.clientPerson.id" />
+ </p:persons>
+ </t:beaneditform-->
+ </t:zone>
+
+</t:layout>
Added: trunk/billy-ui/src/main/webapp/InvoiceList.tml
===================================================================
--- trunk/billy-ui/src/main/webapp/InvoiceList.tml (rev 0)
+++ trunk/billy-ui/src/main/webapp/InvoiceList.tml 2009-08-28 12:01:57 UTC (rev 8)
@@ -0,0 +1,37 @@
+<!-- InvoiceList.tml
+
+ Author: fdesbois
+ Revision: $Revision: 5 $
+
+ Last update: $Date: 2009-07-31 16:58:45 +0200 (Fri, 31 Jul 2009) $
+ by $Author: fdesbois $
+-->
+<t:layout t:ident="invoiceList" t:pageTitle="${message:title-page}"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
+
+ <h1>${message:h1}</h1>
+ <div t:type="grid" t:source="invoices" t:row="invoice" include="invoiceNumber, invoiceDate, hopeDate, effectiveDate" add="client, actions"
+ reorder="client, invoiceNumber, invoiceDate, hopeDate, effectiveDate" rowsPerPage="30">
+ <p:clientCell>
+ <t:if test="invoice.clientPerson.client.viewUrl">
+ <a href="${invoice.clientPerson.client.viewUrl}" title="${invoice.clientPerson.client.name}">${invoice.clientPerson.client.name}</a>
+ <p:else>
+ ${invoice.clientPerson.client.name}
+ </p:else>
+ </t:if>
+ </p:clientCell>
+ <p:actionsCell>
+ <a t:type="pagelink" class="img" t:id="editInvoice" t:page="invoiceForm" t:context="invoice.id" title="${message:edit-invoice}">
+ <img src="${asset:context:/img/icons/crystal/edit.png}" alt="${message:edit-invoice}"/>
+ </a>
+ <a t:type="actionlink" class="img" t:id="delInvoice" title="${message:del-invoice}" t:context="invoice.id"
+ t:mixins="confirm" t:message="${message:del-confirm}">
+ <img src="${asset:context:/img/icons/crystal/cancel.png}" alt="${message:del-invoice}"/>
+ </a>
+ </p:actionsCell>
+ </div>
+ <a t:type="pagelink" class="img" t:id="addInvoice" t:page="invoiceForm" title="${message:add-invoice}">
+ <img src="${asset:context:/img/icons/crystal/add.png}" alt="${message:add-invoice}"/>
+ </a>
+
+</t:layout>
Modified: trunk/billy-ui/src/main/webapp/css/common.css
===================================================================
--- trunk/billy-ui/src/main/webapp/css/common.css 2009-08-27 11:26:57 UTC (rev 7)
+++ trunk/billy-ui/src/main/webapp/css/common.css 2009-08-28 12:01:57 UTC (rev 8)
@@ -161,54 +161,16 @@
color: red;
}
-/* Category */
-.categories td.name {
- width: 700px;
-}
+/* BILLY */
-#zoneListEntries table.t-data-grid td.amount {
- font-size: 0.8em;
- letter-spacing: 1px;
- padding-left: 15px;
+#billy-form-invoice p {
+ height: 28px;
}
-#zoneListEntries table.t-data-grid td.selected-listEntries {
- background-color: yellow;
+#billy-form-invoice select {
+ width: 200px;
}
-#zoneListEntries table.t-data-grid tr.parentCategory {
- background-color: #DDEEFF;
- /*font-weight: bold;*/
-}
-
-#zoneListEntries table.t-data-grid tr.parentCategory td.title {
- font-size: 1.2em;
-}
-
-#zoneListEntries table.t-data-grid a.entry {
- text-decoration: none;
-}
-
-#zoneListEntries table.t-data-grid a.entry:hover {
- text-decoration: underline;
- color: black;
-}
-
-#previewTable fieldset {
- padding: 15px;
- margin: 8px;
-}
-
-#entryFormComponent input.interval {
- width: 30px;
-}
-
-div.zoneFlash {
- padding: 10px;
- border: 1px solid black;
- margin: 10px;
-}
-
-#entryFormComponent p.actions {
- padding-top: 12px;
+#billy-form-invoice input.date {
+ width: 80px;
}
\ No newline at end of file
1
0
r7 - in trunk/billy-business/src/main/java/org/chorem/billy: business impl
by fdesbois@users.chorem.org 27 Aug '09
by fdesbois@users.chorem.org 27 Aug '09
27 Aug '09
Author: fdesbois
Date: 2009-08-27 13:26:57 +0200 (Thu, 27 Aug 2009)
New Revision: 7
Added:
trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java
Modified:
trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java
trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java
trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java
Log:
Add ServiceInvoice implementations for createUpdate, getAll and delete
Modified: trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java 2009-08-27 11:04:29 UTC (rev 6)
+++ trunk/billy-business/src/main/java/org/chorem/billy/business/ClientHelper.java 2009-08-27 11:26:57 UTC (rev 7)
@@ -76,6 +76,28 @@
return entity;
}
+ public static ClientPerson getClientPerson(ClientEntity entity, Client client) {
+ ClientPerson person = new ClientPerson();
+ person.setName(entity.getPersonName());
+ person.setSource(entity.getSource());
+ person.setEmail(entity.getPersonEmail());
+
+ String topiaId = entity.getTopiaId(); // specifique à un triplet Client / Service / ClientPerson
+ person.setId(ContextUtilBilly.convertId(topiaId));
+ person.setSubDivisionName(entity.getSubDivisionName());
+
+ if (client == null) {
+ client = new Client();
+ client.setName(entity.getName());
+ client.setSiret(entity.getSiret());
+ client.setSource(entity.getSource());
+ }
+
+ person.setClient(client);
+
+ return person;
+ }
+
/*public static Client getClientOrganization(ClientEntity entity) throws ConvertException {
Client result = Convert.toDTO(entity, ClientEntity.class, ClientOrganization.class);
Added: trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java (rev 0)
+++ trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java 2009-08-27 11:26:57 UTC (rev 7)
@@ -0,0 +1,57 @@
+/**
+ * *##% Billy 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.billy.business;
+
+import org.chorem.billy.ContextUtilBilly;
+import org.chorem.billy.dto.ClientPerson;
+import org.chorem.billy.dto.Invoice;
+import org.chorem.billy.persistence.ClientEntity;
+import org.chorem.billy.persistence.InvoiceEntity;
+import org.chorem.exceptions.ConvertException;
+import org.chorem.utils.Convert;
+
+/**
+ * InvoiceHelper.java
+ *
+ * Created on 2009-08-27
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class InvoiceHelper {
+
+ public static Invoice getInvoice(InvoiceEntity entity) throws ConvertException {
+ Invoice invoice = Convert.toDTO(entity, InvoiceEntity.class, Invoice.class);
+
+ invoice.setId(ContextUtilBilly.convertId(entity.getTopiaId()));
+
+ ClientEntity client = entity.getClientEntity();
+
+ ClientPerson person = ClientHelper.getClientPerson(client, null);
+
+ invoice.setClientPerson(person);
+
+ return invoice;
+ }
+
+}
Property changes on: trunk/billy-business/src/main/java/org/chorem/billy/business/InvoiceHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Revision Date
Modified: trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java 2009-08-27 11:04:29 UTC (rev 6)
+++ trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceClientImpl.java 2009-08-27 11:26:57 UTC (rev 7)
@@ -147,7 +147,7 @@
services.put(entity.getSubDivisionName(), persons);
}
- ClientPerson person = new ClientPerson();
+ /*ClientPerson person = new ClientPerson();
person.setName(entity.getPersonName());
person.setSource(entity.getSource());
person.setEmail(entity.getPersonEmail());
@@ -155,8 +155,11 @@
String topiaId = entity.getTopiaId(); // specifique à un triplet Client / Service / ClientPerson
person.setId(ContextUtilBilly.convertId(topiaId));
person.setSubDivisionName(entity.getSubDivisionName());
- person.setClient(client);
+ person.setClient(client);*/
+ ClientPerson person = ClientHelper.getClientPerson(entity, client);
+
+
persons.add(person);
//Client client = ClientHelper.getClient(entity);
Modified: trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java
===================================================================
--- trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java 2009-08-27 11:04:29 UTC (rev 6)
+++ trunk/billy-business/src/main/java/org/chorem/billy/impl/ServiceInvoiceImpl.java 2009-08-27 11:26:57 UTC (rev 7)
@@ -1,9 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.chorem.billy.impl;
/**
* *##% Billy Business
* Copyright (C) 2009 CodeLutin
@@ -23,15 +17,28 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
+package org.chorem.billy.impl;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.billy.BillyException;
+import org.chorem.billy.BillyModelDAOHelper;
import org.chorem.billy.ContextUtilBilly;
+import org.chorem.billy.business.ClientHelper;
+import org.chorem.billy.business.InvoiceHelper;
import org.chorem.billy.dto.Invoice;
+import org.chorem.billy.persistence.ClientEntity;
+import org.chorem.billy.persistence.InvoiceEntity;
+import org.chorem.billy.persistence.InvoiceEntityDAO;
import org.chorem.billy.services.ServiceInvoice;
import org.chorem.billy.services.ServiceInvoiceAbstract;
import org.chorem.utils.PeriodDates;
+import org.chorem.utils.ServiceHelper;
import org.nuiton.topia.TopiaContext;
/**
@@ -57,17 +64,77 @@
@Override
public void createUpdateInvoice(Invoice invoice) throws BillyException {
- throw new UnsupportedOperationException("Not supported yet.");
+ TopiaContext transaction = null;
+ try {
+ transaction = context.beginTransaction();
+
+ InvoiceEntityDAO dao = BillyModelDAOHelper.getInvoiceEntityDAO(transaction);
+
+ Map<String, Object> existParams = new HashMap<String, Object>();
+
+ existParams.put(InvoiceEntity.INVOICE_NUMBER, invoice.getInvoiceNumber());
+ existParams.put(InvoiceEntity.INVOICE_DATE, invoice.getInvoiceDate());
+
+ Map<String, Object> saveParams = new HashMap<String, Object>(existParams);
+
+ saveParams.put(InvoiceEntity.HOPE_DATE, invoice.getHopeDate());
+ saveParams.put(InvoiceEntity.EFFECTIVE_DATE, invoice.getEffectiveDate());
+ saveParams.put(InvoiceEntity.AMOUNT, invoice.getAmount());
+
+ if (invoice.getClientPerson() == null) {
+ ContextUtilBilly.serviceException(transaction, "Unable to create or update invoice",
+ new IllegalArgumentException("Client must be provided to create update the invoice"));
+ }
+ ClientEntity client = ClientHelper.createUpdateClient(invoice.getClientPerson(), transaction, log);
+
+ saveParams.put(InvoiceEntity.CLIENT_ENTITY, client);
+
+ InvoiceEntity entity = ServiceHelper.createUpdateEntity(dao, invoice.getId(), existParams, saveParams, log);
+
+ invoice.setId(ContextUtilBilly.convertId(entity.getTopiaId()));
+
+ transaction.commitTransaction();
+ transaction.closeContext();
+ } catch (Exception eee) {
+ ContextUtilBilly.serviceException(transaction, "Unable to create or update invoice", eee);
+ }
}
@Override
public void deleteInvoice(String invoiceId) throws BillyException {
- throw new UnsupportedOperationException("Not supported yet.");
+ TopiaContext transaction = null;
+ try {
+ transaction = context.beginTransaction();
+
+ InvoiceEntityDAO dao = BillyModelDAOHelper.getInvoiceEntityDAO(transaction);
+
+ ServiceHelper.deleteEntity(dao, invoiceId, log);
+
+ transaction.commitTransaction();
+ transaction.closeContext();
+ } catch (Exception eee) {
+ ContextUtilBilly.serviceException(transaction, "Unable to delete invoice with id = " + invoiceId, eee);
+ }
}
@Override
public List<Invoice> getAllInvoices() throws BillyException {
- throw new UnsupportedOperationException("Not supported yet.");
+ List<Invoice> results = new ArrayList<Invoice>();
+ TopiaContext transaction = null;
+ try {
+ transaction = context.beginTransaction();
+
+ InvoiceEntityDAO dao = BillyModelDAOHelper.getInvoiceEntityDAO(transaction);
+
+ for (InvoiceEntity entity : dao.findAll()) {
+ results.add(InvoiceHelper.getInvoice(entity));
+ }
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ ContextUtilBilly.serviceException(transaction, "Unable to get all invoices", eee);
+ }
+ return results;
}
@Override
1
0
r6 - in trunk/billy-business/src/test/java/org/chorem/billy: impl test
by fdesbois@users.chorem.org 27 Aug '09
by fdesbois@users.chorem.org 27 Aug '09
27 Aug '09
Author: fdesbois
Date: 2009-08-27 13:04:29 +0200 (Thu, 27 Aug 2009)
New Revision: 6
Modified:
trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java
trunk/billy-business/src/test/java/org/chorem/billy/test/ClientMock.java
Log:
- Add svn:keywords
Modified: trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java
===================================================================
--- trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java 2009-08-27 11:02:58 UTC (rev 5)
+++ trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java 2009-08-27 11:04:29 UTC (rev 6)
@@ -40,10 +40,10 @@
* Created on 2009-08-27
*
* @author fdesbois
- * @version $Revision: 3 $
+ * @version $Revision$
*
- * Last update: $Date: 2009-08-26 16:02:12 +0200 (Wed, 26 Aug 2009) $
- * by : $Author: fdesbois $
+ * Last update: $Date$
+ * by : $Author$
*/
public class ServiceClientImplTest {
Property changes on: trunk/billy-business/src/test/java/org/chorem/billy/impl/ServiceClientImplTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Revision Date
Modified: trunk/billy-business/src/test/java/org/chorem/billy/test/ClientMock.java
===================================================================
--- trunk/billy-business/src/test/java/org/chorem/billy/test/ClientMock.java 2009-08-27 11:02:58 UTC (rev 5)
+++ trunk/billy-business/src/test/java/org/chorem/billy/test/ClientMock.java 2009-08-27 11:04:29 UTC (rev 6)
@@ -32,10 +32,10 @@
* Created on 2009-08-27
*
* @author fdesbois
- * @version $Revision: 3 $
+ * @version $Revision$
*
- * Last update: $Date: 2009-08-26 16:02:12 +0200 (Wed, 26 Aug 2009) $
- * by : $Author: fdesbois $
+ * Last update: $Date$
+ * by : $Author$
*/
public class ClientMock {
Property changes on: trunk/billy-business/src/test/java/org/chorem/billy/test/ClientMock.java
___________________________________________________________________
Added: svn:keywords
+ Author Revision Date
1
0