[
https://issues.apache.org/jira/browse/OFBIZ-4949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13501117#comment-13501117
]
Jacopo Cappellato commented on OFBIZ-4949:
------------------------------------------
I like #3 too: an optional child element.
The following examples would then be valid xml files.
The default mode is "create-update" (as in current implementation); the
following two are equivalent and both valid:
{code}
<entity-engine-xml>
<Entity fieldId="ABC" description="abc"/>
<Entity fieldId="DEF" description="def"/>
</entity-engine-xml>
{code}
{code}
<entity-engine-xml>
<create-update>
<Entity fieldId="ABC" description="abc"/>
<Entity fieldId="DEF" description="def"/>
</create-update>
</entity-engine-xml>
{code}
The other modes need to be explicitly set:
{code}
<entity-engine-xml>
<create-replace>
<Entity fieldId="ABC" description="abc"/>
<Entity fieldId="DEF" description="def"/>
</create-replace>
</entity-engine-xml>
{code}
and you can have several modes:
{code}
<entity-engine-xml>
<Entity fieldId="ABC" description="abc"/>
<create-replace>
<Entity fieldId="DEF" description="def"/>
</create-replace>
</entity-engine-xml>
{code}
or the same:
{code}
<entity-engine-xml>
<create-update>
<Entity fieldId="ABC" description="abc"/>
</create-update>
<create-replace>
<Entity fieldId="DEF" description="def"/>
</create-replace>
</entity-engine-xml>
{code}
> Add a new attribute for entity-engine-xml tag, nullify-absent-fields
> --------------------------------------------------------------------
>
> Key: OFBIZ-4949
> URL: https://issues.apache.org/jira/browse/OFBIZ-4949
> Project: OFBiz
> Issue Type: Sub-task
> Components: framework
> Affects Versions: SVN trunk
> Reporter: Olivier Heintz
> Priority: Minor
> Attachments: OFBIZ-4949-NMA.patch, OFBIZ-4949.patch,
> OFBIZ-4949.patch, OFBIZ-4949.patch
>
>
> This enhancement is useful when a entity is load by reader (ex: seed) and
> sometime, it could be modify in data file. If a field is change from a value
> to null, currently this modification will not be done in the next load.
> When you are first importing new data, quite naturally all fields other than
> those specified in the file will be null. If, however, you're updating
> existing data, you might want any field not specified in the file to retain
> its current value, or you might want the contents of the file to specify
> everything about a record, in other words "take this data and null out the
> rest". The alternative to set-other-fields-to-null (or whatever else we
> might call it) would be a huge number of attribute="" in the file.
> For portletWidget, entity PortalPortal have a lot of field with potential
> default value, so sometime, first release use some field and when it's
> reviewed and corrected, some field are changed to null to use the default
> value (to follow best practice).
> This enhancement will be very useful for portletData file.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira