Skip to content

Property-based merge strategy #46

Description

@jwadolowski

I just encountered the following case:

  • user would like to modify properties of a /my/path/to/some/node
  • some properties should be set as defined, i.e. property1 = value1
  • the remaining ones should be merged with existing value, ie. property2 = aaa, user defined property2 as bbb and expected value is aaabbb
  • at the same time it'd be great to completely ignore existing values in cq_jcr's properties, so it gets automatically read and concatenated with value defined by user

append property exists today, but it is considered global and its role is to either ensure that only properties defined in cq_jcr should be set or we'd like to append new properties to existing state (at the same time we don't really care how many properties exist and what values are assigned to them).

The very first solution that came to my mind is brand new cq_jcr property that defines merge strategy for each property, for example:

cq_jcr "/content/my/path" do
   ...
   properties(
     'property_one' => 'first',
     'property_two' => 'second',
     'property_three' => 'third'
  )
  merge_stragetgy(
    'default' => 'overwrite',
    'property_one' => 'append',
    'property_two' => 'append',
  )

  action :create
end

At the time of writing I'm not sure though if that's the right way to go. It definitely requires some design session.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions