From 68b95f3a3fda2a484ea0ded1d083676704703c68 Mon Sep 17 00:00:00 2001 From: Rainer Klute Date: Sun, 15 Aug 2004 15:20:08 +0000 Subject: [PATCH] Some code and documentation cleanup. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353584 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hpsf/DocumentSummaryInformation.java | 6 +-- .../org/apache/poi/hpsf/MutableSection.java | 7 ++- .../apache/poi/hpsf/SummaryInformation.java | 7 ++- .../poi/hpsf/wellknown/PropertyIDMap.java | 54 +++++++++++++++---- .../org/apache/poi/hpsf/basic/TestWrite.java | 1 - 5 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java b/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java index 01418cfaa5..21b1b2a9fe 100644 --- a/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java +++ b/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java @@ -255,11 +255,7 @@ public class DocumentSummaryInformation extends SpecialPropertySet /** - *

Returns true if the custom links are hampered - * by excessive noise, for all applications.

- * - * FIXME (3): Explain this some more! I (Rainer) - * don't understand it.

+ *

Returns true if the custom links are dirty.

* * @return The linksDirty value */ diff --git a/src/java/org/apache/poi/hpsf/MutableSection.java b/src/java/org/apache/poi/hpsf/MutableSection.java index aef344aab2..f457631a14 100644 --- a/src/java/org/apache/poi/hpsf/MutableSection.java +++ b/src/java/org/apache/poi/hpsf/MutableSection.java @@ -506,7 +506,7 @@ public class MutableSection extends Section /** - *

Returns this section's properties.

+ *

Gets this section's properties.

* * @return this section's properties. */ @@ -521,14 +521,13 @@ public class MutableSection extends Section /** *

Gets a property.

* - *

FIXME (2): This method ensures that properties and - * preprops are in sync. Cleanup this awful stuff!

- * * @param id The ID of the property to get * @return The property or null if there is no such property */ public Object getProperty(final long id) { + /* Calling getProperties() ensures that properties and preprops are in + * sync.

*/ getProperties(); return super.getProperty(id); } diff --git a/src/java/org/apache/poi/hpsf/SummaryInformation.java b/src/java/org/apache/poi/hpsf/SummaryInformation.java index ea5d734311..cd7fa00a1f 100644 --- a/src/java/org/apache/poi/hpsf/SummaryInformation.java +++ b/src/java/org/apache/poi/hpsf/SummaryInformation.java @@ -264,10 +264,9 @@ public class SummaryInformation extends SpecialPropertySet * when this method is implemented. Please note that the * return type is likely to change!

* - *

FIXME (3) / Hint to developers: Drew Varner - * <Drew.Varner -at- sc.edu> said that this is an image in - * WMF or Clipboard (BMP?) format. He also provided two links that - * might be helpful: Hint to developers: Drew Varner <Drew.Varner -at- + * sc.edu> said that this is an image in WMF or Clipboard (BMP?) format. + * He also provided two links that might be helpful: http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch * and This is a dictionary which maps property ID values to property @@ -29,12 +31,8 @@ import java.util.HashMap; * should treat them as unmodifiable, copy them and modifiy the * copies.

* - *

FIXME (3): Make the singletons unmodifiable. However, - * since this requires to use a {@link HashMap} delegate instead of - * extending {@link HashMap} and thus requires a lot of stupid typing, I won't - * do that for the time being.

- * - * @author Rainer Klute (klute@rainer-klute.de) + * @author Rainer Klute
<klute@rainer-klute.de> * @version $Id$ * @since 2002-02-09 */ @@ -104,7 +102,31 @@ public class PropertyIDMap extends HashMap * document

*/ public static final int PID_APPNAME = 18; - /**

FIXME (2): ID of the property that denotes...

*/ + /**

ID of the property that denotes whether read/write access to the + * document is allowed or whether is should be opened as read-only. It can + * have the following values:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *

Value

Description

0

No restriction

2

Read-only recommended

4

Read-only enforced

+ */ public static final int PID_SECURITY = 19; @@ -242,6 +264,18 @@ public class PropertyIDMap extends HashMap + /** + *

Creates a {@link PropertyIDMap} backed by another map.

+ * + * @param map The instance to be created is backed by this map. + */ + public PropertyIDMap(final Map map) + { + super(map); + } + + + /** *

Puts a ID string for an ID into the {@link * PropertyIDMap}.

@@ -300,7 +334,8 @@ public class PropertyIDMap extends HashMap m.put(PID_THUMBNAIL, "PID_THUMBNAIL"); m.put(PID_APPNAME, "PID_APPNAME"); m.put(PID_SECURITY, "PID_SECURITY"); - summaryInformationProperties = m; + summaryInformationProperties = + new PropertyIDMap(Collections.unmodifiableMap(m)); } return summaryInformationProperties; } @@ -335,7 +370,8 @@ public class PropertyIDMap extends HashMap m.put(PID_MANAGER, "PID_MANAGER"); m.put(PID_COMPANY, "PID_COMPANY"); m.put(PID_LINKSDIRTY, "PID_LINKSDIRTY"); - documentSummaryInformationProperties = m; + documentSummaryInformationProperties = + new PropertyIDMap(Collections.unmodifiableMap(m)); } return documentSummaryInformationProperties; } diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java b/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java index 6c0e97a740..1e1eada3a1 100644 --- a/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java +++ b/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java @@ -29,7 +29,6 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Map;