FileEntryElement.java

  1. /**
  2.  * **********************************************************************
  3.  *
  4.  * <p>DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  5.  *
  6.  * <p>Use is subject to license terms.
  7.  *
  8.  * <p>Licensed to the Apache Software Foundation (ASF) under one or more contributor license
  9.  * agreements. See the NOTICE file distributed with this work for additional information regarding
  10.  * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
  11.  * "License"); you may not use this file except in compliance with the License. You may obtain a
  12.  * copy of the License at
  13.  *
  14.  * <p>http://www.apache.org/licenses/LICENSE-2.0
  15.  *
  16.  * <p>Unless required by applicable law or agreed to in writing, software distributed under the
  17.  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  18.  * express or implied.
  19.  *
  20.  * <p>See the License for the specific language governing permissions and limitations under the
  21.  * License.
  22.  *
  23.  * <p>**********************************************************************
  24.  */

  25. /*
  26.  * This file is automatically generated.
  27.  * Don't edit manually.
  28.  */
  29. package org.odftoolkit.odfdom.pkg.manifest;

  30. import org.odftoolkit.odfdom.pkg.OdfElement;
  31. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  32. import org.odftoolkit.odfdom.pkg.OdfName;
  33. import org.odftoolkit.odfdom.pkg.OdfPackageNamespace;

  34. /** Manifest implementation of OpenDocument element {@odf.element manifest:file-entry}. */
  35. public class FileEntryElement extends OdfElement {

  36.   public static final OdfName ELEMENT_NAME =
  37.       OdfName.newName(OdfPackageNamespace.MANIFEST, "file-entry");

  38.   /**
  39.    * Create the instance of <code>FileEntryElement</code>
  40.    *
  41.    * @param ownerDoc The type is <code>OdfFileDom</code>
  42.    */
  43.   public FileEntryElement(OdfFileDom ownerDoc) {
  44.     super(ownerDoc, ELEMENT_NAME);
  45.   }

  46.   /**
  47.    * Get the element name
  48.    *
  49.    * @return return <code>OdfName</code> the name of element {@odf.element manifest:file-entry}.
  50.    */
  51.   @Override
  52.   public OdfName getOdfName() {
  53.     return ELEMENT_NAME;
  54.   }

  55.   /**
  56.    * Receives the value of the ODFDOM attribute representation <code>FullPathAttribute</code> , See
  57.    * {@odf.attribute manifest:full-path}
  58.    *
  59.    * <p>Attribute is mandatory.
  60.    *
  61.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  62.    *     and no default value defined.
  63.    */
  64.   public String getFullPathAttribute() {
  65.     FullPathAttribute attr =
  66.         (FullPathAttribute) getOdfAttribute(OdfPackageNamespace.MANIFEST, "full-path");
  67.     if (attr != null) {
  68.       return String.valueOf(attr.getValue());
  69.     }
  70.     return null;
  71.   }

  72.   /**
  73.    * Sets the value of ODFDOM attribute representation <code>FullPathAttribute</code> , See
  74.    * {@odf.attribute manifest:full-path}
  75.    *
  76.    * @param fullPathValue The type is <code>String</code>
  77.    */
  78.   public void setFullPathAttribute(String fullPathValue) {
  79.     FullPathAttribute attr = new FullPathAttribute((OdfFileDom) this.ownerDocument);
  80.     setOdfAttribute(attr);
  81.     attr.setValue(fullPathValue);
  82.   }

  83.   /**
  84.    * Receives the value of the ODFDOM attribute representation <code>MediaTypeAttribute</code> , See
  85.    * {@odf.attribute manifest:media-type}
  86.    *
  87.    * <p>Attribute is mandatory.
  88.    *
  89.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  90.    *     and no default value defined.
  91.    */
  92.   public String getMediaTypeAttribute() {
  93.     MediaTypeAttribute attr =
  94.         (MediaTypeAttribute) getOdfAttribute(OdfPackageNamespace.MANIFEST, "media-type");
  95.     if (attr != null) {
  96.       return String.valueOf(attr.getValue());
  97.     }
  98.     return null;
  99.   }

  100.   /**
  101.    * Sets the value of ODFDOM attribute representation <code>MediaTypeAttribute</code> , See
  102.    * {@odf.attribute manifest:media-type}
  103.    *
  104.    * @param mediaTypeValue The type is <code>String</code>
  105.    */
  106.   public void setMediaTypeAttribute(String mediaTypeValue) {
  107.     MediaTypeAttribute attr = new MediaTypeAttribute((OdfFileDom) this.ownerDocument);
  108.     setOdfAttribute(attr);
  109.     attr.setValue(mediaTypeValue);
  110.   }

  111.   /**
  112.    * Receives the value of the ODFDOM attribute representation <code>PreferredViewModeAttribute
  113.    * </code> , See {@odf.attribute manifest:preferred-view-mode}
  114.    *
  115.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  116.    *     and no default value defined.
  117.    */
  118.   public String getPreferredViewModeAttribute() {
  119.     PreferredViewModeAttribute attr =
  120.         (PreferredViewModeAttribute)
  121.             getOdfAttribute(OdfPackageNamespace.MANIFEST, "preferred-view-mode");
  122.     if (attr != null) {
  123.       return String.valueOf(attr.getValue());
  124.     }
  125.     return null;
  126.   }

  127.   /**
  128.    * Sets the value of ODFDOM attribute representation <code>PreferredViewModeAttribute</code> , See
  129.    * {@odf.attribute manifest:preferred-view-mode}
  130.    *
  131.    * @param preferredViewModeValue The type is <code>String</code>
  132.    */
  133.   public void setPreferredViewModeAttribute(String preferredViewModeValue) {
  134.     PreferredViewModeAttribute attr =
  135.         new PreferredViewModeAttribute((OdfFileDom) this.ownerDocument);
  136.     setOdfAttribute(attr);
  137.     attr.setValue(preferredViewModeValue);
  138.   }

  139.   /**
  140.    * Receives the value of the ODFDOM attribute representation <code>SizeAttribute</code> , See
  141.    * {@odf.attribute manifest:size}
  142.    *
  143.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  144.    *     set and no default value defined.
  145.    */
  146.   public Integer getSizeAttribute() {
  147.     SizeAttribute attr = (SizeAttribute) getOdfAttribute(OdfPackageNamespace.MANIFEST, "size");
  148.     if (attr != null) {
  149.       return Integer.valueOf(attr.intValue());
  150.     }
  151.     return null;
  152.   }

  153.   /**
  154.    * Sets the value of ODFDOM attribute representation <code>SizeAttribute</code> , See
  155.    * {@odf.attribute manifest:size}
  156.    *
  157.    * @param sizeValue The type is <code>Integer</code>
  158.    */
  159.   public void setSizeAttribute(Integer sizeValue) {
  160.     SizeAttribute attr = new SizeAttribute((OdfFileDom) this.ownerDocument);
  161.     setOdfAttribute(attr);
  162.     attr.setIntValue(sizeValue.intValue());
  163.   }

  164.   /**
  165.    * Receives the value of the ODFDOM attribute representation <code>VersionAttribute</code> , See
  166.    * {@odf.attribute manifest:version}
  167.    *
  168.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  169.    *     and no default value defined.
  170.    */
  171.   public String getVersionAttribute() {
  172.     VersionAttribute attr =
  173.         (VersionAttribute) getOdfAttribute(OdfPackageNamespace.MANIFEST, "version");
  174.     if (attr != null) {
  175.       return String.valueOf(attr.getValue());
  176.     }
  177.     return null;
  178.   }

  179.   /**
  180.    * Sets the value of ODFDOM attribute representation <code>VersionAttribute</code> , See
  181.    * {@odf.attribute manifest:version}
  182.    *
  183.    * @param versionValue The type is <code>String</code>
  184.    */
  185.   public void setVersionAttribute(String versionValue) {
  186.     VersionAttribute attr = new VersionAttribute((OdfFileDom) this.ownerDocument);
  187.     setOdfAttribute(attr);
  188.     attr.setValue(versionValue);
  189.   }

  190.   /**
  191.    * Create child element {@odf.element manifest:encryption-data}.
  192.    *
  193.    * @param checksumValue the <code>String</code> value of <code>ChecksumAttribute</code>, see
  194.    *     {@odf.attribute manifest:checksum} at specification
  195.    * @param checksumTypeValue the <code>String</code> value of <code>ChecksumTypeAttribute</code>,
  196.    *     see {@odf.attribute manifest:checksum-type} at specification Child element is new in Odf
  197.    *     1.2
  198.    * @return the element {@odf.element manifest:encryption-data}
  199.    */
  200.   public EncryptionDataElement newEncryptionDataElement(
  201.       String checksumValue, String checksumTypeValue) {
  202.     EncryptionDataElement manifestEncryptionData =
  203.         ((OdfFileDom) this.ownerDocument).newOdfElement(EncryptionDataElement.class);
  204.     manifestEncryptionData.setChecksumAttribute(checksumValue);
  205.     manifestEncryptionData.setChecksumTypeAttribute(checksumTypeValue);
  206.     this.appendChild(manifestEncryptionData);
  207.     return manifestEncryptionData;
  208.   }
  209. }