Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property-based merge strategy #46

Open
jwadolowski opened this issue Apr 21, 2017 · 0 comments
Open

Property-based merge strategy #46

jwadolowski opened this issue Apr 21, 2017 · 0 comments

Comments

@jwadolowski
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant