Changeset 854
- Timestamp:
- 07/08/09 17:09:15 (3 years ago)
- Location:
- trunk/docx4j/src/main/java/org/docx4j
- Files:
-
- 6 edited
- 1 moved
-
convert/in/FlatOpcXmlImporter.java (modified) (2 diffs)
-
openpackaging/contenttype/ContentTypeManager.java (moved) (moved from trunk/docx4j/src/main/java/org/docx4j/openpackaging/contenttype/ContentTypeManagerImpl.java) (6 diffs)
-
openpackaging/io/LoadFromJCR.java (modified) (2 diffs)
-
openpackaging/io/LoadFromZipFile.java (modified) (2 diffs)
-
openpackaging/io/LoadFromZipNG.java (modified) (2 diffs)
-
openpackaging/packages/Package.java (modified) (2 diffs)
-
openpackaging/packages/WordprocessingMLPackage.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/convert/in/FlatOpcXmlImporter.java
r846 r854 46 46 import org.docx4j.openpackaging.contenttype.ContentType; 47 47 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 48 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;49 48 import org.docx4j.openpackaging.exceptions.Docx4JException; 50 49 import org.docx4j.openpackaging.exceptions.InvalidFormatException; … … 116 115 // but only the WordML package exists at present 117 116 118 ctm = new ContentTypeManager Impl();117 ctm = new ContentTypeManager(); 119 118 120 119 ctm.addDefaultContentType("rels", "application/vnd.openxmlformats-package.relationships+xml"); -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/contenttype/ContentTypeManager.java
r790 r854 82 82 * @version 1.0 83 83 */ 84 public class ContentTypeManagerImpl implements ContentTypeManager { 85 86 // TODO - merge this with interface. 87 // There is no value in having a separate implementation. 88 89 protected static Logger log = Logger.getLogger(ContentTypeManagerImpl.class); 84 public class ContentTypeManager { 85 86 protected static Logger log = Logger.getLogger(ContentTypeManager.class); 90 87 91 88 /** … … 134 131 * If the content types part content is not valid. 135 132 */ 136 public ContentTypeManager Impl(Document contentTypes) throws InvalidFormatException {133 public ContentTypeManager(Document contentTypes) throws InvalidFormatException { 137 134 init(); 138 135 if (contentTypes != null) { … … 148 145 } 149 146 150 public ContentTypeManager Impl() {147 public ContentTypeManager() { 151 148 init(); 152 149 } … … 169 166 String extension = partName.getExtension(); 170 167 if ((extension.length() == 0) 171 || (this.defaultContentType.containsKey(extension) && !(defaultCTExists = this.defaultContentType172 .containsValue(contentType))))168 || (this.defaultContentType.containsKey(extension) 169 && !(defaultCTExists = this.defaultContentType.containsValue(contentType)))) { 173 170 this.addOverrideContentType(partName.getURI(), contentType); 174 else if (!defaultCTExists)171 } else if (!defaultCTExists) { 175 172 this.addDefaultContentType(extension, contentType); 173 } 176 174 } 177 175 … … 474 472 475 473 /** 476 * Check if the specified content type is already register. 474 * Check if the specified content type is already registered 475 * as a default content type. We don't currently have a method 476 * to check whether its registered as an override content type; 477 * getContentType(PartName partName) may suffice for that purpose. 477 478 * 478 479 * @param contentType 479 480 * The content type to check. 480 481 * @return <code>true</code> if the specified content type is already 481 * register , then <code>false</code>.482 * registered, then <code>false</code>. 482 483 */ 483 484 public boolean isContentTypeRegistered(String contentType) { … … 485 486 throw new IllegalArgumentException("contentType"); 486 487 487 return (this.defaultContentType.values().contains(contentType) || (this.overrideContentType != null && this.overrideContentType 488 .values().contains(contentType))); 488 return this.defaultContentType.values().contains(contentType); 489 // || (this.overrideContentType != null 490 // && this.overrideContentType.values().contains(contentType))); 489 491 } 490 492 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/io/LoadFromJCR.java
r819 r854 51 51 import org.docx4j.openpackaging.URIHelper; 52 52 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 53 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;54 53 import org.docx4j.openpackaging.exceptions.InvalidFormatException; 55 54 import org.docx4j.openpackaging.Base; … … 119 118 120 119 public LoadFromJCR(NodeMapper nodeMapper) { 121 this(new ContentTypeManager Impl(), nodeMapper );120 this(new ContentTypeManager(), nodeMapper ); 122 121 } 123 122 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/io/LoadFromZipFile.java
r819 r854 40 40 import org.docx4j.openpackaging.URIHelper; 41 41 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 42 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;43 42 import org.docx4j.openpackaging.exceptions.Docx4JException; 44 43 import org.docx4j.openpackaging.exceptions.InvalidFormatException; … … 88 87 89 88 public LoadFromZipFile() { 90 this(new ContentTypeManager Impl() );89 this(new ContentTypeManager() ); 91 90 } 92 91 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/io/LoadFromZipNG.java
r819 r854 45 45 import org.docx4j.openpackaging.URIHelper; 46 46 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 47 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;48 47 import org.docx4j.openpackaging.exceptions.Docx4JException; 49 48 import org.docx4j.openpackaging.exceptions.InvalidFormatException; … … 91 90 92 91 public LoadFromZipNG() { 93 this(new ContentTypeManager Impl() );92 this(new ContentTypeManager() ); 94 93 } 95 94 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/Package.java
r817 r854 28 28 import org.docx4j.openpackaging.Base; 29 29 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 30 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;31 30 import org.docx4j.openpackaging.exceptions.InvalidFormatException; 32 31 import org.docx4j.openpackaging.parts.CustomXmlDataStoragePart; … … 101 100 partName = new PartName("/", false); 102 101 103 contentTypeManager = new ContentTypeManager Impl();102 contentTypeManager = new ContentTypeManager(); 104 103 } catch (Exception e) { 105 104 log.error(e.getMessage()); -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
r791 r854 49 49 import org.docx4j.openpackaging.contenttype.ContentType; 50 50 import org.docx4j.openpackaging.contenttype.ContentTypeManager; 51 import org.docx4j.openpackaging.contenttype.ContentTypeManagerImpl;52 51 import org.docx4j.openpackaging.contenttype.ContentTypes; 53 52 import org.docx4j.openpackaging.exceptions.Docx4JException; … … 238 237 org.docx4j.convert.in.FlatOpcXmlImporter xmlPackage = new org.docx4j.convert.in.FlatOpcXmlImporter( wmlPackageEl); 239 238 240 ContentTypeManager ctm = new ContentTypeManager Impl();239 ContentTypeManager ctm = new ContentTypeManager(); 241 240 242 241 Part tmpDocPart = xmlPackage.getRawPart(ctm, "/word/document.xml");
Note: See TracChangeset
for help on using the changeset viewer.
