On 11/9/06, Dan Connelly <[EMAIL PROTECTED]> wrote:
Stefan Guggisberg wrote:

> On 11/8/06, Dan Connelly <[EMAIL PROTECTED]> wrote:
>
>> All:
>>
>> This is a follow-up on my questions posted per "ThirdHop for structured
>> node types".   I have got most of what I want working, but not all.
>>
>> One remaining problem is that a certain child-node stays unstructured
>> although I have provided a structured node type for it.   It is
>> difficult to diagnose why I am not getting jcr:primaryType of
>> "teneo:proxy" for the "author" child node.
>>
>> Details below.   The "library:Book" node is imported (correctly) as a
>> structured type.   But its child "author" is not.   It should be a
>> "teneo:proxy" primary node type.
>>
>> Could there be a problem here because the"author" element is in the
>> un-named namespace, not in the "library" namespace of its parent?
>
>
> no. the problem is the following:
>
> [...]
> <library:Book jcr:primaryType="teneo:eobject"
> [...]
>
> i.e. library:Book is of type teneo:eobject which extends
> nt:unstructured. that's why "author" ends up being of type
> nt:unstructured.
>
> i guess library:Book should be of type library:Book.
>
> btw: the naming of node and type is somewhat confusing...
>
> cheers
> stefan
>
<snip>
--------------------------------------------------------------------------------------------------------

Stefan:

Agreed, the jcr:primaryType attribute on element library:Book gets set
incorrectly.

How can I fix this in my node type specification?

(I assume that I can alter this behavior through the node type defs,
that this is not a bug in Jackrabbit.)

I made some changes in my custom_nodetype.xml spec trying to make this
change:

    * I set isMixin="true" for teneo:eobject.

why do you think that this would help?

    * I set explicit requiredPrimaryType in the childNode defs of
      teneo:content.

However, the output XML is unchanged.   The element library:Book still
has attribute jcr:primaryType="teneo:eobject", which is incorrect.

i quickly ran a test with your node type definitions and your
xml data, here's my test code:

           root.addNode("tmp", "teneo:content");
           root.save();

           FileInputStream fis = new FileInputStream("d:/temp/xml/book.xml");
           wsp.importXML("/tmp", fis,
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
           fis.close();
           dumpTree(root.getNode("tmp"), System.out);

here's the console output:

[node]   /tmp
        [prop]   jcr:primaryType teneo:content
        [node]   /library:Book
                [prop]   pages 500
                [prop]   jcr:primaryType library:Book
                [prop]   category ScienceFiction
                [prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
                [prop]   title The Hobbit
                [node]   /author
                        [prop]   href jcr://proxies.test.writer/#/Content.2
                        [prop]   jcr:primaryType teneo:proxy

i guess everything's fine.

i suggest you redo your test with a clean repository.

cheers
stefan

I have listed the relevant portion of my new custom_nodetype.xml below.

       Thanks,    Dan

 <nodeType name="teneo:eobject" isMixin="true">
    <supertypes>
      <supertype>mix:referenceable</supertype>
      <supertype>nt:unstructured</supertype>
    </supertypes>
  </nodeType>

    <nodeType name="teneo:proxy" isMixin="false" >
     <supertypes>
      <supertype>nt:base</supertype>
      </supertypes>
    <propertyDefinition name="href" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false" />
    </nodeType>

    <nodeType name="library:Book" isMixin="false"
hasOrderableChildNodes="false" >
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="title" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
        <propertyDefinition name="pages" requiredType="Long"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
        <propertyDefinition name="category" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
        <childNodeDefinition name="author"
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
onParentVersion="COPY" protected="false" sameNameSiblings="false" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
        </childNodeDefinition>
    </nodeType>

    <nodeType name="library:Library" isMixin="false"
hasOrderableChildNodes="false">
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="name" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
        <childNodeDefinition name="writers"
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
        <childNodeDefinition name="books"
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
    </nodeType>

    <nodeType name="library:Writer" isMixin="false"
hasOrderableChildNodes="false" >
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="name" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
        <childNodeDefinition name="books"
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
    </nodeType>

    <nodeType name="teneo:content" isMixin="false" >
     <supertypes>
      <supertype>nt:unstructured</supertype>
      </supertypes>
      <childNodeDefinition name="library:Library"
defaultPrimaryType="library:Library" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false"
sameNameSiblings="false" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Library</requiredPrimaryType>
        </requiredPrimaryTypes>
      </childNodeDefinition>
    <childNodeDefinition name="library:Book"
defaultPrimaryType="library:Book" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Book</requiredPrimaryType>
        </requiredPrimaryTypes>
    </childNodeDefinition>
    <childNodeDefinition name="library:Writer"
defaultPrimaryType="library:Writer" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false"
sameNameSiblings="true" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Writer</requiredPrimaryType>
        </requiredPrimaryTypes>
      </childNodeDefinition>
    </nodeType>



Reply via email to