Bug 23903

Summary: Add this method to DocumentSummaryInformation which will get the custom properties
Product: POI Reporter: Robert Flaherty <Robert_Flaherty>
Component: HPSFAssignee: POI Developers List <dev>
Status: CLOSED FIXED    
Severity: enhancement    
Priority: P3    
Version: 2.0-pre3   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Robert Flaherty 2003-10-18 04:41:43 UTC
/**
	 * Gets the custom properties as a hash map from the property name to 
value.
	 * Note that the result is created on each invocation to avoid 
duplicate
	 * storage in the base class.
	 * 
	 * @return The custom properties if any exist, <code>null</code> 
otherwise.
	 */
	public HashMap getCustomProperties()
	{
		HashMap		rPropertyNameToValueHashMap = null;
		
		if (sectionCount == 2)
		{
			HashMap		rPropertyIdToNameHashMap;
			Iterator	rPropertyIdToNameIterator;
			Map.Entry	rPropertyIdToNameMapEntry;
			Section		rSection;
			
			rSection = (Section)sections.get(1);
			if ((rPropertyIdToNameHashMap = (HashMap)
rSection.getProperty(PropertyIDMap.PID_DICTIONARY)) != null)
			{
				rPropertyNameToValueHashMap = new HashMap
(rPropertyIdToNameHashMap.size());
				rPropertyIdToNameIterator = 
rPropertyIdToNameHashMap.entrySet().iterator();
				while (rPropertyIdToNameIterator.hasNext())
				{
					rPropertyIdToNameMapEntry = (Map.Entry)
rPropertyIdToNameIterator.next();
					rPropertyNameToValueHashMap.put
(rPropertyIdToNameMapEntry.getValue(), rSection.getProperty(((Number)
rPropertyIdToNameMapEntry.getKey()).intValue()));
				}
			}
		}
		
		return rPropertyNameToValueHashMap;
	}
Comment 1 Robert Flaherty 2003-10-21 16:34:10 UTC
One change that needs to be made to that method I posted with the current 
implementation of SpecialPropertySet is that 'sectionCount' needs to be 
changed to getSectionCount() and 'sections' to getSections() b/c only the 
methods delegate to the wrapped PropertySet, but the fields are unset.  I'm 
going to ask that they be set to accomodate any derived classes in another  
bug.
Comment 2 Rainer Klute 2003-10-22 05:47:32 UTC
I refactored your contribution and added it to DocumentSummaryInformation. I
will appear in the HEAD branch soon.
Comment 3 Robert Flaherty 2004-08-16 16:41:19 UTC
Any idea when this addition will make it into a release?
Comment 4 Rainer Klute 2004-08-16 16:47:21 UTC
It's there for nearly 10 months. That's why this issue is closed. :-)
Comment 5 Robert Flaherty 2004-08-16 18:20:09 UTC
As of build 2.5.1, the built version of DocumentSummaryInformation is 
1.9.4.1.  Looks like it was merged into the trunk after 1.12 where the fix 
was.  Version 1.14 is the tip.  So for some reason the REL_2_BRANCH and 
REL_2_5_1 tags haven't been moved up.

Many of the other files I looked at are the same (Section, 
SpecialPropertySet); tip is not used.  Not sure if some are intentional or not.
Comment 6 Rainer Klute 2004-08-16 18:36:41 UTC
Sorry, I misunderstood you. Since more than a year or so HPSF changes are in the
CVS HEAD only, not in the REL_2 branches. That's something we'll address soon by
merging the REL_2_5_1 branch into the trunk. Until then you have to checkout the
HEAD.