You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by gb...@apache.org on 2013/03/06 16:57:52 UTC
svn commit: r1453395 [2/11] - in /pdfbox/trunk/xmpbox: ./
src/main/java/org/apache/xmpbox/ src/main/java/org/apache/xmpbox/schema/
src/main/java/org/apache/xmpbox/type/ src/main/java/org/apache/xmpbox/xml/
src/test/java/org/apache/xmpbox/ src/test/java...
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/DublinCoreSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/DublinCoreSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/DublinCoreSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/DublinCoreSchema.java Wed Mar 6 15:57:44 2013
@@ -31,736 +31,789 @@ import org.apache.xmpbox.type.MIMEType;
import org.apache.xmpbox.type.PropertyType;
import org.apache.xmpbox.type.StructuredType;
import org.apache.xmpbox.type.TextType;
-import org.apache.xmpbox.type.TypeMapping;
import org.apache.xmpbox.type.Types;
-
/**
* Representation of a DublinCore Schema
*
* @author a183132
*
*/
-@StructuredType(preferedPrefix="dc",namespace="http://purl.org/dc/elements/1.1/")
-public class DublinCoreSchema extends XMPSchema {
+@StructuredType(preferedPrefix = "dc", namespace = "http://purl.org/dc/elements/1.1/")
+public class DublinCoreSchema extends XMPSchema
+{
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String CONTRIBUTOR = "contributor";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String COVERAGE = "coverage";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Seq)
+ public static final String CREATOR = "creator";
+
+ @PropertyType(type = Types.Date, card = Cardinality.Seq)
+ public static final String DATE = "date";
+
+ @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
+ public static final String DESCRIPTION = "description";
+
+ @PropertyType(type = Types.MIMEType, card = Cardinality.Simple)
+ public static final String FORMAT = "format";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String IDENTIFIER = "identifier";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String LANGUAGE = "language";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String PUBLISHER = "publisher";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String RELATION = "relation";
+
+ @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
+ public static final String RIGHTS = "rights";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String SOURCE = "source";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String SUBJECT = "subject";
+
+ @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
+ public static final String TITLE = "title";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String TYPE = "type";
+
+ /**
+ * Constructor of a Dublin Core schema with preferred prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public DublinCoreSchema(XMPMetadata metadata)
+ {
+ super(metadata);
+ }
+
+ /**
+ * Constructor of a Dublin Core schema with specified prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param ownPrefix
+ * The prefix to assign
+ */
+ public DublinCoreSchema(XMPMetadata metadata, String ownPrefix)
+ {
+ super(metadata, ownPrefix);
+ }
+
+ /**
+ * set contributor(s) to the resource (other than the authors)
+ *
+ * @param properName
+ * Value to set
+ */
+ public void addContributor(String properName)
+ {
+ addQualifiedBagValue(CONTRIBUTOR, properName);
+ }
+
+ public void removeContributor(String properName)
+ {
+ removeUnqualifiedBagValue(CONTRIBUTOR, properName);
+ }
+
+ /**
+ * set the extent or scope of the resource
+ *
+ * @param text
+ * Value to set
+ */
+ public void setCoverage(String text)
+ {
+ addProperty(createTextType(COVERAGE, text));
+ }
+
+ /**
+ * set the extent or scope of the resource
+ *
+ * @param text
+ * Property to set
+ */
+ public void setCoverageProperty(TextType text)
+ {
+ addProperty(text);
+ }
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String CONTRIBUTOR = "contributor";
+ /**
+ * set the autor(s) of the resource
+ *
+ * @param properName
+ * Value to add
+ * @throws InappropriateTypeException
+ */
+ public void addCreator(String properName)
+ {
+ addUnqualifiedSequenceValue(CREATOR, properName);
+ }
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String COVERAGE = "coverage";
+ public void removeCreator(String name)
+ {
+ removeUnqualifiedSequenceValue(CREATOR, name);
+ }
- @PropertyType(type = Types.Text, card = Cardinality.Seq)
- public static final String CREATOR = "creator";
-
- @PropertyType(type = Types.Date, card = Cardinality.Seq)
- public static final String DATE = "date";
-
- @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
- public static final String DESCRIPTION = "description";
-
- @PropertyType(type = Types.MIMEType, card = Cardinality.Simple)
- public static final String FORMAT = "format";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String IDENTIFIER = "identifier";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String LANGUAGE = "language";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String PUBLISHER = "publisher";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String RELATION = "relation";
-
- @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
- public static final String RIGHTS = "rights";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String SOURCE = "source";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String SUBJECT = "subject";
-
- @PropertyType(type = Types.LangAlt, card = Cardinality.Simple)
- public static final String TITLE = "title";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String TYPE = "type";
-
- /**
- * Constructor of a Dublin Core schema with preferred prefix
- *
- * @param metadata
- * The metadata to attach this schema
- */
- public DublinCoreSchema(XMPMetadata metadata) {
- super(metadata);
- }
-
- /**
- * Constructor of a Dublin Core schema with specified prefix
- *
- * @param metadata
- * The metadata to attach this schema
- * @param ownPrefix
- * The prefix to assign
- */
- public DublinCoreSchema(XMPMetadata metadata, String ownPrefix) {
- super(metadata, ownPrefix);
- }
-
- /**
- * set contributor(s) to the resource (other than the authors)
- *
- * @param properName
- * Value to set
- */
- public void addContributor(String properName) {
- addQualifiedBagValue(CONTRIBUTOR, properName);
- }
-
- public void removeContributor (String properName) {
- removeUnqualifiedBagValue(CONTRIBUTOR, properName);
- }
-
-
- /**
- * set the extent or scope of the resource
- *
- * @param text
- * Value to set
- */
- public void setCoverage(String text) {
- addProperty(createTextType ( COVERAGE, text));
- }
-
- /**
- * set the extent or scope of the resource
- *
- * @param text
- * Property to set
- */
- public void setCoverageProperty(TextType text) {
- addProperty(text);
- }
-
- /**
- * set the autor(s) of the resource
- *
- * @param properName
- * Value to add
- * @throws InappropriateTypeException
- */
- public void addCreator(String properName) {
- addUnqualifiedSequenceValue(CREATOR, properName);
- }
-
- public void removeCreator (String name) {
- removeUnqualifiedSequenceValue(CREATOR, name);
- }
-
- /**
- * Set date(s) that something interesting happened to the resource
- *
- * @param date
- * Value to add
- */
- public void addDate(Calendar date) {
- addUnqualifiedSequenceDateValue(DATE, date);
- }
-
- public void removeDate (Calendar date) {
- removeUnqualifiedSequenceDateValue(DATE, date);
- }
-
- /**
- * add a textual description of the content of the resource (multiple values
- * may be present for different languages)
- *
- * @param lang
- * language concerned
- * @param value
- * Value to add
- */
- public void addDescription(String lang, String value) {
- setUnqualifiedLanguagePropertyValue(DESCRIPTION, lang, value);
- }
+ /**
+ * Set date(s) that something interesting happened to the resource
+ *
+ * @param date
+ * Value to add
+ */
+ public void addDate(Calendar date)
+ {
+ addUnqualifiedSequenceDateValue(DATE, date);
+ }
+
+ public void removeDate(Calendar date)
+ {
+ removeUnqualifiedSequenceDateValue(DATE, date);
+ }
+
+ /**
+ * add a textual description of the content of the resource (multiple values may be present for different languages)
+ *
+ * @param lang
+ * language concerned
+ * @param value
+ * Value to add
+ */
+ public void addDescription(String lang, String value)
+ {
+ setUnqualifiedLanguagePropertyValue(DESCRIPTION, lang, value);
+ }
/**
* Set the default value for the description.
- *
- * @param value The description of this resource.
+ *
+ * @param value
+ * The description of this resource.
*/
- public void setDescription( String value )
+ public void setDescription(String value)
{
- addDescription(null, value);
+ addDescription(null, value);
}
-
/**
* Convenience method for signature compatibility with jempbox
- *
+ *
* @see DublinCoreSchema#addDescription(String, String)
*/
@Deprecated
- public void setDescription( String language, String description )
+ public void setDescription(String language, String description)
+ {
+ addDescription(language, description);
+ }
+
+ /**
+ * set the file format used when saving the resource.
+ *
+ * @param mimeType
+ * Value to set
+ */
+ public void setFormat(String mimeType)
{
- addDescription(language, description );
+ addProperty(createTextType(FORMAT, mimeType));
}
-
-
- /**
- * set the file format used when saving the resource.
- *
- * @param mimeType
- * Value to set
- */
- public void setFormat(String mimeType) {
- addProperty(createTextType ( FORMAT, mimeType));
- }
-
- /**
- * Set the unique identifier of the resource
- *
- * @param text
- * Value to set
- */
- public void setIdentifier(String text) {
- addProperty(createTextType ( IDENTIFIER, text));
- }
-
- /**
- * Set the unique identifier of the resource
- *
- * @param text
- * Property to set
- */
- public void setIdentifierProperty(TextType text) {
- addProperty(text);
- }
-
- /**
- * Add language(s) used in this resource
- *
- * @param locale
- * Value to set
- */
- public void addLanguage(String locale) {
- addQualifiedBagValue(LANGUAGE, locale);
- }
-
- public void removeLanguage (String locale) {
- removeUnqualifiedBagValue(LANGUAGE, locale);
- }
-
- /**
- * add publisher(s)
- *
- * @param properName
- * Value to add
- */
- public void addPublisher(String properName) {
- addQualifiedBagValue(PUBLISHER, properName);
- }
-
- public void removePublisher (String name) {
- removeUnqualifiedBagValue(PUBLISHER, name);
- }
-
- /**
- * Add relationships to other documents
- *
- * @param text
- * Value to set
- */
- public void addRelation(String text) {
- addQualifiedBagValue(RELATION, text);
- }
-
- public void removeRelation (String text) {
- removeUnqualifiedBagValue (RELATION, text);
- }
-
- /**
- * add informal rights statement, by language.
- *
- * @param lang
- * Language concerned
- * @param value
- * Value to set
- */
- public void addRights(String lang, String value) {
- setUnqualifiedLanguagePropertyValue(RIGHTS, lang, value);
- }
+ /**
+ * Set the unique identifier of the resource
+ *
+ * @param text
+ * Value to set
+ */
+ public void setIdentifier(String text)
+ {
+ addProperty(createTextType(IDENTIFIER, text));
+ }
+
+ /**
+ * Set the unique identifier of the resource
+ *
+ * @param text
+ * Property to set
+ */
+ public void setIdentifierProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ /**
+ * Add language(s) used in this resource
+ *
+ * @param locale
+ * Value to set
+ */
+ public void addLanguage(String locale)
+ {
+ addQualifiedBagValue(LANGUAGE, locale);
+ }
+
+ public void removeLanguage(String locale)
+ {
+ removeUnqualifiedBagValue(LANGUAGE, locale);
+ }
+
+ /**
+ * add publisher(s)
+ *
+ * @param properName
+ * Value to add
+ */
+ public void addPublisher(String properName)
+ {
+ addQualifiedBagValue(PUBLISHER, properName);
+ }
+
+ public void removePublisher(String name)
+ {
+ removeUnqualifiedBagValue(PUBLISHER, name);
+ }
+
+ /**
+ * Add relationships to other documents
+ *
+ * @param text
+ * Value to set
+ */
+ public void addRelation(String text)
+ {
+ addQualifiedBagValue(RELATION, text);
+ }
+
+ public void removeRelation(String text)
+ {
+ removeUnqualifiedBagValue(RELATION, text);
+ }
+
+ /**
+ * add informal rights statement, by language.
+ *
+ * @param lang
+ * Language concerned
+ * @param value
+ * Value to set
+ */
+ public void addRights(String lang, String value)
+ {
+ setUnqualifiedLanguagePropertyValue(RIGHTS, lang, value);
+ }
/**
* Convenience method for signature compatibility with jempbox
- *
+ *
* @see DublinCoreSchema#addRights(String, String)
*/
- @Deprecated
- public void setRights( String language, String rights )
+ @Deprecated
+ public void setRights(String language, String rights)
{
- addRights(language, rights );
+ addRights(language, rights);
}
/**
- * Convenience method for signature compatibility with jempbox.
- * Add default rights
- *
+ * Convenience method for signature compatibility with jempbox. Add default rights
+ *
* @see DublinCoreSchema#addRights(String, String)
*/
- @Deprecated
- public void setRights( String rights )
+ @Deprecated
+ public void setRights(String rights)
+ {
+ addRights(null, rights);
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Value to set
+ */
+ public void setSource(String text)
+ {
+ addProperty(createTextType(SOURCE, text));
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Property to set
+ */
+ public void setSourceProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Property to set
+ */
+ public void setFormatProperty(MIMEType text)
+ {
+ addProperty(text);
+ }
+
+ /**
+ * add descriptive phrases or keywords that specify the topic of the content of the resource
+ *
+ * @param text
+ * Value to add
+ */
+ public void addSubject(String text)
+ {
+ addQualifiedBagValue(SUBJECT, text);
+ }
+
+ public void removeSubject(String text)
+ {
+ removeUnqualifiedBagValue(SUBJECT, text);
+ }
+
+ /**
+ * set the title of the document, or the name given to the resource (by language)
+ *
+ * @param lang
+ * Language concerned
+ * @param value
+ * Value to set
+ */
+ public void setTitle(String lang, String value)
+ {
+ setUnqualifiedLanguagePropertyValue(TITLE, lang, value);
+ }
+
+ /**
+ * set default title
+ *
+ * @param lang
+ * @param value
+ */
+ public void setTitle(String value)
+ {
+ setTitle(null, value);
+ }
+
+ /**
+ * set the title of the document, or the name given to the resource (by language)
+ *
+ * @see DublinCoreSchema#setTitle(String)
+ *
+ */
+ public void addTitle(String lang, String value)
+ {
+ setTitle(lang, value);
+ }
+
+ /**
+ * set the document type (novel, poem, ...)
+ *
+ * @param type
+ * Value to set
+ */
+ public void addType(String type)
+ {
+ addQualifiedBagValue(TYPE, type);
+ }
+
+ /**
+ * Return the Bag of contributor(s)
+ *
+ * @return Contributor property
+ */
+ public ArrayProperty getContributorsProperty()
+ {
+ return (ArrayProperty) getProperty(CONTRIBUTOR);
+ }
+
+ /**
+ * Return a String list of contributor(s)
+ *
+ * @return List of contributors values
+ */
+ public List<String> getContributors()
+ {
+ return getUnqualifiedBagValueList(CONTRIBUTOR);
+
+ }
+
+ /**
+ * Return the Coverage TextType Property
+ *
+ * @return Coverage property
+ */
+ public TextType getCoverageProperty()
+ {
+ return (TextType) getProperty(COVERAGE);
+ }
+
+ /**
+ * Return the value of the coverage
+ *
+ * @return Coverage value
+ */
+ public String getCoverage()
+ {
+ TextType tt = (TextType) getProperty(COVERAGE);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the Sequence of contributor(s)
+ *
+ * @return Creator property
+ */
+ public ArrayProperty getCreatorsProperty()
+ {
+ return (ArrayProperty) getProperty(CREATOR);
+ }
+
+ /**
+ * Return the creator(s) string value
+ *
+ * @return List of creators values
+ */
+ public List<String> getCreators()
+ {
+ return getUnqualifiedSequenceValueList(CREATOR);
+ }
+
+ /**
+ * Return the sequence of date(s)
+ *
+ * @return date property
+ */
+ public ArrayProperty getDatesProperty()
+ {
+ return (ArrayProperty) getProperty(DATE);
+ }
+
+ /**
+ * Return a calendar list of date
+ *
+ * @return List of dates values
+ */
+ public List<Calendar> getDates()
{
- addRights(null, rights );
+ return getUnqualifiedSequenceDateValueList(DATE);
+ }
+
+ /**
+ * Return the Lang alt Description
+ *
+ * @return Description property
+ */
+ public ArrayProperty getDescriptionProperty()
+ {
+ return (ArrayProperty) getProperty(DESCRIPTION);
+ }
+
+ /**
+ * Return a list of languages defined in description property
+ *
+ * @return get List of languages defined for description property
+ */
+ public List<String> getDescriptionLanguages()
+ {
+ return getUnqualifiedLanguagePropertyLanguagesValue(DESCRIPTION);
+ }
+
+ /**
+ * Return a language value for description property
+ *
+ * @param lang
+ * The language wanted
+ * @return Desription value for specified language
+ */
+ public String getDescription(String lang)
+ {
+ return getUnqualifiedLanguagePropertyValue(DESCRIPTION, lang);
}
-
- /**
- * Set the unique identifer of the work from which this resource was derived
- *
- * @param text
- * Value to set
- */
- public void setSource(String text) {
- addProperty(createTextType ( SOURCE, text));
- }
-
- /**
- * Set the unique identifer of the work from which this resource was derived
- *
- * @param text
- * Property to set
- */
- public void setSourceProperty(TextType text) {
- addProperty(text);
- }
-
- /**
- * Set the unique identifer of the work from which this resource was derived
- *
- * @param text
- * Property to set
- */
- public void setFormatProperty(MIMEType text) {
- addProperty(text);
- }
-
- /**
- * add descriptive phrases or keywords that specify the topic of the content
- * of the resource
- *
- * @param text
- * Value to add
- */
- public void addSubject(String text) {
- addQualifiedBagValue(SUBJECT, text);
- }
-
- public void removeSubject (String text) {
- removeUnqualifiedBagValue(SUBJECT, text);
- }
-
- /**
- * set the title of the document, or the name given to the resource (by
- * language)
- *
- * @param lang
- * Language concerned
- * @param value
- * Value to set
- */
- public void setTitle(String lang, String value) {
- setUnqualifiedLanguagePropertyValue(TITLE, lang, value);
- }
-
- /**
- * set default title
- * @param lang
- * @param value
- */
- public void setTitle(String value) {
- setTitle(null, value);
- }
-
- /**
- * set the title of the document, or the name given to the resource (by
- * language)
- *
- * @see DublinCoreSchema#setTitle(String)
- *
- */
- public void addTitle(String lang, String value) {
- setTitle(lang,value);
- }
-
- /**
- * set the document type (novel, poem, ...)
- *
- * @param type
- * Value to set
- */
- public void addType(String type) {
- addQualifiedBagValue(TYPE, type);
- }
-
- /**
- * Return the Bag of contributor(s)
- *
- * @return Contributor property
- */
- public ArrayProperty getContributorsProperty() {
- return (ArrayProperty) getProperty(CONTRIBUTOR);
- }
-
- /**
- * Return a String list of contributor(s)
- *
- * @return List of contributors values
- */
- public List<String> getContributors() {
- return getUnqualifiedBagValueList(CONTRIBUTOR);
-
- }
-
- /**
- * Return the Coverage TextType Property
- *
- * @return Coverage property
- */
- public TextType getCoverageProperty() {
- return (TextType) getProperty(COVERAGE);
- }
-
- /**
- * Return the value of the coverage
- *
- * @return Coverage value
- */
- public String getCoverage() {
- TextType tt = (TextType) getProperty(COVERAGE);
- return tt == null ? null : tt.getStringValue();
- }
-
- /**
- * Return the Sequence of contributor(s)
- *
- * @return Creator property
- */
- public ArrayProperty getCreatorsProperty() {
- return (ArrayProperty) getProperty(CREATOR);
- }
-
- /**
- * Return the creator(s) string value
- *
- * @return List of creators values
- */
- public List<String> getCreators() {
- return getUnqualifiedSequenceValueList(CREATOR);
- }
-
- /**
- * Return the sequence of date(s)
- *
- * @return date property
- */
- public ArrayProperty getDatesProperty() {
- return (ArrayProperty) getProperty(DATE);
- }
-
- /**
- * Return a calendar list of date
- *
- * @return List of dates values
- */
- public List<Calendar> getDates() {
- return getUnqualifiedSequenceDateValueList(DATE);
- }
-
- /**
- * Return the Lang alt Description
- *
- * @return Description property
- */
- public ArrayProperty getDescriptionProperty() {
- return (ArrayProperty) getProperty(DESCRIPTION);
- }
-
- /**
- * Return a list of languages defined in description property
- *
- * @return get List of languages defined for description property
- */
- public List<String> getDescriptionLanguages() {
- return getUnqualifiedLanguagePropertyLanguagesValue(DESCRIPTION);
- }
-
- /**
- * Return a language value for description property
- *
- * @param lang
- * The language wanted
- * @return Desription value for specified language
- */
- public String getDescription(String lang) {
- return getUnqualifiedLanguagePropertyValue(DESCRIPTION, lang);
- }
-
/**
* Get the default value for the description.
- *
+ *
* @return The description of this resource.
*/
public String getDescription()
{
- return getDescription( null );
+ return getDescription(null);
+ }
+
+ /**
+ * Return the file format property
+ *
+ * @return the format property
+ */
+ public TextType getFormatProperty()
+ {
+ return (TextType) getProperty(FORMAT);
+ }
+
+ /**
+ * return the file format value
+ *
+ * @return the format value
+ */
+ public String getFormat()
+ {
+ TextType tt = (TextType) getProperty(FORMAT);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the unique identifier property of this resource
+ *
+ * @return the identifier property
+ */
+ public TextType getIdentifierProperty()
+ {
+ return (TextType) getProperty(IDENTIFIER);
+ }
+
+ /**
+ * return the unique identifier value of this resource
+ *
+ * @return the unique identifier value
+ */
+ public String getIdentifier()
+ {
+ TextType tt = (TextType) getProperty(IDENTIFIER);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the bag DC language
+ *
+ * @return language property
+ */
+ public ArrayProperty getLanguagesProperty()
+ {
+ return (ArrayProperty) getProperty(LANGUAGE);
}
-
+ /**
+ * Return the list of values defined in the DC language
+ *
+ * @return list of languages defined for language property
+ */
+ public List<String> getLanguages()
+ {
+ return getUnqualifiedBagValueList(LANGUAGE);
+ }
- /**
- * Return the file format property
- *
- * @return the format property
- */
- public TextType getFormatProperty() {
- return (TextType) getProperty(FORMAT);
- }
-
- /**
- * return the file format value
- *
- * @return the format value
- */
- public String getFormat() {
- TextType tt = (TextType) getProperty(FORMAT);
- return tt == null ? null : tt.getStringValue();
- }
-
- /**
- * Return the unique identifier property of this resource
- *
- * @return the identifier property
- */
- public TextType getIdentifierProperty() {
- return (TextType) getProperty(IDENTIFIER);
- }
-
- /**
- * return the unique identifier value of this resource
- *
- * @return the unique identifier value
- */
- public String getIdentifier() {
- TextType tt = (TextType) getProperty(IDENTIFIER);
- return tt == null ? null : tt.getStringValue();
- }
-
- /**
- * Return the bag DC language
- *
- * @return language property
- */
- public ArrayProperty getLanguagesProperty() {
- return (ArrayProperty) getProperty(LANGUAGE);
- }
-
- /**
- * Return the list of values defined in the DC language
- *
- * @return list of languages defined for language property
- */
- public List<String> getLanguages() {
- return getUnqualifiedBagValueList(LANGUAGE);
- }
-
- /**
- * Return the bag DC publisher
- *
- * @return publisher property
- */
- public ArrayProperty getPublishersProperty() {
- return (ArrayProperty) getProperty(PUBLISHER);
- }
-
- /**
- * Return the list of values defined in the DC publisher
- *
- * @return list of values for publisher property
- */
- public List<String> getPublishers() {
- return getUnqualifiedBagValueList(PUBLISHER);
- }
-
- /**
- * Return the bag DC relation
- *
- * @return relation property
- */
- public ArrayProperty getRelationsProperty() {
- return (ArrayProperty) getProperty(RELATION);
- }
-
- /**
- * Return the list of values defined in the DC relation
- *
- * @return list of values for relation property
- */
- public List<String> getRelations() {
- return getUnqualifiedBagValueList(RELATION);
- }
-
- /**
- * Convenience method for signature compatibility with jempbox
- *
- * @see DublinCoreSchema#getRelations()
- */
- @Deprecated
- public List<String> getRelationships() {
- return getRelations();
- }
-
- /**
- * Return the Lang alt Rights
- *
- * @return rights property
- */
- public ArrayProperty getRightsProperty() {
- return (ArrayProperty) getProperty(RIGHTS);
- }
-
- /**
- * Return a list of languages defined in Right property
- *
- * @return list of rights languages values defined
- */
- public List<String> getRightsLanguages() {
- return getUnqualifiedLanguagePropertyLanguagesValue(RIGHTS);
- }
-
- /**
- * Return a language value for Right property
- *
- * @param lang
- * language concerned
- * @return the rights value for specified language
- */
- public String getRights(String lang) {
- return getUnqualifiedLanguagePropertyValue(RIGHTS, lang);
- }
-
- /**
- * Return the default value for Right property
- *
- * @see DublinCoreSchema#getRights(String)
- */
- public String getRights() {
- return getRights(null);
- }
-
-
- /**
- * Return the source property of this resource
- *
- * @return source property
- */
- public TextType getSourceProperty() {
- return (TextType) getProperty(SOURCE);
- }
-
- /**
- * return the source value of this resource
- *
- * @return value of source property
- */
- public String getSource() {
- TextType tt = (TextType) getProperty(SOURCE);
- return tt == null ? null : tt.getStringValue();
- }
-
- /**
- * Return the bag DC Subject
- *
+ /**
+ * Return the bag DC publisher
+ *
+ * @return publisher property
+ */
+ public ArrayProperty getPublishersProperty()
+ {
+ return (ArrayProperty) getProperty(PUBLISHER);
+ }
+
+ /**
+ * Return the list of values defined in the DC publisher
+ *
+ * @return list of values for publisher property
+ */
+ public List<String> getPublishers()
+ {
+ return getUnqualifiedBagValueList(PUBLISHER);
+ }
+
+ /**
+ * Return the bag DC relation
+ *
+ * @return relation property
+ */
+ public ArrayProperty getRelationsProperty()
+ {
+ return (ArrayProperty) getProperty(RELATION);
+ }
+
+ /**
+ * Return the list of values defined in the DC relation
+ *
+ * @return list of values for relation property
+ */
+ public List<String> getRelations()
+ {
+ return getUnqualifiedBagValueList(RELATION);
+ }
+
+ /**
+ * Convenience method for signature compatibility with jempbox
+ *
+ * @see DublinCoreSchema#getRelations()
+ */
+ @Deprecated
+ public List<String> getRelationships()
+ {
+ return getRelations();
+ }
+
+ /**
+ * Return the Lang alt Rights
+ *
+ * @return rights property
+ */
+ public ArrayProperty getRightsProperty()
+ {
+ return (ArrayProperty) getProperty(RIGHTS);
+ }
+
+ /**
+ * Return a list of languages defined in Right property
+ *
+ * @return list of rights languages values defined
+ */
+ public List<String> getRightsLanguages()
+ {
+ return getUnqualifiedLanguagePropertyLanguagesValue(RIGHTS);
+ }
+
+ /**
+ * Return a language value for Right property
+ *
+ * @param lang
+ * language concerned
+ * @return the rights value for specified language
+ */
+ public String getRights(String lang)
+ {
+ return getUnqualifiedLanguagePropertyValue(RIGHTS, lang);
+ }
+
+ /**
+ * Return the default value for Right property
+ *
+ * @see DublinCoreSchema#getRights(String)
+ */
+ public String getRights()
+ {
+ return getRights(null);
+ }
+
+ /**
+ * Return the source property of this resource
+ *
+ * @return source property
+ */
+ public TextType getSourceProperty()
+ {
+ return (TextType) getProperty(SOURCE);
+ }
+
+ /**
+ * return the source value of this resource
+ *
+ * @return value of source property
+ */
+ public String getSource()
+ {
+ TextType tt = (TextType) getProperty(SOURCE);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the bag DC Subject
+ *
* @return the subject property
- */
- public ArrayProperty getSubjectsProperty() {
- return (ArrayProperty) getProperty(SUBJECT);
- }
-
- /**
- * Return the list of values defined in the DC Subject
- *
- * @return the list of subject values
- */
- public List<String> getSubjects() {
- return getUnqualifiedBagValueList(SUBJECT);
- }
-
- /**
- * Return the Lang alt Title
- *
- * @return the title property
- */
- public ArrayProperty getTitleProperty() {
- return (ArrayProperty) getProperty(TITLE);
- }
-
- /**
- * Return a list of languages defined in Title property
- *
- * @return list of languages defined for title property
- */
- public List<String> getTitleLanguages() {
- return getUnqualifiedLanguagePropertyLanguagesValue(TITLE);
- }
-
- /**
- * Return a language value for Title property
- *
- * @param lang
- * the language concerned
- * @return the title value for specified language
- */
- public String getTitle(String lang) {
- return getUnqualifiedLanguagePropertyValue(TITLE, lang);
- }
-
- /**
- * Get the default value for the title.
- *
- * @return The default title of this resource.
- */
- public String getTitle()
- {
- return getTitle( null );
- }
-
-
- /**
- * Return the bag DC Type
- *
- * @return the type property
- */
- public ArrayProperty getTypesProperty() {
- return (ArrayProperty) getProperty(TYPE);
- }
-
- /**
- * Return the list of values defined in the DC Type
- *
- * @return the value of type property
- */
- public List<String> getTypes() {
- return getUnqualifiedBagValueList(TYPE);
- }
-
- public void removeType (String type) {
- removeUnqualifiedBagValue(TYPE, type);
- }
+ */
+ public ArrayProperty getSubjectsProperty()
+ {
+ return (ArrayProperty) getProperty(SUBJECT);
+ }
+
+ /**
+ * Return the list of values defined in the DC Subject
+ *
+ * @return the list of subject values
+ */
+ public List<String> getSubjects()
+ {
+ return getUnqualifiedBagValueList(SUBJECT);
+ }
+
+ /**
+ * Return the Lang alt Title
+ *
+ * @return the title property
+ */
+ public ArrayProperty getTitleProperty()
+ {
+ return (ArrayProperty) getProperty(TITLE);
+ }
+
+ /**
+ * Return a list of languages defined in Title property
+ *
+ * @return list of languages defined for title property
+ */
+ public List<String> getTitleLanguages()
+ {
+ return getUnqualifiedLanguagePropertyLanguagesValue(TITLE);
+ }
+
+ /**
+ * Return a language value for Title property
+ *
+ * @param lang
+ * the language concerned
+ * @return the title value for specified language
+ */
+ public String getTitle(String lang)
+ {
+ return getUnqualifiedLanguagePropertyValue(TITLE, lang);
+ }
+
+ /**
+ * Get the default value for the title.
+ *
+ * @return The default title of this resource.
+ */
+ public String getTitle()
+ {
+ return getTitle(null);
+ }
+
+ /**
+ * Return the bag DC Type
+ *
+ * @return the type property
+ */
+ public ArrayProperty getTypesProperty()
+ {
+ return (ArrayProperty) getProperty(TYPE);
+ }
+
+ /**
+ * Return the list of values defined in the DC Type
+ *
+ * @return the value of type property
+ */
+ public List<String> getTypes()
+ {
+ return getUnqualifiedBagValueList(TYPE);
+ }
+
+ public void removeType(String type)
+ {
+ removeUnqualifiedBagValue(TYPE, type);
+ }
}
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAExtensionSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAExtensionSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAExtensionSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAExtensionSchema.java Wed Mar 6 15:57:44 2013
@@ -26,7 +26,6 @@ import org.apache.xmpbox.type.ArrayPrope
import org.apache.xmpbox.type.Cardinality;
import org.apache.xmpbox.type.PropertyType;
import org.apache.xmpbox.type.StructuredType;
-import org.apache.xmpbox.type.TypeMapping;
import org.apache.xmpbox.type.Types;
/**
@@ -35,36 +34,36 @@ import org.apache.xmpbox.type.Types;
* @author a183132
*
*/
-@StructuredType(preferedPrefix="pdfaExtension",namespace="http://www.aiim.org/pdfa/ns/extension/")
-public class PDFAExtensionSchema extends XMPSchema {
+@StructuredType(preferedPrefix = "pdfaExtension", namespace = "http://www.aiim.org/pdfa/ns/extension/")
+public class PDFAExtensionSchema extends XMPSchema
+{
@PropertyType(type = Types.PDFASchema, card = Cardinality.Bag)
public static final String SCHEMAS = "schemas";
-
-
/**
* Build a new PDFExtension schema
*
* @param metadata
* The metadata to attach this schema XMPMetadata
*/
- public PDFAExtensionSchema(XMPMetadata metadata) {
+ public PDFAExtensionSchema(XMPMetadata metadata)
+ {
super(metadata);
}
- public PDFAExtensionSchema(XMPMetadata metadata, String prefix) {
+ public PDFAExtensionSchema(XMPMetadata metadata, String prefix)
+ {
super(metadata, prefix);
}
-
- /**
- *
- * @return the list of subject values
- */
- public ArrayProperty getSchemasProperty() {
- return (ArrayProperty) getProperty(SCHEMAS);
- }
-
+ /**
+ *
+ * @return the list of subject values
+ */
+ public ArrayProperty getSchemasProperty()
+ {
+ return (ArrayProperty) getProperty(SCHEMAS);
+ }
}
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java Wed Mar 6 15:57:44 2013
@@ -32,254 +32,294 @@ import org.apache.xmpbox.type.Structured
import org.apache.xmpbox.type.TextType;
import org.apache.xmpbox.type.Types;
-
/**
* Representation of PDF/A Identification Schema
*
* @author a183132
*
*/
-@StructuredType(preferedPrefix="pdfaid",namespace="http://www.aiim.org/pdfa/ns/id/")
-public class PDFAIdentificationSchema extends XMPSchema {
-
- @PropertyType(type = Types.Integer, card = Cardinality.Simple)
- public static final String PART = "part";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String AMD = "amd";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String CONFORMANCE = "conformance";
-
- /*
- * <rdf:Description rdf:about=""
- * xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
- * <pdfaid:conformance>B</pdfaid:conformance> <pdfaid:part>1</pdfaid:part>
- * </rdf:Description>
- */
-
- /**
- * Constructor of a PDF/A Identification schema
- *
- * @param metadata
- * The metadata to attach this schema
- */
- public PDFAIdentificationSchema(XMPMetadata metadata) {
- super(metadata);
- }
-
- public PDFAIdentificationSchema(XMPMetadata metadata, String prefix) {
- super(metadata, prefix);
- }
-
- /**
- * Set the PDFA Version identifier (with string)
- *
- * @param value
- * The version Id value to set
- *
- */
- public void setPartValueWithString(String value) {
- IntegerType part = (IntegerType)instanciateSimple(PART, value);
- addProperty(part);
- }
-
- /**
- * Set the PDFA Version identifier (with an int)
- *
- * @param value
- * The version Id value to set
- */
- public void setPartValueWithInt(int value) {
- IntegerType part = (IntegerType)instanciateSimple(PART, value);
- addProperty(part);
- }
-
- /**
- * Set the PDF/A Version identifier (with an int)
- *
- * @param value
- * The version Id property to set
- */
- public void setPart(Integer value) {
- setPartValueWithInt(value.intValue());
- }
-
- /**
- * Set the PDF/A Version identifier
- *
- * @param part
- * set the PDF/A Version id property
- */
- public void setPartProperty(IntegerType part) {
- addProperty(part);
- }
-
- /**
- * Set the PDF/A amendment identifier
- *
- * @param value
- * The amendment identifier value to set
- */
- public void setAmd(String value) {
- TextType amd = createTextType ( AMD, value);
- addProperty(amd);
- }
-
- /**
- * Set the PDF/A amendment identifier
- *
- * @param amd
- * The amendment identifier property to set
- */
- public void setAmdProperty(TextType amd) {
- addProperty(amd);
- }
-
- /**
- * Set the PDF/A conformance level
- *
- * @param value
- * The conformance level value to set
- * @throws BadFieldValueException
- * If Conformance Value not 'A' or 'B'
- */
- public void setConformance(String value) throws BadFieldValueException {
- if (value.equals("A") || value.equals("B")) {
- TextType conf = createTextType ( CONFORMANCE, value);
- addProperty(conf);
-
- } else {
- throw new BadFieldValueException(
- "The property given not seems to be a PDF/A conformance level (must be A or B)");
- }
- }
-
- /**
- * Set the PDF/A conformance level
- *
- * @param conf
- * The conformance level property to set
- * @throws BadFieldValueException
- * If Conformance Value not 'A' or 'B'
- */
- public void setConformanceProperty(TextType conf) throws BadFieldValueException {
- String value = conf.getStringValue();
- if (value.equals("A") || value.equals("B")) {
- addProperty(conf);
- } else {
- throw new BadFieldValueException(
- "The property given not seems to be a PDF/A conformance level (must be A or B)");
- }
- }
-
- /**
- * Give the PDFAVersionId (as an integer)
- *
- * @return Part value (Integer)
- */
- public Integer getPart() {
- AbstractField tmp = getPartProperty();
- if (tmp instanceof IntegerType) {
- return ((IntegerType) tmp).getValue();
- } else {
- for (Attribute attribute : getAllAttributes()) {
- if (attribute.getName().equals(PART)) {
- return Integer.valueOf(attribute.getValue());
- }
- }
- return null;
- }
- }
-
- /**
- * Give the property corresponding to the PDFA Version id
- *
- * @return Part property
- */
- public IntegerType getPartProperty() {
- AbstractField tmp = getProperty(PART);
- if (tmp instanceof IntegerType) {
- return (IntegerType) tmp;
- }
- return null;
- }
-
- /**
- * Give the PDFAAmendmentId (as an String)
- *
- * @return Amendment value
- */
- public String getAmendment() {
- AbstractField tmp = getProperty(AMD);
- if (tmp instanceof TextType) {
- return ((TextType) tmp).getStringValue();
- }
- return null;
- }
-
- /**
- * Give the property corresponding to the PDFA Amendment id
- *
- * @return Amendment property
- */
- public TextType getAmdProperty() {
- AbstractField tmp = getProperty(AMD);
- if (tmp instanceof TextType) {
- return (TextType) tmp;
- }
- return null;
- }
-
- /**
- * Give the PDFA Amendment Id (as an String)
- *
- * @return Amendment Value
- */
- public String getAmd() {
- TextType tmp = getAmdProperty();
- if (tmp==null) {
- for (Attribute attribute : getAllAttributes()) {
- if (attribute.getName().equals(AMD)) {
- return attribute.getValue();
- }
- }
- return null;
- } else {
- return tmp.getStringValue();
- }
- }
-
- /**
- * Give the property corresponding to the PDFA Conformance id
- *
- * @return conformance property
- */
- public TextType getConformanceProperty() {
- AbstractField tmp = getProperty(CONFORMANCE);
- if (tmp instanceof TextType) {
- return (TextType) tmp;
- }
- return null;
- }
-
- /**
- * Give the Conformance id
- *
- * @return conformance id value
- */
- public String getConformance() {
- TextType tt = getConformanceProperty();
- if (tt==null) {
- for (Attribute attribute : getAllAttributes()) {
- if (attribute.getName().equals(CONFORMANCE)) {
- return attribute.getValue();
- }
- }
- return null;
- } else {
- return tt.getStringValue();
- }
- }
+@StructuredType(preferedPrefix = "pdfaid", namespace = "http://www.aiim.org/pdfa/ns/id/")
+public class PDFAIdentificationSchema extends XMPSchema
+{
+
+ @PropertyType(type = Types.Integer, card = Cardinality.Simple)
+ public static final String PART = "part";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String AMD = "amd";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String CONFORMANCE = "conformance";
+
+ /*
+ * <rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
+ * <pdfaid:conformance>B</pdfaid:conformance> <pdfaid:part>1</pdfaid:part> </rdf:Description>
+ */
+
+ /**
+ * Constructor of a PDF/A Identification schema
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public PDFAIdentificationSchema(XMPMetadata metadata)
+ {
+ super(metadata);
+ }
+
+ public PDFAIdentificationSchema(XMPMetadata metadata, String prefix)
+ {
+ super(metadata, prefix);
+ }
+
+ /**
+ * Set the PDFA Version identifier (with string)
+ *
+ * @param value
+ * The version Id value to set
+ *
+ */
+ public void setPartValueWithString(String value)
+ {
+ IntegerType part = (IntegerType) instanciateSimple(PART, value);
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDFA Version identifier (with an int)
+ *
+ * @param value
+ * The version Id value to set
+ */
+ public void setPartValueWithInt(int value)
+ {
+ IntegerType part = (IntegerType) instanciateSimple(PART, value);
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDF/A Version identifier (with an int)
+ *
+ * @param value
+ * The version Id property to set
+ */
+ public void setPart(Integer value)
+ {
+ setPartValueWithInt(value.intValue());
+ }
+
+ /**
+ * Set the PDF/A Version identifier
+ *
+ * @param part
+ * set the PDF/A Version id property
+ */
+ public void setPartProperty(IntegerType part)
+ {
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDF/A amendment identifier
+ *
+ * @param value
+ * The amendment identifier value to set
+ */
+ public void setAmd(String value)
+ {
+ TextType amd = createTextType(AMD, value);
+ addProperty(amd);
+ }
+
+ /**
+ * Set the PDF/A amendment identifier
+ *
+ * @param amd
+ * The amendment identifier property to set
+ */
+ public void setAmdProperty(TextType amd)
+ {
+ addProperty(amd);
+ }
+
+ /**
+ * Set the PDF/A conformance level
+ *
+ * @param value
+ * The conformance level value to set
+ * @throws BadFieldValueException
+ * If Conformance Value not 'A' or 'B'
+ */
+ public void setConformance(String value) throws BadFieldValueException
+ {
+ if (value.equals("A") || value.equals("B"))
+ {
+ TextType conf = createTextType(CONFORMANCE, value);
+ addProperty(conf);
+
+ }
+ else
+ {
+ throw new BadFieldValueException(
+ "The property given not seems to be a PDF/A conformance level (must be A or B)");
+ }
+ }
+
+ /**
+ * Set the PDF/A conformance level
+ *
+ * @param conf
+ * The conformance level property to set
+ * @throws BadFieldValueException
+ * If Conformance Value not 'A' or 'B'
+ */
+ public void setConformanceProperty(TextType conf) throws BadFieldValueException
+ {
+ String value = conf.getStringValue();
+ if (value.equals("A") || value.equals("B"))
+ {
+ addProperty(conf);
+ }
+ else
+ {
+ throw new BadFieldValueException(
+ "The property given not seems to be a PDF/A conformance level (must be A or B)");
+ }
+ }
+
+ /**
+ * Give the PDFAVersionId (as an integer)
+ *
+ * @return Part value (Integer)
+ */
+ public Integer getPart()
+ {
+ AbstractField tmp = getPartProperty();
+ if (tmp instanceof IntegerType)
+ {
+ return ((IntegerType) tmp).getValue();
+ }
+ else
+ {
+ for (Attribute attribute : getAllAttributes())
+ {
+ if (attribute.getName().equals(PART))
+ {
+ return Integer.valueOf(attribute.getValue());
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Version id
+ *
+ * @return Part property
+ */
+ public IntegerType getPartProperty()
+ {
+ AbstractField tmp = getProperty(PART);
+ if (tmp instanceof IntegerType)
+ {
+ return (IntegerType) tmp;
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFAAmendmentId (as an String)
+ *
+ * @return Amendment value
+ */
+ public String getAmendment()
+ {
+ AbstractField tmp = getProperty(AMD);
+ if (tmp instanceof TextType)
+ {
+ return ((TextType) tmp).getStringValue();
+ }
+ return null;
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Amendment id
+ *
+ * @return Amendment property
+ */
+ public TextType getAmdProperty()
+ {
+ AbstractField tmp = getProperty(AMD);
+ if (tmp instanceof TextType)
+ {
+ return (TextType) tmp;
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFA Amendment Id (as an String)
+ *
+ * @return Amendment Value
+ */
+ public String getAmd()
+ {
+ TextType tmp = getAmdProperty();
+ if (tmp == null)
+ {
+ for (Attribute attribute : getAllAttributes())
+ {
+ if (attribute.getName().equals(AMD))
+ {
+ return attribute.getValue();
+ }
+ }
+ return null;
+ }
+ else
+ {
+ return tmp.getStringValue();
+ }
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Conformance id
+ *
+ * @return conformance property
+ */
+ public TextType getConformanceProperty()
+ {
+ AbstractField tmp = getProperty(CONFORMANCE);
+ if (tmp instanceof TextType)
+ {
+ return (TextType) tmp;
+ }
+ return null;
+ }
+
+ /**
+ * Give the Conformance id
+ *
+ * @return conformance id value
+ */
+ public String getConformance()
+ {
+ TextType tt = getConformanceProperty();
+ if (tt == null)
+ {
+ for (Attribute attribute : getAllAttributes())
+ {
+ if (attribute.getName().equals(CONFORMANCE))
+ {
+ return attribute.getValue();
+ }
+ }
+ return null;
+ }
+ else
+ {
+ return tt.getStringValue();
+ }
+ }
}
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PhotoshopSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PhotoshopSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PhotoshopSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/PhotoshopSchema.java Wed Mar 6 15:57:44 2013
@@ -36,473 +36,556 @@ import org.apache.xmpbox.type.ProperName
import org.apache.xmpbox.type.PropertyType;
import org.apache.xmpbox.type.StructuredType;
import org.apache.xmpbox.type.TextType;
-import org.apache.xmpbox.type.TypeMapping;
import org.apache.xmpbox.type.Types;
import org.apache.xmpbox.type.URIType;
-@StructuredType(preferedPrefix="photoshop",namespace="http://ns.adobe.com/photoshop/1.0/")
-public class PhotoshopSchema extends XMPSchema {
+@StructuredType(preferedPrefix = "photoshop", namespace = "http://ns.adobe.com/photoshop/1.0/")
+public class PhotoshopSchema extends XMPSchema
+{
- public PhotoshopSchema(XMPMetadata metadata) {
- super(metadata);
- }
-
- public PhotoshopSchema(XMPMetadata metadata, String ownPrefix) {
- super(metadata, ownPrefix);
- }
-
- public static final String PREFERED_PREFIX = "photoshop";
-
- public static final String PHOTOSHOPURI = "http://ns.adobe.com/photoshop/1.0/";
-
- @PropertyType(type = Types.URI, card = Cardinality.Simple)
- public static final String ANCESTORID = "AncestorID";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String AUTHORS_POSITION = "AuthorsPosition";
-
- @PropertyType(type = Types.ProperName, card = Cardinality.Simple)
- public static final String CAPTION_WRITER = "CaptionWriter";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String CATEGORY = "Category";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String CITY = "City";
-
- @PropertyType(type = Types.Integer, card = Cardinality.Simple)
- public static final String COLOR_MODE = "ColorMode";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String COUNTRY = "Country";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String CREDIT = "Credit";
-
- @PropertyType(type = Types.Date, card = Cardinality.Simple)
- public static final String DATE_CREATED = "DateCreated";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String DOCUMENT_ANCESTORS = "DocumentAncestors";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String HEADLINE = "Headline";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String HISTORY = "History";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String ICC_PROFILE = "ICCProfile";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String INSTRUCTIONS = "Instructions";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String SOURCE = "Source";
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String STATE = "State";
-
- @PropertyType(type = Types.Text, card = Cardinality.Bag)
- public static final String SUPPLEMENTAL_CATEGORIES = "SupplementalCategories";
-
- @PropertyType(type = Types.Layer, card = Cardinality.Seq)
- public static final String TEXT_LAYERS = "TextLayers";
-
- private ArrayProperty seqLayer;
-
- @PropertyType(type = Types.Text, card = Cardinality.Simple)
- public static final String TRANSMISSION_REFERENCE = "TransmissionReference";
-
- @PropertyType(type = Types.Integer, card = Cardinality.Simple)
- public static final String URGENCY = "Urgency";
-
- public URIType getAncestorIDProperty() {
- return (URIType) getProperty(ANCESTORID);
- }
-
- public String getAncestorID() {
- TextType tt = ((TextType) getProperty(ANCESTORID));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setAncestorID(String text) {
- URIType tt = (URIType)instanciateSimple(ANCESTORID, text);
- setAncestorIDProperty(tt);
- }
-
- public void setAncestorIDProperty(URIType text) {
- addProperty(text);
- }
-
- public TextType getAuthorsPositionProperty() {
- return (TextType) getProperty(AUTHORS_POSITION);
- }
-
- public String getAuthorsPosition() {
- TextType tt = ((TextType) getProperty(AUTHORS_POSITION));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setAuthorsPosition(String text) {
- TextType tt = (TextType)instanciateSimple(AUTHORS_POSITION, text);
- setAuthorsPositionProperty(tt);
- }
-
- public void setAuthorsPositionProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getCaptionWriterProperty() {
- return (TextType) getProperty(CAPTION_WRITER);
- }
-
- public String getCaptionWriter() {
- TextType tt = ((TextType) getProperty(CAPTION_WRITER));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setCaptionWriter(String text) {
- ProperNameType tt = (ProperNameType)instanciateSimple(CAPTION_WRITER, text);
- setCaptionWriterProperty(tt);
- }
-
- public void setCaptionWriterProperty(ProperNameType text) {
- addProperty(text);
- }
-
- public TextType getCategoryProperty() {
- return (TextType) getProperty(CATEGORY);
- }
-
- public String getCategory() {
- TextType tt = ((TextType) getProperty(CATEGORY));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setCategory(String text) {
- TextType tt = (TextType)instanciateSimple(CATEGORY, text);
- setCategoryProperty(tt);
- }
-
- public void setCategoryProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getCityProperty() {
- return (TextType) getProperty(CITY);
- }
-
- public String getCity() {
- TextType tt = ((TextType) getProperty(CITY));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setCity(String text) {
- TextType tt= (TextType)instanciateSimple(CITY, text);
- setCityProperty(tt);
- }
-
- public void setCityProperty(TextType text) {
- addProperty(text);
- }
-
- public IntegerType getColorModeProperty() {
- return (IntegerType) getProperty(COLOR_MODE);
- }
-
- public Integer getColorMode() {
- IntegerType tt = ((IntegerType) getProperty(COLOR_MODE));
- return tt == null ? null : tt.getValue();
- }
-
- public void setColorMode(String text) {
- IntegerType tt = (IntegerType)instanciateSimple(COLOR_MODE, text);
- setColorModeProperty(tt);
- }
-
- public void setColorModeProperty(IntegerType text) {
- addProperty(text);
- }
-
- public TextType getCountryProperty() {
- return (TextType) getProperty(COUNTRY);
- }
-
- public String getCountry() {
- TextType tt = ((TextType) getProperty(COUNTRY));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setCountry(String text) {
- TextType tt = (TextType)instanciateSimple(COUNTRY, text);
- setCountryProperty(tt);
- }
-
- public void setCountryProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getCreditProperty() {
- return (TextType) getProperty(CREDIT);
- }
-
- public String getCredit() {
- TextType tt = ((TextType) getProperty(CREDIT));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setCredit(String text) {
- TextType tt = (TextType)instanciateSimple(CREDIT, text);
- setCreditProperty(tt);
- }
-
- public void setCreditProperty(TextType text) {
- addProperty(text);
- }
-
- public DateType getDateCreatedProperty() {
- return (DateType) getProperty(DATE_CREATED);
- }
-
- public String getDateCreated() {
- TextType tt = ((TextType) getProperty(DATE_CREATED));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setDateCreated(String text) {
- DateType tt = (DateType)instanciateSimple(DATE_CREATED, text);
- setDateCreatedProperty(tt);
- }
-
- public void setDateCreatedProperty(DateType text) {
- addProperty(text);
- }
-
- public void addDocumentAncestors(String text) {
- addQualifiedBagValue(DOCUMENT_ANCESTORS, text);
- }
-
- public ArrayProperty getDocumentAncestorsProperty() {
- return (ArrayProperty) getProperty(DOCUMENT_ANCESTORS);
- }
-
- public List<String> getDocumentAncestors() {
- return getUnqualifiedBagValueList(DOCUMENT_ANCESTORS);
- }
-
- public TextType getHeadlineProperty() {
- return (TextType) getProperty(HEADLINE);
- }
-
- public String getHeadline() {
- TextType tt = ((TextType) getProperty(HEADLINE));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setHeadline(String text) {
- TextType tt = (TextType) instanciateSimple(HEADLINE, text);
- setHeadlineProperty(tt);
- }
-
- public void setHeadlineProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getHistoryProperty() {
- return (TextType) getProperty(HISTORY);
- }
-
- public String getHistory() {
- TextType tt = ((TextType) getProperty(HISTORY));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setHistory(String text) {
- TextType tt= (TextType)instanciateSimple(HISTORY, text);
- setHistoryProperty(tt);
- }
-
- public void setHistoryProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getICCProfileProperty() {
- return (TextType) getProperty(ICC_PROFILE);
- }
-
- public String getICCProfile() {
- TextType tt = ((TextType) getProperty(ICC_PROFILE));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setICCProfile(String text) {
- TextType tt = (TextType)instanciateSimple(ICC_PROFILE, text);
- setICCProfileProperty(tt);
- }
-
- public void setICCProfileProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getInstructionsProperty() {
- return (TextType) getProperty(INSTRUCTIONS);
- }
-
- public String getInstructions() {
- TextType tt = ((TextType) getProperty(INSTRUCTIONS));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setInstructions(String text) {
- TextType tt = (TextType)instanciateSimple(INSTRUCTIONS, text);
- setInstructionsProperty(tt);
-
- }
-
- public void setInstructionsProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getSourceProperty() {
- return (TextType) getProperty(SOURCE);
- }
-
- public String getSource() {
- TextType tt = ((TextType) getProperty(SOURCE));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setSource(String text) {
- TextType source = (TextType)instanciateSimple(SOURCE, text);
- setSourceProperty(source);
- }
-
- public void setSourceProperty(TextType text) {
- addProperty(text);
- }
-
- public TextType getStateProperty() {
- return (TextType) getProperty(STATE);
- }
-
- public String getState() {
- TextType tt = ((TextType) getProperty(STATE));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setState(String text) {
- TextType tt = (TextType)instanciateSimple(STATE, text);
- setStateProperty(tt);
- }
-
- public void setStateProperty(TextType text) {
- addProperty(text);
- }
-
- public void addSupplementalCategories(String text) {
- addQualifiedBagValue(SUPPLEMENTAL_CATEGORIES, text);
- }
-
- public void removeSupplementalCategories(String text) {
- removeUnqualifiedBagValue(SUPPLEMENTAL_CATEGORIES, text);
- }
-
- /**
+ public PhotoshopSchema(XMPMetadata metadata)
+ {
+ super(metadata);
+ }
+
+ public PhotoshopSchema(XMPMetadata metadata, String ownPrefix)
+ {
+ super(metadata, ownPrefix);
+ }
+
+ public static final String PREFERED_PREFIX = "photoshop";
+
+ public static final String PHOTOSHOPURI = "http://ns.adobe.com/photoshop/1.0/";
+
+ @PropertyType(type = Types.URI, card = Cardinality.Simple)
+ public static final String ANCESTORID = "AncestorID";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String AUTHORS_POSITION = "AuthorsPosition";
+
+ @PropertyType(type = Types.ProperName, card = Cardinality.Simple)
+ public static final String CAPTION_WRITER = "CaptionWriter";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String CATEGORY = "Category";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String CITY = "City";
+
+ @PropertyType(type = Types.Integer, card = Cardinality.Simple)
+ public static final String COLOR_MODE = "ColorMode";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String COUNTRY = "Country";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String CREDIT = "Credit";
+
+ @PropertyType(type = Types.Date, card = Cardinality.Simple)
+ public static final String DATE_CREATED = "DateCreated";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String DOCUMENT_ANCESTORS = "DocumentAncestors";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String HEADLINE = "Headline";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String HISTORY = "History";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String ICC_PROFILE = "ICCProfile";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String INSTRUCTIONS = "Instructions";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String SOURCE = "Source";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String STATE = "State";
+
+ @PropertyType(type = Types.Text, card = Cardinality.Bag)
+ public static final String SUPPLEMENTAL_CATEGORIES = "SupplementalCategories";
+
+ @PropertyType(type = Types.Layer, card = Cardinality.Seq)
+ public static final String TEXT_LAYERS = "TextLayers";
+
+ private ArrayProperty seqLayer;
+
+ @PropertyType(type = Types.Text, card = Cardinality.Simple)
+ public static final String TRANSMISSION_REFERENCE = "TransmissionReference";
+
+ @PropertyType(type = Types.Integer, card = Cardinality.Simple)
+ public static final String URGENCY = "Urgency";
+
+ public URIType getAncestorIDProperty()
+ {
+ return (URIType) getProperty(ANCESTORID);
+ }
+
+ public String getAncestorID()
+ {
+ TextType tt = ((TextType) getProperty(ANCESTORID));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setAncestorID(String text)
+ {
+ URIType tt = (URIType) instanciateSimple(ANCESTORID, text);
+ setAncestorIDProperty(tt);
+ }
+
+ public void setAncestorIDProperty(URIType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getAuthorsPositionProperty()
+ {
+ return (TextType) getProperty(AUTHORS_POSITION);
+ }
+
+ public String getAuthorsPosition()
+ {
+ TextType tt = ((TextType) getProperty(AUTHORS_POSITION));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setAuthorsPosition(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(AUTHORS_POSITION, text);
+ setAuthorsPositionProperty(tt);
+ }
+
+ public void setAuthorsPositionProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getCaptionWriterProperty()
+ {
+ return (TextType) getProperty(CAPTION_WRITER);
+ }
+
+ public String getCaptionWriter()
+ {
+ TextType tt = ((TextType) getProperty(CAPTION_WRITER));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setCaptionWriter(String text)
+ {
+ ProperNameType tt = (ProperNameType) instanciateSimple(CAPTION_WRITER, text);
+ setCaptionWriterProperty(tt);
+ }
+
+ public void setCaptionWriterProperty(ProperNameType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getCategoryProperty()
+ {
+ return (TextType) getProperty(CATEGORY);
+ }
+
+ public String getCategory()
+ {
+ TextType tt = ((TextType) getProperty(CATEGORY));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setCategory(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(CATEGORY, text);
+ setCategoryProperty(tt);
+ }
+
+ public void setCategoryProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getCityProperty()
+ {
+ return (TextType) getProperty(CITY);
+ }
+
+ public String getCity()
+ {
+ TextType tt = ((TextType) getProperty(CITY));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setCity(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(CITY, text);
+ setCityProperty(tt);
+ }
+
+ public void setCityProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public IntegerType getColorModeProperty()
+ {
+ return (IntegerType) getProperty(COLOR_MODE);
+ }
+
+ public Integer getColorMode()
+ {
+ IntegerType tt = ((IntegerType) getProperty(COLOR_MODE));
+ return tt == null ? null : tt.getValue();
+ }
+
+ public void setColorMode(String text)
+ {
+ IntegerType tt = (IntegerType) instanciateSimple(COLOR_MODE, text);
+ setColorModeProperty(tt);
+ }
+
+ public void setColorModeProperty(IntegerType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getCountryProperty()
+ {
+ return (TextType) getProperty(COUNTRY);
+ }
+
+ public String getCountry()
+ {
+ TextType tt = ((TextType) getProperty(COUNTRY));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setCountry(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(COUNTRY, text);
+ setCountryProperty(tt);
+ }
+
+ public void setCountryProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getCreditProperty()
+ {
+ return (TextType) getProperty(CREDIT);
+ }
+
+ public String getCredit()
+ {
+ TextType tt = ((TextType) getProperty(CREDIT));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setCredit(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(CREDIT, text);
+ setCreditProperty(tt);
+ }
+
+ public void setCreditProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public DateType getDateCreatedProperty()
+ {
+ return (DateType) getProperty(DATE_CREATED);
+ }
+
+ public String getDateCreated()
+ {
+ TextType tt = ((TextType) getProperty(DATE_CREATED));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setDateCreated(String text)
+ {
+ DateType tt = (DateType) instanciateSimple(DATE_CREATED, text);
+ setDateCreatedProperty(tt);
+ }
+
+ public void setDateCreatedProperty(DateType text)
+ {
+ addProperty(text);
+ }
+
+ public void addDocumentAncestors(String text)
+ {
+ addQualifiedBagValue(DOCUMENT_ANCESTORS, text);
+ }
+
+ public ArrayProperty getDocumentAncestorsProperty()
+ {
+ return (ArrayProperty) getProperty(DOCUMENT_ANCESTORS);
+ }
+
+ public List<String> getDocumentAncestors()
+ {
+ return getUnqualifiedBagValueList(DOCUMENT_ANCESTORS);
+ }
+
+ public TextType getHeadlineProperty()
+ {
+ return (TextType) getProperty(HEADLINE);
+ }
+
+ public String getHeadline()
+ {
+ TextType tt = ((TextType) getProperty(HEADLINE));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setHeadline(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(HEADLINE, text);
+ setHeadlineProperty(tt);
+ }
+
+ public void setHeadlineProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getHistoryProperty()
+ {
+ return (TextType) getProperty(HISTORY);
+ }
+
+ public String getHistory()
+ {
+ TextType tt = ((TextType) getProperty(HISTORY));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setHistory(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(HISTORY, text);
+ setHistoryProperty(tt);
+ }
+
+ public void setHistoryProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getICCProfileProperty()
+ {
+ return (TextType) getProperty(ICC_PROFILE);
+ }
+
+ public String getICCProfile()
+ {
+ TextType tt = ((TextType) getProperty(ICC_PROFILE));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setICCProfile(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(ICC_PROFILE, text);
+ setICCProfileProperty(tt);
+ }
+
+ public void setICCProfileProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getInstructionsProperty()
+ {
+ return (TextType) getProperty(INSTRUCTIONS);
+ }
+
+ public String getInstructions()
+ {
+ TextType tt = ((TextType) getProperty(INSTRUCTIONS));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setInstructions(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(INSTRUCTIONS, text);
+ setInstructionsProperty(tt);
+
+ }
+
+ public void setInstructionsProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getSourceProperty()
+ {
+ return (TextType) getProperty(SOURCE);
+ }
+
+ public String getSource()
+ {
+ TextType tt = ((TextType) getProperty(SOURCE));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setSource(String text)
+ {
+ TextType source = (TextType) instanciateSimple(SOURCE, text);
+ setSourceProperty(source);
+ }
+
+ public void setSourceProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public TextType getStateProperty()
+ {
+ return (TextType) getProperty(STATE);
+ }
+
+ public String getState()
+ {
+ TextType tt = ((TextType) getProperty(STATE));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setState(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(STATE, text);
+ setStateProperty(tt);
+ }
+
+ public void setStateProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public void addSupplementalCategories(String text)
+ {
+ addQualifiedBagValue(SUPPLEMENTAL_CATEGORIES, text);
+ }
+
+ public void removeSupplementalCategories(String text)
+ {
+ removeUnqualifiedBagValue(SUPPLEMENTAL_CATEGORIES, text);
+ }
+
+ /**
* Add a new supplemental category.
*
- * @param s The supplemental category.
+ * @param s
+ * The supplemental category.
*/
- public void addSupplementalCategory( String s )
+ public void addSupplementalCategory(String s)
+ {
+ addSupplementalCategories(s);
+ }
+
+ public void removeSupplementalCategory(String text)
{
- addSupplementalCategories(s);
+ removeSupplementalCategories(text);
}
-
- public void removeSupplementalCategory (String text) {
- removeSupplementalCategories(text);
- }
-
-
-
- public ArrayProperty getSupplementalCategoriesProperty() {
- return (ArrayProperty) getProperty(SUPPLEMENTAL_CATEGORIES);
- }
-
- public List<String> getSupplementalCategories() {
- return getUnqualifiedBagValueList(SUPPLEMENTAL_CATEGORIES);
- }
-
- public void addTextLayers(String layerName, String layerText) {
- if (seqLayer == null) {
- seqLayer = createArrayProperty(TEXT_LAYERS, Cardinality.Seq);
- addProperty(seqLayer);
- }
- LayerType layer = new LayerType(getMetadata());
- layer.setLayerName(layerName);
- layer.setLayerText(layerText);
- seqLayer.getContainer().addProperty(layer);
- }
-
- public List<LayerType> getTextLayers() throws BadFieldValueException {
- List<AbstractField> tmp = getUnqualifiedArrayList(TEXT_LAYERS);
- if (tmp != null) {
- List<LayerType> layers = new ArrayList<LayerType>();
- for (AbstractField abstractField : tmp) {
- if (abstractField instanceof LayerType) {
- layers.add((LayerType) abstractField);
- } else {
- throw new BadFieldValueException("Layer expected and "
- + abstractField.getClass().getName() + " found.");
- }
- }
- return layers;
- }
- return null;
-
- }
-
- public TextType getTransmissionReferenceProperty() {
- return (TextType) getProperty(TRANSMISSION_REFERENCE);
- }
-
- public String getTransmissionReference() {
- TextType tt = ((TextType) getProperty(TRANSMISSION_REFERENCE));
- return tt == null ? null : tt.getStringValue();
- }
-
- public void setTransmissionReference(String text) {
- TextType tt = (TextType)instanciateSimple(TRANSMISSION_REFERENCE, text);
- setTransmissionReferenceProperty(tt);
- }
-
- public void setTransmissionReferenceProperty(TextType text) {
- addProperty(text);
- }
-
- public IntegerType getUrgencyProperty() {
- return (IntegerType) getProperty(URGENCY);
- }
-
- public Integer getUrgency() {
- IntegerType tt = ((IntegerType) getProperty(URGENCY));
- return tt == null ? null : tt.getValue();
- }
-
- public void setUrgency(String s) {
- IntegerType tt = (IntegerType)instanciateSimple(URGENCY, s);
- setUrgencyProperty(tt);
- }
-
- public void setUrgency( Integer s )
- {
- IntegerType tt = (IntegerType)instanciateSimple(URGENCY, s);
- setUrgencyProperty(tt);
- }
-
-
- public void setUrgencyProperty(IntegerType text) {
- addProperty(text);
- }
-
-
+
+ public ArrayProperty getSupplementalCategoriesProperty()
+ {
+ return (ArrayProperty) getProperty(SUPPLEMENTAL_CATEGORIES);
+ }
+
+ public List<String> getSupplementalCategories()
+ {
+ return getUnqualifiedBagValueList(SUPPLEMENTAL_CATEGORIES);
+ }
+
+ public void addTextLayers(String layerName, String layerText)
+ {
+ if (seqLayer == null)
+ {
+ seqLayer = createArrayProperty(TEXT_LAYERS, Cardinality.Seq);
+ addProperty(seqLayer);
+ }
+ LayerType layer = new LayerType(getMetadata());
+ layer.setLayerName(layerName);
+ layer.setLayerText(layerText);
+ seqLayer.getContainer().addProperty(layer);
+ }
+
+ public List<LayerType> getTextLayers() throws BadFieldValueException
+ {
+ List<AbstractField> tmp = getUnqualifiedArrayList(TEXT_LAYERS);
+ if (tmp != null)
+ {
+ List<LayerType> layers = new ArrayList<LayerType>();
+ for (AbstractField abstractField : tmp)
+ {
+ if (abstractField instanceof LayerType)
+ {
+ layers.add((LayerType) abstractField);
+ }
+ else
+ {
+ throw new BadFieldValueException("Layer expected and " + abstractField.getClass().getName()
+ + " found.");
+ }
+ }
+ return layers;
+ }
+ return null;
+
+ }
+
+ public TextType getTransmissionReferenceProperty()
+ {
+ return (TextType) getProperty(TRANSMISSION_REFERENCE);
+ }
+
+ public String getTransmissionReference()
+ {
+ TextType tt = ((TextType) getProperty(TRANSMISSION_REFERENCE));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ public void setTransmissionReference(String text)
+ {
+ TextType tt = (TextType) instanciateSimple(TRANSMISSION_REFERENCE, text);
+ setTransmissionReferenceProperty(tt);
+ }
+
+ public void setTransmissionReferenceProperty(TextType text)
+ {
+ addProperty(text);
+ }
+
+ public IntegerType getUrgencyProperty()
+ {
+ return (IntegerType) getProperty(URGENCY);
+ }
+
+ public Integer getUrgency()
+ {
+ IntegerType tt = ((IntegerType) getProperty(URGENCY));
+ return tt == null ? null : tt.getValue();
+ }
+
+ public void setUrgency(String s)
+ {
+ IntegerType tt = (IntegerType) instanciateSimple(URGENCY, s);
+ setUrgencyProperty(tt);
+ }
+
+ public void setUrgency(Integer s)
+ {
+ IntegerType tt = (IntegerType) instanciateSimple(URGENCY, s);
+ setUrgencyProperty(tt);
+ }
+
+ public void setUrgencyProperty(IntegerType text)
+ {
+ addProperty(text);
+ }
+
}
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicJobTicketSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicJobTicketSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicJobTicketSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicJobTicketSchema.java Wed Mar 6 15:57:44 2013
@@ -32,31 +32,34 @@ import org.apache.xmpbox.type.Cardinalit
import org.apache.xmpbox.type.JobType;
import org.apache.xmpbox.type.PropertyType;
import org.apache.xmpbox.type.StructuredType;
-import org.apache.xmpbox.type.TypeMapping;
import org.apache.xmpbox.type.Types;
-@StructuredType(preferedPrefix="xmpBJ",namespace="http://ns.adobe.com/xap/1.0/bj/")
-public class XMPBasicJobTicketSchema extends XMPSchema {
+@StructuredType(preferedPrefix = "xmpBJ", namespace = "http://ns.adobe.com/xap/1.0/bj/")
+public class XMPBasicJobTicketSchema extends XMPSchema
+{
@PropertyType(type = Types.Job, card = Cardinality.Bag)
public static final String JOB_REF = "JobRef";
private ArrayProperty bagJobs;
-
- public XMPBasicJobTicketSchema(XMPMetadata metadata) {
- this(metadata,null);
+ public XMPBasicJobTicketSchema(XMPMetadata metadata)
+ {
+ this(metadata, null);
}
- public XMPBasicJobTicketSchema(XMPMetadata metadata, String ownPrefix) {
+ public XMPBasicJobTicketSchema(XMPMetadata metadata, String ownPrefix)
+ {
super(metadata, ownPrefix);
}
- public void addJob(String id , String name, String url) {
- addJob(id,name,url,null);
+ public void addJob(String id, String name, String url)
+ {
+ addJob(id, name, url, null);
}
-
- public void addJob(String id , String name, String url, String fieldPrefix) {
+
+ public void addJob(String id, String name, String url, String fieldPrefix)
+ {
JobType job = new JobType(getMetadata(), fieldPrefix);
job.setId(id);
job.setName(name);
@@ -64,34 +67,45 @@ public class XMPBasicJobTicketSchema ext
addJob(job);
}
- public void addJob (JobType job) {
- String prefix = getNamespacePrefix(job.getNamespace());
- if (prefix!=null) {
- // use same prefix for all jobs
- job.setPrefix(prefix);
- } else {
- // add prefix
- addNamespace(job.getNamespace(), job.getPrefix());
- }
- // create bag if not existing
- if (bagJobs == null) {
+ public void addJob(JobType job)
+ {
+ String prefix = getNamespacePrefix(job.getNamespace());
+ if (prefix != null)
+ {
+ // use same prefix for all jobs
+ job.setPrefix(prefix);
+ }
+ else
+ {
+ // add prefix
+ addNamespace(job.getNamespace(), job.getPrefix());
+ }
+ // create bag if not existing
+ if (bagJobs == null)
+ {
bagJobs = createArrayProperty(JOB_REF, Cardinality.Bag);
addProperty(bagJobs);
}
// add job
bagJobs.getContainer().addProperty(job);
}
-
- public List<JobType> getJobs() throws BadFieldValueException {
+
+ public List<JobType> getJobs() throws BadFieldValueException
+ {
List<AbstractField> tmp = getUnqualifiedArrayList(JOB_REF);
- if (tmp != null) {
+ if (tmp != null)
+ {
List<JobType> layers = new ArrayList<JobType>();
- for (AbstractField abstractField : tmp) {
- if (abstractField instanceof JobType) {
+ for (AbstractField abstractField : tmp)
+ {
+ if (abstractField instanceof JobType)
+ {
layers.add((JobType) abstractField);
- } else {
- throw new BadFieldValueException("Job expected and "
- + abstractField.getClass().getName() + " found.");
+ }
+ else
+ {
+ throw new BadFieldValueException("Job expected and " + abstractField.getClass().getName()
+ + " found.");
}
}
return layers;
@@ -100,5 +114,4 @@ public class XMPBasicJobTicketSchema ext
}
-
}