source: trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/CustomXmlDataStoragePropertiesPart.java @ 1436

Revision 1436, 1.8 KB checked in by jharrop, 15 months ago (diff)

generics; flesh out example.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1/*
2 *  Copyright 2007-2008, Plutext Pty Ltd.
3 *   
4 *  This file is part of docx4j.
5
6    docx4j is licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18
19 */
20
21package org.docx4j.openpackaging.parts;
22
23
24import org.docx4j.customXmlProperties.DatastoreItem;
25import org.docx4j.jaxb.Context;
26import org.docx4j.openpackaging.exceptions.InvalidFormatException;
27import org.docx4j.openpackaging.parts.relationships.Namespaces;
28
29
30public final class CustomXmlDataStoragePropertiesPart extends JaxbXmlPart<DatastoreItem> {
31       
32        public CustomXmlDataStoragePropertiesPart(PartName partName) throws InvalidFormatException {
33                super(partName);
34                init();
35        }
36       
37        public CustomXmlDataStoragePropertiesPart() throws InvalidFormatException {
38                super(new PartName("/customXML/itemProps1.xml"));
39                init();
40        }
41
42        public void init() {           
43       
44               
45                // Used if this Part is added to [Content_Types].xml
46                setContentType(new  org.docx4j.openpackaging.contenttype.ContentType( 
47                                org.docx4j.openpackaging.contenttype.ContentTypes.OFFICEDOCUMENT_CUSTOMXML_DATASTORAGEPROPERTIES));
48
49                // Used when this Part is added to a rels
50                setRelationshipType(Namespaces.CUSTOM_XML_DATA_STORAGE_PROPERTIES);
51       
52                this.setJAXBContext(Context.jcCustomXmlProperties);
53        }
54
55        public String getItemId() {
56               
57                return ((DatastoreItem)this.jaxbElement).getItemID();
58               
59        }
60}
Note: See TracBrowser for help on using the repository browser.