You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Markus Pallo <pa...@dig.de> on 2009/07/27 10:48:06 UTC

Sling ClassDescriptorReader miss uuid

the parsefielddescriptor of classdescriptor reader is missing uuid field 
handling.

I compared the attribs in mapping file generated by 
jcrocm.FieldDescriptor and ClassDescriptorReader of sling and there some 
attribs more missing.

Is this according to an early adaption of jackrabbit-ocm ?

According to the last questions i posted and no replies, i am wondering 
if somebody is using jcrocm ?


Markus


---------------------------------------------------------------
org.apache.sling.maven.jcrocm.FieldDescriptor

 &lt;!ATTLIST field-descriptor
 *      fieldName CDATA #REQUIRED
 *      fieldType CDATA #IMPLIED
 *      jcrName CDATA #IMPLIED
 *      id (true | false) &quot;false&quot;
 *      path (true | false) &quot;false&quot;
 *      uuid (true | false) &quot;false&quot;
 *      converter CDATA #IMPLIED
 *      jcrDefaultValue CDATA #IMPLIED
 *      jcrValueConstraints CDATA #IMPLIED
 *      jcrType (String | Date | Long | Double | Boolean | Binary) #IMPLIED
 *      jcrAutoCreated (true | false) &quot;false&quot;
 *      jcrMandatory (true | false) &quot;false&quot;
 *      jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | 
IGNORE | ABORT) &quot;COPY&quot;
 *      jcrProtected (true | false) &quot;false&quot;
 *      jcrMultiple (true | false) &quot;false&quot;
 *  &gt;

---------------------------------------------------------
 org.apache.sling.jcr.ocm.impl.ClassDescriptorReader.parseFieldDescriptor

        /*
         *  fieldName CDATA #REQUIRED
         *  jcrName CDATA #IMPLIED
         *  id (true | false) "false"
         *  path (true | false) "false"
         *  jcrType (String | Date | Long | Double | Boolean | Binary) 
#IMPLIED
         *  jcrAutoCreated (true | false) "false"
         *  jcrMandatory (true | false) "false"
         *  jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | 
IGNORE | ABORT) "COPY"
         *  jcrProtected (true | false) "false"
         *  jcrMultiple (true | false) "false"
         */

-- 
------------------------------------------------------------------
DIG Digitale Medienberatungs-
und Produktions- GmbH
Neckarstr. 1/5
78727 Oberndorf a. N.

Amtsgericht Stuttgart HRB 480914
Geschäftsführer: Carsten Huber
------------------------------------------------------------------
Tel: +49 (0)7423 8750 60
Fax: +49 (0)7423 8750 23
Internet: http://www.dig.de
eMail: pallo@dig.de

Ein Unternehmen der Schwarzwälder Bote Mediengruppe

 


Re: Sling ClassDescriptorReader miss uuid

Posted by Carsten Ziegeler <cz...@apache.org>.
Hmm, ok this change looks ok to me (but I'm not an expert here).

Could you please open an issue in jira for this?

Thanks
Carsten

Markus Pallo wrote:
> ok, here we go ...
> 
> i have a mapped class (see below) and after inserting and retrieving the
> object out of the repository, the id (uuid) is not filled.
> 
> 
> Base base = new Base();
> base.setPath("/ocmtestpath");
> base.setTitle("ocmtesttitle");
> base.setName("ocmtestname");
> 
> objectContentManager.insert(cat);
> try {
>  Base base = (Base) objectContentManager.getObject(cat.getPath());
>  // error id is not filled with uuid
> } catch (Exception e) {
> }
> 
> 
> 
> The generated (jcrocm) mappings.xml file has the entry for uuid.
> 
> After patching sling ClassDescriptorReader.parseFieldDescriptor and add
> the following line
> 
> fd.setUuid(this.getOptionalAttribute("uuid", false));
> 
> it works.
> 
> I am wondering there are other fields missing in parseFieldDescriptor as
> described in previous post.
> 
> 
> 
> Are you willing to patch ClassDescriptorReader and add the missing
> entries ? Or any other informations required ?
> 
> 
> 
> ---mappings.xml-----------------------------------------------------
> 
> 
>  <!--
>      Class: de.dig.cms.common.ocm.Base
>  -->
>  <class-descriptor
>     className="de.dig.cms.common.ocm.Base"
>     jcrMixinTypes="mix:referenceable">
> 
>    <field-descriptor
>       fieldName="id"
>       uuid="true" />
> 
>    <field-descriptor
>       fieldName="name"
>       jcrName="true" />
> 
>    <field-descriptor
>       fieldName="path"
>       path="true" />
>  </class-descriptor>
> 
> ---Base.class------------------------------------
> package ocm;
> 
> /**
> * @ocm.mapped discriminator="true" jcrMixinTypes="mix:referenceable"
> */
> public class Base {
>    private String resourceType;
> 
>    /**
>     * @ocm.field uuid="true"
>     */
>    private String id;
> 
>    /**
>     * @ocm.field jcrName="true"
>     */
>    private String name;
> 
>    /**
>     * @ocm.field path="true"
>     */      private String path;
> 
>    public Base() {
>    }
> 
>    public String getUuid() {
>        return uuid;
>    }
> 
>    public void setUuid(String uuid) {
>        this.uuid = uuid;
>    }
> 
>    public String getName() {
>        return name;
>    }
> 
>    public void setName(String name) {
>        this.name = name;
>    }
> 
>    public String getPath() {
>        return path;
>    }
> 
>    public void setPath(String path) {
>        this.path = path;
>    }
> 
> 
> }
> 
> 
> Carsten Ziegeler wrote:
>> Markus Pallo wrote:
>>  
>>> the parsefielddescriptor of classdescriptor reader is missing uuid field
>>> handling.
>>>
>>> I compared the attribs in mapping file generated by
>>> jcrocm.FieldDescriptor and ClassDescriptorReader of sling and there some
>>> attribs more missing.
>>>
>>> Is this according to an early adaption of jackrabbit-ocm ?
>>>
>>> According to the last questions i posted and no replies, i am wondering
>>> if somebody is using jcrocm ?
>>>
>>>     
>> I fear noone is using jcr ocm here :(
>>
>> Maybe it would help if you could post bugs including the errors you're
>> running into - the more information you give, the better the chance that
>> someone can help :)
>>
>> Carsten
>>
>>   
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Sling ClassDescriptorReader miss uuid

Posted by Markus Pallo <pa...@dig.de>.
ok, here we go ...

i have a mapped class (see below) and after inserting and retrieving the 
object out of the repository, the id (uuid) is not filled.


Base base = new Base();
base.setPath("/ocmtestpath");
base.setTitle("ocmtesttitle");
base.setName("ocmtestname");

objectContentManager.insert(cat);
try {
  Base base = (Base) objectContentManager.getObject(cat.getPath());
  // error id is not filled with uuid
} catch (Exception e) {
}



The generated (jcrocm) mappings.xml file has the entry for uuid.

After patching sling ClassDescriptorReader.parseFieldDescriptor and add 
the following line

fd.setUuid(this.getOptionalAttribute("uuid", false));

it works.

I am wondering there are other fields missing in parseFieldDescriptor as 
described in previous post.



Are you willing to patch ClassDescriptorReader and add the missing 
entries ? Or any other informations required ?



---mappings.xml-----------------------------------------------------


  <!--
      Class: de.dig.cms.common.ocm.Base
  -->
  <class-descriptor
     className="de.dig.cms.common.ocm.Base"
     jcrMixinTypes="mix:referenceable">

    <field-descriptor
       fieldName="id"
       uuid="true" />

    <field-descriptor
       fieldName="name"
       jcrName="true" />

    <field-descriptor
       fieldName="path"
       path="true" />
  </class-descriptor>

---Base.class------------------------------------
package ocm;

/**
* @ocm.mapped discriminator="true" jcrMixinTypes="mix:referenceable"
 */
public class Base {
    private String resourceType;

    /**
     * @ocm.field uuid="true"
     */
    private String id;

    /**
     * @ocm.field jcrName="true"
     */
    private String name;

    /**
     * @ocm.field path="true"
     */   
    private String path;

    public Base() {
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }


}


Carsten Ziegeler wrote:
> Markus Pallo wrote:
>   
>> the parsefielddescriptor of classdescriptor reader is missing uuid field
>> handling.
>>
>> I compared the attribs in mapping file generated by
>> jcrocm.FieldDescriptor and ClassDescriptorReader of sling and there some
>> attribs more missing.
>>
>> Is this according to an early adaption of jackrabbit-ocm ?
>>
>> According to the last questions i posted and no replies, i am wondering
>> if somebody is using jcrocm ?
>>
>>     
> I fear noone is using jcr ocm here :(
>
> Maybe it would help if you could post bugs including the errors you're
> running into - the more information you give, the better the chance that
> someone can help :)
>
> Carsten
>
>   


-- 
------------------------------------------------------------------
DIG Digitale Medienberatungs-
und Produktions- GmbH
Neckarstr. 1/5
78727 Oberndorf a. N.

Amtsgericht Stuttgart HRB 480914
Geschäftsführer: Carsten Huber
------------------------------------------------------------------
Tel: +49 (0)7423 8750 60
Fax: +49 (0)7423 8750 23
Internet: http://www.dig.de
eMail: pallo@dig.de

Ein Unternehmen der Schwarzwälder Bote Mediengruppe

 


Re: Sling ClassDescriptorReader miss uuid

Posted by Carsten Ziegeler <cz...@apache.org>.
Markus Pallo wrote:
> the parsefielddescriptor of classdescriptor reader is missing uuid field
> handling.
> 
> I compared the attribs in mapping file generated by
> jcrocm.FieldDescriptor and ClassDescriptorReader of sling and there some
> attribs more missing.
> 
> Is this according to an early adaption of jackrabbit-ocm ?
> 
> According to the last questions i posted and no replies, i am wondering
> if somebody is using jcrocm ?
> 
I fear noone is using jcr ocm here :(

Maybe it would help if you could post bugs including the errors you're
running into - the more information you give, the better the chance that
someone can help :)

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org