You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Swapnil M Mane (JIRA)" <ji...@apache.org> on 2019/04/28 12:07:00 UTC

[jira] [Commented] (OFBIZ-10958) Service createProductFeature ignores passed productFeatureId

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

Swapnil M Mane commented on OFBIZ-10958:
----------------------------------------

Thank you [~uHeidfeld] for reporting the issue and provide the patch, it is highly appreciated!

I have committed your code in 
trunk at rev #1858319
release18.12 at rev #1858320
release17.12 at rev #1858321
release16.11 at rev #1858322


Along with this, I have done some exploration, here are my finding (adding here just for informational purpose and future reference)

Here we can't make the changes mentioned below, because, for *optional* field's value, invokeCreate method (internally calling isIn and IsOut methods of ModelParam) of EntityAutoEngine.java consider the attribute (override) defined at last for parameters with the same name.

i.e. for below example, optional value for productFeatureId for mode IN  will be false (but it is defined true)

{code}
<override name=productFeatureId type=String mode=IN optional=true/>
<override name=productFeatureId type=String mode=OUT optional=false/>
{code}

Due to this, isSinglePkIn (in invokeCreate method) field got false value, and the system will auto-generate the productFeatureId and ignore the user's input.

Similarly, we can't write in this way
{code}
<override name=productFeatureId type=String mode=OUT optional=false/>
<override name=productFeatureId type=String mode=IN optional=true/>
{code}

Because in this case, isSinglePkOut (in invokeCreate method) field got false value, and again the system will auto-generate the productFeatureId and ignore the user's input.

Thanks!

> Service createProductFeature ignores passed productFeatureId
> ------------------------------------------------------------
>
>                 Key: OFBIZ-10958
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10958
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Trunk
>            Reporter: Ulrich Heidfeld
>            Assignee: Swapnil M Mane
>            Priority: Minor
>         Attachments: OFBIZ-10958_Fix_createProductFeature.patch
>
>
> Service "createProductFeature" ignores passed productFeatureId caused by overwritten output parameter. If I do following changes, this problem disappears.
>  original:
> {code:xml}
> <service name="createProductFeature" engine="entity-auto" invoke="create"
>              default-entity-name="ProductFeature" auth="true">
>     <description>Create a ProductFeature record</description>
>     <auto-attributes include="all" mode="IN" optional="true"/>
>     <attribute name="productFeatureId" type="String" mode="OUT" optional="false"/>
>     <override name="productFeatureTypeId" mode="IN" optional="false"/>
>     <override name="description" mode="IN" optional="false"/>
> </service>
> {code}
> Fix:
> {code:xml}
> <service name="createProductFeature" engine="entity-auto" invoke="create" 
>         default-entity-name="ProductFeature" auth="true"> 
>     <description>Create a ProductFeature record</description> 
>     <auto-attributes include="all" mode="IN" optional="true"/> 
>     <override name="productFeatureId" type="String" mode="INOUT" optional="true"/>
>     <override name="productFeatureTypeId" mode="IN" optional="false"/> 
>     <override name="description" mode="IN" optional="false"/> 
> </service>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)