Bonzoms-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
- 119 discussions
r52 - in trunk: . bonzoms-business/src/site bonzoms-business/src/site/resources bonzoms-business/src/site/resources/css bonzoms-business/src/site/resources/schemas bonzoms-ui/src/site bonzoms-ui/src/site/resources/css src/site
by fdesbois@users.chorem.org 24 Aug '09
by fdesbois@users.chorem.org 24 Aug '09
24 Aug '09
Author: fdesbois
Date: 2009-08-24 10:46:28 +0200 (Mon, 24 Aug 2009)
New Revision: 52
Added:
trunk/bonzoms-business/src/site/resources/css/
trunk/bonzoms-business/src/site/resources/css/site.css
Modified:
trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Services.png
trunk/bonzoms-business/src/site/site.xml
trunk/bonzoms-ui/src/site/resources/css/site.css
trunk/bonzoms-ui/src/site/site.xml
trunk/pom.xml
trunk/src/site/site.xml
Log:
Change pom dependency and site.xml for mavenpom and jrst
Added: trunk/bonzoms-business/src/site/resources/css/site.css
===================================================================
--- trunk/bonzoms-business/src/site/resources/css/site.css (rev 0)
+++ trunk/bonzoms-business/src/site/resources/css/site.css 2009-08-24 08:46:28 UTC (rev 52)
@@ -0,0 +1,7 @@
+pre.literal_block {
+ border: 2px groove #FF4940;
+ background-color: #FFF1E1;
+ padding: 11px 11px 0;
+ font-family: monospace;
+ color: #58140B;
+}
\ No newline at end of file
Modified: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Services.png
===================================================================
(Binary files differ)
Modified: trunk/bonzoms-business/src/site/site.xml
===================================================================
--- trunk/bonzoms-business/src/site/site.xml 2009-08-21 08:34:14 UTC (rev 51)
+++ trunk/bonzoms-business/src/site/site.xml 2009-08-24 08:46:28 UTC (rev 52)
@@ -2,21 +2,10 @@
<project name="Bonzoms-business">
<publishDate format="dd/MM/yyyy"/>
-
- <skin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-nuiton-skin</artifactId>
- <version>${skin.version}</version>
- </skin>
<bannerLeft>
<name>${project.name}</name>
</bannerLeft>
-
- <bannerRight>
- <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
- <href>http://www.codelutin.com</href>
- </bannerRight>
<body>
Modified: trunk/bonzoms-ui/src/site/resources/css/site.css
===================================================================
--- trunk/bonzoms-ui/src/site/resources/css/site.css 2009-08-21 08:34:14 UTC (rev 51)
+++ trunk/bonzoms-ui/src/site/resources/css/site.css 2009-08-24 08:46:28 UTC (rev 52)
@@ -1,4 +1,4 @@
-pre {
+pre.literal_block {
border: 2px groove #FF4940;
background-color: #FFF1E1;
padding: 11px 11px 0;
Modified: trunk/bonzoms-ui/src/site/site.xml
===================================================================
--- trunk/bonzoms-ui/src/site/site.xml 2009-08-21 08:34:14 UTC (rev 51)
+++ trunk/bonzoms-ui/src/site/site.xml 2009-08-24 08:46:28 UTC (rev 52)
@@ -3,20 +3,9 @@
<publishDate format="dd/MM/yyyy"/>
- <skin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-nuiton-skin</artifactId>
- <version>${skin.version}</version>
- </skin>
-
<bannerLeft>
<name>${project.name}</name>
</bannerLeft>
-
- <bannerRight>
- <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
- <href>http://www.codelutin.com</href>
- </bannerRight>
<body>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-21 08:34:14 UTC (rev 51)
+++ trunk/pom.xml 2009-08-24 08:46:28 UTC (rev 52)
@@ -9,7 +9,7 @@
<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>
@@ -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 ************************************** -->
<!-- ************************************************************* -->
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2009-08-21 08:34:14 UTC (rev 51)
+++ trunk/src/site/site.xml 2009-08-24 08:46:28 UTC (rev 52)
@@ -3,22 +3,11 @@
<publishDate format="dd/MM/yyyy"/>
- <skin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-nuiton-skin</artifactId>
- <version>1.0.0-rc-2-SNAPSHOT</version>
- </skin>
-
<bannerLeft>
<name>${project.name}</name>
<href>index.html</href>
</bannerLeft>
- <bannerRight>
- <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
- <href>${project.organization.url}</href>
- </bannerRight>
-
<poweredBy>
<logo href="http://maven.apache.org" name="Maven" img="${project.url}/images/logos/maven-feather.png"/>
<logo href="http://www.nuiton.org/projects/show/jrst" name="JRst" img="${project.url}/images/jrst-logo.png"/>
1
0
r51 - in trunk/bonzoms-business/src: main/xmi site site/resources/schemas site/rst site/rst/developper
by fdesbois@users.chorem.org 21 Aug '09
by fdesbois@users.chorem.org 21 Aug '09
21 Aug '09
Author: fdesbois
Date: 2009-08-21 10:34:14 +0200 (Fri, 21 Aug 2009)
New Revision: 51
Added:
trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities_generation.png
Modified:
trunk/bonzoms-business/src/main/xmi/bonzoms.zargo
trunk/bonzoms-business/src/site/rst/developper/topia.rst
trunk/bonzoms-business/src/site/rst/index.rst
trunk/bonzoms-business/src/site/rst/specifications.rst
trunk/bonzoms-business/src/site/site.xml
Log:
Add rst documentation
Modified: trunk/bonzoms-business/src/main/xmi/bonzoms.zargo
===================================================================
(Binary files differ)
Added: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities_generation.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities_generation.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/bonzoms-business/src/site/rst/developper/topia.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/developper/topia.rst 2009-08-20 16:33:24 UTC (rev 50)
+++ trunk/bonzoms-business/src/site/rst/developper/topia.rst 2009-08-21 08:34:14 UTC (rev 51)
@@ -1,10 +1,131 @@
-Topia
+Génération avec ToPIA
+=====================
-Entites Generation
+:Author: $Author: fdesbois $
+:Version: 1.0
+:Revision: $Revision: 47 $
+:Date: $Date: 2009-08-19 19:01:06 +0200 (Wed, 19 Aug 2009) $
-- DAO
-- Impl
+*Created by fdesbois on 2009-08-19*
+Topia est le framework principal pour le module Bonzoms-business. Il permet de générer les entités, les daos, les dtos et les services. Les transactions topia
+sont également utilisés pour permettre de se connecter à une base de données pour la persistance des entités. Ainsi les services utilisent les daos pour
+ajouter/modifier/supprimer et sélectionner les entités persistantes de la base de données. Cette dernière est configurable dans le fichier ContextBonzoms.properties ::
+
+ hibernate.hbm2ddl.auto=update
+ hibernate.show_sql=false
+
+ hibernate.dialect=org.hibernate.dialect.H2Dialect
+ hibernate.connection.username=sa
+ hibernate.connection.password=
+ hibernate.connection.driver_class=org.h2.Driver
+ hibernate.connection.url=jdbc:h2:file:~/h2data/bonzoms
+
+Actuellement, le fichier de propriétés par défaut utilise une base de données de type H2. Il est possible d'utiliser un autre fichier de propriétés au moment
+de l'exécution de l'application. Ce fichier devra s'appeler **ContextBonzoms.properties** et être placé dans le dossier /etc de votre machine.
+
+.. _maven-eugene-plugin: http://maven-site.nuiton.org/eugene/maven-eugene-plugin/index.html
+
+Voici la configuration du plugin maven pour la génération des classes javas (`maven-eugene-plugin`_ ) ::
+
+ <plugin>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>maven-eugene-plugin</artifactId>
+ <version>${generator.version}</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <!--Configuration of model generator-->
+ <configuration>
+ <addCompileDirectory>true</addCompileDirectory>
+ <includes>**/*.objectmodel</includes>
+ <templates>org.nuiton.topia.generator.TopiaMetaGenerator,org.nuiton.topia.generator.BeanGenerator,
+ org.nuiton.topia.generator.TopiaApplicationServiceMetaGenerator</templates>
+ <defaultPackage>${project.groupId}</defaultPackage>
+ <fullPackagePath>${project.groupId}</fullPackagePath>
+ <extractedPackages>${project.groupId}</extractedPackages>
+ </configuration>
+ <goals>
+ <goal>zargo2xmi</goal>
+ <goal>xmi2objectmodel</goal>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <!-- Topia generation from zargo -->
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-soa</artifactId>
+ <version>${topia.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.xfire</groupId>
+ <artifactId>xfire-java5</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+Comme vous pouvez le constater dans les *goals*, trois étapes de génération sont effectuées :
+
+- zargo2xmi : Extraction du fichier XMI du modèle zargo (créer via `ArgoUML 0.28`_ ). Le fichier zargo est placé dans le dossier *src/main/xmi*.
+
+- xmi2objectmodel : Création d'un fichier *objectmodel* depuis le fichier xmi (utilisation de la librairie `EUGene`_ ). Ce fichier est généré dans le dossier
+ *target/generated-sources/models*
+
+- generate : Génération via ToPIA des fichiers pour les entités, les daos, les dtos et les services. Les fichiers sont générés dans le dossier
+ *target/generated-sources/java*. Ce sont les trois générateurs utilisés qui permettent les différentes générations.
+
+.. _ArgoUML 0.28: http://argouml.tigris.org/
+
+.. _EUGene: http://maven-site.nuiton.org/eugene/eugene/index.html
+
+Note
+ L'exclusion de xfire évite un conflit lors de l'utilisation de topia-soa.
+
+TopiaMetaGenerator
+------------------
+
+Le TopiaMetaGenerator inclus dans ToPIA-persistence permet la génération des entités et daos. Pour chaque entité du modèle avec le stéréotype **<<entity>>** 7 fichiers sont générés.
+Prenons l'exemple pour l'entité nommé *ContactEntity* :
+
+- ContactEntity.java : Interface représentant l'entité. Elle comprend les attributs et méthodes décrits dans le modèle UML + les accesseurs générés pour chaque attribut.
+ Elle comprend aussi des constantes statiques représentant le nom des attributs existants. Pour ContactEntity nous avons un seul champs, le champs *contact*.
+
+- ContactEntityAbstract.java : Classe abstraite implémentant les méthodes générés dans l'interface. Seul les méthodes non écrite dans le modèle UML sont implémentés.
+
+- ContactEntityImpl.java : Classe héritant de la classe abstraite précédente et implémentant l'interface de l'entité. Cette classe est généré uniquement si aucune
+ méthodes sont écrites dans l'entité dans le modèle UML. En effet ces méthodes devront être implémentés par le développeur et la classe devra être créé dans le
+ package **org.chorem.bonzoms.persistence**. (Vous pouvez trouver un exemple pour l'entité *PartyEntity* -> PartyEntityImpl).
+
+- ContactEntityImpl.hbm.xml : Fichier de mapping hibernate pour l'entité.
+
+- ContactEntityDAO.java : Final class du DAO (Data Access Object) pour manipulation des entités (create, update, delete, find, findAll, ...). Hérite de ContactEntityDAOImpl.
+
+- ContactEntityDAOAbstract.java : Classe abstraite du DAO avec implémentation des méthodes spécifiques à l'entité.
+
+- ContactEntityDAOImpl.java : Herite de la classe abstraite et permet la surcharge ou l'ajout de méthodes pour le DAO. Cette classe est vide par défaut et peut
+ ne pas être généré si l'entité sur le diagramme possède des méthodes avec le stéréotype **<<dao>>**
+
+La génération respecte l'héritage. Ainsi il est possible de manipuler les DAO d'une classe père pour trouver des fils (Ex : PartyEntityDAO).
+
+Voici le diagramme qui permet de générer les entités de Bonzoms :
+
+.. image:: ../schemas/ClassDiagram_Entities_generation.png
+ :alt: Modèle du domaine - Entités de Bonzoms
+ :align: center
+
+Classes vertes : pas de génération des classes DAOImpl et Impl
+
+Classes jaunes : pas de génération de la classe Impl
+
+Classes roses : pas de génération de la classe DAOImpl
+
+BeanGenerator
+-------------
+
DTO Generation
- Dependances
Modified: trunk/bonzoms-business/src/site/rst/index.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/index.rst 2009-08-20 16:33:24 UTC (rev 50)
+++ trunk/bonzoms-business/src/site/rst/index.rst 2009-08-21 08:34:14 UTC (rev 51)
@@ -1 +1,46 @@
-Index
\ No newline at end of file
+Sommaire
+========
+
+Bonzoms est une application permettant la gestion des personnes, sociétés, leurs relations, rôles et contacts.
+
+Ce site regroupe les documentations utilisateur et développeur du module maven Bonzoms-business.
+
+Ce module contient la gestion métier de Bonzoms : implémentation des services, gestion de la persistance via ToPIA.
+
+Vous pouvez vous rendre sur la page de présentation de Bonzoms : `ici`_ . Ou allez voir les spécifications : `la`_ .
+
+.. _ici: presentation.html
+
+.. _la: specifications.html
+
+Documentation utilisateur :
+
+- Descriptions en détails des `services`_ de Bonzoms.
+
+- Format des données pouvant être `exportees`_ (utilisation du standard Oasis CIQ).
+
+- Les `relations`_ et rôles existants par défaut dans l'application Bonzoms.
+
+- La `FAQ`_
+
+.. _services: user/services.html
+
+.. _exportees: user/export.html
+
+.. _relations: user/relations.html
+
+.. _FAQ: user/faq.html
+
+Documentation développeur :
+
+- `Organisation`_ du projet Bonzoms.
+
+- Utilisation de `ToPIA`_ pour la génération des classes java (entités, daos, dtos et services)
+
+- Utilisation de `ChoReg`_ pour l'export des données
+
+.. _Organisation: developper/organisation.html
+
+.. _ToPIA: developper/topia.html
+
+.. _ChoReg: developper/choreg.html
Modified: trunk/bonzoms-business/src/site/rst/specifications.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/specifications.rst 2009-08-20 16:33:24 UTC (rev 50)
+++ trunk/bonzoms-business/src/site/rst/specifications.rst 2009-08-21 08:34:14 UTC (rev 51)
@@ -1,5 +1,5 @@
Spécifications de Bonzoms
-========================
+=========================
:Author: $Author$
:Version: 1.0
@@ -58,7 +58,7 @@
Pour plus de détails techniques sur les dtos voir la documentation sur l'utilisation de `ToPIA`_.
-.. _dto: developper/topia.html
+.. _ToPIA: developper/topia.html
Services
--------
Modified: trunk/bonzoms-business/src/site/site.xml
===================================================================
--- trunk/bonzoms-business/src/site/site.xml 2009-08-20 16:33:24 UTC (rev 50)
+++ trunk/bonzoms-business/src/site/site.xml 2009-08-21 08:34:14 UTC (rev 51)
@@ -29,6 +29,7 @@
<menu name="Utilisateur">
<item name="Services" href="user/services.html" />
<item name="Export" href="user/export.html" />
+ <item name="Gestion des relations" href="user/relations.html" />
<item name="FAQ" href="user/faq.html" />
</menu>
@@ -42,6 +43,7 @@
<menu name="Liens">
<item name="ToPIA" href="http://nuiton.org/embedded/topia/topia-persistence/index.html" title="Documentation ToPIA" />
+ <item name="ArgoUML" href="http://argouml.tigris.org/" title="ArgoUML" />
<item name="ChoReg" href="http://chorem.org/embedded/choreg/choreg" title="Documentation ChoReg" />
<item name="OASIS CIQ" href="http://www.oasis-open.org/committees/ciq/" title="Standard Oasis CIQ" />
<item name="OASIS CIQ Api" href="http://chorem.org/embedded/choreg/oasis-ciq-api" title="Documentation Oasis CIQ Api" />
1
0
Author: fdesbois
Date: 2009-08-20 18:33:24 +0200 (Thu, 20 Aug 2009)
New Revision: 50
Modified:
trunk/bonzoms-business/src/test/resources/ContextBonzoms.properties
Log:
Change h2data destination to target folder
Modified: trunk/bonzoms-business/src/test/resources/ContextBonzoms.properties
===================================================================
--- trunk/bonzoms-business/src/test/resources/ContextBonzoms.properties 2009-08-19 17:08:48 UTC (rev 49)
+++ trunk/bonzoms-business/src/test/resources/ContextBonzoms.properties 2009-08-20 16:33:24 UTC (rev 50)
@@ -6,4 +6,4 @@
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:~/h2data/test/bonzoms
\ No newline at end of file
+hibernate.connection.url=jdbc:h2:file:target/h2data/bonzoms
\ No newline at end of file
1
0
r49 - trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/export
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 19:08:48 +0200 (Wed, 19 Aug 2009)
New Revision: 49
Modified:
trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/export/FormatXPILTest.java
Log:
Change target for xml test
Modified: trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/export/FormatXPILTest.java
===================================================================
--- trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/export/FormatXPILTest.java 2009-08-19 17:01:38 UTC (rev 48)
+++ trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/export/FormatXPILTest.java 2009-08-19 17:08:48 UTC (rev 49)
@@ -62,6 +62,10 @@
@BeforeClass
public static void setUpClass() throws Exception {
+ File dir = new File("target/xml");
+ if (!dir.exists()) {
+ dir.mkdir();
+ }
}
@AfterClass
@@ -109,9 +113,9 @@
PartyDocument result = FormatXPIL.getDocument(personEntity, ServicePerson.class);
assertTrue(result.validate());
-
+
try {
- result.save(new File("person.xml"));
+ result.save(new File("target/xml/person.xml"));
} catch (IOException eee) {
log.error("Error in save", eee);
fail("IOException");
1
0
Author: fdesbois
Date: 2009-08-19 19:01:38 +0200 (Wed, 19 Aug 2009)
New Revision: 48
Removed:
trunk/bonzoms-business/person.xml
Log:
suppress test xml file
Deleted: trunk/bonzoms-business/person.xml
===================================================================
--- trunk/bonzoms-business/person.xml 2009-08-19 17:01:06 UTC (rev 47)
+++ trunk/bonzoms-business/person.xml 2009-08-19 17:01:38 UTC (rev 48)
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<urn:Party xmlns:urn="urn:oasis:names:tc:ciq:xpil:3"><urn:PartyName><urn1:PersonName xmlns:urn1="urn:oasis:names:tc:ciq:xnl:3"><urn1:NameElement urn1:ElementType="FirstName">Florian</urn1:NameElement><urn1:NameElement urn1:ElementType="LastName">DESBOIS</urn1:NameElement></urn1:PersonName></urn:PartyName><urn:Identifiers><urn:Identifier><urn:IdentifierElement urn:Type="Identifier">org.chorem.bonzoms.services.ServicePerson://org.chorem.bonzoms.persistence.PersonEntity#1248438244819#0.9473705596808139</urn:IdentifierElement></urn:Identifier></urn:Identifiers></urn:Party>
\ No newline at end of file
1
0
r47 - in trunk/bonzoms-business/src: main/java/org/chorem/bonzoms main/java/org/chorem/bonzoms/business main/java/org/chorem/bonzoms/enums main/java/org/chorem/bonzoms/export main/java/org/chorem/bonzoms/impl main/xmi site site/resources/schemas site/rst site/rst/developper site/rst/user test/java/org/chorem/bonzoms/impl
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 19:01:06 +0200 (Wed, 19 Aug 2009)
New Revision: 47
Added:
trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_DTO.png
trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities.png
trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Services.png
trunk/bonzoms-business/src/site/resources/schemas/ImplDiagram_Entities.png
trunk/bonzoms-business/src/site/resources/schemas/UseCases_Bonzoms.png
trunk/bonzoms-business/src/site/rst/
trunk/bonzoms-business/src/site/rst/developper/
trunk/bonzoms-business/src/site/rst/developper/choreg.rst
trunk/bonzoms-business/src/site/rst/developper/organisation.rst
trunk/bonzoms-business/src/site/rst/developper/topia.rst
trunk/bonzoms-business/src/site/rst/index.rst
trunk/bonzoms-business/src/site/rst/presentation.rst
trunk/bonzoms-business/src/site/rst/specifications.rst
trunk/bonzoms-business/src/site/rst/user/
trunk/bonzoms-business/src/site/rst/user/export.rst
trunk/bonzoms-business/src/site/rst/user/faq.rst
trunk/bonzoms-business/src/site/rst/user/relations.rst
trunk/bonzoms-business/src/site/rst/user/services.rst
trunk/bonzoms-business/src/site/site.xml
Modified:
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/ContextUtilBonzoms.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/RegisterBonzomsServices.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/BonzomsTypeHelper.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/ContactHelper.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyHelper.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyRoleHelper.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/RelationshipHelper.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/ContactTypeValues.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyRoleTypeValues.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyTypeValues.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/RelationshipTypeValues.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/export/FormatXPIL.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServiceGroupPersonImpl.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyImpl.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyRoleImpl.java
trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePersonDTO.java
trunk/bonzoms-business/src/main/xmi/bonzoms.zargo
trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/impl/ServicePartyRoleImplTest.java
Log:
- Cleaning some helper methods
- Add javadoc
- Add rst documentation : project organisation, presentation and specifications
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/ContextUtilBonzoms.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/ContextUtilBonzoms.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/ContextUtilBonzoms.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -17,29 +17,24 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
-
package org.chorem.bonzoms;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Date;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.utils.Convert;
-import org.chorem.utils.DateUtils;
import org.chorem.utils.PropertiesLoader;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.service.TopiaApplicationServiceFactory;
-import org.nuiton.util.Resource;
/**
* ContextUtilBonzoms.java
*
+ * Context management for Topia context and propeties file.
+ * All services used ContextUtilBonzoms to get root context and open new transactions.
+ * ContextUtilBonzoms is also used to close root context when application shutdown.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -50,15 +45,24 @@
private static final Log log = LogFactory.getLog(ContextUtilBonzoms.class);
+ /**
+ * Topia root context
+ */
private static TopiaContext rootContext;
+ /**
+ * Properties configuration for Bonzoms
+ */
private static Properties config;
+ /**
+ * Initialize flag, true when init was done, false when root context was closed.
+ */
private static boolean init = false;
/**
* Initialize of rootContext for ToPIA.
- * Helped by loadProperties.
+ * @see org.chorem.utils.PropertiesLoader#loadPropertiesFile(java.lang.String)
*/
private static void init() {
if (!init) {
@@ -66,7 +70,7 @@
log.info("Initialize of TopiaContext...");
}
try {
- config = loadFileProperties("ContextBonzoms.properties");
+ config = PropertiesLoader.loadPropertiesFile("ContextBonzoms.properties");
config.setProperty("topia.persistence.classes", BonzomsModelDAOHelper.getImplementationClassesAsString());
rootContext = TopiaContextFactory.getContext(config);
@@ -82,24 +86,9 @@
}
/**
- * Property file loading
- * @param filename
- * @return
- * @throws java.net.URISyntaxException
- * @throws java.io.IOException
+ * Getting ToPIA root context. Will be initialized if it's not done yet.
+ * @return the ToPIA root context for open transaction.
*/
- private static Properties loadFileProperties(String filename)
- throws URISyntaxException, IOException {
- /*Properties props = new Properties();
- URL url = Resource.getURL(filename);
- if (log.isDebugEnabled()) {
- log.debug(url);
- }
- props.load(url.openStream());
- return props;*/
- return PropertiesLoader.loadPropertiesFile(filename);
- }
-
public static TopiaContext getRootContext() {
if (!init || rootContext == null || rootContext.isClosed()) {
init();
@@ -107,6 +96,11 @@
return rootContext;
}
+ /**
+ * Getting configuration properties. Used for ui services exported in ChoReg.
+ * @return properties configuration for Bonzoms
+ * @see org.chorem.bonzoms.ui.services.BonzomsManager
+ */
public static Properties getConfig() {
if (!init) {
init();
@@ -114,6 +108,10 @@
return config;
}
+ /**
+ * Closing ToPIA root context. Must be used when application closed or stopped.
+ * @throws BonzomsException
+ */
public static void closeRootContext() throws BonzomsException {
if (init) {
try {
@@ -128,14 +126,23 @@
}
}
+ /**
+ * Id conversion for DTO.
+ * @param id topiaId to convert
+ * @return a short id used in DTO and Web interface
+ */
public static String convertId(String id) {
return Convert.toWebId(id);
- }
+ }
- public static String convertDate(Date date) {
- return DateUtils.formatDate(date, "dd/MM/yyyy");
- }
-
+ /**
+ * Manage exception for Bonzoms services. Encapsulate exception catch in services in a new BonzomsException.
+ * When the exception is a TopiaException, transaction will be rollback and close.
+ * @param transaction Topia transaction from service
+ * @param message Main message for BonzomsException
+ * @param eee exception catch in services
+ * @throws BonzomsException
+ */
public static void serviceException(TopiaContext transaction, String message, Exception eee) throws BonzomsException {
if (log.isErrorEnabled()) {
log.error("An error occured",eee);
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/RegisterBonzomsServices.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/RegisterBonzomsServices.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/RegisterBonzomsServices.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -1,6 +1,20 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% Bonzoms 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.bonzoms;
@@ -22,6 +36,10 @@
*
* Created on 2009-07-24
*
+ * Manage business services registration for ChoReg. This class permit bonzoms-business to be used in stand-alone whithout bonzoms-ui.
+ * You must build bonzoms-business in a war file to permit usage of ChoReg whithout web interface.
+ * When bonzoms-ui is deployed, it used this class to startup and shutdown registration and context for ToPIA.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -34,16 +52,27 @@
private static final ChoremRegistry choreg = ChoremRegistryImpl.getInstance();
+ /**
+ * Initialized method from ServletContextListener. Used if bonzoms-business is deployed in stand-alone in a war file.
+ * @param arg0 ServletContextEvent
+ */
@Override
public void contextInitialized(ServletContextEvent arg0) {
startup();
}
+ /**
+ * Destroyed method from ServletContextListener. Used if bonzoms-business is used in a stand-alone war file.
+ * @param arg0 ServletContextEvent
+ */
@Override
public void contextDestroyed(ServletContextEvent arg0) {
shutdown();
}
+ /**
+ * Startup ChoReg registration for business services. ToPIA root context is initialized at the same time, in services constructor.
+ */
public static void startup() {
if (log.isInfoEnabled()) {
log.info("Bonzoms registration business services");
@@ -52,6 +81,9 @@
register(ServiceOrganization.class, new ServiceOrganizationXPIL());
}
+ /**
+ * Shutdown ChoReg registration for business services. ToPIA root context is closed after unregistration.
+ */
public static void shutdown() {
unregister(ServicePerson.class);
unregister(ServiceOrganization.class);
@@ -65,6 +97,11 @@
}
}
+ /**
+ * Private registration method to add log message and manage identification for services.
+ * @param serviceClass service class for identification
+ * @param service instance of ChoremService for choreg registration
+ */
private static void register(Class serviceClass, ChoremService service) {
String sid = ChoremConvert.toSid(serviceClass);
choreg.register(sid, service);
@@ -73,6 +110,10 @@
}
}
+ /**
+ * Private unregistration method to add log message and manage identification for services.
+ * @param serviceClass service class for identification
+ */
private static void unregister(Class serviceClass) {
String sid = ChoremConvert.toSid(serviceClass);
choreg.unregister(sid);
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/BonzomsTypeHelper.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/BonzomsTypeHelper.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/BonzomsTypeHelper.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -30,6 +30,8 @@
/**
* BonzomsTypeHelper.java
*
+ * Helper class for Bonzoms type entities.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -38,6 +40,18 @@
*/
public class BonzomsTypeHelper {
+ /**
+ * Get a Type Entity from Bonzoms. The entity will be created if not exist. The entity is identified by is type value and java class.
+ * See enums package for different values of types depend on the entity.
+ * @param <E> Entity class type
+ * @param type name of the type to add or get
+ * @param entityClass entity class to get DAO for ToPIA
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return the TypeEntity find or created corresponding to the value String type given in parameter
+ * @throws IllegalArgumentException
+ * @throws TopiaException
+ */
public static <E extends TypeEntity> E getTypeEntity(String type, Class<E> entityClass,
TopiaContext transaction, Log log) throws IllegalArgumentException, TopiaException {
E typeEntity = null;
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/ContactHelper.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/ContactHelper.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/ContactHelper.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -47,6 +47,8 @@
/**
* ContactHelper.java
*
+ * Helper for contacts.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -55,22 +57,23 @@
*/
public class ContactHelper {
- private static final String CLASS_PARTYROLE = PartyRoleEntity.class.getName();
-
- private static final String CLASS_PARTY = PartyEntity.class.getName();
-
+ /**
+ * Conversion ContactEntity to Contact (DTO).
+ * Add city and country attributes for Address type contact.
+ * @param entity ContactEntity to convert
+ * @return a Contact DTO equivalent to the entity
+ * @throws ConvertException
+ * @see org.chorem.utils.Convert#toDTO(org.nuiton.topia.persistence.TopiaEntity, java.lang.Class, java.lang.Class)
+ */
public static Contact getContact(ContactEntity entity) throws ConvertException {
- // FIXME interfaceClass bizarre
- // entity.getClass() renvoie sur ContactEntityImpl
- // PROBLEME avec @SearchFields non présent sur ContactEntityImpl et indispensable pour le toDTO
boolean address = entity.getContactType().isAddress();
Class interfaceClass = address ? AddressEntity.class : ContactEntity.class;
Contact result = Convert.toDTO(entity,interfaceClass,Contact.class);
- // Attributs specifiques au DTO
+ // Specific DTO attributes
result.setType(entity.getContactType().getName());
result.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
- result.setEditable(false);
+ result.setEditable(false); // Used for Web Interface
if (address) {
CityEntity cityEntity = ((AddressEntity)entity).getCityEntity();
if (cityEntity != null) {
@@ -82,6 +85,16 @@
return result;
}
+ /**
+ * Getting a ContactEntity based on Contact DTO. Use the good DAO depends on Contact type (Address or others).
+ * @param contact contact to convert
+ * @param transaction ToPIA transaction
+ * @param log logging
+ * @return the ContactEntity equivalent to Contact DTO
+ * @throws TopiaException from DAO
+ * @throws IllegalArgumentException when contact parameter is null
+ * @throws EntityException from ServiceHelper
+ */
public static ContactEntity getContactEntity(Contact contact, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
if (contact == null) {
@@ -96,82 +109,24 @@
}
return ServiceHelper.getEntity(dao, contact.getId(), log);
}
-
- public static void addContactToPartyRole(ContactEntity contact, PartyRoleEntity role,
- TopiaContext transaction, Log log) throws TopiaException, IllegalArgumentException, EntityException {
- if (!existContactToPartyRole(contact,role)) {
- if (log.isInfoEnabled()) {
- log.info("Add " + role.getClass().getName() + " to CONTACT");
- }
-
- role.addContactEntity(contact);
- //transaction.commitTransaction();
- } else {
- // ALREADY EXIST
- }
- }
-
- public static void removeContactToPartyRole(ContactEntity contact, PartyRoleEntity role,
- TopiaContext transaction, Log log) throws TopiaException, IllegalArgumentException, EntityException {
-
- if (existContactToPartyRole(contact,role)) { // REMOVE
- if (log.isInfoEnabled()) {
- log.info("Remove " + role.getClass().getName() + " to CONTACT");
- }
-
- role.removeContactEntity(contact);
- //transaction.commitTransaction();
- } else {
- // NOT EXIST
- }
- }
-
- private static boolean existContactToPartyRole(ContactEntity contact, PartyRoleEntity role) {
- Collection<ContactEntity> listContacts = role.getContactEntity();
- return listContacts.contains(contact);
- }
-
- public static void addContactToParty(ContactEntity contact, PartyEntity party,
- TopiaContext transaction, Log log) throws TopiaException, IllegalArgumentException, EntityException {
-
- if (!existContactToParty(contact,party)) {
- if (log.isInfoEnabled()) {
- log.info("Add " + party.getClass().getName() + " to CONTACT");
- }
-
- party.addContacts(contact);
- //transaction.commitTransaction();
- } else {
- // ALREADY EXIST
- }
- }
-
- public static void removeContactToParty(ContactEntity contact, PartyEntity party,
- TopiaContext transaction, Log log) throws TopiaException, IllegalArgumentException, EntityException {
-
- if (existContactToParty(contact,party)) { // REMOVE
- if (log.isInfoEnabled()) {
- log.info("Remove " + party.getClass().getName() + " to CONTACT");
- }
-
- party.removeContacts(contact);
- //transaction.commitTransaction();
- } else {
- // NOT EXIST
- }
- }
-
- private static boolean existContactToParty(ContactEntity contact, PartyEntity party) {
- Collection<ContactEntity> listContacts = party.getContacts();
- return listContacts.contains(contact);
- }
-
+ /**
+ * Create or update a ContactEntity from Contact DTO.
+ * When the Contact is of type Address, the City and Country will be createUpdate.
+ * @param contact Contact DTO
+ * @param transaction ToPIA transaction
+ * @param log logging
+ * @return the ContactEntity added or updated
+ * @throws TopiaException from DAO
+ * @throws IllegalArgumentException when contact is null
+ * @throws EntityException from ServiceHelper
+ * @see org.chorem.utils.ServiceHelper#createUpdateEntity(org.nuiton.topia.persistence.TopiaDAO, java.lang.String, java.util.Map,
+ * java.util.Map, org.apache.commons.logging.Log)
+ */
public static ContactEntity createUpdateContact(Contact contact, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
ContactEntity entity = null;
-
if (contact != null && contact.getContact() != null && !contact.getContact().isEmpty()) {
@@ -192,7 +147,7 @@
}
existParams.put(AddressEntity.CONTACT2,contact.getContact2());
- CityEntity city = createUpdateCity(contact, transaction, log);
+ CityEntity city = createOrGetCity(contact, transaction, log);
existParams.put(AddressEntity.CITY_ENTITY,city);
@@ -203,19 +158,27 @@
saveParams = new HashMap<String, Object>(existParams);
- //String id = contact.getSaveId() != null && !contact.getSaveId().isEmpty() ? contact.getSaveId() : contact.getId();
-
entity = ServiceHelper.createUpdateEntity(dao,contact.getId(),existParams,saveParams,log);
contact.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
- } else if (log.isErrorEnabled()) {
- //log.error("Contact must be not null or not empty");
+ } else {
throw new IllegalArgumentException("Null Contact contact. Can't create or update null object or with an empty contact attribute");
}
return entity;
}
- private static CityEntity createUpdateCity(Contact contact, TopiaContext transaction, Log log)
+ /**
+ * Create or get a CityEntity from a Contact DTO. Also create or get the CountryEntity corresponding to country attribute of the contact.
+ * The CityEntity could not be updated. If all params find an existing entity, nothing happens. If not, a new CityEntity will be created.
+ * @param contact Contact DTO where city, postalCode and country are defined
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return the CityEntity created or updated
+ * @throws TopiaException
+ * @throws IllegalArgumentException
+ * @throws EntityException
+ */
+ private static CityEntity createOrGetCity(Contact contact, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
CountryEntityDAO countryDAO = BonzomsModelDAOHelper.getCountryEntityDAO(transaction);
@@ -228,7 +191,6 @@
existParams.put(CityEntity.POSTAL_CODE, contact.getPostalCode());
CityEntityDAO dao = BonzomsModelDAOHelper.getCityEntityDAO(transaction);
- // PAS D'UPDATE possible -> La moindre diff cree une nouvelle ville
CityEntity city = ServiceHelper.createUpdateEntity(dao, null, existParams, existParams, log);
return city;
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyHelper.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyHelper.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyHelper.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -33,6 +33,7 @@
import org.chorem.bonzoms.persistence.GroupPersonEntity;
import org.chorem.bonzoms.persistence.GroupPersonEntityDAO;
import org.chorem.bonzoms.persistence.PartyEntity;
+import org.chorem.bonzoms.persistence.PartyEntityDAO;
import org.chorem.bonzoms.persistence.PartyRoleEntity;
import org.chorem.bonzoms.persistence.PartyType;
import org.chorem.bonzoms.persistence.PersonEntity;
@@ -45,6 +46,8 @@
/**
* PartyHelper.java
*
+ * Helper for Party and also subclasses GroupPerson and Person
+ *
* @author fdesbois
* @version $Revision$
*
@@ -53,59 +56,85 @@
*/
public class PartyHelper {
+ /**
+ * Convert a PartyEntity to a Party (DTO). The conversion depends on subclass type.
+ * @param entity PartyEntity to convert
+ * @return the Party equivalent to the entity
+ * @throws ConvertException
+ */
+ public static Party getParty(PartyEntity entity) throws ConvertException {
+ String partyType = entity.getPartyType().getName();
+ if (PartyTypeValues.isPerson(partyType)) {
+ return getPerson((PersonEntity)entity);
+ } else if (PartyTypeValues.isGroupPerson(partyType)) {
+ return getGroupPerson((GroupPersonEntity)entity);
+ }
+ return null;
+ }
+
+ /**
+ * Convert a PersonEntity to a Person (DTO).
+ * @param entity PersonEntity to convert
+ * @return the Person equivalent to the entity
+ * @throws ConvertException
+ */
public static Person getPerson(PersonEntity entity) throws ConvertException {
Person person = Convert.toDTO(entity, PersonEntity.class, Person.class);
person.setName(person.getFirstName() + " " + person.getLastName());
return getCommonFromParty(person, entity);
}
+ /**
+ * Convert a GroupPersonEntity to a GroupPerson (DTO).
+ * @param entity GroupPersonEntity to convert
+ * @return the GroupPerson equivalent to the entity
+ * @throws ConvertException
+ */
public static GroupPerson getGroupPerson(GroupPersonEntity entity) throws ConvertException {
GroupPerson group = Convert.toDTO(entity, GroupPersonEntity.class, GroupPerson.class);
return getCommonFromParty(group, entity);
}
- public static Party getParty(PartyEntity entity) throws ConvertException {
- String partyType = entity.getPartyType().getName();
- if (PartyTypeValues.isPerson(partyType)) {
- return getPerson((PersonEntity)entity);
- } else if (PartyTypeValues.isGroupPerson(partyType)) {
- return getGroupPerson((GroupPersonEntity)entity);
- }
- //Party party = Convert.toDTO(entity, PartyEntity.class, Party.class);
- //return getCommonFromParty(party, entity);
- return null;
- }
-
+ /**
+ * Private method to convert common attributes from both PersonEntity and GroupPersonEntity whith inheritates from PartyEntity
+ * @param <D> DTO type extends Party
+ * @param <E> Entity type extends PartyEntity
+ * @param party DTO use for receive common conversion
+ * @param entity Entity to convert
+ * @return the DTO converted
+ */
private static <D extends Party, E extends PartyEntity> D getCommonFromParty(D party, E entity) {
party.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
party.setType(entity.getPartyType().getName());
return party;
}
+ /**
+ * Getting the Entity class depends on DTO object. GroupPersonEntity for GroupPerson and PersonEntity for Person.
+ * @param <E> Entity type extends PartyEntity
+ * @param <D> DTO type extends Party
+ * @param dto DTO to know which instance of class is
+ * @return the Entity class corresponding to the DTO
+ */
public static <E extends PartyEntity, D extends Party> Class<E> getEntityClass(D dto) {
if (dto instanceof Person) {
- return (Class<E>) PersonEntity.class; // CAST bizarre !
+ return (Class<E>) PersonEntity.class;
} else if (dto instanceof GroupPerson) {
return (Class<E>) GroupPersonEntity.class;
}
return null;
}
- public static void deleteParty(String partyId, Class partyClass, TopiaContext transaction, Log log)
- throws TopiaException, IllegalArgumentException, EntityException {
-
- TopiaDAO dao = BonzomsModelDAOHelper.getDAO(transaction, partyClass);
-
- PartyEntity party = ServiceHelper.getEntity(dao, partyId, log);
-
- // deleteRoles -> deleteRelationships
- for (PartyRoleEntity entity : party.getRoles()) {
- PartyRoleHelper.deleteRole(entity, transaction, log);
- }
-
- ServiceHelper.deleteEntity(dao, party, log);
- }
-
+ /**
+ * Create or update a GroupPersonEntity from a GroupPerson (DTO).
+ * @param group GrouPerson DTO
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return the GroupPersonEntity created or updated
+ * @throws TopiaException
+ * @throws IllegalArgumentException
+ * @throws EntityException
+ */
public static GroupPersonEntity createUpdateGroupPerson(GroupPerson group, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
GroupPersonEntity entity = null;
@@ -114,7 +143,6 @@
GroupPersonEntityDAO dao = BonzomsModelDAOHelper.getGroupPersonEntityDAO(transaction);
Map<String, Object> existParams = new HashMap<String, Object>();
- Map<String, Object> saveParams = new HashMap<String, Object>();
existParams.put(GroupPersonEntity.NAME, group.getName());
PartyType type =
@@ -122,10 +150,8 @@
existParams.put(PartyEntity.PARTY_TYPE, type);
- saveParams = new HashMap<String, Object>(existParams);
+ entity = ServiceHelper.createUpdateEntity(dao, group.getId(), existParams, existParams, log);
- entity = ServiceHelper.createUpdateEntity(dao, group.getId(), existParams, saveParams, log);
-
group.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
} else {
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyRoleHelper.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyRoleHelper.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/PartyRoleHelper.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -35,9 +35,8 @@
import org.chorem.bonzoms.persistence.PartyRoleEntity;
import org.chorem.bonzoms.persistence.PartyRoleEntityDAO;
import org.chorem.bonzoms.persistence.PartyRoleType;
-import org.chorem.bonzoms.persistence.RelationshipEntity;
-import org.chorem.bonzoms.persistence.RelationshipEntityDAO;
import org.chorem.utils.Convert;
+import org.chorem.utils.DateUtils;
import org.chorem.utils.DateValidator;
import org.chorem.utils.ServiceHelper;
import org.nuiton.topia.TopiaContext;
@@ -47,6 +46,8 @@
/**
* PartyRoleHelper.java
*
+ * Helper for PartyRole.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -55,6 +56,12 @@
*/
public class PartyRoleHelper {
+ /**
+ * Convert PartyRoleEntity to PartyRole (DTO).
+ * @param entity PartyRoleEntity to convert
+ * @return PartyRole converted
+ * @throws ConvertException
+ */
public static PartyRole getPartyRole(PartyRoleEntity entity) throws ConvertException {
PartyRole role = Convert.toDTO(entity, PartyRoleEntity.class, PartyRole.class);
@@ -62,11 +69,28 @@
role.setType(entity.getPartyRoleType().getName());
role.setParty(PartyHelper.getParty(entity.getPartyEntity()));
role.setNbRelations(entity.getRelationshipsTo().size() + entity.getRelationshipsFrom().size());
- String thruDate = role.getThruDate() != null ? ContextUtilBonzoms.convertDate(role.getThruDate()) : "";
- role.setShow(role.getType() + " : " + ContextUtilBonzoms.convertDate(role.getFromDate()) + " - " + thruDate);
+ String thruDate = role.getThruDate() != null ? convertDate(role.getThruDate()) : "";
+ role.setShow(role.getType() + " : " + convertDate(role.getFromDate()) + " - " + thruDate);
return role;
}
+ private static String convertDate(Date date) {
+ return DateUtils.formatDate(date, DateUtils.DEFAULT_PATTERN);
+ }
+
+ /**
+ * Create or update PartyRoleEntity with role from for Relationship.
+ * FromDate and ThruDate are same as Relationship. New creation roles depends on existence and borns for dates.
+ * Type of role depends on relationship type : use RelationshipTypeValues to get appropriate type name for the role.
+ * The party is the from Party in Relationship.
+ * @param rel Relationship contains roleFrom
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return PartyRoleEntity created or updated
+ * @throws TopiaException
+ * @throws IllegalArgumentException
+ * @throws EntityException
+ */
public static PartyRoleEntity createUpdatePartyRoleFrom(Relationship rel, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
@@ -81,6 +105,19 @@
return createUpdatePartyRole(role, transaction, log);
}
+ /**
+ * Create or update PartyRoleEntity with role to for Relationship.
+ * FromDate and ThruDate are same as Relationship. New creation of role depends on existence and borns for dates.
+ * Type of role depends on relationship type : use RelationshipTypeValues to get appropriate type name for the role.
+ * The partyParent is the to Party in Relationship.
+ * @param rel Relationship contains roleTo
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return PartyRoleEntity created or updated
+ * @throws TopiaException
+ * @throws IllegalArgumentException
+ * @throws EntityException
+ */
public static PartyRoleEntity createUpdatePartyRoleTo(Relationship rel, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
@@ -95,6 +132,21 @@
return createUpdatePartyRole(role, transaction, log);
}
+ /**
+ * Create or update a PartyRoleEntity from a PartyRole (DTO).
+ * The creation depends on dates : if fromDate > oldThruDate or thruDate < oldFromDate.
+ * Otherwise, the role dates are updated. Usage of DateValidator to update dates in ServiceHelper.
+ * Same role can be used multiple times in relationships. Difference appears when dates are significativly differents (condition for creation).
+ * @param role PartyRole source
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return the PartyRoleEntity created or updated
+ * @throws TopiaException
+ * @throws IllegalArgumentException
+ * @throws EntityException
+ * @see org.chorem.utils.ServiceHelper#createUpdateEntity(org.nuiton.topia.persistence.TopiaDAO, java.lang.String, java.util.Map, java.util.Map, org.apache.commons.logging.Log)
+ * @see org.chorem.utils.DateValidator
+ */
public static PartyRoleEntity createUpdatePartyRole(PartyRole role, TopiaContext transaction, Log log)
throws TopiaException, IllegalArgumentException, EntityException {
PartyRoleEntity entity = null;
@@ -133,9 +185,10 @@
PartyRoleEntityDAO dao = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
- // Traitement spécifique dependant de l'existance de l'objet
- if (role.getId() == null || "".equals(role.getId())) { // NEW
- role.setId(existRole(dao, existParams, role.getFromDate(), role.getThruDate()));
+ // For a new PartyRole, id may be retrieve from DB depends on dates and PartyRole existence (type and party references).
+ if (role.getId() == null || "".equals(role.getId())) { // NEW
+ String topiaId = existRole(dao, existParams, role.getFromDate(), role.getThruDate());
+ role.setId(topiaId);
}
entity = ServiceHelper.createUpdateEntity(dao, role.getId(), null, saveParams, log);
@@ -149,6 +202,16 @@
return entity;
}
+ /**
+ * Retrieve topiaId from DB if PartyRole already exists in same borns of fromDate and thruDate.
+ * Test newFromDate > oldThruDate and newThruDate < oldFromDate
+ * @param dao DAO to retrieve existing entities corresponding to existParams map
+ * @param existParams Map to test existence of PartyRole (include type and party references)
+ * @param fromDate new date for beginning PartyRole
+ * @param thruDate new date for ending PartyRole
+ * @return topiaId if PartyRole already exist in correct borned dates
+ * @throws TopiaException
+ */
private static String existRole(PartyRoleEntityDAO dao, Map<String, Object> existParams, Date fromDate, Date thruDate) throws TopiaException {
for (PartyRoleEntity oldEntity : dao.findAllByProperties(existParams)) {
// On souhaite creer un nouveau role si les nouvelles bornes sont completement en dehors des anciennes
@@ -163,16 +226,4 @@
return null;
}
- public static void deleteRole(PartyRoleEntity role, TopiaContext transaction, Log log)
- throws TopiaException {
- PartyRoleEntityDAO dao = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
-
- RelationshipEntityDAO relDAO = BonzomsModelDAOHelper.getRelationshipEntityDAO(transaction);
- for (RelationshipEntity entity : relDAO.findAllByPartyRole(role)) {
- RelationshipHelper.deleteRelationship(entity, transaction, log);
- }
-
- ServiceHelper.deleteEntity(dao, role, log);
- }
-
}
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/RelationshipHelper.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/RelationshipHelper.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/business/RelationshipHelper.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -46,6 +46,8 @@
/**
* RelationshipHelper.java
*
+ * Helper for Relationship.
+ *
* @author fdesbois
* @version $Revision$
*
@@ -54,6 +56,14 @@
*/
public class RelationshipHelper {
+ /**
+ * Convert RelationshipEntity to Relationship (DTO).
+ * Relationship inherits of RelationshipAbstract (some common attributes with other DTO RelationshipRoles).
+ * Relationship links directly partyFrom (party) and partyTo (partyParent) without role consideration.
+ * @param entity RelationshipEntity to convert
+ * @return the Relationship equivalent to the entity
+ * @throws ConvertException
+ */
public static Relationship getRelationship(RelationshipEntity entity) throws ConvertException {
Relationship rel = Convert.toDTO(entity, RelationshipEntity.class, Relationship.class);
@@ -66,27 +76,48 @@
return getCommonFromRelationshipAbstract(rel, entity);
}
+ /**
+ * Convert RelationshipEntity to RelationshipRoles (DTO).
+ * RelationshipRoles inherits of RelationshipAbstract (some common attributes with other DTO Relationship).
+ * RelationshipRoles links partyRoleFrom (role) and partyRoleTo (roleParent).
+ * @param entity RelationshipEntity to convert
+ * @return the Relationship equivalent to the entity
+ * @throws ConvertException
+ */
public static RelationshipRoles getRelationshipRoles(RelationshipEntity entity)
throws ConvertException, TopiaException {
RelationshipRoles rel = Convert.toDTO(entity, RelationshipEntity.class, RelationshipRoles.class);
rel.setRoleParent(PartyRoleHelper.getPartyRole(entity.getToRole()));
rel.setRole(PartyRoleHelper.getPartyRole(entity.getFromRole()));
- /*RelationshipEntityDAO dao = BonzomsModelDAOHelper.getRelationshipEntityDAO(transaction);
- rel.setRoles(new ArrayList<PartyRole>()); // Intialisation de la liste, provoque un NullPointerException sinon.
- for (PartyRoleEntity roleFrom : dao.findAllPartyRoleFromsByPartyRoleTo(roleTo,entity.getRelationshipType())) {
- rel.addRoles(PartyRoleHelper.getPartyRole(roleFrom));
- }*/
return getCommonFromRelationshipAbstract(rel, entity);
}
+ /**
+ * Common part for converting RelationshipEntity to RelationshipAbstract (DTO).
+ * @param <D> type of DTO (Relationship or RelationshipRoles)
+ * @param relation DTO to set common attributes
+ * @param entity RelationshipEntity source for conversion
+ * @return a RelationshipAbstract converted
+ */
private static <D extends RelationshipAbstract> D getCommonFromRelationshipAbstract(D relation, RelationshipEntity entity) {
relation.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
relation.setType(entity.getRelationshipType().getName());
return relation;
}
+ /**
+ * Create or update RelationshipEntity from RelationshipAbstract (DTO).
+ * Relationships can be created directly without knowing roles. Correct roles will be find or create to attach them to the relationship.
+ * @param rel RelationshipAbstract to create or update
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return the RelationshipEntity created or updated
+ * @throws IllegalArgumentException
+ * @throws TopiaException
+ * @throws EntityException
+ */
public static RelationshipEntity createUpdateRelationship(RelationshipAbstract rel, TopiaContext transaction, Log log)
throws IllegalArgumentException, TopiaException, EntityException {
RelationshipEntity entity = null;
@@ -127,7 +158,18 @@
return entity;
}
-
+ /**
+ * Private method to help create or getting partyRole to. Used in createUpdateRelationship.
+ * PartyRoleHelper is used to manage PartyRole and find correct types for the relationship.
+ * The treatment depends on RelationshipAbstract type because RelationshipRoles contains PartyRole contrary to Relationship.
+ * @param rel RelationshipAbstract contains
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return PartyRoleEntity for Relationship create or update roleTo
+ * @throws IllegalArgumentException
+ * @throws TopiaException
+ * @throws EntityException
+ */
private static PartyRoleEntity getPartyRoleTo(RelationshipAbstract rel, TopiaContext transaction, Log log)
throws IllegalArgumentException, TopiaException, EntityException {
if (rel instanceof RelationshipRoles) {
@@ -142,6 +184,18 @@
return null;
}
+ /**
+ * Private method to help create or getting partyRole to. Used in createUpdateRelationship.
+ * PartyRoleHelper is used to manage PartyRole and find correct types for the relationship.
+ * The treatment depends on RelationshipAbstract type because RelationshipRoles contains PartyRole contrary to Relationship.
+ * @param rel RelationshipAbstract contains
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return PartyRoleEntity for Relationship create or update roleTo
+ * @throws IllegalArgumentException
+ * @throws TopiaException
+ * @throws EntityException
+ */
private static PartyRoleEntity getPartyRoleFrom(RelationshipAbstract rel, TopiaContext transaction, Log log)
throws IllegalArgumentException, TopiaException, EntityException {
if (rel instanceof RelationshipRoles) {
@@ -156,13 +210,16 @@
return null;
}
- public static void deleteRelationship(RelationshipEntity entity, TopiaContext transaction, Log log)
- throws TopiaException {
- RelationshipEntityDAO dao = BonzomsModelDAOHelper.getRelationshipEntityDAO(transaction);
- ServiceHelper.deleteEntity(dao, entity, log);
- }
-
-
+ /**
+ * Getting relationhips for a PartyEntity with rolesTo. Used to get for exemple, all division for an organization.
+ * @param type of relationshio to get
+ * @param partyTo party involve in relation as roleTo
+ * @param roleToType type of role for the party
+ * @param transaction Topia transaction
+ * @param log logging
+ * @return a List of RelationshipEntity
+ * @throws TopiaException
+ */
public static List<RelationshipEntity> getRelationshipFromsByPartyTo(String type, PartyEntity partyTo, String roleToType,
TopiaContext transaction, Log log) throws TopiaException {
List<RelationshipEntity> results = new ArrayList<RelationshipEntity>();
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/ContactTypeValues.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/ContactTypeValues.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/ContactTypeValues.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -25,6 +25,9 @@
/**
* ContactTypeValues.java
*
+ * Known values for ContactType. ADDRESS, PHONE, FAX, EMAIL, CELLPHONE, INTERNET.
+ * Some methods are defined to test type from a String value or getting all known types.
+ *
* @author fdesbois
* @version $Revision$
*
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyRoleTypeValues.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyRoleTypeValues.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyRoleTypeValues.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -25,6 +25,9 @@
/**
* PartyRoleTypeValues.java
*
+ * Known values for PartyRole type. EMPLOYEE, EMPLOYER, DIVISION, PARENT_ORGANIZATION, ORGANIZATION, SUPPLIER, CUSTOMER, PROSPECT.
+ * Some methods are defined to group types depends on party type (person, organization, ...).
+ *
* @author fdesbois
* @version $Revision$
*
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyTypeValues.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyTypeValues.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/PartyTypeValues.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -22,6 +22,8 @@
/**
* PartyTypeValues.java
*
+ * Known values for Party type. ORGANIZATION, SERVICE, PERSON
+ *
* @author fdesbois
* @version $Revision$
*
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/RelationshipTypeValues.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/RelationshipTypeValues.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/enums/RelationshipTypeValues.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -25,6 +25,9 @@
/**
* RelationshipTypeValues.java
*
+ * Known values for Relationship type. EMPLOYMENT, ROLLUP_PARENT, ROLLUP_DIVISION, WORK_FOR_DIVISION, SUPPLIER, CUSTOMER, PROSPECT, CONTACT.
+ * Some methods are defined to test type as a string value or getting roles types corresponding to a relationship type.
+ *
* @author fdesbois
* @version $Revision$
*
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/export/FormatXPIL.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/export/FormatXPIL.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/export/FormatXPIL.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -40,14 +40,15 @@
import urn.oasis.names.tc.ciq.xnl.PartyNameType.PersonName;
import urn.oasis.names.tc.ciq.xnl.PersonNameElementList;
import urn.oasis.names.tc.ciq.xnl.SubDivisionTypeList;
-import urn.oasis.names.tc.ciq.xpil.IdentifiersDocument.Identifiers.Identifier.IdentifierElement;
import urn.oasis.names.tc.ciq.xpil.PartyDocument;
-import urn.oasis.names.tc.ciq.xpil.PartyIdentifierElementList;
import urn.oasis.names.tc.ciq.xpil.PartyType;
/**
* FormatXPIL.java
*
+ * Class used to convert entities to object known in Oasis CIQ Api based on XML specification.
+ * Usage for exporting data in XPIL format for ChoReg or other applications which supports this XML format.
+ *
* Created on 2009-07-23
*
* @author fdesbois
@@ -64,20 +65,22 @@
}
+ /**
+ * Construct main XML document of type PartyDocument depends on PartyEntityType.
+ * Usage of service class which managed entities to create source id for the entity.
+ * @param entity PartyEntity to convert in xPIL
+ * @param serviceClass service which managed PartyEntity to create sourceId
+ * @return the PartyDocument created
+ * @see org.chorem.oasis.ciq.api.XNLHelper
+ */
public static PartyDocument getDocument(PartyEntity entity, Class<? extends ServiceParty> serviceClass) {
String partyType = entity.getPartyType().getName();
PartyDocument doc = PartyDocument.Factory.newInstance();
- PartyType party = doc.addNewParty();
+ PartyType party = doc.addNewParty();
- //ElectronicAddressIdentifier email = party.addNewElectronicAddressIdentifiers().addNewElectronicAddressIdentifier();
-
- // Source id for party
- /*IdentifierElement identifier = party.addNewIdentifiers().addNewIdentifier().addNewIdentifierElement();
- identifier.setType(PartyIdentifierElementList.IDENTIFIER);
- identifier.setStringValue(Convert.toChoremUri(serviceClass, entity));*/
XPILHelper.setMainIdentifier(party, Convert.toChoremUri(serviceClass, entity));
if (PartyTypeValues.isGroupPerson(partyType)) {
@@ -98,6 +101,13 @@
return doc;
}
+ /**
+ * Construct main XML document for an Organization with subDivisions.
+ * @param organization GroupPersonEntity of type ORGANIZATION
+ * @param subDivisions list of GroupPersonEntity as subdivisions linked with the organization
+ * @return the PartyDocument created
+ * @see org.chorem.oasis.ciq.api.XNLHelper
+ */
public static PartyDocument getDocument(GroupPersonEntity organization, List<GroupPersonEntity> subDivisions) {
PartyDocument doc = getDocument(organization, ServiceOrganization.class);
@@ -113,6 +123,16 @@
return doc;
}
+ /**
+ * Getting correct object depends on class required for converting PartyDocument.
+ * PartyDocument can be exported in multiples types to be used in ChoReg : String, InputStream and XMLStreamReader.
+ * See documentation for ChoReg <http://maven-site.chorem.org/choreg/choreg>
+ * @param <T> type of object to return
+ * @param returnType class for typing return object
+ * @param doc PartyDocument to export
+ * @return the object requested for exporting xPIL data
+ * @throws WrongTypeException used in ChoReg
+ */
public static <T> T getReturnObject(Class<T> returnType, PartyDocument doc) throws WrongTypeException {
String validTypes = " _ ValidTypes [" +
String.class.getName() + ", " +
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServiceGroupPersonImpl.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServiceGroupPersonImpl.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServiceGroupPersonImpl.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -61,31 +61,8 @@
try {
transaction = context.beginTransaction();
- GroupPersonEntity entity = null;
+ PartyHelper.createUpdateGroupPerson(group, transaction, log);
- if (group != null) {
- GroupPersonEntityDAO dao = BonzomsModelDAOHelper.getGroupPersonEntityDAO(transaction);
-
- Map<String, Object> existParams = new HashMap<String, Object>();
- Map<String, Object> saveParams = new HashMap<String, Object>();
-
- existParams.put(GroupPersonEntity.NAME, group.getName());
- PartyType type =
- BonzomsTypeHelper.getTypeEntity(group.getType(), PartyType.class, transaction, log);
-
- existParams.put(PartyEntity.PARTY_TYPE, type);
-
- saveParams = new HashMap<String, Object>(existParams);
-
- entity = ServiceHelper.createUpdateEntity(dao, group.getId(), existParams, saveParams, log);
-
- group.setId(ContextUtilBonzoms.convertId(entity.getTopiaId()));
-
- } else {
- ContextUtilBonzoms.serviceException(transaction, "Unable to create or update a null object for GroupPerson !",
- new IllegalArgumentException("GroupPerson is null"));
- }
-
transaction.commitTransaction();
transaction.closeContext();
} catch (Exception eee) {
@@ -120,7 +97,8 @@
try {
transaction = context.beginTransaction();
- PartyHelper.deleteParty(id, GroupPersonEntity.class, transaction, log);
+ GroupPersonEntityDAO dao = BonzomsModelDAOHelper.getGroupPersonEntityDAO(transaction);
+ ServiceHelper.deleteEntity(dao, id, log);
transaction.commitTransaction();
transaction.closeContext();
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyImpl.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyImpl.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyImpl.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -20,6 +20,7 @@
package org.chorem.bonzoms.impl;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.chorem.bonzoms.BonzomsException;
import org.chorem.bonzoms.BonzomsModelDAOHelper;
@@ -104,7 +105,14 @@
TopiaDAO partyDAO = BonzomsModelDAOHelper.getDAO(transaction, getEntityClass());
PartyEntity party = ServiceHelper.getEntity(partyDAO, partyId, log);
- ContactHelper.addContactToParty(entity, party, transaction, log);
+ if (!party.getContacts().contains(entity)) {
+ if (log.isInfoEnabled()) {
+ log.info("Add " + party.getClass().getName() + " to CONTACT");
+ }
+ party.addContacts(entity);
+ } else {
+ // ALREADY EXIST
+ }
transaction.commitTransaction();
transaction.closeContext();
@@ -124,7 +132,14 @@
TopiaDAO partyDAO = BonzomsModelDAOHelper.getDAO(transaction, getEntityClass());
PartyEntity party = ServiceHelper.getEntity(partyDAO, partyId, log);
- ContactHelper.removeContactToParty(entity, party, transaction, log);
+ if (party.getContacts().contains(entity)) {
+ if (log.isInfoEnabled()) {
+ log.info("Remove " + party.getClass().getName() + " to CONTACT");
+ }
+ party.removeContacts(entity);
+ } else {
+ // NOT EXIST
+ }
transaction.commitTransaction();
transaction.closeContext();
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyRoleImpl.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyRoleImpl.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePartyRoleImpl.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -105,80 +105,6 @@
}
@Override
- public void addContact(Contact contact, String partyRoleId) throws BonzomsException {
- TopiaContext transaction = null;
- try {
- transaction = context.beginTransaction();
-
- ContactEntity entity = ContactHelper.createUpdateContact(contact, transaction, log);
-
- PartyRoleEntityDAO partyRoleDAO = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
- PartyRoleEntity role = ServiceHelper.getEntity(partyRoleDAO, partyRoleId, log);
-
- ContactHelper.addContactToPartyRole(entity, role, transaction, log);
-
- transaction.commitTransaction();
- transaction.closeContext();
- } catch (Exception eee) {
- ContextUtilBonzoms.serviceException(transaction, "Unable to add the contact to party role with id=" + partyRoleId + "!", eee);
- }
- }
-
- // FIXME Refactor Exceptions
- @Override
- public void removeContact(String contactId, String partyRoleId) {
- try {
- TopiaContext transaction = context.beginTransaction();
-
- ContactEntityDAO dao = BonzomsModelDAOHelper.getContactEntityDAO(transaction);
- ContactEntity entity = ServiceHelper.getEntity(dao,contactId,log);
-
- PartyRoleEntityDAO partyRoleDAO = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
- PartyRoleEntity role = ServiceHelper.getEntity(partyRoleDAO, partyRoleId, log);
-
- ContactHelper.removeContactToPartyRole(entity, role, transaction, log);
-
- transaction.commitTransaction();
- transaction.closeContext();
- } catch (IllegalArgumentException ex) {
- log.error("IllegalArgumentException",ex);
- } catch (EntityException ex) {
- log.error("EntityException",ex);
- } catch (TopiaException ex) {
- log.error("TopiaException",ex);
- // EXCEPTION Unknown
- }
- }
-
- // FIXME Refactor Exceptions
- @Override
- public List<Contact> getContacts(String partyRoleId) {
- List<Contact> contacts = new ArrayList<Contact>();
- try {
- TopiaContext transaction = context.beginTransaction();
-
- PartyRoleEntityDAO partyRoleDAO = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
- PartyRoleEntity role = ServiceHelper.getEntity(partyRoleDAO, partyRoleId, log);
-
- for (ContactEntity entity : role.getContactEntity()) {
- contacts.add(ContactHelper.getContact(entity));
- }
-
- transaction.closeContext();
- } catch(ConvertException ex) {
- log.error("ConvertException",ex);
- } catch (IllegalArgumentException ex) {
- log.error("IllegalArgumentException",ex);
- } catch (EntityException ex) {
- log.error("EntityException",ex);
- } catch (TopiaException ex) {
- log.error("TopiaException",ex);
- // EXCEPTION Unknown
- }
- return contacts;
- }
-
- @Override
public void deletePartyRole(String partyRoleId) throws BonzomsException {
TopiaContext transaction = null;
try {
@@ -186,8 +112,7 @@
PartyRoleEntityDAO partyRoleDAO = BonzomsModelDAOHelper.getPartyRoleEntityDAO(transaction);
- PartyRoleEntity partyRole = ServiceHelper.getEntity(partyRoleDAO, partyRoleId, log);
- PartyRoleHelper.deleteRole(partyRole, transaction, log);
+ ServiceHelper.deleteEntity(partyRoleDAO, partyRoleId, log);
transaction.commitTransaction();
transaction.closeContext();
@@ -230,4 +155,5 @@
public PartyRole getNewPartyRole() {
return new PartyRole();
}
+
}
Modified: trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePersonDTO.java
===================================================================
--- trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePersonDTO.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/main/java/org/chorem/bonzoms/impl/ServicePersonDTO.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -113,7 +113,8 @@
try {
transaction = context.beginTransaction();
- PartyHelper.deleteParty(id, PersonEntity.class, transaction, log);
+ PersonEntityDAO dao = BonzomsModelDAOHelper.getPersonEntityDAO(transaction);
+ ServiceHelper.deleteEntity(dao, id, log);
transaction.commitTransaction();
transaction.closeContext();
Modified: trunk/bonzoms-business/src/main/xmi/bonzoms.zargo
===================================================================
(Binary files differ)
Added: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_DTO.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_DTO.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Entities.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Services.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/ClassDiagram_Services.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bonzoms-business/src/site/resources/schemas/ImplDiagram_Entities.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/ImplDiagram_Entities.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bonzoms-business/src/site/resources/schemas/UseCases_Bonzoms.png
===================================================================
(Binary files differ)
Property changes on: trunk/bonzoms-business/src/site/resources/schemas/UseCases_Bonzoms.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bonzoms-business/src/site/rst/developper/choreg.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/developper/choreg.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/developper/choreg.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,5 @@
+Choreg
+
+- Deploiement en stand-alone : utilisation ServletContextListener
+
+- Implementation des services pour ChoReg (heritage generique)
Added: trunk/bonzoms-business/src/site/rst/developper/organisation.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/developper/organisation.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/developper/organisation.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,113 @@
+Organisation du projet
+======================
+
+:Author: $Author$
+:Version: 1.0
+:Revision: $Revision$
+:Date: $Date$
+
+*Created by fdesbois on 2009-08-19*
+
+Le projet Bonzoms utilise Maven pour gérer les dépendances et générer le code via ToPIA. ToPIA permet ainsi de générer les entités, les dtos et les services.
+Il y a 7 packages différents dans Bonzoms-business.
+
+org.chorem.bonzoms
+------------------
+
+Package principal contenant l'exception de base de Bonzoms : BonzomsException qui est renvoyé par tous les services de Bonzoms. Ce package contient également
+la classe ContextUtilBonzoms qui permet de gérer de façon statique le contexte principal pour ToPIA. Ainsi chaque service demande au ContextUtilBonzoms le contexte
+root pour ouvrir une nouvelle transaction ::
+
+ TopiaContext transaction = ContextUtilBonzoms.getRootContext().beginTransaction();
+
+L'initialisation du contexte root via le fichier de propriétés Topia (ContextBonzoms.properties) est automatique si elle n'a pas déjà été effectuée. Cependant
+il est nécessaire d'appeler explicitement la méthode **ContextUtilBonzoms.closeRootContext()** à la fermeture de l'application.
+
+Le package principal contient une classe permettant de charger les services via ChoReg si ce dernier est présent dans le ClassLoader. (voir documentation sur `choreg`_ ).
+
+org.chorem.bonzoms.business
+---------------------------
+
+Ce package contient des classes d'aide (Helper) utiliser pour factoriser un comportement commun entre plusieurs méthodes de services (ex : createUpdatePartyRole).
+Ainsi la transaction courante du service est transmis au Helper sans fermeture ni réouverture. Ceci permet d'éviter les communications entre deux services distincts.
+Chaque transaction est ouverte et fermer (commit et rollback également) localement à chaque méthode de service.
+
+org.chorem.bonzoms.enums
+------------------------
+
+Complément au package précédent, ce package permet de regrouper les différentes valeurs des types manipulés dans Bonzoms : RelationshipType, PartyType,
+PartyRoleType et ContactType.
+
+org.chorem.bonzoms.export
+-------------------------
+
+Gestion des exports de Bonzoms. Que ce soit pour exporter en fichier XML ou utiliser les conversions pour ChoReg.
+
+org.chorem.bonzoms.impl
+-----------------------
+
+Package regroupant l'implémentation des interfaces des services générés par ToPIA (dans le package org.chorem.bonzoms.services). Chaque service utilise le
+root context de ToPIA chargé via la classe ContextUtilBonzoms. Les transactions sont locales aux méthodes des services.
+
+Implémentation type ::
+
+ public void serviceMethod(params...) throws BonzomsException {
+ TopiaContext transaction = null;
+ try {
+ transaction = context.beginTransaction(); // context root provenant de ContextUtilBonzoms
+
+ // traitement Topia avec utilisation des DAO ou des Helper
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ ContextUtilBonzoms.serviceException(transaction, "Error", eee);
+ }
+ return results;
+ }
+
+La majorité des méthodes de services renvoient une BonzomsException qui encapsule généralement l'erreur provoqué dans le service. Cette erreur peut provenir
+de Topia ou d'un Helper. Les types d'exceptions connus sont : TopiaException, IllegalArgumentException, EntityException et ConvertException. Un utilitaire d'aide
+est principalement utiliser pour faciliter la gestion et le renvoi d'erreurs : ServiceHelper provenant du module chorem-commons de ChoReg. Cette classe
+permet d'effectuer les opérations principales : createUpdate, delete, get, getOrCreate, ... tout en gérant et renvoyant les exceptions éventuelles. Il n'est
+donc pas nécessaire de gérer les erreurs dans les services, il suffit de les renvoyer via une BonzomsException à l'utilisateur du service. Ainsi l'erreur
+pour l'utilisateur sera assez précise pour lui permettre de corriger son comportement. Dans les cas de gestions complexes, il est possible de réencapsulé
+directement un nouvelle exception.
+
+Exemple ::
+
+ if (param == null) {
+ ContextUtilBonzoms.serviceException(transaction, "unable to use param for this method", new IllegalArgumentException("Argument param null"));
+ }
+
+ou plus simplement ::
+
+ if (param == null) {
+ throw new BonzomsException("Illegal parameter param null for this method");
+ }
+
+L'avantage d'utiliser la méthode serviceException de ContextUtilBonzoms, c'est la gestion des transactions en cas d'échec. En effet la transaction si elle
+existe et est ouverte sera annulé (rollback) et fermé (closeContext).
+
+org.chorem.bonzoms.persistence
+------------------------------
+
+Package où se situe les entités générés par ToPIA depuis le modèle expliquer dans les `specifications entites`_ . Ce package contient également les surcharges de certaines
+entités ou DAO (voir documentation sur la `generation avec ToPIA`_ )
+
+.. _specifications entites: ../specifications.html#entites
+
+.. _generation avec ToPIA: topia.html
+
+org.chorem.bonzoms.dto
+----------------------
+
+Package où se situe les dtos générés par ToPIA depuis le modèle expliquer dans les `specifications DTO`_ .
+
+.. _specifications DTO: ../specifications.html#dto
+
+org.chorem.bonzoms.services
+---------------------------
+
+Package où se situe les services générés par ToPIA depuis le modèle expliquer dans les `specifications services`_ .
+
+.. _specifications services: ../specifications.html#services
Property changes on: trunk/bonzoms-business/src/site/rst/developper/organisation.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision Id
Added: trunk/bonzoms-business/src/site/rst/developper/topia.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/developper/topia.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/developper/topia.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,19 @@
+Topia
+
+Entites Generation
+
+- DAO
+- Impl
+
+DTO Generation
+
+- Dependances
+- Convert
+- TopiaId
+
+Services Generation
+
+- ToPIA-SOA non utilise en runtime
+
+
+
Added: trunk/bonzoms-business/src/site/rst/index.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/index.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/index.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1 @@
+Index
\ No newline at end of file
Added: trunk/bonzoms-business/src/site/rst/presentation.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/presentation.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/presentation.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,45 @@
+Présentation de Bonzoms
+=======================
+
+:Author: $Author$
+:Version: 1.0
+:Revision: $Revision$
+:Date: $Date$
+
+*Created by fdesbois on 2009-08-19*
+
+Bonzoms est une application permettant de regrouper l'ensemble des acteurs d'une société et leurs rôles et relations. Il peut servir également d'annuaire
+et à l'avenir de CRM.
+
+Bonzoms fournit l'implémentation d'un modèle solide de gestion des personnes et contacts dans une société.
+
+Ainsi bonzoms permet :
+
+- La manipulation des personnes acteurs dans une société (employés, clients, fournisseurs, contacts externes, partenaires, ...)
+
+- La manipulation des sociétés et groupes auxquels appartiennent ces personnes.
+
+- Les contacts des personnes et de leurs sociétés (email, adresses, telephones, ...)
+
+- Les rôles et relations entre les différentes personnes et/ou sociétés, groupes, etc...
+
+- L'export de ses données suivant le standard Oasis CIQ
+
+.. image:: schemas/UseCases_Bonzoms.png
+ :alt: Cas d'utilisations
+ :align: center
+
+Les termes suivant seront régulièrement utilisés, que ce soit dans le code source de l'application ou dans la documentation :
+
+- party : terme désignant un tiers, c'est à dire un acteur que ce soit une personne, une société, un service, une association, ...
+
+- partyRole : terme désignant le rôle d'un tiers (client, chef de projet, directeur général, maison mère, ...)
+
+- relationship : relation entre deux rôles et donc entre les deux acteurs de la relation
+
+Maintenant que les notions de base et le principe de Bonzoms sont exposés, vous pouvez lire le document de `specifications`_ comprenant les diagrammes de classes
+de l'application. Sinon vous pouvez vous orienter directement vers la description des services proposés par l'application : `ici`_ .
+
+.. _specifications: specifications.html
+
+.. _ici: user/services.html
Property changes on: trunk/bonzoms-business/src/site/rst/presentation.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision Id
Added: trunk/bonzoms-business/src/site/rst/specifications.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/specifications.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/specifications.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,81 @@
+Spécifications de Bonzoms
+========================
+
+:Author: $Author$
+:Version: 1.0
+:Revision: $Revision$
+:Date: $Date$
+
+*Created by fdesbois on 2009-08-19*
+
+Ce document permet de décrire en détail les données manipulés par Bonzoms et proposés sous la forme de services pour d'autres applications ou son interface web Bonzoms-ui.
+
+Entites
+-------
+
+La classe principale est la classe PartyEntity correspondant à un tiers qui peut être de plusieurs types différents spécifiés par PartyType. Deux classes filles
+héritent de PartyEntity, l'une correspondant à une personne, PersonEntity et l'autre à un groupe de personnes, GroupPersonEntity. Les sociétés sont en fait
+considérés comme des groupes de personnes avec pour type *ORGANIZATION*. Ce modèle ne propose pas de détails particuliers pour une société ou un groupe de personnes
+en général, seul le nom est utiliser pour l'identifier. Chaque PartyEntity est composés de plusieurs PartyRoleEntity correspondants aux rôles des personnes ou
+groupes de personnes. Chaque rôle à un type définit par PartyRoleType et deux dates correspondants à la période sur lequel le rôle est conduit par le tiers. Il
+est bien évidemment possible que la date de fin (thruDate) soit vide pour montrer que le rôle est actuellement utilisé par le tiers. Les PartyRoleEntity permettent de
+déterminer les RelationshipEntity d'un tiers. Ainsi une RelationshipEntity possède deux rôles, un "from" (rôle fils) et un "to" (rôle parent). Pour simplifier ces termes,
+le rôle "to" sert à indiquer le rôle qui est utilisé dans de nombreuses relations du même type. Par exemple, pour une société, les employés auront le rôle "from"
+*EMPLOYEE* et la société le rôle "to" conteneur parent *EMPLOYER* pour une relation de type *EMPLOYMENT*. (Voir la documentation sur les `relations`_ existantes pour plus
+de détails sur les différentes possibilités). Une PartyEntity a également plusieurs ContactEntity définis également par un ContactType. A savoir que le diagramme
+n'indique pas l'héritage entre tous les types (RelationshipType, ContactType, PartyRoleType, PartyType) avec une même entité TypeEntity. Le ContactEntity est donc
+défini par son type mais peut être considéré comme une AddressEntity pour plus de paramètres. Notamment une AddressEntity est lié à une CityEntity elle même lié
+à une CountryEntity pour permettre la sauvegarde des villes et pays existants.
+
+.. _relations: user/relations.html
+
+.. image:: schemas/ClassDiagram_Entities.png
+ :alt: Modèle du domaine - Entités de Bonzoms
+ :align: center
+
+DTO
+---
+
+Les DTO (Data Transfert Object) de l'application Bonzoms sont des simplifications du modèle d'entité (ou des ajouts au modèle) pour permettre une manipulation plus
+simple au niveau des services ou de l'interface web de l'application. Ainsi des dépendances permettent de repérer les liaisons entre les DTO (en jaune) et
+les entités (en vert). La dépendance est définie de la manière suivante : tous les attributs de l'entité sont copiés dans ceux du DTO. Ainsi certaines simplifications
+apparaissent : un seul DTO Contact permet d'identifier un ContactEntity ou une AddressEntity. Ce DTO comprend également les attributs définissant le CityEntity et le CountryEntity
+dans le cas d'une adresse. L'héritage des partys est par contre garder de la même manière que les entités. Quant aux relations, deux différents DTO existent :
+
+- Relationship : relation entre deux partys sans prise en compte des rôles.
+
+- RelationshipRoles : relation entre deux rôles, eux même liés aux partys (de la même manière que les entités).
+
+Pourquoi cette différence ? Bonzoms permet de créer des relations entre deux tiers même si elle ne connaît pas les rôles de ces derniers. Ainsi une partie automatique
+de l'application permet d'identifier les deux types de rôles correspondants à un type de relation (voir documentation sur les `relations`_ ). L'utilisateur de Bonzoms
+peut ainsi créer précisemment une relation en lui fournissant les deux rôles (préalablement créés), ou bien laisser faire Bonzoms et lui fournir uniquement les deux
+tiers impliqués dans la relation (en identifiant bien qui est le père).
+La classe RelationshipAbstract quant à elle permet de lier la relation à son entité pour garder la partie commune aux deux types de DTO.
+
+.. image:: schemas/ClassDiagram_DTO.png
+ :alt: DTO de Bonzoms
+ :align: center
+
+Pour plus de détails techniques sur les dtos voir la documentation sur l'utilisation de `ToPIA`_.
+
+.. _dto: developper/topia.html
+
+Services
+--------
+
+Les services seront ici décrit brievement. Vous pouvez voir le détail de chacun d'eux sur la page `services`_ .
+
+Les services permettent à l'utilisateur de manipuler le contenu de Bonzoms. On retrouve la notion d'héritage précédente entre les partys. Ainsi le ServiceParty
+est l'interface père des ServicePerson et ServiceGroupPerson. Le ServiceOrganization hérite ici du ServiceGroupPerson pour permettre de travailler plus précisemment
+sur les sociétés. Trois autres services sont disponibles : ServiceContact, ServiceRelationship et ServicePartyRole pour respectivement manipuler les contacts,
+les relations et les rôles de Bonzoms. Certains éléments peuvent être manipulés dans différents services dépendant des besoins de l'utilisateur. Ainsi les contacts
+peuvent être manipulés indépendamment des Party ou bien liés à ces derniers. Le principe reste identique pour les rôles et relations. Certaines méthodes permettent
+en effet de créer automatiquement la relation et ses rôles (addDivision par exemple dans l'interface ServiceOrganization).
+
+.. _services: user/services.html
+
+.. image:: schemas/ClassDiagram_Services.png
+ :alt: Services de Bonzoms
+ :align: center
+
+Pour plus de détails techniques sur les services voir la documentation sur l'utilisation de `ToPIA`_.
\ No newline at end of file
Property changes on: trunk/bonzoms-business/src/site/rst/specifications.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision Id
Added: trunk/bonzoms-business/src/site/rst/user/export.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/user/export.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/user/export.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,8 @@
+Export
+
+service d'export xPIL lie a Choreg
+
+donnees exporter (comment le standard est utilise via Oasis CIQ Api)
+
+
+
Added: trunk/bonzoms-business/src/site/rst/user/faq.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/user/faq.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/user/faq.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1 @@
+FAQ
\ No newline at end of file
Added: trunk/bonzoms-business/src/site/rst/user/relations.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/user/relations.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/user/relations.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,3 @@
+Relations
+
+Types de relations existantes + roles et utilisation des services pour automatisation
\ No newline at end of file
Added: trunk/bonzoms-business/src/site/rst/user/services.rst
===================================================================
--- trunk/bonzoms-business/src/site/rst/user/services.rst (rev 0)
+++ trunk/bonzoms-business/src/site/rst/user/services.rst 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,12 @@
+Services
+========
+
+.. contents:: Sommaire
+
+description de chaque service
+
+
+ServiceParty
+------------
+
+Service
\ No newline at end of file
Added: trunk/bonzoms-business/src/site/site.xml
===================================================================
--- trunk/bonzoms-business/src/site/site.xml (rev 0)
+++ trunk/bonzoms-business/src/site/site.xml 2009-08-19 17:01:06 UTC (rev 47)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Bonzoms-business">
+
+ <publishDate format="dd/MM/yyyy"/>
+
+ <skin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-nuiton-skin</artifactId>
+ <version>${skin.version}</version>
+ </skin>
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ </bannerLeft>
+
+ <bannerRight>
+ <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
+ <href>http://www.codelutin.com</href>
+ </bannerRight>
+
+ <body>
+
+ <menu name="Présentation" inherit="top" >
+ <item name="Sommaire" href="index.html" />
+ <item name="En bref" href="presentation.html" />
+ <item name="Spécifications" href="specifications.html" />
+ </menu>
+
+ <menu name="Utilisateur">
+ <item name="Services" href="user/services.html" />
+ <item name="Export" href="user/export.html" />
+ <item name="FAQ" href="user/faq.html" />
+ </menu>
+
+ <menu name="Développeur">
+ <item name="Organisation du projet" href="developper/organisation.html" />
+ <item name="Génération avec ToPIA" href="developper/topia.html" />
+ <item name="Utilisation de ChoReg" href="developper/choreg.html" />
+ </menu>
+
+ <menu ref="parent"/>
+
+ <menu name="Liens">
+ <item name="ToPIA" href="http://nuiton.org/embedded/topia/topia-persistence/index.html" title="Documentation ToPIA" />
+ <item name="ChoReg" href="http://chorem.org/embedded/choreg/choreg" title="Documentation ChoReg" />
+ <item name="OASIS CIQ" href="http://www.oasis-open.org/committees/ciq/" title="Standard Oasis CIQ" />
+ <item name="OASIS CIQ Api" href="http://chorem.org/embedded/choreg/oasis-ciq-api" title="Documentation Oasis CIQ Api" />
+ <item name="Code Lutin" href="http://codelutin.com/"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ </body>
+
+</project>
+
Modified: trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/impl/ServicePartyRoleImplTest.java
===================================================================
--- trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/impl/ServicePartyRoleImplTest.java 2009-08-19 16:47:56 UTC (rev 46)
+++ trunk/bonzoms-business/src/test/java/org/chorem/bonzoms/impl/ServicePartyRoleImplTest.java 2009-08-19 17:01:06 UTC (rev 47)
@@ -30,6 +30,7 @@
import org.chorem.bonzoms.enums.PartyTypeValues;
import org.chorem.bonzoms.services.ServicePartyRole;
import org.chorem.bonzoms.services.ServiceGroupPerson;
+import org.chorem.exceptions.EntityException;
import org.chorem.utils.DateUtils;
import org.junit.After;
import org.junit.AfterClass;
@@ -234,5 +235,12 @@
log.debug("deleteGroupPerson error");
fail("BonzomsException");
}
+
+ try {
+ serviceRoles.getPartyRole(role.getId());
+ } catch (BonzomsException eee) {
+ log.debug("Expected Exception");
+ assertEquals(eee.getCause().getClass(),EntityException.class);
+ }
}
}
1
0
r46 - trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services
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 18:47:56 +0200 (Wed, 19 Aug 2009)
New Revision: 46
Modified:
trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java
trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/BonzomsManager.java
Log:
Cleaning old try for injection PageRender and ServiceUIPerson
Modified: trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java
===================================================================
--- trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java 2009-08-19 10:12:30 UTC (rev 45)
+++ trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java 2009-08-19 16:47:56 UTC (rev 46)
@@ -24,18 +24,15 @@
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.EagerLoad;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.ioc.services.RegistryShutdownHub;
import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
-import org.apache.tapestry5.services.PageRenderLinkSource;
import org.chorem.bonzoms.impl.ServiceContactImpl;
import org.chorem.bonzoms.impl.ServiceOrganizationDTO;
import org.chorem.bonzoms.impl.ServicePartyImpl;
import org.chorem.bonzoms.impl.ServicePartyRoleImpl;
import org.chorem.bonzoms.impl.ServicePersonDTO;
import org.chorem.bonzoms.impl.ServiceRelationshipImpl;
-import org.chorem.bonzoms.RegisterBonzomsServices;
import org.chorem.bonzoms.services.ServicePerson;
import org.chorem.bonzoms.services.ServiceContact;
import org.chorem.bonzoms.services.ServiceOrganization;
@@ -107,10 +104,6 @@
}
}
- /*public ServiceUIPerson buildServiceUIPerson(@InjectService("PageRenderLinkSource") PageRenderLinkSource pageRender) {
- return new ServiceUIPerson(pageRender);
- }*/
-
/**
* Construct service to launch when Tapestry shutdown. Depends on existence of ChoReg in the application server.
* If ChoReg exist, the listener for shutdown will be BonzomsManager (which implements RegistryShutdownListener) to unregister services in ChoReg.
Modified: trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/BonzomsManager.java
===================================================================
--- trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/BonzomsManager.java 2009-08-19 10:12:30 UTC (rev 45)
+++ trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/BonzomsManager.java 2009-08-19 16:47:56 UTC (rev 46)
@@ -22,13 +22,9 @@
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.tapestry5.Link;
-import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
-import org.apache.tapestry5.services.PageRenderLinkSource;
import org.chorem.bonzoms.ContextUtilBonzoms;
import org.chorem.bonzoms.RegisterBonzomsServices;
-import org.chorem.bonzoms.ui.pages.person.PersonView;
import org.chorem.choreg.ChoremConvert;
import org.chorem.choreg.ChoremRegistry;
import org.chorem.choreg.ChoremRegistryImpl;
@@ -43,6 +39,14 @@
* 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$
*
@@ -61,26 +65,10 @@
public static final String CONFIG_DEFAULT_UI_SERVER_PORT = "8080";
- //@Inject
private static final Log log = LogFactory.getLog(BonzomsManager.class);
- //private final PageRenderLinkSource pageRender;
-
- private final ServiceUIPerson servicePerson;
-
private static ChoremRegistry choreg = ChoremRegistryImpl.getInstance();
- //private ServiceUIPerson servicePerson;
-
- public BonzomsManager(ServiceUIPerson servicePerson) {
- //this.pageRender = pageRender;
- this.servicePerson = servicePerson;
- }
-
- public BonzomsManager() {
- this.servicePerson = null;
- }
-
@Override
public void run() {
RegisterBonzomsServices.startup();
@@ -96,7 +84,6 @@
@Override
public void registryDidShutdown() {
RegisterBonzomsServices.shutdown();
- //unregister(ServiceUIPerson.class);
}
private void register(Class serviceClass, ChoremUIService service) {
1
0
Author: fdesbois
Date: 2009-08-19 12:12:30 +0200 (Wed, 19 Aug 2009)
New Revision: 45
Modified:
trunk/pom.xml
Log:
Change url for mailing lists
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-19 08:09:20 UTC (rev 44)
+++ trunk/pom.xml 2009-08-19 10:12:30 UTC (rev 45)
@@ -178,24 +178,24 @@
<mailingLists>
<mailingList>
<name>bonzoms-commits</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/bonzoms-commits</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/bonzoms-commits</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-commits</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-commits</unsubscribe>
<post>bonzoms-commits(a)$list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/bonzoms-commits/</archive>
</mailingList>
<mailingList>
<name>bonzoms-devel</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/bonzoms-devel</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/bonzoms-devel</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-devel</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-devel</unsubscribe>
<post>bonzoms-devel(a)list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/bonzoms-devel/</archive>
</mailingList>
<mailingList>
<name>bonzoms-users</name>
- <subscribe>http://list.chorem.org/mailman/listinfo/bonzoms-users</subscribe>
- <unsubscribe>http://list.chorem.org/mailman/listinfo/bonzoms-users</unsubscribe>
+ <subscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-users</subscribe>
+ <unsubscribe>http://list.chorem.org/cgi-bin/mailman/listinfo/bonzoms-users</unsubscribe>
<post>bonzoms-users(a)list.chorem.org</post>
<archive>http://list.chorem.org/pipermail/bonzoms-users/</archive>
</mailingList>
1
0
r44 - in trunk: . bonzoms-business bonzoms-business/src/main/webapp/META-INF bonzoms-ui bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services bonzoms-ui/src/main/webapp/META-INF
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:09:20 +0200 (Wed, 19 Aug 2009)
New Revision: 44
Modified:
trunk/bonzoms-business/pom.xml
trunk/bonzoms-business/src/main/webapp/META-INF/context.xml
trunk/bonzoms-ui/pom.xml
trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java
trunk/bonzoms-ui/src/main/webapp/META-INF/context.xml
trunk/pom.xml
Log:
- Change scope for OASIS CIQ Api and XMLBeans
- Delete old build method for injection of ServiceUIPerson (tapestry does'nt work in embedded mode ClassNoDefFoundError)
Modified: trunk/bonzoms-business/pom.xml
===================================================================
--- trunk/bonzoms-business/pom.xml 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/bonzoms-business/pom.xml 2009-08-19 08:09:20 UTC (rev 44)
@@ -52,13 +52,10 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.1.112</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <type>jar</type>
</dependency>
</dependencies>
<!-- ************************************************************* -->
Modified: trunk/bonzoms-business/src/main/webapp/META-INF/context.xml
===================================================================
--- trunk/bonzoms-business/src/main/webapp/META-INF/context.xml 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/bonzoms-business/src/main/webapp/META-INF/context.xml 2009-08-19 08:09:20 UTC (rev 44)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Context antiJARLocking="true" path="/bonzoms-business-1.0.0-rc-2-SNAPSHOT"/>
+<Context antiJARLocking="true" path="/bonzoms-business-1.0.0-rc-3-SNAPSHOT"/>
Modified: trunk/bonzoms-ui/pom.xml
===================================================================
--- trunk/bonzoms-ui/pom.xml 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/bonzoms-ui/pom.xml 2009-08-19 08:09:20 UTC (rev 44)
@@ -51,5 +51,8 @@
<!-- ************************************************************* -->
<packaging>war</packaging>
+ <properties>
+ <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
+ </properties>
+</project>
-</project>
Modified: trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java
===================================================================
--- trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/bonzoms-ui/src/main/java/org/chorem/bonzoms/ui/services/AppModule.java 2009-08-19 08:09:20 UTC (rev 44)
@@ -98,19 +98,18 @@
* @param configuration Tapestry configuration to contribution
* @param servicePerson test
*/
- public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration,
- @InjectService("ServiceUIPerson") ServiceUIPerson servicePerson)
+ public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration)
{
try {
- configuration.add("BonzomsStartup", new BonzomsManager(servicePerson));
+ configuration.add("BonzomsStartup", new BonzomsManager());
} catch (NoClassDefFoundError eee) {
System.out.println("AppModule.contributeRegistryStartup() : ChoremRegistry unavailable");
}
}
- public ServiceUIPerson buildServiceUIPerson(@InjectService("PageRenderLinkSource") PageRenderLinkSource pageRender) {
+ /*public ServiceUIPerson buildServiceUIPerson(@InjectService("PageRenderLinkSource") PageRenderLinkSource pageRender) {
return new ServiceUIPerson(pageRender);
- }
+ }*/
/**
* Construct service to launch when Tapestry shutdown. Depends on existence of ChoReg in the application server.
Modified: trunk/bonzoms-ui/src/main/webapp/META-INF/context.xml
===================================================================
--- trunk/bonzoms-ui/src/main/webapp/META-INF/context.xml 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/bonzoms-ui/src/main/webapp/META-INF/context.xml 2009-08-19 08:09:20 UTC (rev 44)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Context antiJARLocking="true" path="/bonzoms-ui-1.0.0-rc-2-SNAPSHOT"/>
+<Context antiJARLocking="true" path="/bonzoms"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-08-11 09:03:20 UTC (rev 43)
+++ trunk/pom.xml 2009-08-19 08:09:20 UTC (rev 44)
@@ -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,9 +58,14 @@
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.4.0</version>
- <scope>provided</scope>
</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>
1
0