[ 
https://issues.apache.org/jira/browse/OFBIZ-5853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14203432#comment-14203432
 ] 

Nicolas Malin commented on OFBIZ-5853:
--------------------------------------

Hi Hans I understand that on old time it was more easier to call a create 
service with test presence to sure they was no error on creation. But as says 
Leon now we are more than 100 createPartyRole calling. After a quick check :
~50 are present on party creation service, so it's good using.
~40 are present on with a check sequence like this :
{code}
<entity-one entity-name="partyRole">
<if-empty field="partyRole">
    <call-service service-name="createPartyRole"/>
</if-empty>
{code}
only five call directly createPartyRole without check and have a pk conflict 
possibility. My apologize I don't detected them during my control.

After that we have some code like this :
{code}
    <eca service="createBillingAccountRole" event="invoke">
        <condition field-name="roleTypeId" operator="is-not-empty"/>
        <condition field-name="partyId" operator="is-not-empty"/>
        <action service="ensurePartyRole" mode="sync"/>
    </eca>
{code}
Like you says we have many entities that use partyRole as pk and we have 
different management. I don't search to change create by ensure just I prefer 
it (I admit when I drink my coffee I remember that it's a better name :) ) but 
to increase the using coherence. 

In the other way, the crud service have generally this naming convention 
create${EntityName}, update${EntityName} and remove${EntityName}. At a 
crossroads, use createPartyRole for creation only and ensurePartyRole to create 
a party role only if not exist would be appear that a real good compromise. 

It's the reason that I don't jump to revert createPartyRole, simply that we 
lost some coherence and I think isn't a good way.

> The createPartyRole service does not check a duplicate key.
> -----------------------------------------------------------
>
>                 Key: OFBIZ-5853
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5853
>             Project: OFBiz
>          Issue Type: Bug
>          Components: party
>    Affects Versions: Trunk
>            Reporter: Supatthra Nawicha
>            Assignee: Nicolas Malin
>            Priority: Minor
>             Fix For: Trunk
>
>         Attachments: OFBIZ-5853.patch, OFBIZ-5853.patch, 
> ofbizbug_CreatePartyroleService.diff
>
>
> The createPartyRole service is changed from minilang to entity-auto which 
> does not check a duplicate key. It effect to the 
> createPartyRelationshipContactAccount service which call the createPartyRole 
> service without check a duplicate key. And it might effect to other code that 
> call the createPartyRole service as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to