You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Martin Buergi (JIRA)" <ji...@apache.org> on 2010/01/26 16:46:34 UTC

[jira] Created: (JCR-2479) Adding a Mixin-type with mandatory properties after setting these properties throws exception

Adding a Mixin-type with mandatory properties after setting these properties throws exception
---------------------------------------------------------------------------------------------

                 Key: JCR-2479
                 URL: https://issues.apache.org/jira/browse/JCR-2479
             Project: Jackrabbit Content Repository
          Issue Type: Bug
    Affects Versions: 2.0-beta6
            Reporter: Martin Buergi
            Priority: Critical


Testcase:

nodetype definition with mandatory property:

[nt:foo]
 mixin
- bar(string) mandatory


this throws the exception "mandatory property {}bar does not exist":

Node node = session.getRootNode().addNode("test");
node.setProperty("bar", "test");
node.addMixin("nt:foo");
node.getSession().save();


and this works at least with alpha 4 and before:

Node node = session.getRootNode().addNode("test");
node.addMixin("nt:foo");
node.setProperty("bar", "test");
node.getSession().save();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-2479) Adding a Mixin-type with mandatory properties after setting these properties throws exception

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

Stefan Guggisberg resolved JCR-2479.
------------------------------------

    Resolution: Invalid

the said behaviour is as expected and not a bug.

> Node node = session.getRootNode().addNode("test");

test is an instance of nt:unstructured

> node.setProperty("bar", "test");

'bar" is a legal non-mandatory property declared by 
the residual property definition of nt:unstructured

> node.addMixin("nt:foo");

a property definition is added by the mixin nt:foo which declares 
a mandatory string property "bar".

note that this does not affect the existing "bar" property 
declared by nt:unstructured. 

> node.getSession().save();

=> an exception is thrown since the mandatory constrained 
declared in nt:foo is not satisfied. 

> Adding a Mixin-type with mandatory properties after setting these properties throws exception
> ---------------------------------------------------------------------------------------------
>
>                 Key: JCR-2479
>                 URL: https://issues.apache.org/jira/browse/JCR-2479
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>    Affects Versions: 2.0-beta6
>            Reporter: Martin Buergi
>            Priority: Critical
>
> Testcase:
> nodetype definition with mandatory property:
> [nt:foo]
>  mixin
> - bar(string) mandatory
> this throws the exception "mandatory property {}bar does not exist":
> Node node = session.getRootNode().addNode("test");
> node.setProperty("bar", "test");
> node.addMixin("nt:foo");
> node.getSession().save();
> and this works at least with alpha 4 and before:
> Node node = session.getRootNode().addNode("test");
> node.addMixin("nt:foo");
> node.setProperty("bar", "test");
> node.getSession().save();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2479) Adding a Mixin-type with mandatory properties after setting these properties throws exception

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805469#action_12805469 ] 

Thomas Mueller commented on JCR-2479:
-------------------------------------

For me, it is a bit strange that the mixing needs to be added first. But that's how it is currently.

For data migration (data first, structure later) it does sound like a reasonable feature request.

Martin, could you explain why in your case you want to add the mixin _after_ adding the property?




> Adding a Mixin-type with mandatory properties after setting these properties throws exception
> ---------------------------------------------------------------------------------------------
>
>                 Key: JCR-2479
>                 URL: https://issues.apache.org/jira/browse/JCR-2479
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>    Affects Versions: 2.0-beta6
>            Reporter: Martin Buergi
>            Priority: Critical
>
> Testcase:
> nodetype definition with mandatory property:
> [nt:foo]
>  mixin
> - bar(string) mandatory
> this throws the exception "mandatory property {}bar does not exist":
> Node node = session.getRootNode().addNode("test");
> node.setProperty("bar", "test");
> node.addMixin("nt:foo");
> node.getSession().save();
> and this works at least with alpha 4 and before:
> Node node = session.getRootNode().addNode("test");
> node.addMixin("nt:foo");
> node.setProperty("bar", "test");
> node.getSession().save();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2479) Adding a Mixin-type with mandatory properties after setting these properties throws exception

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805442#action_12805442 ] 

Alexander Klimetschek commented on JCR-2479:
--------------------------------------------

Looking at the JCR 2.0 spec again, I guess this is due to this special definition:

   3.7.2.4.3 Mandatory and Residual Definitions

   In repositories that support residual definitions, an item cannot be both
   mandatory and residual (see ยง3.7.2.1.2 Item Definition Name and Residual Definitions).

> Adding a Mixin-type with mandatory properties after setting these properties throws exception
> ---------------------------------------------------------------------------------------------
>
>                 Key: JCR-2479
>                 URL: https://issues.apache.org/jira/browse/JCR-2479
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>    Affects Versions: 2.0-beta6
>            Reporter: Martin Buergi
>            Priority: Critical
>
> Testcase:
> nodetype definition with mandatory property:
> [nt:foo]
>  mixin
> - bar(string) mandatory
> this throws the exception "mandatory property {}bar does not exist":
> Node node = session.getRootNode().addNode("test");
> node.setProperty("bar", "test");
> node.addMixin("nt:foo");
> node.getSession().save();
> and this works at least with alpha 4 and before:
> Node node = session.getRootNode().addNode("test");
> node.addMixin("nt:foo");
> node.setProperty("bar", "test");
> node.getSession().save();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.