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
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); + } } }
participants (1)
-
fdesbois@users.chorem.org