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

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

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.7.0.Final
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                cbeer Chris Beer
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: