Home » pdfbox-1.1.0-src » org.apache.jempbox.xmp » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.jempbox.xmp;
   18   
   19   import java.util.List;
   20   
   21   import org.w3c.dom.Element;
   22   
   23   /**
   24    * Define XMP properties that are related to rights management.
   25    * 
   26    * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
   27    * @version $Revision: 1.6 $
   28    */
   29   public class XMPSchemaRightsManagement extends XMPSchema
   30   {
   31       /**
   32        * The namespace for this schema.
   33        */
   34       public static final String NAMESPACE = "http://ns.adobe.com/xap/1.0/rights/";
   35   
   36       /**
   37        * Construct a new blank PDF schema.
   38        *
   39        * @param parent The parent metadata schema that this will be part of.
   40        */
   41       public XMPSchemaRightsManagement(XMPMetadata parent)
   42       {
   43           super(parent, "xmpRights", NAMESPACE);
   44       }
   45   
   46       /**
   47        * Constructor from existing XML element.
   48        * 
   49        * @param element The existing element.
   50        * @param prefix The schema prefix.
   51        */
   52       public XMPSchemaRightsManagement(Element element, String prefix)
   53       {
   54           super(element, prefix);
   55       }
   56   
   57       /**
   58        * The online rights management certificate.
   59        *
   60        * @param certificate The URL to the rights cert.
   61        */
   62       public void setCertificateURL( String certificate )
   63       {
   64           setTextProperty("xmpRights:Certificate", certificate);
   65       }
   66   
   67       /**
   68        * Get the URL of the rights managment certificate.
   69        *
   70        * @return The rights management certificate URL.
   71        */
   72       public String getCertificateURL()
   73       {
   74           return getTextProperty(prefix + ":Certificate");
   75       }
   76   
   77       /**
   78        * Flag indicating if this is a rights managed resource.
   79        *
   80        * @param marked The marked value.
   81        */
   82       public void setMarked( Boolean marked )
   83       {
   84           setBooleanProperty(prefix + ":Marked", marked);
   85       }
   86   
   87       /**
   88        * Get the flag that indicates if this is a marked resource..
   89        *
   90        * @return The value of the marked flag.
   91        */
   92       public Boolean getMarked()
   93       {
   94           Boolean b = getBooleanProperty(prefix + ":Marked");
   95           return b != null ? b : Boolean.FALSE;
   96       }
   97   
   98       /**
   99        * Remove an owner from the list.
  100        *
  101        * @param owner The owner to remove.
  102        */
  103       public void removeOwner( String owner )
  104       {
  105           removeBagValue(prefix + ":Owner", owner);
  106       }
  107   
  108       /**
  109        * Add an owner to the list.
  110        *
  111        * @param owner A new legal owner to this resource.
  112        */
  113       public void addOwner( String owner )
  114       {
  115           addBagValue(prefix + ":Owner", owner);
  116       }
  117   
  118       /**
  119        * Get the complete list of legal owners.
  120        *
  121        * @return The list of owners.
  122        */
  123       public List<String> getOwners()
  124       {
  125           return getBagList(prefix + ":Owner");
  126       }
  127   
  128       /**
  129        * Set the default usage terms for this resource.
  130        *
  131        * @param terms The resource usage terms. 
  132        */
  133       public void setUsageTerms( String terms )
  134       {
  135           setLanguageProperty(prefix + ":UsageTerms", null, terms);
  136       }
  137   
  138       /**
  139        * Get the default usage terms for the document.
  140        *
  141        * @return The terms for this resource.
  142        */
  143       public String getUsageTerms()
  144       {
  145           return getLanguageProperty(prefix + ":UsageTerms", null);
  146       }
  147   
  148       /**
  149        * Set the usage terms of this resource in a specific language.
  150        *
  151        * @param language The language code.
  152        * @param terms The terms of this resource.
  153        */
  154       public void setDescription( String language, String terms )
  155       {
  156           setLanguageProperty(prefix + ":UsageTerms", language, terms);
  157       }
  158   
  159       /**
  160        * Get the usage terms in a specific language.
  161        *
  162        * @param language The language code to get the description for.
  163        *
  164        * @return The usage terms in the specified language or null if it does not exist.
  165        */
  166       public String getUsageTerms( String language )
  167       {
  168           return getLanguageProperty(prefix + ":UsageTerms", language);
  169       }
  170   
  171       /**
  172        * Get a list of all languages that a usage term exists for.
  173        *
  174        * @return A non-null list of languages, potentially an empty list.
  175        */
  176       public List<String> getUsageTermsLanguages()
  177       {
  178           return getLanguagePropertyLanguages(prefix + ":UsageTerms");
  179       }
  180   
  181       /**
  182        * Set the external link that describes the owners/rights of this resource.
  183        *
  184        * @param webStatement The URL to a terms site.
  185        */
  186       public void setWebStatement( String webStatement )
  187       {
  188           setTextProperty(prefix + ":WebStatement", webStatement);
  189       }
  190   
  191       /**
  192        * Get the URL that describes the terms of this resource.
  193        *
  194        * @return The usage rights URL.
  195        */
  196       public String getWebStatement()
  197       {
  198           return getTextProperty(prefix + ":WebStatement");
  199       }
  200   
  201       /**
  202        * Set the copyright information.
  203        *
  204        * @param copyright The copyright information.
  205        */
  206       public void setCopyright( String copyright )
  207       {
  208           setTextProperty(prefix + ":Copyright", copyright);
  209       }
  210   
  211       /**
  212        * Get the copyright information.
  213        *
  214        * @return The copyright information.
  215        */
  216       public String getCopyright()
  217       {
  218           return getTextProperty(prefix + ":Copyright");
  219       }
  220   }

Home » pdfbox-1.1.0-src » org.apache.jempbox.xmp » [javadoc | source]