On Tue, Oct 16, 2012 at 4:39 PM, Mete Atamel <mata...@adobe.com> wrote: > Hi, > > I have 2 questions on MicroKernel add/set property that MicroKernel > JavaDoc does not seem to answer. > > 1- What's the difference between adding a property vs. setting a property? > Are the two following commits basically the same? > > mk.commit("/", "+\"a/key1\" : \"value1\"", null, null); > mk.commit("/", "^\"a/key1\" : \"value1\"", null, null);
initially we used to only support the 'set property' (create-or-modify) syntax, i.e. ^"/some/property" : "some value" however, in JCR there are 2 distinct event types: PROPERTY_ADDED and PROPERTY_CHANGED in the mk journal/diff we therefore need to make the same distinction, i.e. added properties are reported with the '+' syntax, whereas the '^' syntax is used to represent property modifications. > > > Or are there scenarios where adding a property acts differently than > setting a property? > > 2- Is adding a property twice supposed to work or is it supposed to throw > a MicroKernelException? For example, this seems to work with > MicroKernelImpl but is it supposed to? > > mk.commit("/", "+\"a/key1\" : \"value1\"", null, null); > mk.commit("/", "+\"a/key1\" : \"value1\"", null, null); you're right, that seems to be a bug. could you please file a jira issue? > > What about setting a property twice? that shouldn't be an issue. you can set a property more than once in a single commit. only the last modification should be persisted. cheers stefan > > > Thanks, > Mete > >