jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Giguère (JIRA) <j...@apache.org>
Subject [jira] Commented: (JCR-1645) Add support for Map of referenced beans
Date Tue, 10 Jun 2008 20:31:45 GMT

    [ https://issues.apache.org/jira/browse/JCR-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604024#action_12604024
] 

Vincent Giguère commented on JCR-1645:
--------------------------------------

Hi, 

I have coded a new class called: BeanReferenceMapConverterImpl which allows for the conversion
of java.util.Map of beans stored as references.

It pretty much works the same way as the converter for collections of references with the
following distinction:

Since the key to the map can NOT be stored on the referenced node (because it is potentially
referenced multiple time), 
The key needs to be part of the relation stored on the collection node.

I chose the following approach: 
I encode both the key and the uuid of the referenced bean in a Value of PropertyType (PropertyType.REFERENCE)
When reloading nodes, both the uuid and the keys are decoded and the map is reconstituted
in the ManageableMapImpl.

I do not have credentials to submit code, so, I will attach it to this issue.

There is a unit test that validates the following: 
- Map of referenced nodes are persisted and reloaded properly
- Map can persist and restore same node reference under various keys
- Multiple nodes can reference the same reference node with different keys
- Converter removes deleted nodes when updating
- Converter adds new nodes wen updating
- Converter can simultaneously remove and add new references

IMPORTANT:
For the unit test to work, you need to modify the test model : 

org.apache.jackrabbit.ocm.testmodel.collection.Main must now have: 

@Collection(collectionConverter = BeanReferenceMapConverterImpl.class)
private Map<String, A> referenceMap = new HashMap<String, A>();
with getter and setter...


NOTE: Make sure that you import org.apache.jackrabbit.ocm.testmodel.uuid.A (not the other
A that does not contain a uuid)

Regards,

Vincent Giguère

> Add support for Map of referenced beans
> ---------------------------------------
>
>                 Key: JCR-1645
>                 URL: https://issues.apache.org/jira/browse/JCR-1645
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: jackrabbit-ocm
>            Reporter: Vincent Giguère
>         Attachments: BeanReferenceMapConverterImplTest.java
>
>
> OCM should support the mapping of maps of referenced beans.
> @Collection(collectionConverter= BeanReferenceCollectionConverterImpl.class)
> private java.util.Map<String, ReferencedBean> aMap;
> BeanReferenceCollectionConverterImpl (mainly the method doGetCollection) needs to be
updated to support the interface ManageableMap interface.

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


Mime
View raw message