2
* $Id: DublinCoreSchema.java 3596 2008-10-10 11:37:58Z psoares33 $
4
* Copyright 2005 by Bruno Lowagie.
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* (the "License"); you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the License.
14
* The Original Code is 'iText, a free JAVA-PDF library'.
16
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
17
* the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
18
* All Rights Reserved.
19
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
20
* are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
22
* Contributor(s): all the names of the contributors are added in the source code
25
* Alternatively, the contents of this file may be used under the terms of the
26
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
27
* provisions of LGPL are applicable instead of those above. If you wish to
28
* allow use of your version of this file only under the terms of the LGPL
29
* License and not to allow others to use your version of this file under
30
* the MPL, indicate your decision by deleting the provisions above and
31
* replace them with the notice and other provisions required by the LGPL.
32
* If you do not delete the provisions above, a recipient may use your version
33
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE
35
* This library is free software; you can redistribute it and/or modify it
36
* under the terms of the MPL as stated above or under the terms of the GNU
37
* Library General Public License as published by the Free Software Foundation;
38
* either version 2 of the License, or any later version.
40
* This library is distributed in the hope that it will be useful, but WITHOUT
41
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
42
* FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
45
* If you didn't download this code from the following link, you should check if
46
* you aren't using an obsolete version:
47
* http://www.lowagie.com/iText/
50
package com.lowagie.text.xml.xmp;
54
* An implementation of an XmpSchema.
56
public class DublinCoreSchema extends XmpSchema {
58
private static final long serialVersionUID = -4551741356374797330L;
59
/** default namespace identifier*/
60
public static final String DEFAULT_XPATH_ID = "dc";
61
/** default namespace uri*/
62
public static final String DEFAULT_XPATH_URI = "http://purl.org/dc/elements/1.1/";
64
/** External Contributors to the resource (other than the authors). */
65
public static final String CONTRIBUTOR = "dc:contributor";
66
/** The extent or scope of the resource. */
67
public static final String COVERAGE = "dc:coverage";
68
/** The authors of the resource (listed in order of precedence, if significant). */
69
public static final String CREATOR = "dc:creator";
70
/** Date(s) that something interesting happened to the resource. */
71
public static final String DATE = "dc:date";
72
/** A textual description of the content of the resource. Multiple values may be present for different languages. */
73
public static final String DESCRIPTION = "dc:description";
74
/** The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers. */
75
public static final String FORMAT = "dc:format";
76
/** Unique identifier of the resource. */
77
public static final String IDENTIFIER = "dc:identifier";
78
/** An unordered array specifying the languages used in the resource. */
79
public static final String LANGUAGE = "dc:language";
81
public static final String PUBLISHER = "dc:publisher";
82
/** Relationships to other documents. */
83
public static final String RELATION = "dc:relation";
84
/** Informal rights statement, selected by language. */
85
public static final String RIGHTS = "dc:rights";
86
/** Unique identifier of the work from which this resource was derived. */
87
public static final String SOURCE = "dc:source";
88
/** An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource. */
89
public static final String SUBJECT = "dc:subject";
90
/** The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known. */
91
public static final String TITLE = "dc:title";
92
/** A document type; for example, novel, poem, or working paper. */
93
public static final String TYPE = "dc:type";
96
public DublinCoreSchema() {
97
super("xmlns:" + DEFAULT_XPATH_ID + "=\"" + DEFAULT_XPATH_URI + "\"");
98
setProperty(FORMAT, "application/pdf");
105
public void addTitle(String title) {
106
XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
108
setProperty(TITLE, array);
112
* Adds a description.
115
public void addDescription(String desc) {
116
XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
118
setProperty(DESCRIPTION, array);
125
public void addSubject(String subject) {
126
XmpArray array = new XmpArray(XmpArray.UNORDERED);
128
setProperty(SUBJECT, array);
134
* @param subject array of subjects
136
public void addSubject(String[] subject) {
137
XmpArray array = new XmpArray(XmpArray.UNORDERED);
138
for (int i = 0; i < subject.length; i++) {
139
array.add(subject[i]);
141
setProperty(SUBJECT, array);
145
* Adds a single author.
148
public void addAuthor(String author) {
149
XmpArray array = new XmpArray(XmpArray.ORDERED);
151
setProperty(CREATOR, array);
155
* Adds an array of authors.
158
public void addAuthor(String[] author) {
159
XmpArray array = new XmpArray(XmpArray.ORDERED);
160
for (int i = 0; i < author.length; i++) {
161
array.add(author[i]);
163
setProperty(CREATOR, array);
167
* Adds a single publisher.
170
public void addPublisher(String publisher) {
171
XmpArray array = new XmpArray(XmpArray.ORDERED);
172
array.add(publisher);
173
setProperty(PUBLISHER, array);
177
* Adds an array of publishers.
180
public void addPublisher(String[] publisher) {
181
XmpArray array = new XmpArray(XmpArray.ORDERED);
182
for (int i = 0; i < publisher.length; i++) {
183
array.add(publisher[i]);
185
setProperty(PUBLISHER, array);