Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-1041

Commons Properties API inconsistence between List and Map

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • OpenCMIS 1.1.0
    • OpenCMIS 1.2.0
    • opencmis-commons
    • None

    Description

      org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl, the provided implementation of the MutableProperties Interface in Commons API is backed by a List and Map to provide these two different views via getPropertyList and_ getProperties_.

      If a Property with the same ID is added twice via addProperty the Map replaces the old property while the List appends the new one.

      Junit Test:

      @Test
      	public void testProperties_OpenCMISImpl() throws Exception
      	{
      		MutableProperties properties = new PropertiesImpl();
      		PropertyData<String> propertyOne = new PropertyStringImpl("my:test", "testOne");
      		PropertyData<String> propertyTwo = new PropertyStringImpl("my:test", "testTwo");
      
      		properties.addProperty(propertyOne);
      		Assert.assertEquals(1, properties.getProperties().size());
      		Assert.assertEquals(1, properties.getPropertyList().size());
      
      		properties.addProperty(propertyTwo);
      		// map replaces old property by new one, so only one entry here
      		Assert.assertEquals(1, properties.getProperties().size());
      		// list appends at the end, so two entries here
      		Assert.assertEquals(2, properties.getPropertyList().size());
      	}

      Attachments

        Issue Links

          Activity

            People

              fmui Florian Müller
              shomeier Sascha Homeier
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: