You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@community.apache.org by Ricardo Ulate <ri...@valtech.de> on 2015/09/16 15:07:48 UTC

OCM - Bug fix - @Collection

Hi,

I'm sure I'm not using the right channel, but this page
http://www.apache.org/dev/contrib-email-tips.html
Was too confusing, I don't want to invest 1h time to help out with a simple fix.



When using the @Collection tag on lists (where the element is a node WITH an ID):

The class DefaultCollectionConverterImpl (in version 2.0.0 of the OCM) around lines at line 230:


        while (collectionIterator.hasNext()) {

            Object item = collectionIterator.next();

            String elementJcrName = null;



            if (elementClassDescriptor.hasUUIdField()){

            elementJcrName = collectionDescriptor.getJcrElementName();

            elementJcrName = (elementJcrName == null)? COLLECTION_ELEMENT_NAME : elementJcrName;



Should be:

        while (collectionIterator.hasNext()) {

            Object item = collectionIterator.next();

            String elementJcrName = null;



            if (elementClassDescriptor.hasUUIdField()){

if (elementClassDescriptor.hasIdField()) {

                 String idFieldName = elementClassDescriptor.getIdFieldDescriptor().getFieldName();

                elementJcrName = ReflectionUtils.getNestedProperty(item, idFieldName).toString();

}

else {

            elementJcrName = collectionDescriptor.getJcrElementName();

}

            elementJcrName = (elementJcrName == null)? COLLECTION_ELEMENT_NAME : elementJcrName;


Cheers,

Ricardo

Re: OCM - Bug fix - @Collection

Posted by Luciano Resende <lu...@gmail.com>.
You might want to redirect your question to Apache Jackrabbit mailing list

http://jackrabbit.apache.org/jcr/mailing-lists.html

On Wed, Sep 16, 2015 at 6:07 AM, Ricardo Ulate <ri...@valtech.de>
wrote:

>
> Hi,
>
> I'm sure I'm not using the right channel, but this page
> http://www.apache.org/dev/contrib-email-tips.html
> Was too confusing, I don't want to invest 1h time to help out with a
> simple fix.
>
>
>
> When using the @Collection tag on lists (where the element is a node WITH
> an ID):
>
> The class DefaultCollectionConverterImpl (in version 2.0.0 of the OCM)
> around lines at line 230:
>
>
>         while (collectionIterator.hasNext()) {
>
>             Object item = collectionIterator.next();
>
>             String elementJcrName = null;
>
>
>
>             if (elementClassDescriptor.hasUUIdField()){
>
>             elementJcrName = collectionDescriptor.getJcrElementName();
>
>             elementJcrName = (elementJcrName == null)?
> COLLECTION_ELEMENT_NAME : elementJcrName;
>
>
>
> Should be:
>
>         while (collectionIterator.hasNext()) {
>
>             Object item = collectionIterator.next();
>
>             String elementJcrName = null;
>
>
>
>             if (elementClassDescriptor.hasUUIdField()){
>
> if (elementClassDescriptor.hasIdField()) {
>
>                  String idFieldName =
> elementClassDescriptor.getIdFieldDescriptor().getFieldName();
>
>                 elementJcrName = ReflectionUtils.getNestedProperty(item,
> idFieldName).toString();
>
> }
>
> else {
>
>             elementJcrName = collectionDescriptor.getJcrElementName();
>
> }
>
>             elementJcrName = (elementJcrName == null)?
> COLLECTION_ELEMENT_NAME : elementJcrName;
>
>
> Cheers,
>
> Ricardo
>



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/