You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2011/02/16 18:42:24 UTC

[jira] Created: (SLING-1983) Post servlet: Patching multi-value properties

Post servlet: Patching multi-value properties
---------------------------------------------

                 Key: SLING-1983
                 URL: https://issues.apache.org/jira/browse/SLING-1983
             Project: Sling
          Issue Type: New Feature
          Components: Servlets
            Reporter: Alexander Klimetschek


As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p, allow patching of multi-value properties:

New "@Patch" suffix:

my:property@TypeHint=String[]
my:property@Patch=true
my:property=+value1
my:property=-value1

When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated SLING-1983:
-------------------------------------

    Affects Version/s: Servlets Post 2.1.0
        Fix Version/s: Servlets Post 2.1.2

> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.0
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>             Fix For: Servlets Post 2.1.2
>
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005616#comment-13005616 ] 

Felix Meschberger commented on SLING-1983:
------------------------------------------

Committed the patch slightly modified (mostly JavaDoc and some internal rearranging) in Revs. 1080549/1080550.

> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002592#comment-13002592 ] 

Felix Meschberger commented on SLING-1983:
------------------------------------------

Thanks for providing the patch. I am inspecting and applying it

> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-1983:
----------------------------------------

    Assignee: Felix Meschberger

> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated SLING-1983:
-----------------------------------------

    Description: 
As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:

New "@Patch" suffix:

my:property@TypeHint=String[]
my:property@Patch=true
my:property=+value1
my:property=-value1

When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

  was:
As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p, allow patching of multi-value properties:

New "@Patch" suffix:

my:property@TypeHint=String[]
my:property@Patch=true
my:property=+value1
my:property=-value1

When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.


> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reopened SLING-1983:
--------------------------------------


wrong resolution
                
> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.0
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>             Fix For: Servlets Post 2.1.2
>
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Felix Meschberger (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-1983.
--------------------------------------

    Resolution: Fixed

Can be resolved, documentation to be done as part of SLING-2393
                
> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.0
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>             Fix For: Servlets Post 2.1.2
>
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Carsten Ziegeler (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197659#comment-13197659 ] 

Carsten Ziegeler commented on SLING-1983:
-----------------------------------------

Can we resolve this issue?
                
> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.0
>            Reporter: Alexander Klimetschek
>            Assignee: Felix Meschberger
>             Fix For: Servlets Post 2.1.2
>
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p , allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SLING-1983) Post servlet: Patching multi-value properties

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated SLING-1983:
-----------------------------------------

    Attachment: SLING-1983.patch

This patch will add @Patch support as described.

Notably, the code is very restrictive and won't change anything on the property if the operations are wrong (i.e. no +/- ops given in the values). Also, an existing array is kept, and not forced into a set. For example, if there are two elements "foo" in the array, and they are not touched by the patch operations, they will stay in it. The order is also kept, newly added elements are appended. Otherwise the set semantics are ensured: adding something will not add it twice, and removing something will remove all occurrences in the array.

I took the chance to clear up the SlingPropertyValueHandler, remove duplicated code (there was a lot for the multi-value case and the date/reference handling) and tried to simplify the rather complex logic. Patching is now basically just a "filter" for the values before they are written to the multi-value property as usual.

Included is a new integration test (PostServletPatchTest.java) for this. I also updated the SlingDateValuesTest to test multi-value date properties, which have specific handling and thus are quite important to test (because of the above code cleanup). However, there is no specific test case for date or reference properties in the context of @Patch yet. Basically if there is a 1:1 mapping from string to value via getString to string, the patch will work, otherwise it's impossible anyway, as there is no equals() defined for jcr Value.

To run the integration tests with the new post servlet bundle, one has to change launchpad/builder/src/main/bundles/list.xml to use 2.1.1-SNAPSHOT of org.apache.sling.servlets.post. (Or install the latest bundle in the running sling instance using -PautoInstallBundle).

> Post servlet: Patching multi-value properties
> ---------------------------------------------
>
>                 Key: SLING-1983
>                 URL: https://issues.apache.org/jira/browse/SLING-1983
>             Project: Sling
>          Issue Type: New Feature
>          Components: Servlets
>            Reporter: Alexander Klimetschek
>         Attachments: SLING-1983.patch
>
>
> As described on the sling list http://sling.markmail.org/thread/xxaaqowtx7jgfo3p, allow patching of multi-value properties:
> New "@Patch" suffix:
> my:property@TypeHint=String[]
> my:property@Patch=true
> my:property=+value1
> my:property=-value1
> When "@Patch" is present, each of the property values from the request are expected to start with either "+" or "-", followed by the actual value. These two would represent the operations you want to have executed on the set.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira