Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2098

Add ability to retrieve REFERENCE/WEAKREFERENCE/etc nodes from values

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 3.7.0.Final
    • None
    • None
    • None

    Description

      The JCR API doesn't provide a way to go from a multivalued REFERENCE property to the Nodes. The current approach seems to be, e.g.:

      p = Property.getValues
      Value[] values = p.getValues
      session.getNodeByIdentifier(values[0])
      

      If you have a single-valued Property, you can just do, e.g.:

      Property#getNode
      

      Here are a couple API extensions we could add:

      Node Value#getNode(Session)
      

      Value doesn't have a session available, so we have to send one in. It's a new pattern, but maybe the most consistent with normal usage.

      NodeIterator Property#getNodes and/or
      Node Property#getNode(int index)
      

      Property does have a Session member. None of the other JCR methods support multivalued field access, which makes this a little weird too.

      I think the first option would be easier for me to work with (and adapt into existing code), because we're already passing Values around for processing, but welcome other suggestions.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            cbeer_jira Chris Beer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: