XWiki Platform
  1. XWiki Platform
  2. XWIKI-4791

Default entity reference serializer serializes the full reference for an extracted reference

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.2 M1
    • Fix Version/s: None
    • Labels:
    • keywords:
      model
    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:
      XWIKI-8182Entity Reference serializers should fail if the passed reference is invalid
      XWIKI-7500When serialized with local serializer Object reference is not that local
      XWIKI-5002Implement Explicit Reference Resolver and Serializer
      XWIKI-6654Multiple backslash are not properly handled in reference resolvers and serializers
      XWIKI-10373Start implementing the Serialization part of the URL module
      XWIKI-8001ModelScriptService does not have a method to serialize with parameters
      XWIKI-5003Add optional parameter support for Reference Resolvers and Serializers
      XWIKI-4899Add Model API to get default Entity Reference values
      XWIKI-4929XWikiDocument#getParent and setParent does not serialize/resolve the reference based on the document but on the current context
      XWIKI-9614Introduce entity reference resolver for Confluence reference syntax

      Description

      For example, for a reference like the one resolved from

      xwiki:Space.Page
      

      doing a

      serializer.serialize(reference.extractReference(EntityType.SPACE))
      

      will result in

      xwiki:Space.Page
      

      instead of

      xwiki:Space
      

        Activity

        Hide
        Vincent Massol added a comment -

        Probably fixed by some other issue.

        I see we have the following test:

            @Test
            public void testSerializeRelativeReference()
            {
                EntityReference reference = new EntityReference("page", EntityType.DOCUMENT);
                Assert.assertEquals("page", serializer.serialize(reference));
        
                reference = new EntityReference("page", EntityType.DOCUMENT, new EntityReference("space", EntityType.SPACE));
                Assert.assertEquals("space.page", serializer.serialize(reference));
            }
        

        This test as added on 3/11/2010, in commit "Ensure that the reference serializer can serialize relative references git-svn-id: https://svn.xwiki.org/svnroot/xwiki/platform/core/trunk@27577 f329d543-caf0-0310-9063-dda96c69346f"

        Show
        Vincent Massol added a comment - Probably fixed by some other issue. I see we have the following test: @Test public void testSerializeRelativeReference() { EntityReference reference = new EntityReference( "page" , EntityType.DOCUMENT); Assert.assertEquals( "page" , serializer.serialize(reference)); reference = new EntityReference( "page" , EntityType.DOCUMENT, new EntityReference( "space" , EntityType.SPACE)); Assert.assertEquals( "space.page" , serializer.serialize(reference)); } This test as added on 3/11/2010, in commit "Ensure that the reference serializer can serialize relative references git-svn-id: https://svn.xwiki.org/svnroot/xwiki/platform/core/trunk@27577 f329d543-caf0-0310-9063-dda96c69346f"
        Hide
        Vincent Massol added a comment -

        Added new test to prove it works:

                // Ensure that the page part is not displayed in the serialized result
                Assert.assertEquals("space", serializer.serialize(reference.extractReference(EntityType.SPACE)));
        
        Show
        Vincent Massol added a comment - Added new test to prove it works: // Ensure that the page part is not displayed in the serialized result Assert.assertEquals( "space" , serializer.serialize(reference.extractReference(EntityType.SPACE)));

          People

          • Assignee:
            Vincent Massol
            Reporter:
            Anca Luca
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Date of First Response: