| 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 | |
|---|
| 21 | package org.docx4j.xmlPackage; |
|---|
| 22 | |
|---|
| 23 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 24 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 25 | import javax.xml.bind.annotation.XmlAttribute; |
|---|
| 26 | import javax.xml.bind.annotation.XmlSchemaType; |
|---|
| 27 | import javax.xml.bind.annotation.XmlType; |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * |
|---|
| 32 | * Defines a part of a package using open package |
|---|
| 33 | * conventions. A part with contentType containing xml |
|---|
| 34 | * requires xmlData. All other contentType values use |
|---|
| 35 | * binaryData. |
|---|
| 36 | * |
|---|
| 37 | * |
|---|
| 38 | * <p>Java class for CT_Part complex type. |
|---|
| 39 | * |
|---|
| 40 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 41 | * |
|---|
| 42 | * <pre> |
|---|
| 43 | * <complexType name="CT_Part"> |
|---|
| 44 | * <complexContent> |
|---|
| 45 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 46 | * <choice> |
|---|
| 47 | * <element name="xmlData" type="{http://schemas.microsoft.com/office/2006/xmlPackage}CT_XmlData"/> |
|---|
| 48 | * <element name="binaryData" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> |
|---|
| 49 | * </choice> |
|---|
| 50 | * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> |
|---|
| 51 | * <attribute name="contentType"> |
|---|
| 52 | * <simpleType> |
|---|
| 53 | * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> |
|---|
| 54 | * <pattern value="text/xml"/> |
|---|
| 55 | * <pattern value="application/xml"/> |
|---|
| 56 | * <pattern value="application/.+\+xml"/> |
|---|
| 57 | * <pattern value=".+"/> |
|---|
| 58 | * </restriction> |
|---|
| 59 | * </simpleType> |
|---|
| 60 | * </attribute> |
|---|
| 61 | * <attribute name="compression" default="deflateSuperFast"> |
|---|
| 62 | * <simpleType> |
|---|
| 63 | * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> |
|---|
| 64 | * <enumeration value="store"/> |
|---|
| 65 | * <enumeration value="deflateSuperFast"/> |
|---|
| 66 | * <enumeration value="deflateFast"/> |
|---|
| 67 | * <enumeration value="deflateNormal"/> |
|---|
| 68 | * <enumeration value="deflateMaximum"/> |
|---|
| 69 | * </restriction> |
|---|
| 70 | * </simpleType> |
|---|
| 71 | * </attribute> |
|---|
| 72 | * <attribute name="padding" type="{http://www.w3.org/2001/XMLSchema}unsignedInt" default="0" /> |
|---|
| 73 | * </restriction> |
|---|
| 74 | * </complexContent> |
|---|
| 75 | * </complexType> |
|---|
| 76 | * </pre> |
|---|
| 77 | * |
|---|
| 78 | * |
|---|
| 79 | */ |
|---|
| 80 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 81 | @XmlType(name = "CT_Part", propOrder = { |
|---|
| 82 | "xmlData", |
|---|
| 83 | "binaryData" |
|---|
| 84 | }) |
|---|
| 85 | public class Part { |
|---|
| 86 | |
|---|
| 87 | protected XmlData xmlData; |
|---|
| 88 | protected byte[] binaryData; |
|---|
| 89 | @XmlAttribute(namespace = "http://schemas.microsoft.com/office/2006/xmlPackage", required = true) |
|---|
| 90 | protected String name; |
|---|
| 91 | @XmlAttribute(namespace = "http://schemas.microsoft.com/office/2006/xmlPackage") |
|---|
| 92 | protected String contentType; |
|---|
| 93 | @XmlAttribute(namespace = "http://schemas.microsoft.com/office/2006/xmlPackage") |
|---|
| 94 | protected String compression; |
|---|
| 95 | @XmlAttribute(namespace = "http://schemas.microsoft.com/office/2006/xmlPackage") |
|---|
| 96 | @XmlSchemaType(name = "unsignedInt") |
|---|
| 97 | protected Long padding; |
|---|
| 98 | |
|---|
| 99 | /** |
|---|
| 100 | * Gets the value of the xmlData property. |
|---|
| 101 | * |
|---|
| 102 | * @return |
|---|
| 103 | * possible object is |
|---|
| 104 | * {@link XmlData } |
|---|
| 105 | * |
|---|
| 106 | */ |
|---|
| 107 | public XmlData getXmlData() { |
|---|
| 108 | return xmlData; |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | /** |
|---|
| 112 | * Sets the value of the xmlData property. |
|---|
| 113 | * |
|---|
| 114 | * @param value |
|---|
| 115 | * allowed object is |
|---|
| 116 | * {@link XmlData } |
|---|
| 117 | * |
|---|
| 118 | */ |
|---|
| 119 | public void setXmlData(XmlData value) { |
|---|
| 120 | this.xmlData = value; |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | /** |
|---|
| 124 | * Gets the value of the binaryData property. |
|---|
| 125 | * |
|---|
| 126 | * @return |
|---|
| 127 | * possible object is |
|---|
| 128 | * byte[] |
|---|
| 129 | */ |
|---|
| 130 | public byte[] getBinaryData() { |
|---|
| 131 | return binaryData; |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | /** |
|---|
| 135 | * Sets the value of the binaryData property. |
|---|
| 136 | * |
|---|
| 137 | * @param value |
|---|
| 138 | * allowed object is |
|---|
| 139 | * byte[] |
|---|
| 140 | */ |
|---|
| 141 | public void setBinaryData(byte[] value) { |
|---|
| 142 | this.binaryData = ((byte[]) value); |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | /** |
|---|
| 146 | * Gets the value of the name property. |
|---|
| 147 | * |
|---|
| 148 | * @return |
|---|
| 149 | * possible object is |
|---|
| 150 | * {@link String } |
|---|
| 151 | * |
|---|
| 152 | */ |
|---|
| 153 | public String getName() { |
|---|
| 154 | return name; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | /** |
|---|
| 158 | * Sets the value of the name property. |
|---|
| 159 | * |
|---|
| 160 | * @param value |
|---|
| 161 | * allowed object is |
|---|
| 162 | * {@link String } |
|---|
| 163 | * |
|---|
| 164 | */ |
|---|
| 165 | public void setName(String value) { |
|---|
| 166 | this.name = value; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | /** |
|---|
| 170 | * Gets the value of the contentType property. |
|---|
| 171 | * |
|---|
| 172 | * @return |
|---|
| 173 | * possible object is |
|---|
| 174 | * {@link String } |
|---|
| 175 | * |
|---|
| 176 | */ |
|---|
| 177 | public String getContentType() { |
|---|
| 178 | return contentType; |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | /** |
|---|
| 182 | * Sets the value of the contentType property. |
|---|
| 183 | * |
|---|
| 184 | * @param value |
|---|
| 185 | * allowed object is |
|---|
| 186 | * {@link String } |
|---|
| 187 | * |
|---|
| 188 | */ |
|---|
| 189 | public void setContentType(String value) { |
|---|
| 190 | this.contentType = value; |
|---|
| 191 | } |
|---|
| 192 | |
|---|
| 193 | /** |
|---|
| 194 | * Gets the value of the compression property. |
|---|
| 195 | * |
|---|
| 196 | * @return |
|---|
| 197 | * possible object is |
|---|
| 198 | * {@link String } |
|---|
| 199 | * |
|---|
| 200 | */ |
|---|
| 201 | public String getCompression() { |
|---|
| 202 | if (compression == null) { |
|---|
| 203 | return "deflateSuperFast"; |
|---|
| 204 | } else { |
|---|
| 205 | return compression; |
|---|
| 206 | } |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | /** |
|---|
| 210 | * Sets the value of the compression property. |
|---|
| 211 | * |
|---|
| 212 | * @param value |
|---|
| 213 | * allowed object is |
|---|
| 214 | * {@link String } |
|---|
| 215 | * |
|---|
| 216 | */ |
|---|
| 217 | public void setCompression(String value) { |
|---|
| 218 | this.compression = value; |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | /** |
|---|
| 222 | * Gets the value of the padding property. |
|---|
| 223 | * |
|---|
| 224 | * @return |
|---|
| 225 | * possible object is |
|---|
| 226 | * {@link Long } |
|---|
| 227 | * |
|---|
| 228 | */ |
|---|
| 229 | public long getPadding() { |
|---|
| 230 | if (padding == null) { |
|---|
| 231 | return 0L; |
|---|
| 232 | } else { |
|---|
| 233 | return padding; |
|---|
| 234 | } |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | /** |
|---|
| 238 | * Sets the value of the padding property. |
|---|
| 239 | * |
|---|
| 240 | * @param value |
|---|
| 241 | * allowed object is |
|---|
| 242 | * {@link Long } |
|---|
| 243 | * |
|---|
| 244 | */ |
|---|
| 245 | public void setPadding(Long value) { |
|---|
| 246 | this.padding = value; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | } |
|---|