Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-12845

New EntityReference#extractFirstReference(EntityType)

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 7.4-milestone-1
    • 7.3
    • Model
    • None
    • Unit
    • Unknown
    • N/A

    Description

      Right now when you have an EntityReference of type EntityType.SPACE and you wish to get the first space name, it's hard to do. I'm just proposing to add a new API:

          public EntityReference extractFirstReference(EntityType type)
          {
              EntityReference reference = extractReference(type);
      
              while (reference != null && reference.getParent() != null 
                  && reference.getParent().getType().equals(type))
              {
                  reference = reference.getParent();
              }
      
              return reference;
          }
      

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: