You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2011/07/24 15:57:54 UTC
svn commit: r1150371 [4/8] - in /pdfbox/trunk/xmpbox: ./ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/padaf/ src/main/java/org/apache/padaf/xmpbox/
src/main/java/org/apache/padaf/xmpbox/parser/ src...
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,299 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.IntegerType;
+import org.apache.padaf.xmpbox.type.TextType;
+
+
+/**
+ * Representation of PDF/A Identification Schema
+ *
+ * @author a183132
+ *
+ */
+public class PDFAIdentificationSchema extends XMPSchema {
+
+ public static final String IDPREFIX = "pdfaid";
+ public static final String IDPREFIXSEP = "pdfaid:";
+ public static final String IDURI = "http://www.aiim.org/pdfa/ns/id/";
+
+ @PropertyType(propertyType = "Integer")
+ public static final String PART = "part";
+
+ @PropertyType(propertyType = "Text")
+ public static final String AMD = "amd";
+
+ @PropertyType(propertyType = "Text")
+ 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, IDPREFIX, IDURI);
+ }
+
+ public PDFAIdentificationSchema(XMPMetadata metadata, String prefix) {
+ super(metadata, prefix, IDURI);
+ }
+
+ /**
+ * Set the PDFA Version identifier (with string)
+ *
+ * @param value
+ * The version Id value to set
+ *
+ */
+ public void setPartValueWithString(String value) {
+ IntegerType part = new IntegerType(metadata, IDPREFIX, 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 = new IntegerType(metadata, IDPREFIX, PART, value);
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDF/A Version identifier (with an int)
+ *
+ * @param value
+ * The version Id property to set
+ */
+ public void setPartValue(Integer value) {
+ IntegerType part = new IntegerType(metadata, IDPREFIX, PART, value);
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDF/A Version identifier
+ *
+ * @param part
+ * set the PDF/A Version id property
+ */
+ public void setPart(IntegerType part) {
+ addProperty(part);
+ }
+
+ /**
+ * Set the PDF/A amendment identifier
+ *
+ * @param value
+ * The amendment identifier value to set
+ */
+ public void setAmdValue(String value) {
+ TextType amd = new TextType(metadata, IDPREFIX, AMD, value);
+ addProperty(amd);
+ }
+
+ /**
+ * Set the PDF/A amendment identifier
+ *
+ * @param amd
+ * The amendment identifier property to set
+ */
+ public void setAmd(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 setConformanceValue(String value) throws BadFieldValueException {
+ if (value.equals("A") || value.equals("B")) {
+ TextType conf = new TextType(metadata, IDPREFIX, 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 setConformance(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 getPartValue() {
+ AbstractField tmp = getPart();
+ if (tmp != null) {
+ if (tmp instanceof IntegerType) {
+ return ((IntegerType) tmp).getValue();
+ }
+ return null;
+ } else {
+ for (Attribute attribute : getAllAttributes()) {
+ if (attribute.getQualifiedName().equals(IDPREFIXSEP + PART)) {
+ return new Integer(attribute.getValue());
+ }
+ }
+ return null;
+
+ }
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Version id
+ *
+ * @return Part property
+ */
+ public IntegerType getPart() {
+ AbstractField tmp = getProperty(IDPREFIXSEP + PART);
+ if (tmp != null) {
+ if (tmp instanceof IntegerType) {
+ return (IntegerType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFAAmendmentId (as an String)
+ *
+ * @return Amendment value
+ */
+ public String getAmendmentValue() {
+ AbstractField tmp = getProperty(IDPREFIXSEP + AMD);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Amendment id
+ *
+ * @return Amendment property
+ */
+ public TextType getAmd() {
+ AbstractField tmp = getProperty(IDPREFIXSEP + AMD);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFA Amendment Id (as an String)
+ *
+ * @return Amendment Value
+ */
+ public String getAmdValue() {
+ TextType tmp = getAmd();
+ if (tmp==null) {
+ for (Attribute attribute : getAllAttributes()) {
+ if (attribute.getQualifiedName().equals(IDPREFIXSEP + AMD)) {
+ return attribute.getValue();
+ }
+ }
+ return null;
+ } else {
+ return tmp.getStringValue();
+ }
+ }
+
+ /**
+ * Give the property corresponding to the PDFA Conformance id
+ *
+ * @return conformance property
+ */
+ public TextType getConformance() {
+ AbstractField tmp = getProperty(IDPREFIXSEP + CONFORMANCE);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the Conformance id
+ *
+ * @return conformance id value
+ */
+ public String getConformanceValue() {
+ TextType tt = getConformance();
+ if (tt==null) {
+ for (Attribute attribute : getAllAttributes()) {
+ if (attribute.getQualifiedName().equals(IDPREFIXSEP + CONFORMANCE)) {
+ return attribute.getValue();
+ }
+ }
+ return null;
+ } else {
+ return tt.getStringValue();
+ }
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescription.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescription.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescription.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescription.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,239 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.Iterator;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
+import org.apache.padaf.xmpbox.type.Elementable;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.w3c.dom.Element;
+
+/**
+ * Representation of a PDF/A property type schema
+ *
+ * @author a183132
+ *
+ */
+public class PDFAPropertyDescription implements Elementable {
+
+ public static final String PDFAPROPPREFIX = "pdfaProperty";
+ public static final String PDFAPROPPREFIXSEP = "pdfaProperty:";
+
+ public static final String NAME = "name";
+ public static final String VALUETYPE = "valueType";
+ public static final String CATEGORY = "category";
+ public static final String DESCRIPTION = "description";
+
+ protected XMPMetadata metadata;
+ protected ComplexPropertyContainer content;
+
+ /**
+ * Build a new property description
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public PDFAPropertyDescription(XMPMetadata metadata) {
+ this.metadata = metadata;
+ content = new ComplexPropertyContainer(metadata, "rdf", "li");
+ content
+ .setAttribute(new Attribute(null, "rdf", "parseType",
+ "Resource"));
+ }
+
+ /**
+ * set the name of this property
+ *
+ * @param name
+ * The value to set
+ */
+ public void setNameValue(String name) {
+ content.addProperty(new TextType(metadata, PDFAPROPPREFIX, NAME, name));
+ }
+
+ /**
+ * set the value type of this property
+ *
+ * @param type
+ * The value to set
+ */
+ public void setValueTypeValue(String type) {
+ content.addProperty(new TextType(metadata, PDFAPROPPREFIX, VALUETYPE,
+ type));
+ }
+
+ /**
+ * set the category of this property
+ *
+ * @param category
+ * The value to set
+ * @throws BadFieldValueException
+ * if category value not 'internal' or 'external'
+ */
+ public void setCategoryValue(String category) throws BadFieldValueException {
+ if (category.equals("external") || category.equals("internal")) {
+ content.addProperty(new TextType(metadata, PDFAPROPPREFIX,
+ CATEGORY, category));
+ } else {
+ throw new BadFieldValueException(
+ "Unexpected value '"
+ + category
+ + "' for property category (only values 'internal' or 'external' are allowed)");
+ }
+ }
+
+ /**
+ * set the description of this property
+ *
+ * @param desc
+ * The value to set
+ */
+ public void setDescriptionValue(String desc) {
+ content.addProperty(new TextType(metadata, PDFAPROPPREFIX, DESCRIPTION,
+ desc));
+ }
+
+ /**
+ * Get the property value
+ *
+ * @param qualifiedName
+ * the name of property wanted
+ * @return property value
+ */
+ private String getPropertyValue(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the current defined name (in a string)
+ *
+ * @return the name value defined for this property
+ */
+ public String getNameValue() {
+ return getPropertyValue(PDFAPROPPREFIXSEP + NAME);
+ }
+
+ /**
+ * Return the current ValueType (in a string)
+ *
+ * @return the valueType value defined for this property
+ */
+ public String getValueTypeValue() {
+ return getPropertyValue(PDFAPROPPREFIXSEP + VALUETYPE);
+ }
+
+ /**
+ * Return the current category (in a string)
+ *
+ * @return the category value defined for this property
+ */
+ public String getCategoryValue() {
+ return getPropertyValue(PDFAPROPPREFIXSEP + CATEGORY);
+ }
+
+ /**
+ * Return the current description (in a string)
+ *
+ * @return the description value defined for this property
+ */
+ public String getDescriptionValue() {
+ return getPropertyValue(PDFAPROPPREFIXSEP + DESCRIPTION);
+ }
+
+ /**
+ * Get a property from its qualified name as a TextType object
+ *
+ * @param qualifiedName
+ * the Name of property wanted
+ * @return the property wanted
+ */
+ private TextType getProperty(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the property corresponding to the property name definition
+ *
+ * @return the Name property defined for this PropertyDescription
+ */
+ public TextType getName() {
+ return getProperty(PDFAPROPPREFIXSEP + NAME);
+ }
+
+ /**
+ * Return the property corresponding to the property valueType definition
+ *
+ * @return the ValueType property defined for this PropertyDescription
+ */
+ public TextType getValueType() {
+ return getProperty(PDFAPROPPREFIXSEP + VALUETYPE);
+ }
+
+ /**
+ * Return the property corresponding to the property category definition
+ *
+ * @return the Category property defined for this PropertyDescription
+ */
+ public TextType getCategory() {
+ return getProperty(PDFAPROPPREFIXSEP + CATEGORY);
+ }
+
+ /**
+ * Return the property corresponding to the property description definition
+ *
+ * @return the Description property defined for this PropertyDescription
+ */
+ public TextType getDescription() {
+ return getProperty(PDFAPROPPREFIXSEP + DESCRIPTION);
+ }
+
+ /**
+ * Get Dom Element for xml/rdf serialization
+ *
+ * @return the DOM Element
+ */
+ public Element getElement() {
+ return content.getElement();
+ }
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescription.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescription.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescription.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescription.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,389 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
+import org.apache.padaf.xmpbox.type.Elementable;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.w3c.dom.Element;
+
+/**
+ * Representation of a PDF/A Value type schema
+ *
+ * @author a183132
+ *
+ */
+public class PDFAValueTypeDescription implements Elementable {
+
+ public static final String PDFATYPEPREFIX = "pdfaType";
+ public static final String PDFATYPEPREFIXSEP = "pdfaType:";
+
+ public static final String TYPE = "type";
+ public static final String NS_URI = "namespaceURI";
+ public static final String PREFIX = "prefix";
+ public static final String DESCRIPTION = "description";
+ public static final String FIELD = "field";
+
+ protected FieldDescriptionContainer fields;
+ protected XMPMetadata metadata;
+ protected ComplexPropertyContainer content;
+
+ /**
+ * Build a new valuetype description
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public PDFAValueTypeDescription(XMPMetadata metadata) {
+ this.metadata = metadata;
+ content = new ComplexPropertyContainer(metadata, "rdf", "li");
+ content
+ .setAttribute(new Attribute(null, "rdf", "parseType",
+ "Resource"));
+ fields = new FieldDescriptionContainer();
+ content.getElement().appendChild(fields.getElement());
+
+ }
+
+ /**
+ * set the name of this valuetype
+ *
+ * @param name
+ * The value to set
+ */
+ public void setTypeNameValue(String name) {
+ content.addProperty(new TextType(metadata, PDFATYPEPREFIX, TYPE, name));
+ }
+
+ /**
+ * set the namespaceURI of this valueType
+ *
+ * @param nsURI
+ * The value to set
+ */
+ public void setNamespaceURIValue(String nsURI) {
+ content.addProperty(new TextType(metadata, PDFATYPEPREFIX, NS_URI,
+ nsURI));
+ }
+
+ /**
+ * set the prefix of this valuetype
+ *
+ * @param prefix
+ * The value to set
+ */
+ public void setPrefixValue(String prefix) {
+ content.addProperty(new TextType(metadata, PDFATYPEPREFIX, PREFIX,
+ prefix));
+ }
+
+ /**
+ * set the description of this property
+ *
+ * @param desc
+ * The value to set
+ */
+ public void setDescriptionValue(String desc) {
+ content.addProperty(new TextType(metadata, PDFATYPEPREFIX, DESCRIPTION,
+ desc));
+ }
+
+ /**
+ * Get value type property value as a string
+ *
+ * @param qualifiedName
+ * the Name of property wanted
+ * @return value of the property wanted which describe this property
+ */
+ private String getValueTypeProperty(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the current defined type name (in a string)
+ *
+ * @return the type value (so the name) given to this valuetype
+ */
+ public String getTypeNameValue() {
+ return getValueTypeProperty(PDFATYPEPREFIXSEP + TYPE);
+ }
+
+ /**
+ * Return the current nsURI (in a string)
+ *
+ * @return the namespace URI value
+ */
+ public String getNamespaceURIValue() {
+ return getValueTypeProperty(PDFATYPEPREFIXSEP + NS_URI);
+ }
+
+ /**
+ * Return the current prefix (in a string)
+ *
+ * @return The prefix value
+ */
+ public String getPrefixValue() {
+ return getValueTypeProperty(PDFATYPEPREFIXSEP + PREFIX);
+ }
+
+ /**
+ * Return the description of this valueType(in a string)
+ *
+ * @return the description value
+ */
+ public String getDescriptionValue() {
+ return getValueTypeProperty(PDFATYPEPREFIXSEP + DESCRIPTION);
+ }
+
+ /**
+ * Get value type property value as a TextType
+ *
+ * @param qualifiedName
+ * the name of the property wanted
+ * @return the property wanted
+ */
+ private TextType getTypeProperty(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the property corresponding to the type name definition
+ *
+ * @return the type property (or the property that define the name of this
+ * valuetype)
+ */
+ public TextType getTypeName() {
+ return getTypeProperty(PDFATYPEPREFIXSEP + TYPE);
+ }
+
+ /**
+ * Return the property corresponding to the Type namespaceURI definition
+ *
+ * @return the namespace URI property
+ */
+ public TextType getNamespaceURI() {
+ return getTypeProperty(PDFATYPEPREFIXSEP + NS_URI);
+ }
+
+ /**
+ * Return the property corresponding to the type prefix definition
+ *
+ * @return the prefix property
+ */
+ public TextType getPrefix() {
+ return getTypeProperty(PDFATYPEPREFIXSEP + PREFIX);
+ }
+
+ /**
+ * Return the property corresponding to the type description definition
+ *
+ * @return the description property
+ */
+ public TextType getDescription() {
+ return getTypeProperty(PDFATYPEPREFIXSEP + DESCRIPTION);
+ }
+
+ /**
+ * Give all Fields description embedded in this valuetype
+ *
+ * @return a list of Field defined for this valuetype
+ */
+ public List<PDFAFieldDescription> getFields() {
+ return Collections.unmodifiableList(fields.fields);
+ }
+
+ /**
+ * Add a field description to this valuetype
+ *
+ * @param name
+ * name of field
+ * @param valueType
+ * valueType of field
+ * @param description
+ * description of field
+ * @return the Field property created
+ */
+ public PDFAFieldDescription addField(String name, String valueType,
+ String description) {
+ PDFAFieldDescription field = new PDFAFieldDescription(metadata);
+ field.setNameValue(name);
+ field.setValueTypeValue(valueType);
+ field.setDescriptionValue(description);
+ fields.addFieldDescription(field);
+ return field;
+ }
+
+ /**
+ * Add a Structured Field to this valueType
+ *
+ * @param field
+ * the field to add to this valueType
+ */
+ public void addField(PDFAFieldDescription field) {
+ fields.addFieldDescription(field);
+ }
+
+ /**
+ * Get Dom Element for xml/rdf serialization
+ *
+ * @return the DOM element
+ */
+ public Element getElement() {
+ return content.getElement();
+ }
+
+ /**
+ * Container of Field Description
+ *
+ * @author a183132
+ *
+ */
+ public class FieldDescriptionContainer implements Elementable {
+
+ protected Element element, content;
+ protected List<PDFAFieldDescription> fields;
+
+ /**
+ *
+ * PDF/A Field Description Container constructor
+ */
+ public FieldDescriptionContainer() {
+ element = metadata.getFuturOwner().createElement(
+ PDFAExtensionSchema.PDFATYPESEP + FIELD);
+ content = metadata.getFuturOwner().createElement("rdf:Seq");
+ element.appendChild(content);
+
+ fields = new ArrayList<PDFAFieldDescription>();
+ }
+
+ /**
+ * Add a PDF/A Field Description to the current structure
+ *
+ * @param obj
+ * the field to add
+ */
+ public void addFieldDescription(PDFAFieldDescription obj) {
+ if (containsFieldDescription(obj)) {
+ removeFieldDescription(obj);
+ }
+ fields.add(obj);
+ content.appendChild(obj.content.getElement());
+ }
+
+ /**
+ * access to all PDF/A Field Descriptions
+ *
+ * @return an Iterator on all PDF/A Field Descriptions declared
+ */
+ public Iterator<PDFAFieldDescription> getAllFieldDescription() {
+ return fields.iterator();
+ }
+
+ /**
+ * Check if two PDF/A Field Descriptions are similar
+ *
+ * @param prop1
+ * the first PDF/A Field Description
+ * @param prop2
+ * the second PDF/A Field Description
+ * @return comparison result
+ */
+ public boolean isSameFieldDescription(PDFAFieldDescription prop1,
+ PDFAFieldDescription prop2) {
+ if (prop1.getClass().equals(prop2.getClass())) {
+ if (prop1.content.getElement().getTextContent().equals(
+ prop2.content.getElement().getTextContent())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if a specified PDF/A Field Description is embedded
+ *
+ * @param field
+ * PDF/A field Description
+ * @return result
+ */
+ public boolean containsFieldDescription(PDFAFieldDescription field) {
+ Iterator<PDFAFieldDescription> it = getAllFieldDescription();
+ PDFAFieldDescription tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (isSameFieldDescription(tmp, field)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove a PDF/A Field description
+ *
+ * @param field
+ * the PDF/A Field Description
+ */
+ public void removeFieldDescription(PDFAFieldDescription field) {
+ if (containsFieldDescription(field)) {
+ fields.remove(field);
+ content.removeChild(field.content.getElement());
+ }
+ }
+
+ /**
+ * Get Dom Element for xml/rdf serialization
+ *
+ * @return the DOM element
+ */
+ public Element getElement() {
+ return element;
+ }
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyAttributesAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyAttributesAnnotation.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyAttributesAnnotation.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyAttributesAnnotation.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * To be used at runtime
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+/**
+ * Annotation to specify attributes expected for a property
+ */
+public @interface PropertyAttributesAnnotation {
+ /**
+ * List of attributes which are expected
+ *
+ */
+ String[] expectedAttributes();
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyAttributesAnnotation.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyExtensionDefinition.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyExtensionDefinition.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyExtensionDefinition.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyExtensionDefinition.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * To be used at runtime
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+/**
+ * Annotation to specify type schema associated to a property.
+ * This annotation help to make automatically PDF/A Extension schema description
+ * for a schema.
+ *
+ * In default case, property description will be read
+ * from xml file specified in ExtensionSchemaAnnotation which define
+ * all properties description. If this file is not specified, description will be read here.
+ *
+ * Note: if file and this propertyDescription are not specified, a default 'not documented description"
+ * is written
+ */
+public @interface PropertyExtensionDefinition {
+
+ /**
+ * get category defined in this description that must be used to build
+ * schema descriptions Note: More details in this class javadoc
+ */
+ String propertyCategory();
+
+ /**
+ * get description defined in this description that must be used to build
+ * schema descriptions Note: More details in this class javadoc
+ *
+ */
+ String propertyDescription() default "";
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyExtensionDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyType.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyType.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyType.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * to be used at runtime
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+/**
+ * Annotation to specify type expected for a property
+ */
+public @interface PropertyType {
+
+ /**
+ * get valuetype defined in this description that must be used to build
+ * properties descriptions in schema descriptions
+ *
+ *
+ */
+ String propertyType();
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PropertyType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaDescription.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaDescription.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaDescription.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaDescription.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,534 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
+import org.apache.padaf.xmpbox.type.Elementable;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.w3c.dom.Element;
+
+/**
+ * Representation of one schema description (used in PDFAExtension Schema)
+ *
+ * @author a183132
+ *
+ */
+public class SchemaDescription implements Elementable {
+
+ protected XMPMetadata metadata;
+ protected ValueTypesDescriptionContainer valueTypes;
+ protected PropertyDescriptionContainer properties;
+ protected ComplexPropertyContainer content;
+
+ /**
+ * Create a new Schema Description
+ *
+ * @param metadata
+ * Metadata where this SchemaDescription will be included
+ */
+ public SchemaDescription(XMPMetadata metadata) {
+ this.metadata = metadata;
+ content = new ComplexPropertyContainer(metadata, "rdf", "li");
+ content
+ .setAttribute(new Attribute(null, "rdf", "parseType",
+ "Resource"));
+
+ // <pdfaSchema:property><seq>
+ properties = new PropertyDescriptionContainer();
+ content.getElement().appendChild(properties.getElement());
+ // <pdfaSchema:valueType><seq>
+ valueTypes = new ValueTypesDescriptionContainer();
+ content.getElement().appendChild(valueTypes.getElement());
+
+ }
+
+ /**
+ * Add a property to the current structure
+ *
+ * @param obj
+ * the property to add
+ */
+ public void addProperty(AbstractField obj) {
+ content.addProperty(obj);
+ }
+
+ /**
+ * Get schema Description property value as a string
+ *
+ * @param qualifiedName
+ * the name of one of properties that constitute a schema
+ * description
+ * @return the value of property specified
+ */
+ private String getPdfaTextValue(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set Description of this schema
+ *
+ * @param description
+ * The value to set
+ */
+ public void setSchemaValue(String description) {
+ // <pdfaSchema:schema>
+ content.addProperty(new TextType(metadata,
+ PDFAExtensionSchema.PDFASCHEMA, PDFAExtensionSchema.SCHEMA,
+ description));
+ }
+
+ /**
+ * Return the schema description value
+ *
+ * @return The value to set
+ */
+ public String getSchema() {
+ return getPdfaTextValue(PDFAExtensionSchema.PDFASCHEMASEP
+ + PDFAExtensionSchema.SCHEMA);
+ }
+
+ /**
+ * Set the Schema Namespace URI
+ *
+ * @param uri
+ * the namespace URI to set for this Schema Description
+ */
+ public void setNameSpaceURIValue(String uri) {
+ content
+ .addProperty(new TextType(metadata,
+ PDFAExtensionSchema.PDFASCHEMA,
+ PDFAExtensionSchema.NS_URI, uri));
+ }
+
+ /**
+ * Return the Schema nameSpaceURI value
+ *
+ * @return the namespace URI defined for this Schema Description
+ */
+ public String getNameSpaceURI() {
+ return getPdfaTextValue(PDFAExtensionSchema.PDFASCHEMASEP
+ + PDFAExtensionSchema.NS_URI);
+ }
+
+ /**
+ * Set the preferred schema namespace prefix
+ *
+ * @param prefix
+ * the prefix to set for this Schema Description
+ */
+ public void setPrefixValue(String prefix) {
+ content.addProperty(new TextType(metadata,
+ PDFAExtensionSchema.PDFASCHEMA, PDFAExtensionSchema.PREFIX,
+ prefix));
+ }
+
+ /**
+ * Return the preferred schema namespace prefix value
+ *
+ * @return the namespace URI defined for this Schema Description
+ */
+ public String getPrefix() {
+ return getPdfaTextValue(PDFAExtensionSchema.PDFASCHEMASEP
+ + PDFAExtensionSchema.PREFIX);
+ }
+
+ /**
+ * Give all PDFAProperties description embedded in this schema
+ *
+ * @return List of all PDF/A Property Descriptions that specified properties
+ * used for the schema associed to this schema description
+ */
+ public List<PDFAPropertyDescription> getProperties() {
+ return Collections.unmodifiableList(properties.properties);
+ }
+
+ /**
+ * Add a property description to this schema
+ *
+ * @param name
+ * property name
+ * @param type
+ * property value type
+ * @param category
+ * property category
+ * @param desc
+ * property description
+ * @return the created PDFAPropertyDescription
+ * @throws BadFieldValueException
+ * When Category field not contain 'internal' or 'external'
+ */
+ public PDFAPropertyDescription addProperty(String name, String type,
+ String category, String desc) throws BadFieldValueException {
+
+ PDFAPropertyDescription prop = new PDFAPropertyDescription(metadata);
+ prop.setNameValue(name);
+ prop.setValueTypeValue(type);
+ prop.setCategoryValue(category);
+ prop.setDescriptionValue(desc);
+ properties.addPropertyDescription(prop);
+
+ return prop;
+ }
+
+ /**
+ * Give all ValueTypes description embedded in this schema
+ *
+ * @return list of all valuetypes defined in this schema description
+ */
+ public List<PDFAValueTypeDescription> getValueTypes() {
+ return Collections.unmodifiableList(valueTypes.valueTypes);
+ }
+
+ /**
+ * Add a valueType description to this schema
+ *
+ * @param type
+ * valuetype type (its name)
+ * @param namespaceURI
+ * valuetype namespace URI
+ * @param prefix
+ * valuetype prefix
+ * @param description
+ * valuetype description
+ * @param fields
+ * list of PDF/A Field Descriptions associated
+ * @return the created PDFAPropertyDescription
+ */
+ public PDFAValueTypeDescription addValueType(String type,
+ String namespaceURI, String prefix, String description,
+ List<PDFAFieldDescription> fields) {
+ PDFAValueTypeDescription valueType = new PDFAValueTypeDescription(
+ metadata);
+ valueType.setTypeNameValue(type);
+ valueType.setNamespaceURIValue(namespaceURI);
+ valueType.setPrefixValue(prefix);
+ valueType.setDescriptionValue(description);
+ // Field is optional
+ if (fields != null) {
+ int size = fields.size();
+ for (int i = 0; i < size; i++) {
+ valueType.addField(fields.get(i));
+ }
+
+ }
+ valueTypes.addValueTypeDescription(valueType);
+
+ return valueType;
+ }
+
+ /**
+ * Container for PDF/A Value Type Descriptions associated to a Schema
+ * Description
+ *
+ * @author a183132
+ *
+ */
+ public class ValueTypesDescriptionContainer implements Elementable {
+
+ protected Element element, content;
+ protected List<PDFAValueTypeDescription> valueTypes;
+
+ /**
+ *
+ * PDF/A Value Type Descriptions Container constructor
+ */
+ public ValueTypesDescriptionContainer() {
+ element = metadata.getFuturOwner().createElement(
+ PDFAExtensionSchema.PDFASCHEMASEP
+ + PDFAExtensionSchema.VALUETYPE);
+ content = metadata.getFuturOwner().createElement("rdf:Seq");
+ element.appendChild(content);
+
+ valueTypes = new ArrayList<PDFAValueTypeDescription>();
+ }
+
+ /**
+ * Add a PDF/A Value Type Description to the current structure
+ *
+ * @param obj
+ * the PDF/A Value Type Description to add
+ */
+ public void addValueTypeDescription(PDFAValueTypeDescription obj) {
+ if (containsValueTypeDescription(obj)) {
+ removeValueTypeDescription(getValueTypeDescription(obj
+ .getTypeNameValue()));
+ }
+ valueTypes.add(obj);
+ content.appendChild(obj.content.getElement());
+ }
+
+ /**
+ * access all PDF/A Value Type Descriptions
+ *
+ * @return Iterator on all PDF/A Value Type Descriptions defined in
+ * order to be used in SchemaDescription class
+ */
+ public Iterator<PDFAValueTypeDescription> getAllValueTypeDescription() {
+ return valueTypes.iterator();
+ }
+
+ /**
+ * Get the PDF/A Value Type description from its type name
+ *
+ * @param type
+ * the name defined for the value type wanted
+ * @return The wanted PDF/A Value Type Description
+ */
+ public PDFAValueTypeDescription getValueTypeDescription(String type) {
+ Iterator<PDFAValueTypeDescription> it = getAllValueTypeDescription();
+ PDFAValueTypeDescription tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getTypeNameValue().equals(type)) {
+ return tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Check if two PDFAValueTypeDescription are similar
+ *
+ * @param prop1
+ * first PDF/A Value Type Description
+ * @param prop2
+ * second PDF/A Value Type Description
+ * @return comparison result
+ */
+ public boolean isSameValueTypeDescription(
+ PDFAValueTypeDescription prop1, PDFAValueTypeDescription prop2) {
+ if (prop1.getClass().equals(prop2.getClass())) {
+ if (prop1.getTypeNameValue().equals(prop2.getTypeNameValue())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if a specified PDFAValueTypeDescription is embedded
+ *
+ * @param vtype
+ * PDF/A Value Type Descriptions
+ * @return result
+ */
+ public boolean containsValueTypeDescription(
+ PDFAValueTypeDescription vtype) {
+ Iterator<PDFAValueTypeDescription> it = getAllValueTypeDescription();
+ PDFAValueTypeDescription tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (isSameValueTypeDescription(tmp, vtype)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove a PDF/A Value Type Description
+ *
+ * @param vtype
+ * PDF/A Value Type Description to remove
+ */
+ public void removeValueTypeDescription(PDFAValueTypeDescription vtype) {
+ if (containsValueTypeDescription(vtype)) {
+ valueTypes.remove(vtype);
+ content.removeChild(vtype.content.getElement());
+ }
+ }
+
+ /**
+ * get the DOM element for xml/rdf serialization
+ *
+ * @return the DOM Element
+ */
+ public Element getElement() {
+ return element;
+ }
+
+ }
+
+ /**
+ * Container for PDF/A Property Descriptions associated to a Schema
+ * Description
+ *
+ * @author a183132
+ *
+ */
+ public class PropertyDescriptionContainer implements Elementable {
+
+ protected Element element, content;
+ protected List<PDFAPropertyDescription> properties;
+
+ /**
+ *
+ * PDF/A Property Descriptions Container constructor
+ */
+ public PropertyDescriptionContainer() {
+ element = metadata.getFuturOwner().createElement(
+ PDFAExtensionSchema.PDFASCHEMASEP
+ + PDFAExtensionSchema.PROPERTY);
+ content = metadata.getFuturOwner().createElement("rdf:Seq");
+ element.appendChild(content);
+
+ properties = new ArrayList<PDFAPropertyDescription>();
+ }
+
+ /**
+ * Add a PropertyDescription to the current structure
+ *
+ * @param obj
+ * the property to add
+ */
+ public void addPropertyDescription(PDFAPropertyDescription obj) {
+ if (containsPropertyDescription(obj)) {
+ removePropertyDescription(getPropertyDescription(obj
+ .getNameValue()));
+ }
+ properties.add(obj);
+ content.appendChild(obj.content.getElement());
+ }
+
+ /**
+ * Return all PropertyDescription
+ *
+ * @return Iterator on all PDF/A Property Descriptions in order to be
+ * used in SchemaDescription class
+ */
+ public Iterator<PDFAPropertyDescription> getAllPropertyDescription() {
+ return properties.iterator();
+ }
+
+ /**
+ * Check if two PDF/A Property Description are similar
+ *
+ * @param prop1
+ * first PDF/A Property Description
+ * @param prop2
+ * second PDF/A Property Description
+ * @return comparison result
+ */
+ public boolean isSamePropertyDescription(PDFAPropertyDescription prop1,
+ PDFAPropertyDescription prop2) {
+ if (prop1.getClass().equals(prop2.getClass())) {
+ // Assuming that 2 properties can't have the same name
+ if (prop1.getNameValue().equals(prop2.getNameValue())) {
+ return true;
+ }
+ // if(prop1.content.getElement().getTextContent().equals(prop2.content.getElement().getTextContent())){
+ // return true;
+ // }
+ }
+ return false;
+ }
+
+ /**
+ * Check if a specified PDF/A Property Description is embedded
+ *
+ * @param prop
+ * PDF/A Property Description
+ * @return result
+ */
+ public boolean containsPropertyDescription(PDFAPropertyDescription prop) {
+ Iterator<PDFAPropertyDescription> it = getAllPropertyDescription();
+ PDFAPropertyDescription tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (isSamePropertyDescription(tmp, prop)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get a PDFAPropertyDescription from its name
+ *
+ * @param name
+ * name defined for PDF/A Property Description
+ * @return the PDF/A Property Description
+ */
+ public PDFAPropertyDescription getPropertyDescription(String name) {
+ Iterator<PDFAPropertyDescription> it = getAllPropertyDescription();
+ PDFAPropertyDescription tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getNameValue().equals(name)) {
+ return tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Remove a PDF/A Property Description
+ *
+ * @param prop
+ * PDF/A Property Description
+ */
+ public void removePropertyDescription(PDFAPropertyDescription prop) {
+ if (containsPropertyDescription(prop)) {
+ properties.remove(prop);
+ content.removeChild(prop.content.getElement());
+ }
+ }
+
+ /**
+ * get the DOM element for xml/rdf serialization
+ *
+ * @return the DOM Element
+ */
+ public Element getElement() {
+ return element;
+ }
+
+ }
+
+ /**
+ * get the DOM element for xml/rdf serialization
+ *
+ * @return the DOM Element
+ */
+ public Element getElement() {
+ return content.getElement();
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaExtensionDefinition.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaExtensionDefinition.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaExtensionDefinition.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaExtensionDefinition.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * to be used at runtime
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+/**
+ * Annotation to specify PDF/A extension schema description associated to a schema
+ *
+ * property_descriptions design a file where all properties descriptions are described
+ * this value is optional. By default, all properties descriptions will be load from
+ * their PropertyExtensionDefinition annotation.
+ * However, if Property_descriptions value is changed all properties descriptions
+ * will be load from this file.
+ *
+ * valueType_description must be use only to specify an XML File path to describe specific valuetypes.
+ *
+ * Note: the 2 files can be created easily with XMLManagers in utils package
+ *
+ */
+public @interface SchemaExtensionDefinition {
+ /**
+ * Get the textual description of this schema
+ *
+ */
+ String schema();
+
+ /**
+ * Get the optional xml file path to have all textual descriptions of
+ * properties defined in this schema
+ */
+ String property_descriptions() default "";
+
+ /**
+ * Get the optional xml file path to have all textual descriptions of value
+ * types defined in this schema
+ */
+ String valueType_description() default "";
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaExtensionDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,552 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.DateType;
+import org.apache.padaf.xmpbox.type.IntegerType;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.apache.padaf.xmpbox.type.ThumbnailType;
+
+
+/**
+ * Representation of XMPBasic Schema
+ *
+ * @author a183132
+ *
+ */
+public class XMPBasicSchema extends XMPSchema {
+
+ public static final String PREFERRED_XMP_PREFIX = "xmp";
+
+ public static final String XMPBASICURI = "http://ns.adobe.com/xap/1.0/";
+
+ @PropertyType(propertyType = "bag Xpath")
+ public static final String ADVISORY = "Advisory";
+
+ @PropertyType(propertyType = "URL")
+ public static final String BASEURL = "BaseURL";
+
+ @PropertyType(propertyType = "Date")
+ public static final String CREATEDATE = "CreateDate";
+
+ @PropertyType(propertyType = "Text")
+ public static final String CREATORTOOL = "CreatorTool";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String IDENTIFIER = "Identifier";
+
+ @PropertyType(propertyType = "Text")
+ public static final String LABEL = "Label";
+
+ @PropertyType(propertyType = "Date")
+ public static final String METADATADATE = "MetadataDate";
+
+ @PropertyType(propertyType = "Date")
+ public static final String MODIFYDATE = "ModifyDate";
+
+ @PropertyType(propertyType = "Text")
+ public static final String NICKNAME = "Nickname";
+
+ @PropertyType(propertyType = "Integer")
+ public static final String RATING = "Rating";
+
+ @PropertyType(propertyType = "Alt Thumbnail")
+ public static final String THUMBNAILS = "Thumbnails";
+
+ protected ComplexProperty altThumbs;
+
+ /**
+ * Constructor of XMPBasic schema with preferred prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public XMPBasicSchema(XMPMetadata metadata) {
+ super(metadata, PREFERRED_XMP_PREFIX, XMPBASICURI);
+
+ }
+
+ /**
+ * Constructor of XMPBasic schema with specified prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param ownPrefix
+ * The prefix to assign
+ */
+ public XMPBasicSchema(XMPMetadata metadata, String ownPrefix) {
+ super(metadata, ownPrefix, XMPBASICURI);
+
+ }
+
+ /**
+ * Add thumbnail to thumbnails list
+ *
+ * @param height
+ * height format
+ * @param width
+ * width format
+ * @param format
+ * thumbnail format
+ * @param img
+ * Image data
+ */
+ public void addThumbnails(Integer height, Integer width, String format,
+ String img) {
+ if (altThumbs == null) {
+ altThumbs = new ComplexProperty(metadata, localPrefix, THUMBNAILS,
+ ComplexProperty.ALTERNATIVE_ARRAY);
+ addProperty(altThumbs);
+ }
+ ThumbnailType thumb = new ThumbnailType(metadata, "rdf", "li");
+ /*
+ * <xapGImg:height>162</xapGImg:height>
+ * <xapGImg:width>216</xapGImg:width>
+ * <xapGImg:format>JPEG</xapGImg:format>
+ * <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD</xapGImg:image>
+ */
+ thumb.setHeight("xapGImg", "height", height);
+ thumb.setWidth("xapGImg", "width", width);
+ thumb.setFormat("xapGImg", "format", format);
+ thumb.setImg("xapGImg", "image", img);
+ altThumbs.getContainer().addProperty(thumb);
+ // SaveMetadataHelper.serialize(metadata, System.out);
+ }
+
+ /**
+ * Add a property specification that were edited outside the authoring
+ * application
+ *
+ * @param xpath
+ * the value to add
+ */
+ public void addToAdvisoryValue(String xpath) {
+ addBagValue(localPrefixSep + ADVISORY, xpath);
+ }
+
+ /**
+ * Set the base URL for relative URLs in the document content
+ *
+ * @param url
+ * the Base url value to set
+ */
+ public void setBaseURLValue(String url) {
+ addProperty(new TextType(metadata, localPrefix, BASEURL, url));
+ }
+
+ /**
+ * Set the base URL property
+ *
+ * @param url
+ * the Base url property to set
+ */
+ public void setBaseURL(TextType url) {
+ addProperty(url);
+ }
+
+ /**
+ * Set the date and time the resource was originally created
+ *
+ * @param date
+ * the value to set
+ */
+ public void setCreateDateValue(Calendar date) {
+ addProperty(new DateType(metadata, localPrefix, CREATEDATE, date));
+ }
+
+ /**
+ * Set the create date property
+ *
+ * @param date
+ * the create date property to set
+ */
+ public void setCreateDate(DateType date) {
+ addProperty(date);
+ }
+
+ /**
+ * set the name of the first known tool used to create this resource
+ *
+ * @param creatorTool
+ * the creator tool value to set
+ */
+ public void setCreatorToolValue(String creatorTool) {
+ addProperty(new TextType(metadata, localPrefix, CREATORTOOL,
+ creatorTool));
+ }
+
+ /**
+ * set the creatorTool property
+ *
+ * @param creatorTool
+ * the creator tool property to set
+ */
+ public void setCreatorTool(TextType creatorTool) {
+ addProperty(creatorTool);
+ }
+
+ /**
+ * Add a text string which unambiguously identify the resource within a
+ * given context
+ *
+ * @param text
+ * the identifier value to add
+ */
+ public void addToIdentifierValue(String text) {
+ addBagValue(localPrefixSep + IDENTIFIER, text);
+ }
+
+ /**
+ * set a word or a short phrase which identifies a document as a member of a
+ * user-defined collection
+ *
+ * @param text
+ * the label value to set
+ */
+ public void setLabelValue(String text) {
+ addProperty(new TextType(metadata, localPrefix, LABEL, text));
+ }
+
+ /**
+ * set the label property
+ *
+ * @param text
+ * the label property to set
+ */
+ public void setLabel(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * Set the date and time that any metadata for this resource was last
+ * changed. (should be equals or more recent than the createDate)
+ *
+ * @param date
+ * the Metadata Date value to set
+ */
+ public void setMetadataDateValue(Calendar date) {
+ addProperty(new DateType(metadata, localPrefix, METADATADATE, date));
+ }
+
+ /**
+ * Set the MetadataDate property
+ *
+ * @param date
+ * the Metadata Date property to set
+ */
+ public void setMetadataDate(DateType date) {
+ addProperty(date);
+ }
+
+ /**
+ * Set the date and time the resource was last modified
+ *
+ * @param date
+ * the Modify Date value to set
+ */
+ public void setModifyDateValue(Calendar date) {
+ addProperty(new DateType(metadata, localPrefix, MODIFYDATE, date));
+ }
+
+ /**
+ * Set the ModifyDate property
+ *
+ * @param date
+ * the Modify Date property to set
+ */
+ public void setModifyDate(DateType date) {
+ addProperty(date);
+ }
+
+ /**
+ * Set a short informal name for the resource
+ *
+ * @param text
+ * the Nickname value to set
+ */
+ public void setNicknameValue(String text) {
+ addProperty(new TextType(metadata, localPrefix, NICKNAME, text));
+ }
+
+ /**
+ * Set the NickName property
+ *
+ * @param text
+ * the Nickname property to set
+ */
+ public void setNickname(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * Set a number that indicates a document's status relative to other
+ * documents, used to organize documents in a file browser (values are
+ * user-defined within an application-defined range)
+ *
+ * @param rate
+ * the rate value to set
+ */
+ public void setRatingValue(Integer rate) {
+ addProperty(new IntegerType(metadata, localPrefix, RATING, rate));
+ }
+
+ /**
+ * Set Rating Property
+ *
+ * @param rate
+ * the rate property to set
+ */
+ public void setRating(IntegerType rate) {
+ addProperty(rate);
+ }
+
+ /**
+ * Get the Advisory property
+ *
+ * @return the advisory property
+ */
+ public ComplexProperty getAdvisory() {
+ return (ComplexProperty) getProperty(localPrefixSep + ADVISORY);
+ }
+
+ /**
+ * Get the Advisory property values
+ *
+ * @return list of adivory values
+ */
+ public List<String> getAdvisoryValue() {
+ return getBagValueList(localPrefixSep + ADVISORY);
+ }
+
+ /**
+ * Get the BaseURL property
+ *
+ * @return the base url property
+ */
+ public TextType getBaseURL() {
+ return (TextType) getProperty(localPrefixSep + BASEURL);
+ }
+
+ /**
+ * Get the BaseURL property value
+ *
+ * @return the base url value
+ */
+ public String getBaseURLValue() {
+ TextType tt = ((TextType) getProperty(localPrefixSep + BASEURL));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Get the CreateDate property
+ *
+ * @return the CreateDate property
+ */
+ public DateType getCreateDate() {
+ return (DateType) getProperty(localPrefixSep + CREATEDATE);
+ }
+
+ /**
+ * Get the CreateDate property value
+ *
+ * @return the CreateDate value
+ */
+ public Calendar getCreateDateValue() {
+ DateType createDate = (DateType) getProperty(localPrefixSep
+ + CREATEDATE);
+ if (createDate != null) {
+ return createDate.getValue();
+ }
+ return null;
+ }
+
+ /**
+ * Get the CreationTool property
+ *
+ * @return the CreationTool property
+ */
+ public TextType getCreatorTool() {
+ return (TextType) getProperty(localPrefixSep + CREATORTOOL);
+ }
+
+ /**
+ * Get the CreationTool property value
+ *
+ * @return the CreationTool value
+ */
+ public String getCreatorToolValue() {
+ TextType tt = ((TextType) getProperty(localPrefixSep + CREATORTOOL));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Get the Identifier property
+ *
+ * @return the Identifier property
+ */
+ public ComplexProperty getIdentifier() {
+ return (ComplexProperty) getProperty(localPrefixSep + IDENTIFIER);
+ }
+
+ /**
+ * Get the Identifier property values
+ *
+ * @return list of all identifier values
+ */
+ public List<String> getIdentifierValue() {
+ return getBagValueList(localPrefixSep + IDENTIFIER);
+ }
+
+ /**
+ * Get the label property
+ *
+ * @return the label property
+ */
+ public TextType getLabel() {
+ return (TextType) getProperty(localPrefixSep + LABEL);
+ }
+
+ /**
+ * Get the label property value
+ *
+ * @return the label value
+ */
+ public String getLabelValue() {
+ TextType tt = ((TextType) getProperty(localPrefixSep + LABEL));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Get the MetadataDate property
+ *
+ * @return the MetadataDate property
+ */
+ public DateType getMetadataDate() {
+ return (DateType) getProperty(localPrefixSep + METADATADATE);
+ }
+
+ /**
+ * Get the MetadataDate property value
+ *
+ * @return the MetadataDate value
+ */
+ public Calendar getMetadataDateValue() {
+ DateType dt = ((DateType) getProperty(localPrefixSep + METADATADATE));
+ return dt == null ? null : dt.getValue();
+ }
+
+ /**
+ * Get the ModifyDate property
+ *
+ * @return the ModifyDate property
+ */
+ public DateType getModifyDate() {
+ return (DateType) getProperty(localPrefixSep + MODIFYDATE);
+ }
+
+ /**
+ * Get the ModifyDate property value
+ *
+ * @return the ModifyDate value
+ */
+ public Calendar getModifyDateValue() {
+ DateType modifyDate = (DateType) getProperty(localPrefixSep
+ + MODIFYDATE);
+ if (modifyDate != null) {
+ return modifyDate.getValue();
+ }
+ return null;
+
+ }
+
+ /**
+ * Get the Nickname property
+ *
+ * @return the Nickname property
+ */
+ public TextType getNickname() {
+ return (TextType) getProperty(localPrefixSep + NICKNAME);
+ }
+
+ /**
+ * Get the Nickname property value
+ *
+ * @return the Nickname value
+ */
+ public String getNicknameValue() {
+ TextType tt = ((TextType) getProperty(localPrefixSep + NICKNAME));
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Get the Rating property
+ *
+ * @return the Rating property
+ */
+ public IntegerType getRating() {
+ return ((IntegerType) getProperty(localPrefixSep + RATING));
+ }
+
+ /**
+ * Get the Rating property value
+ *
+ * @return the Rating value
+ */
+ public Integer getRatingValue() {
+ IntegerType it = ((IntegerType) getProperty(localPrefixSep + RATING));
+ return it == null ? null : it.getValue();
+ }
+
+ /**
+ * Get list of Thumbnails
+ *
+ * @return List of all thumbnails properties defined
+ * @throws BadFieldValueException
+ * if one thumbnail is not thumbnail type
+ */
+ public List<ThumbnailType> getThumbnails() throws BadFieldValueException {
+ List<AbstractField> tmp = getArrayList(localPrefixSep + THUMBNAILS);
+ if (tmp != null) {
+ List<ThumbnailType> thumbs = new ArrayList<ThumbnailType>();
+ for (AbstractField abstractField : tmp) {
+ if (abstractField instanceof ThumbnailType) {
+ thumbs.add((ThumbnailType) abstractField);
+ } else {
+ throw new BadFieldValueException("Thumbnail expected and "
+ + abstractField.getClass().getName() + " found.");
+ }
+ }
+ return thumbs;
+ }
+ return null;
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,713 @@
+/*****************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.TextType;
+
+
+/**
+ * Representation of XMPMediaManagement Schema
+ *
+ * @author gbailleul
+ *
+ */
+public class XMPMediaManagementSchema extends XMPSchema {
+
+ public static final String PREFERRED_XMPMM_PREFIX = "xmpMM";
+
+ public static final String XMPMMURI = "http://ns.adobe.com/xap/1.0/mm/";
+
+ /**
+ * Constructor of XMPMediaManagement Schema with preferred prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public XMPMediaManagementSchema(XMPMetadata metadata) {
+ super(metadata, PREFERRED_XMPMM_PREFIX, XMPMMURI);
+
+ }
+
+ /**
+ * Constructor of XMPMediaManagementSchema schema with specified prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param ownPrefix
+ * The prefix to assign
+ */
+ public XMPMediaManagementSchema(XMPMetadata metadata, String ownPrefix) {
+ super(metadata, ownPrefix, XMPMMURI);
+
+ }
+
+ // -------------------------------- ResourceRef --------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String RESOURCEREF = "ResourceRef";
+
+ /**
+ * Set ResourceRef value
+ *
+ * @param url
+ * resourceRef value to set
+ */
+ public void setResourceRefValue(String url) {
+ setResourceRef(new TextType(metadata, localPrefix, RESOURCEREF, url));
+ }
+
+ /**
+ * Set ResourceRef property
+ *
+ * @param tt
+ * ResourceRef property to set
+ */
+ public void setResourceRef(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get ResourceRef Value
+ *
+ * @return ResourceRef value
+ */
+ public String getResourceRefValue() {
+ TextType tt = getResourceRef();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ /**
+ * Get ResourceRef property
+ *
+ * @return ResourceRef property
+ */
+ public TextType getResourceRef() {
+ return (TextType) getProperty(localPrefixSep + RESOURCEREF);
+ }
+
+ // --------------------------------------- DocumentID
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String DOCUMENTID = "DocumentID";
+
+ /**
+ * Set DocumentId value
+ *
+ * @param url
+ * DocumentId value to set
+ */
+ public void setDocumentIDValue(String url) {
+ setDocumentID(new TextType(metadata, localPrefix, DOCUMENTID, url));
+ }
+
+ /**
+ * Set DocumentId Property
+ *
+ * @param tt
+ * DocumentId Property to set
+ */
+ public void setDocumentID(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get DocumentId property
+ *
+ * @return DocumentId property
+ */
+ public TextType getDocumentID() {
+ return (TextType) getProperty(localPrefixSep + DOCUMENTID);
+ }
+
+ /**
+ * Get DocumentId value
+ *
+ * @return DocumentId value
+ */
+ public String getDocumentIDValue() {
+ TextType tt = getDocumentID();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- Manager
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String MANAGER = "Manager";
+
+ /**
+ * Set Manager value
+ *
+ * @param url
+ * Manager value to set
+ */
+ public void setManagerValue(String url) {
+ setManager(new TextType(metadata, localPrefix, MANAGER, url));
+ }
+
+ /**
+ * Set Manager property
+ *
+ * @param tt
+ * Manager property to set
+ */
+ public void setManager(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get Manager property
+ *
+ * @return Manager property
+ */
+ public TextType getManager() {
+ return (TextType) getProperty(localPrefixSep + MANAGER);
+ }
+
+ /**
+ * Get Manager value
+ *
+ * @return Manager value
+ */
+ public String getManagerValue() {
+ TextType tt = getManager();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- ManageTo
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String MANAGETO = "ManageTo";
+
+ /**
+ * Set ManageTo Value
+ *
+ * @param url
+ * ManageTo Value to set
+ */
+ public void setManageToValue(String url) {
+ setManageTo(new TextType(metadata, localPrefix, MANAGETO, url));
+ }
+
+ /**
+ * Set ManageTo property
+ *
+ * @param tt
+ * ManageTo property to set
+ */
+ public void setManageTo(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * get ManageTo property
+ *
+ * @return ManageTo property
+ */
+ public TextType getManageTo() {
+ return (TextType) getProperty(localPrefixSep + MANAGETO);
+ }
+
+ /**
+ * get ManageTo value
+ *
+ * @return ManageTo value
+ */
+ public String getManageToValue() {
+ TextType tt = getManageTo();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- ManageUI
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String MANAGEUI = "ManageUI";
+
+ /**
+ * Set ManageUI value
+ *
+ * @param url
+ * ManageUI value to set
+ */
+ public void setManageUIValue(String url) {
+ setManageUI(new TextType(metadata, localPrefix, MANAGEUI, url));
+ }
+
+ /**
+ * Set ManageUI property
+ *
+ * @param tt
+ * ManageUI property to set
+ */
+ public void setManageUI(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get ManageUI property
+ *
+ * @return ManageUI property
+ */
+ public TextType getManageUI() {
+ return (TextType) getProperty(localPrefixSep + MANAGEUI);
+ }
+
+ /**
+ * Get ManageUI Value
+ *
+ * @return ManageUI Value
+ */
+ public String getManageUIValue() {
+ TextType tt = getManageUI();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- ManagerVariant
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String MANAGERVARIANT = "ManagerVariant";
+
+ /**
+ * Set ManagerVariant value
+ *
+ * @param url
+ * ManagerVariant value to set
+ */
+ public void setManagerVariantValue(String url) {
+ setManagerVariant(new TextType(metadata, localPrefix, MANAGERVARIANT,
+ url));
+ }
+
+ /**
+ * Set ManagerVariant Property
+ *
+ * @param tt
+ * ManagerVariant Property to set
+ */
+ public void setManagerVariant(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get ManagerVariant property
+ *
+ * @return ManagerVariant property
+ */
+ public TextType getManagerVariant() {
+ return (TextType) getProperty(localPrefixSep + MANAGERVARIANT);
+ }
+
+ /**
+ * Get ManagerVariant value
+ *
+ * @return ManagerVariant value
+ */
+ public String getManagerVariantValue() {
+ TextType tt = getManagerVariant();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- InstanceID
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String INSTANCEID = "InstanceID";
+
+ /**
+ * Set InstanceId value
+ *
+ * @param url
+ * InstanceId value to set
+ */
+ public void setInstanceIDValue(String url) {
+ setInstanceID(new TextType(metadata, localPrefix, INSTANCEID, url));
+ }
+
+ /**
+ * Set InstanceId property
+ *
+ * @param tt
+ * InstanceId property to set
+ */
+ public void setInstanceID(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get InstanceId property
+ *
+ * @return InstanceId property
+ */
+ public TextType getInstanceID() {
+ return (TextType) getProperty(localPrefixSep + INSTANCEID);
+ }
+
+ /**
+ * Get InstanceId value
+ *
+ * @return InstanceId value
+ */
+ public String getInstanceIDValue() {
+ TextType tt = getInstanceID();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- ManageFrom
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String MANAGEFROM = "ManageFrom";
+
+ /**
+ * set ManageFrom Value
+ *
+ * @param url
+ * ManageFrom Value to set
+ */
+ public void setManageFromValue(String url) {
+ setManageFrom(new TextType(metadata, localPrefix, MANAGEFROM, url));
+ }
+
+ /**
+ * set ManageFrom Property
+ *
+ * @param tt
+ * ManageFrom Property to set
+ */
+ public void setManageFrom(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * get ManageFrom Property
+ *
+ * @return ManageFrom Property
+ */
+ public TextType getManageFrom() {
+ return (TextType) getProperty(localPrefixSep + MANAGEFROM);
+ }
+
+ /**
+ * Get ManageFrom value
+ *
+ * @return ManageFrom value
+ */
+ public String getManageFromValue() {
+ TextType tt = getManageFrom();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- OriginalDocumentID
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String ORIGINALDOCUMENTID = "OriginalDocumentID";
+
+ /**
+ * Set OriginalDocumentId value
+ *
+ * @param url
+ * OriginalDocumentId value to set
+ */
+ public void setOriginalDocumentIDValue(String url) {
+ setOriginalDocumentID(new TextType(metadata, localPrefix,
+ ORIGINALDOCUMENTID, url));
+ }
+
+ /**
+ * Set OriginalDocumentId property
+ *
+ * @param tt
+ * OriginalDocumentId property to set
+ */
+ public void setOriginalDocumentID(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get OriginalDocumentId property
+ *
+ * @return OriginalDocumentId property
+ */
+ public TextType getOriginalDocumentID() {
+ return (TextType) getProperty(localPrefixSep + ORIGINALDOCUMENTID);
+ }
+
+ /**
+ * Get OriginalDocumentId value
+ *
+ * @return OriginalDocumentId value
+ */
+ public String getOriginalDocumentIDValue() {
+ TextType tt = getOriginalDocumentID();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- RenditionClass
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String RENDITIONCLASS = "RenditionClass";
+
+ /**
+ * Set renditionClass Value
+ *
+ * @param url
+ * renditionClass Value to set
+ */
+ public void setRenditionClassValue(String url) {
+ setRenditionClass(new TextType(metadata, localPrefix, RENDITIONCLASS,
+ url));
+ }
+
+ /**
+ * Set RenditionClass Property
+ *
+ * @param tt
+ * renditionClass Property to set
+ */
+ public void setRenditionClass(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get RenditionClass property
+ *
+ * @return RenditionClass property
+ */
+ public TextType getRenditionClass() {
+ return (TextType) getProperty(localPrefixSep + RENDITIONCLASS);
+ }
+
+ /**
+ * Get RenditionClass value
+ *
+ * @return RenditionClass value
+ */
+ public String getRenditionClassValue() {
+ TextType tt = getRenditionClass();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- RenditionParams
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String RENDITIONPARAMS = "RenditionParams";
+
+ /**
+ * Set RenditionParams Value
+ *
+ * @param url
+ * RenditionParams Value to set
+ */
+ public void setRenditionParamsValue(String url) {
+ setRenditionParams(new TextType(metadata, localPrefix, RENDITIONPARAMS,
+ url));
+ }
+
+ /**
+ * Set RenditionParams property
+ *
+ * @param tt
+ * RenditionParams property to set
+ */
+ public void setRenditionParams(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get RenditionParams property
+ *
+ * @return RenditionParams property
+ */
+ public TextType getRenditionParams() {
+ return (TextType) getProperty(localPrefixSep + RENDITIONPARAMS);
+ }
+
+ /**
+ * Get RenditionParams value
+ *
+ * @return RenditionParams value
+ */
+ public String getRenditionParamsValue() {
+ TextType tt = getRenditionParams();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- VersionID
+ // ----------------------------
+
+ @PropertyType(propertyType = "Text")
+ public static final String VERSIONID = "VersionID";
+
+ /**
+ * Set VersionId value
+ *
+ * @param url
+ * VersionId value to set
+ */
+ public void setVersionIDValue(String url) {
+ setVersionID(new TextType(metadata, localPrefix, VERSIONID, url));
+ }
+
+ /**
+ * Set VersionId property
+ *
+ * @param tt
+ * VersionId property to set
+ */
+ public void setVersionID(TextType tt) {
+ addProperty(tt);
+ }
+
+ /**
+ * Get VersionId property
+ *
+ * @return VersionId property
+ */
+ public TextType getVersionID() {
+ return (TextType) getProperty(localPrefixSep + VERSIONID);
+ }
+
+ /**
+ * Get VersionId value
+ *
+ * @return VersionId value
+ */
+ public String getVersionIDValue() {
+ TextType tt = getVersionID();
+ return tt != null ? tt.getStringValue() : null;
+ }
+
+ // --------------------------------------- Versions
+ // ----------------------------
+
+ @PropertyType(propertyType = "seq Text")
+ public static final String VERSIONS = "Versions";
+
+ /**
+ * Add a version value
+ *
+ * @param version
+ * version value to set
+ */
+ public void addToVersionsValue(String version) {
+ addSequenceValue(localPrefixSep + VERSIONS, version);
+ }
+
+ /**
+ * Get Versions property
+ *
+ * @return version property to set
+ */
+ public ComplexProperty getVersions() {
+ return (ComplexProperty) getProperty(localPrefixSep + VERSIONS);
+ }
+
+ /**
+ * Get List of Versions values
+ *
+ * @return List of Versions values
+ */
+ public List<String> getVersionsValue() {
+ return getSequenceValueList(localPrefixSep + VERSIONS);
+ }
+
+ // --------------------------------------- History
+ // ----------------------------
+
+// @PropertyType(propertyType = "seq Text")
+ @PropertyType(propertyType = "Unmanaged")
+ public static final String HISTORY = "History";
+
+ /**
+ * Add a History Value
+ *
+ * @param history
+ * History Value to add
+ */
+ public void addToHistoryValue(String history) {
+ addSequenceValue(localPrefixSep + HISTORY, history);
+ }
+
+ /**
+ * Get History Property
+ *
+ * @return History Property
+ */
+ public ComplexProperty getHistory() {
+ return (ComplexProperty) getProperty(localPrefixSep + HISTORY);
+ }
+
+ /**
+ * Get List of History values
+ *
+ * @return List of History values
+ */
+ public List<String> getHistoryValue() {
+ return getSequenceValueList(localPrefixSep + HISTORY);
+ }
+
+ // --------------------------------------- Ingredients
+ // ----------------------------
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String INGREDIENTS = "Ingredients";
+
+ /**
+ * Add an Ingredients value
+ *
+ * @param ingredients
+ * Ingredients value to add
+ */
+ public void addToIngredientsValue(String ingredients) {
+ addBagValue(localPrefixSep + INGREDIENTS, ingredients);
+ }
+
+ /**
+ * . Get Ingredients Property
+ *
+ * @return Ingredients property
+ */
+ public ComplexProperty getIngredients() {
+ return (ComplexProperty) getProperty(localPrefixSep + INGREDIENTS);
+ }
+
+ /**
+ * Get List of Ingredients values
+ *
+ * @return List of Ingredients values
+ */
+ public List<String> getIngredientsValue() {
+ return getBagValueList(localPrefixSep + INGREDIENTS);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
------------------------------------------------------------------------------
svn:eol-style = native