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 2012/08/27 21:36:51 UTC
svn commit: r1377804 [1/2] - in
/pdfbox/branches/xmpbox-refactoring/xmpbox/src:
main/java/org/apache/padaf/xmpbox/ main/java/org/apache/padaf/xmpbox/parser/
main/java/org/apache/padaf/xmpbox/schema/
main/java/org/apache/padaf/xmpbox/type/ test/java/org...
Author: gbailleul
Date: Mon Aug 27 19:36:50 2012
New Revision: 1377804
URL: http://svn.apache.org/viewvc?rev=1377804&view=rev
Log:
PDFBOX-1343: Mutualize StructuredType and schema behaviours
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractComplexProperty.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java Mon Aug 27 19:36:50 2012
@@ -233,7 +233,7 @@ public class XMPMetadata {
XMPSchema tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getNamespaceValue().equals(nsURI)) {
+ if (tmp.getNamespace().equals(nsURI)) {
return tmp;
}
}
@@ -256,7 +256,7 @@ public class XMPMetadata {
XMPSchema tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getNamespaceValue().equals(nsURI)
+ if (tmp.getNamespace().equals(nsURI)
&& tmp.getPrefix().equals(prefix)) {
return tmp;
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java Mon Aug 27 19:36:50 2012
@@ -204,7 +204,7 @@ public class XMPDocumentBuilder {
throws XmpRequiredPropertyException,XmpUnknownValueTypeException,XmpUnexpectedNamespacePrefixException {
List<XMPSchema> schems = meta.getAllSchemas();
for (XMPSchema xmpSchema : schems) {
- if (xmpSchema.getNamespaceValue().equals(PDFAExtensionSchema.PDFAEXTENSIONURI)) {
+ if (xmpSchema.getNamespace().equals(PDFAExtensionSchema.PDFAEXTENSIONURI)) {
// ensure the prefix is the preferred one (cannot use other definition)
if (!xmpSchema.getPrefix().equals(PDFAExtensionSchema.PDFAEXTENSION)) {
throw new XmpUnexpectedNamespacePrefixException("Found invalid prefix for PDF/A extension, found '"+
@@ -594,13 +594,13 @@ public class XMPDocumentBuilder {
*/
private boolean addAttributeAsProperty(XMPMetadata metadata, XMPSchema schema, Attribute attr) {
boolean added = false;
- String schemaNamespace = schema.getNamespaceValue();
+ String schemaNamespace = schema.getNamespace();
String prefix = attr.getPrefix() != null ? attr.getPrefix() : schema.getPrefix();
String type = metadata.getNsMapping().getSpecifiedPropertyType(schemaNamespace, new QName(schemaNamespace, attr.getLocalName(), prefix));
if (type != null) {
AbstractSimpleProperty prop = metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, attr.getLocalName(), attr.getValue(), type);
- schema.getContent().addProperty(prop);
+ schema.addProperty(prop);
added = true;
}
return added;
@@ -904,15 +904,15 @@ public class XMPDocumentBuilder {
String type = getPropertyDeclarationInNamespaces(schema, propertyName);
// found type, manage it
if (type.equals("Lang Alt")) {
- parseSimplePropertyArray(metadata, propertyName, ArrayProperty.ALTERNATIVE_ARRAY, typeMapping.getTypeDescription("Text"), schema.getContent());
+ parseSimplePropertyArray(metadata, propertyName, ArrayProperty.ALTERNATIVE_ARRAY, typeMapping.getTypeDescription("Text"), schema.getContainer());
} else if (typeMapping.isSimpleType(type)) {
TypeDescription<?> tclass = typeMapping.getTypeDescription(type);
- parseSimpleProperty(metadata, propertyName, tclass, schema.getContent());
+ parseSimpleProperty(metadata, propertyName, tclass, schema.getContainer());
} else if (typeMapping.isStructuredType(type)) {
TypeDescription<AbstractStructuredType> tclass = (TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(type);
StructuredPropertyParser parser = new StructuredPropertyParser(
this, tclass);
- parseStructuredProperty(metadata, parser, schema.getContent());
+ parseStructuredProperty(metadata, parser, schema.getContainer());
} else if (typeMapping.getArrayType(type)!=null) {
// retrieve array type and content type
int pos = type.indexOf(' ');
@@ -929,12 +929,12 @@ public class XMPDocumentBuilder {
propertyName,
arrayType,
typeMapping.getTypeDescription(typeInArray),
- schema.getContent());
+ schema.getContainer());
} else if (typeMapping.isStructuredType(typeInArray)) {
// array of structured
StructuredPropertyParser parser = new StructuredPropertyParser(
this, (TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(typeInArray));
- parseStructuredPropertyArray(metadata, propertyName, arrayType, parser, schema.getContent());
+ parseStructuredPropertyArray(metadata, propertyName, arrayType, parser, schema.getContainer());
} else {
// invalid case
throw new XmpUnknownPropertyTypeException("Unknown type : "+type);
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java Mon Aug 27 19:36:50 2012
@@ -87,7 +87,7 @@ public class XmpSerializer {
// prepare schema
Element selem = doc.createElement("rdf:Description");
selem.setAttribute("rdf:about", schema.getAboutValue());
- selem.setAttributeNS(XMPSchema.NS_NAMESPACE, "xmlns:"+schema.getPrefix(), schema.getNamespaceValue());
+ selem.setAttributeNS(XMPSchema.NS_NAMESPACE, "xmlns:"+schema.getPrefix(), schema.getNamespace());
// the other attributes
// List<Attribute> attributes = schema.getAllAttributes();
fillElementWithAttributes(selem, schema.getAllAttributes());
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java Mon Aug 27 19:36:50 2012
@@ -77,7 +77,7 @@ public class AdobePDFSchema extends XMPS
*/
public void setKeywords(String value) {
TextType keywords;
- keywords = new TextType(getMetadata(), null,getLocalPrefix(), KEYWORDS, value);
+ keywords = new TextType(getMetadata(), null,getPrefix(), KEYWORDS, value);
addProperty(keywords);
}
@@ -99,7 +99,7 @@ public class AdobePDFSchema extends XMPS
*/
public void setPDFVersion(String value) {
TextType version;
- version = new TextType(getMetadata(), null,getLocalPrefix(), PDF_VERSION, value);
+ version = new TextType(getMetadata(), null,getPrefix(), PDF_VERSION, value);
addProperty(version);
}
@@ -122,7 +122,7 @@ public class AdobePDFSchema extends XMPS
*/
public void setProducer(String value) {
TextType producer;
- producer = new TextType(getMetadata(),null, getLocalPrefix(), PRODUCER, value);
+ producer = new TextType(getMetadata(),null, getPrefix(), PRODUCER, value);
addProperty(producer);
}
@@ -142,7 +142,7 @@ public class AdobePDFSchema extends XMPS
* @return The property object
*/
public TextType getKeywordsProperty() {
- AbstractField tmp = getUnqualifiedProperty(KEYWORDS);
+ AbstractField tmp = getProperty(KEYWORDS);
if (tmp != null) {
if (tmp instanceof TextType) {
return (TextType) tmp;
@@ -157,7 +157,7 @@ public class AdobePDFSchema extends XMPS
* @return The property value
*/
public String getKeywords() {
- AbstractField tmp = getUnqualifiedProperty(KEYWORDS);
+ AbstractField tmp = getProperty(KEYWORDS);
if (tmp != null) {
if (tmp instanceof TextType) {
return ((TextType) tmp).getStringValue();
@@ -172,7 +172,7 @@ public class AdobePDFSchema extends XMPS
* @return The property object
*/
public TextType getPDFVersionProperty() {
- AbstractField tmp = getUnqualifiedProperty(PDF_VERSION);
+ AbstractField tmp = getProperty(PDF_VERSION);
if (tmp != null) {
if (tmp instanceof TextType) {
return (TextType) tmp;
@@ -187,7 +187,7 @@ public class AdobePDFSchema extends XMPS
* @return The property value
*/
public String getPDFVersion() {
- AbstractField tmp = getUnqualifiedProperty(PDF_VERSION);
+ AbstractField tmp = getProperty(PDF_VERSION);
if (tmp != null) {
if (tmp instanceof TextType) {
return ((TextType) tmp).getStringValue();
@@ -202,7 +202,7 @@ public class AdobePDFSchema extends XMPS
* @return The property object
*/
public TextType getProducerProperty() {
- AbstractField tmp = getUnqualifiedProperty(PRODUCER);
+ AbstractField tmp = getProperty(PRODUCER);
if (tmp != null) {
if (tmp instanceof TextType) {
return (TextType) tmp;
@@ -217,7 +217,7 @@ public class AdobePDFSchema extends XMPS
* @return The property value
*/
public String getProducer() {
- AbstractField tmp = getUnqualifiedProperty(PRODUCER);
+ AbstractField tmp = getProperty(PRODUCER);
if (tmp != null) {
if (tmp instanceof TextType) {
return ((TextType) tmp).getStringValue();
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java Mon Aug 27 19:36:50 2012
@@ -132,7 +132,7 @@ public class DublinCoreSchema extends XM
* Value to set
*/
public void setCoverage(String text) {
- addProperty(new TextType(getMetadata(), null, getLocalPrefix(), COVERAGE, text));
+ addProperty(new TextType(getMetadata(), null, getPrefix(), COVERAGE, text));
}
/**
@@ -218,7 +218,7 @@ public class DublinCoreSchema extends XM
* Value to set
*/
public void setFormat(String mimeType) {
- addProperty(new TextType(getMetadata(), null, getLocalPrefix(), FORMAT, mimeType));
+ addProperty(new TextType(getMetadata(), null, getPrefix(), FORMAT, mimeType));
}
/**
@@ -228,7 +228,7 @@ public class DublinCoreSchema extends XM
* Value to set
*/
public void setIdentifier(String text) {
- addProperty(new TextType(getMetadata(), null, getLocalPrefix(), IDENTIFIER, text));
+ addProperty(new TextType(getMetadata(), null, getPrefix(), IDENTIFIER, text));
}
/**
@@ -326,7 +326,7 @@ public class DublinCoreSchema extends XM
* Value to set
*/
public void setSource(String text) {
- addProperty(new TextType(getMetadata(), null, getLocalPrefix(), SOURCE, text));
+ addProperty(new TextType(getMetadata(), null, getPrefix(), SOURCE, text));
}
/**
@@ -413,7 +413,7 @@ public class DublinCoreSchema extends XM
* @return Contributor property
*/
public ArrayProperty getContributorsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(CONTRIBUTOR);
+ return (ArrayProperty) getProperty(CONTRIBUTOR);
}
/**
@@ -432,7 +432,7 @@ public class DublinCoreSchema extends XM
* @return Coverage property
*/
public TextType getCoverageProperty() {
- return (TextType) getUnqualifiedProperty(COVERAGE);
+ return (TextType) getProperty(COVERAGE);
}
/**
@@ -441,7 +441,7 @@ public class DublinCoreSchema extends XM
* @return Coverage value
*/
public String getCoverage() {
- TextType tt = (TextType) getUnqualifiedProperty(COVERAGE);
+ TextType tt = (TextType) getProperty(COVERAGE);
return tt == null ? null : tt.getStringValue();
}
@@ -451,7 +451,7 @@ public class DublinCoreSchema extends XM
* @return Creator property
*/
public ArrayProperty getCreatorsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(CREATOR);
+ return (ArrayProperty) getProperty(CREATOR);
}
/**
@@ -469,7 +469,7 @@ public class DublinCoreSchema extends XM
* @return date property
*/
public ArrayProperty getDatesProperty() {
- return (ArrayProperty) getUnqualifiedProperty(DATE);
+ return (ArrayProperty) getProperty(DATE);
}
/**
@@ -487,7 +487,7 @@ public class DublinCoreSchema extends XM
* @return Description property
*/
public ArrayProperty getDescriptionProperty() {
- return (ArrayProperty) getUnqualifiedProperty(DESCRIPTION);
+ return (ArrayProperty) getProperty(DESCRIPTION);
}
/**
@@ -528,7 +528,7 @@ public class DublinCoreSchema extends XM
* @return the format property
*/
public TextType getFormatProperty() {
- return (TextType) getUnqualifiedProperty(FORMAT);
+ return (TextType) getProperty(FORMAT);
}
/**
@@ -537,7 +537,7 @@ public class DublinCoreSchema extends XM
* @return the format value
*/
public String getFormat() {
- TextType tt = (TextType) getUnqualifiedProperty(FORMAT);
+ TextType tt = (TextType) getProperty(FORMAT);
return tt == null ? null : tt.getStringValue();
}
@@ -547,7 +547,7 @@ public class DublinCoreSchema extends XM
* @return the identifier property
*/
public TextType getIdentifierProperty() {
- return (TextType) getUnqualifiedProperty(IDENTIFIER);
+ return (TextType) getProperty(IDENTIFIER);
}
/**
@@ -556,7 +556,7 @@ public class DublinCoreSchema extends XM
* @return the unique identifier value
*/
public String getIdentifier() {
- TextType tt = (TextType) getUnqualifiedProperty(IDENTIFIER);
+ TextType tt = (TextType) getProperty(IDENTIFIER);
return tt == null ? null : tt.getStringValue();
}
@@ -566,7 +566,7 @@ public class DublinCoreSchema extends XM
* @return language property
*/
public ArrayProperty getLanguagesProperty() {
- return (ArrayProperty) getUnqualifiedProperty(LANGUAGE);
+ return (ArrayProperty) getProperty(LANGUAGE);
}
/**
@@ -584,7 +584,7 @@ public class DublinCoreSchema extends XM
* @return publisher property
*/
public ArrayProperty getPublishersProperty() {
- return (ArrayProperty) getUnqualifiedProperty(PUBLISHER);
+ return (ArrayProperty) getProperty(PUBLISHER);
}
/**
@@ -602,7 +602,7 @@ public class DublinCoreSchema extends XM
* @return relation property
*/
public ArrayProperty getRelationsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(RELATION);
+ return (ArrayProperty) getProperty(RELATION);
}
/**
@@ -630,7 +630,7 @@ public class DublinCoreSchema extends XM
* @return rights property
*/
public ArrayProperty getRightsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(RIGHTS);
+ return (ArrayProperty) getProperty(RIGHTS);
}
/**
@@ -669,7 +669,7 @@ public class DublinCoreSchema extends XM
* @return source property
*/
public TextType getSourceProperty() {
- return (TextType) getUnqualifiedProperty(SOURCE);
+ return (TextType) getProperty(SOURCE);
}
/**
@@ -678,7 +678,7 @@ public class DublinCoreSchema extends XM
* @return value of source property
*/
public String getSource() {
- TextType tt = (TextType) getUnqualifiedProperty(SOURCE);
+ TextType tt = (TextType) getProperty(SOURCE);
return tt == null ? null : tt.getStringValue();
}
@@ -688,7 +688,7 @@ public class DublinCoreSchema extends XM
* @return the subject property
*/
public ArrayProperty getSubjectsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(SUBJECT);
+ return (ArrayProperty) getProperty(SUBJECT);
}
/**
@@ -706,7 +706,7 @@ public class DublinCoreSchema extends XM
* @return the title property
*/
public ArrayProperty getTitleProperty() {
- return (ArrayProperty) getUnqualifiedProperty(TITLE);
+ return (ArrayProperty) getProperty(TITLE);
}
/**
@@ -746,7 +746,7 @@ public class DublinCoreSchema extends XM
* @return the type property
*/
public ArrayProperty getTypesProperty() {
- return (ArrayProperty) getUnqualifiedProperty(TYPE);
+ return (ArrayProperty) getProperty(TYPE);
}
/**
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java Mon Aug 27 19:36:50 2012
@@ -80,7 +80,7 @@ public class PDFAExtensionSchema extends
* @return the list of subject values
*/
public ArrayProperty getSchemasProperty() {
- return (ArrayProperty) getUnqualifiedProperty(SCHEMAS);
+ return (ArrayProperty) getProperty(SCHEMAS);
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java Mon Aug 27 19:36:50 2012
@@ -39,7 +39,7 @@ import org.apache.padaf.xmpbox.type.Text
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")
@@ -91,7 +91,6 @@ public class PDFAIdentificationSchema ex
* The version Id value to set
*/
public void setPartValueWithInt(int value) {
-// IntegerType part = new IntegerType(metadata, IDPREFIX, PART, value);
IntegerType part = (IntegerType)instanciateSimple(PART, value);
addProperty(part);
}
@@ -188,7 +187,7 @@ public class PDFAIdentificationSchema ex
return null;
} else {
for (Attribute attribute : getAllAttributes()) {
- if (attribute.getQualifiedName().equals(IDPREFIXSEP + PART)) {
+ if (attribute.getQualifiedName().equals(PART)) {
return Integer.valueOf(attribute.getValue());
}
}
@@ -203,7 +202,7 @@ public class PDFAIdentificationSchema ex
* @return Part property
*/
public IntegerType getPartProperty() {
- AbstractField tmp = getProperty(IDPREFIXSEP + PART);
+ AbstractField tmp = getProperty(PART);
if (tmp != null) {
if (tmp instanceof IntegerType) {
return (IntegerType) tmp;
@@ -218,7 +217,7 @@ public class PDFAIdentificationSchema ex
* @return Amendment value
*/
public String getAmendment() {
- AbstractField tmp = getProperty(IDPREFIXSEP + AMD);
+ AbstractField tmp = getProperty(AMD);
if (tmp != null) {
if (tmp instanceof TextType) {
return ((TextType) tmp).getStringValue();
@@ -233,7 +232,7 @@ public class PDFAIdentificationSchema ex
* @return Amendment property
*/
public TextType getAmdProperty() {
- AbstractField tmp = getProperty(IDPREFIXSEP + AMD);
+ AbstractField tmp = getProperty(AMD);
if (tmp != null) {
if (tmp instanceof TextType) {
return (TextType) tmp;
@@ -251,7 +250,7 @@ public class PDFAIdentificationSchema ex
TextType tmp = getAmdProperty();
if (tmp==null) {
for (Attribute attribute : getAllAttributes()) {
- if (attribute.getQualifiedName().equals(IDPREFIXSEP + AMD)) {
+ if (attribute.getQualifiedName().equals(AMD)) {
return attribute.getValue();
}
}
@@ -267,7 +266,7 @@ public class PDFAIdentificationSchema ex
* @return conformance property
*/
public TextType getConformanceProperty() {
- AbstractField tmp = getProperty(IDPREFIXSEP + CONFORMANCE);
+ AbstractField tmp = getProperty(CONFORMANCE);
if (tmp != null) {
if (tmp instanceof TextType) {
return (TextType) tmp;
@@ -285,7 +284,7 @@ public class PDFAIdentificationSchema ex
TextType tt = getConformanceProperty();
if (tt==null) {
for (Attribute attribute : getAllAttributes()) {
- if (attribute.getQualifiedName().equals(IDPREFIXSEP + CONFORMANCE)) {
+ if (attribute.getQualifiedName().equals(CONFORMANCE)) {
return attribute.getValue();
}
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java Mon Aug 27 19:36:50 2012
@@ -113,11 +113,11 @@ public class PhotoshopSchema extends XMP
public static final String URGENCY = "Urgency";
public URIType getAncestorIDProperty() {
- return (URIType) getUnqualifiedProperty(ANCESTORID);
+ return (URIType) getProperty(ANCESTORID);
}
public String getAncestorID() {
- TextType tt = ((TextType) getUnqualifiedProperty(ANCESTORID));
+ TextType tt = ((TextType) getProperty(ANCESTORID));
return tt == null ? null : tt.getStringValue();
}
@@ -131,11 +131,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getAuthorsPositionProperty() {
- return (TextType) getUnqualifiedProperty(AUTHORS_POSITION);
+ return (TextType) getProperty(AUTHORS_POSITION);
}
public String getAuthorsPosition() {
- TextType tt = ((TextType) getUnqualifiedProperty(AUTHORS_POSITION));
+ TextType tt = ((TextType) getProperty(AUTHORS_POSITION));
return tt == null ? null : tt.getStringValue();
}
@@ -149,11 +149,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getCaptionWriterProperty() {
- return (TextType) getUnqualifiedProperty(CAPTION_WRITER);
+ return (TextType) getProperty(CAPTION_WRITER);
}
public String getCaptionWriter() {
- TextType tt = ((TextType) getUnqualifiedProperty(CAPTION_WRITER));
+ TextType tt = ((TextType) getProperty(CAPTION_WRITER));
return tt == null ? null : tt.getStringValue();
}
@@ -167,11 +167,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getCategoryProperty() {
- return (TextType) getUnqualifiedProperty(CATEGORY);
+ return (TextType) getProperty(CATEGORY);
}
public String getCategory() {
- TextType tt = ((TextType) getUnqualifiedProperty(CATEGORY));
+ TextType tt = ((TextType) getProperty(CATEGORY));
return tt == null ? null : tt.getStringValue();
}
@@ -185,11 +185,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getCityProperty() {
- return (TextType) getUnqualifiedProperty(CITY);
+ return (TextType) getProperty(CITY);
}
public String getCity() {
- TextType tt = ((TextType) getUnqualifiedProperty(CITY));
+ TextType tt = ((TextType) getProperty(CITY));
return tt == null ? null : tt.getStringValue();
}
@@ -203,11 +203,11 @@ public class PhotoshopSchema extends XMP
}
public IntegerType getColorModeProperty() {
- return (IntegerType) getUnqualifiedProperty(COLOR_MODE);
+ return (IntegerType) getProperty(COLOR_MODE);
}
public Integer getColorMode() {
- IntegerType tt = ((IntegerType) getUnqualifiedProperty(COLOR_MODE));
+ IntegerType tt = ((IntegerType) getProperty(COLOR_MODE));
return tt == null ? null : tt.getValue();
}
@@ -221,11 +221,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getCountryProperty() {
- return (TextType) getUnqualifiedProperty(COUNTRY);
+ return (TextType) getProperty(COUNTRY);
}
public String getCountry() {
- TextType tt = ((TextType) getUnqualifiedProperty(COUNTRY));
+ TextType tt = ((TextType) getProperty(COUNTRY));
return tt == null ? null : tt.getStringValue();
}
@@ -239,11 +239,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getCreditProperty() {
- return (TextType) getUnqualifiedProperty(CREDIT);
+ return (TextType) getProperty(CREDIT);
}
public String getCredit() {
- TextType tt = ((TextType) getUnqualifiedProperty(CREDIT));
+ TextType tt = ((TextType) getProperty(CREDIT));
return tt == null ? null : tt.getStringValue();
}
@@ -257,11 +257,11 @@ public class PhotoshopSchema extends XMP
}
public DateType getDateCreatedProperty() {
- return (DateType) getUnqualifiedProperty(DATE_CREATED);
+ return (DateType) getProperty(DATE_CREATED);
}
public String getDateCreated() {
- TextType tt = ((TextType) getUnqualifiedProperty(DATE_CREATED));
+ TextType tt = ((TextType) getProperty(DATE_CREATED));
return tt == null ? null : tt.getStringValue();
}
@@ -279,7 +279,7 @@ public class PhotoshopSchema extends XMP
}
public ArrayProperty getDocumentAncestorsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(DOCUMENT_ANCESTORS);
+ return (ArrayProperty) getProperty(DOCUMENT_ANCESTORS);
}
public List<String> getDocumentAncestors() {
@@ -287,11 +287,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getHeadlineProperty() {
- return (TextType) getUnqualifiedProperty(HEADLINE);
+ return (TextType) getProperty(HEADLINE);
}
public String getHeadline() {
- TextType tt = ((TextType) getUnqualifiedProperty(HEADLINE));
+ TextType tt = ((TextType) getProperty(HEADLINE));
return tt == null ? null : tt.getStringValue();
}
@@ -305,11 +305,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getHistoryProperty() {
- return (TextType) getUnqualifiedProperty(HISTORY);
+ return (TextType) getProperty(HISTORY);
}
public String getHistory() {
- TextType tt = ((TextType) getUnqualifiedProperty(HISTORY));
+ TextType tt = ((TextType) getProperty(HISTORY));
return tt == null ? null : tt.getStringValue();
}
@@ -323,11 +323,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getICCProfileProperty() {
- return (TextType) getUnqualifiedProperty(ICC_PROFILE);
+ return (TextType) getProperty(ICC_PROFILE);
}
public String getICCProfile() {
- TextType tt = ((TextType) getUnqualifiedProperty(ICC_PROFILE));
+ TextType tt = ((TextType) getProperty(ICC_PROFILE));
return tt == null ? null : tt.getStringValue();
}
@@ -341,11 +341,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getInstructionsProperty() {
- return (TextType) getUnqualifiedProperty(INSTRUCTIONS);
+ return (TextType) getProperty(INSTRUCTIONS);
}
public String getInstructions() {
- TextType tt = ((TextType) getUnqualifiedProperty(INSTRUCTIONS));
+ TextType tt = ((TextType) getProperty(INSTRUCTIONS));
return tt == null ? null : tt.getStringValue();
}
@@ -360,11 +360,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getSourceProperty() {
- return (TextType) getUnqualifiedProperty(SOURCE);
+ return (TextType) getProperty(SOURCE);
}
public String getSource() {
- TextType tt = ((TextType) getUnqualifiedProperty(SOURCE));
+ TextType tt = ((TextType) getProperty(SOURCE));
return tt == null ? null : tt.getStringValue();
}
@@ -378,11 +378,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getStateProperty() {
- return (TextType) getUnqualifiedProperty(STATE);
+ return (TextType) getProperty(STATE);
}
public String getState() {
- TextType tt = ((TextType) getUnqualifiedProperty(STATE));
+ TextType tt = ((TextType) getProperty(STATE));
return tt == null ? null : tt.getStringValue();
}
@@ -420,7 +420,7 @@ public class PhotoshopSchema extends XMP
public ArrayProperty getSupplementalCategoriesProperty() {
- return (ArrayProperty) getUnqualifiedProperty(SUPPLEMENTAL_CATEGORIES);
+ return (ArrayProperty) getProperty(SUPPLEMENTAL_CATEGORIES);
}
public List<String> getSupplementalCategories() {
@@ -429,7 +429,7 @@ public class PhotoshopSchema extends XMP
public void addTextLayers(String layerName, String layerText) {
if (seqLayer == null) {
- seqLayer = new ArrayProperty(getMetadata(), null, getLocalPrefix(), TEXT_LAYERS,
+ seqLayer = new ArrayProperty(getMetadata(), null, getPrefix(), TEXT_LAYERS,
ArrayProperty.ORDERED_ARRAY);
addProperty(seqLayer);
}
@@ -458,11 +458,11 @@ public class PhotoshopSchema extends XMP
}
public TextType getTransmissionReferenceProperty() {
- return (TextType) getUnqualifiedProperty(TRANSMISSION_REFERENCE);
+ return (TextType) getProperty(TRANSMISSION_REFERENCE);
}
public String getTransmissionReference() {
- TextType tt = ((TextType) getUnqualifiedProperty(TRANSMISSION_REFERENCE));
+ TextType tt = ((TextType) getProperty(TRANSMISSION_REFERENCE));
return tt == null ? null : tt.getStringValue();
}
@@ -476,11 +476,11 @@ public class PhotoshopSchema extends XMP
}
public IntegerType getUrgencyProperty() {
- return (IntegerType) getUnqualifiedProperty(URGENCY);
+ return (IntegerType) getProperty(URGENCY);
}
public Integer getUrgency() {
- IntegerType tt = ((IntegerType) getUnqualifiedProperty(URGENCY));
+ IntegerType tt = ((IntegerType) getProperty(URGENCY));
return tt == null ? null : tt.getValue();
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java Mon Aug 27 19:36:50 2012
@@ -50,7 +50,7 @@ public class XMPBasicJobTicketSchema ext
public XMPBasicJobTicketSchema(XMPMetadata metadata, String ownPrefix) {
super(metadata, ownPrefix, JOB_TICKET_URI);
- getContent().setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
+ getContainer().setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
JobType.PREFERED_PREFIX, JobType.ELEMENT_NS));
}
@@ -70,7 +70,7 @@ public class XMPBasicJobTicketSchema ext
public void addJob (JobType job) {
// create bag if not existing
if (bagJobs == null) {
- bagJobs = new ArrayProperty(getMetadata(), null, getLocalPrefix(), JOB_REF,
+ bagJobs = new ArrayProperty(getMetadata(), null, getPrefix(), JOB_REF,
ArrayProperty.UNORDERED_ARRAY);
addProperty(bagJobs);
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java Mon Aug 27 19:36:50 2012
@@ -124,7 +124,7 @@ public class XMPBasicSchema extends XMPS
public void addThumbnails(Integer height, Integer width, String format,
String img) {
if (altThumbs == null) {
- altThumbs = new ArrayProperty(getMetadata(), null, getLocalPrefix(), THUMBNAILS,
+ altThumbs = new ArrayProperty(getMetadata(), null, getPrefix(), THUMBNAILS,
ArrayProperty.ALTERNATIVE_ARRAY);
addProperty(altThumbs);
}
@@ -346,7 +346,7 @@ public class XMPBasicSchema extends XMPS
* @return the advisory property
*/
public ArrayProperty getAdvisoryProperty() {
- return (ArrayProperty) getUnqualifiedProperty(ADVISORY);
+ return (ArrayProperty) getProperty(ADVISORY);
}
/**
@@ -376,7 +376,7 @@ public class XMPBasicSchema extends XMPS
* @return the base url property
*/
public TextType getBaseURLProperty() {
- return (TextType) getUnqualifiedProperty(BASEURL);
+ return (TextType) getProperty(BASEURL);
}
/**
@@ -385,7 +385,7 @@ public class XMPBasicSchema extends XMPS
* @return the base url value
*/
public String getBaseURL() {
- TextType tt = ((TextType) getUnqualifiedProperty(BASEURL));
+ TextType tt = ((TextType) getProperty(BASEURL));
return tt == null ? null : tt.getStringValue();
}
@@ -395,7 +395,7 @@ public class XMPBasicSchema extends XMPS
* @return the CreateDate property
*/
public DateType getCreateDateProperty() {
- return (DateType) getUnqualifiedProperty(CREATEDATE);
+ return (DateType) getProperty(CREATEDATE);
}
/**
@@ -404,7 +404,7 @@ public class XMPBasicSchema extends XMPS
* @return the CreateDate value
*/
public Calendar getCreateDate() {
- DateType createDate = (DateType) getUnqualifiedProperty(CREATEDATE);
+ DateType createDate = (DateType) getProperty(CREATEDATE);
if (createDate != null) {
return createDate.getValue();
}
@@ -417,7 +417,7 @@ public class XMPBasicSchema extends XMPS
* @return the CreationTool property
*/
public TextType getCreatorToolProperty() {
- return (TextType) getUnqualifiedProperty(CREATORTOOL);
+ return (TextType) getProperty(CREATORTOOL);
}
/**
@@ -426,7 +426,7 @@ public class XMPBasicSchema extends XMPS
* @return the CreationTool value
*/
public String getCreatorTool() {
- TextType tt = ((TextType) getUnqualifiedProperty(CREATORTOOL));
+ TextType tt = ((TextType) getProperty(CREATORTOOL));
return tt == null ? null : tt.getStringValue();
}
@@ -436,7 +436,7 @@ public class XMPBasicSchema extends XMPS
* @return the Identifier property
*/
public ArrayProperty getIdentifiersProperty() {
- return (ArrayProperty) getUnqualifiedProperty(IDENTIFIER);
+ return (ArrayProperty) getProperty(IDENTIFIER);
}
/**
@@ -454,7 +454,7 @@ public class XMPBasicSchema extends XMPS
* @return the label property
*/
public TextType getLabelProperty() {
- return (TextType) getUnqualifiedProperty(LABEL);
+ return (TextType) getProperty(LABEL);
}
/**
@@ -463,7 +463,7 @@ public class XMPBasicSchema extends XMPS
* @return the label value
*/
public String getLabel() {
- TextType tt = ((TextType) getUnqualifiedProperty(LABEL));
+ TextType tt = ((TextType) getProperty(LABEL));
return tt == null ? null : tt.getStringValue();
}
@@ -473,7 +473,7 @@ public class XMPBasicSchema extends XMPS
* @return the MetadataDate property
*/
public DateType getMetadataDateProperty() {
- return (DateType) getUnqualifiedProperty(METADATADATE);
+ return (DateType) getProperty(METADATADATE);
}
/**
@@ -482,7 +482,7 @@ public class XMPBasicSchema extends XMPS
* @return the MetadataDate value
*/
public Calendar getMetadataDate() {
- DateType dt = ((DateType) getUnqualifiedProperty(METADATADATE));
+ DateType dt = ((DateType) getProperty(METADATADATE));
return dt == null ? null : dt.getValue();
}
@@ -492,7 +492,7 @@ public class XMPBasicSchema extends XMPS
* @return the ModifyDate property
*/
public DateType getModifyDateProperty() {
- return (DateType) getUnqualifiedProperty(MODIFYDATE);
+ return (DateType) getProperty(MODIFYDATE);
}
/**
@@ -501,7 +501,7 @@ public class XMPBasicSchema extends XMPS
* @return the ModifyDate value
*/
public Calendar getModifyDate() {
- DateType modifyDate = (DateType) getUnqualifiedProperty(MODIFYDATE);
+ DateType modifyDate = (DateType) getProperty(MODIFYDATE);
if (modifyDate != null) {
return modifyDate.getValue();
}
@@ -515,7 +515,7 @@ public class XMPBasicSchema extends XMPS
* @return the Nickname property
*/
public TextType getNicknameProperty() {
- return (TextType) getUnqualifiedProperty(NICKNAME);
+ return (TextType) getProperty(NICKNAME);
}
/**
@@ -524,7 +524,7 @@ public class XMPBasicSchema extends XMPS
* @return the Nickname value
*/
public String getNickname() {
- TextType tt = ((TextType) getUnqualifiedProperty(NICKNAME));
+ TextType tt = ((TextType) getProperty(NICKNAME));
return tt == null ? null : tt.getStringValue();
}
@@ -534,7 +534,7 @@ public class XMPBasicSchema extends XMPS
* @return the Rating property
*/
public IntegerType getRatingProperty() {
- return ((IntegerType) getUnqualifiedProperty(RATING));
+ return ((IntegerType) getProperty(RATING));
}
/**
@@ -543,7 +543,7 @@ public class XMPBasicSchema extends XMPS
* @return the Rating value
*/
public Integer getRating() {
- IntegerType it = ((IntegerType) getUnqualifiedProperty(RATING));
+ IntegerType it = ((IntegerType) getProperty(RATING));
return it == null ? null : it.getValue();
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java Mon Aug 27 19:36:50 2012
@@ -91,7 +91,7 @@ public class XMPMediaManagementSchema ex
* @return ResourceRef property
*/
public ResourceRefType getResourceRefProperty() {
- return (ResourceRefType)getUnqualifiedProperty(DERIVED_FROM);
+ return (ResourceRefType)getProperty(DERIVED_FROM);
}
@@ -129,7 +129,7 @@ public class XMPMediaManagementSchema ex
* @return DocumentId property
*/
public TextType getDocumentIDProperty() {
- return (TextType) getUnqualifiedProperty(DOCUMENTID);
+ return (TextType) getProperty(DOCUMENTID);
}
/**
@@ -175,7 +175,7 @@ public class XMPMediaManagementSchema ex
* @return Manager property
*/
public TextType getManagerProperty() {
- return (TextType) getUnqualifiedProperty(MANAGER);
+ return (TextType) getProperty(MANAGER);
}
/**
@@ -221,7 +221,7 @@ public class XMPMediaManagementSchema ex
* @return ManageTo property
*/
public TextType getManageToProperty() {
- return (TextType) getUnqualifiedProperty(MANAGETO);
+ return (TextType) getProperty(MANAGETO);
}
/**
@@ -267,7 +267,7 @@ public class XMPMediaManagementSchema ex
* @return ManageUI property
*/
public TextType getManageUIProperty() {
- return (TextType) getUnqualifiedProperty(MANAGEUI);
+ return (TextType) getProperty(MANAGEUI);
}
/**
@@ -313,7 +313,7 @@ public class XMPMediaManagementSchema ex
* @return ManagerVariant property
*/
public TextType getManagerVariantProperty() {
- return (TextType) getUnqualifiedProperty(MANAGERVARIANT);
+ return (TextType) getProperty(MANAGERVARIANT);
}
/**
@@ -359,7 +359,7 @@ public class XMPMediaManagementSchema ex
* @return InstanceId property
*/
public TextType getInstanceIDProperty() {
- return (TextType) getUnqualifiedProperty(INSTANCEID);
+ return (TextType) getProperty(INSTANCEID);
}
/**
@@ -405,7 +405,7 @@ public class XMPMediaManagementSchema ex
* @return ManageFrom Property
*/
public ResourceRefType getManagedFromProperty() {
- return (ResourceRefType) getUnqualifiedProperty(MANAGED_FROM);
+ return (ResourceRefType) getProperty(MANAGED_FROM);
}
// /**
@@ -451,7 +451,7 @@ public class XMPMediaManagementSchema ex
* @return OriginalDocumentId property
*/
public TextType getOriginalDocumentIDProperty() {
- return (TextType) getUnqualifiedProperty(ORIGINALDOCUMENTID);
+ return (TextType) getProperty(ORIGINALDOCUMENTID);
}
/**
@@ -497,7 +497,7 @@ public class XMPMediaManagementSchema ex
* @return RenditionClass property
*/
public TextType getRenditionClassProperty() {
- return (TextType) getUnqualifiedProperty(RENDITIONCLASS);
+ return (TextType) getProperty(RENDITIONCLASS);
}
/**
@@ -543,7 +543,7 @@ public class XMPMediaManagementSchema ex
* @return RenditionParams property
*/
public TextType getRenditionParamsProperty() {
- return (TextType) getUnqualifiedProperty(RENDITIONPARAMS);
+ return (TextType) getProperty(RENDITIONPARAMS);
}
/**
@@ -589,7 +589,7 @@ public class XMPMediaManagementSchema ex
* @return VersionId property
*/
public TextType getVersionIDProperty() {
- return (TextType) getUnqualifiedProperty(VERSIONID);
+ return (TextType) getProperty(VERSIONID);
}
/**
@@ -624,7 +624,7 @@ public class XMPMediaManagementSchema ex
* @return version property to set
*/
public ArrayProperty getVersionsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(VERSIONS);
+ return (ArrayProperty) getProperty(VERSIONS);
}
// --------------------------------------- History
@@ -649,7 +649,7 @@ public class XMPMediaManagementSchema ex
* @return History Property
*/
public ArrayProperty getHistoryProperty() {
- return (ArrayProperty) getUnqualifiedProperty(HISTORY);
+ return (ArrayProperty) getProperty(HISTORY);
}
/**
@@ -683,7 +683,7 @@ public class XMPMediaManagementSchema ex
* @return Ingredients property
*/
public ArrayProperty getIngredientsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(INGREDIENTS);
+ return (ArrayProperty) getProperty(INGREDIENTS);
}
/**
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java Mon Aug 27 19:36:50 2012
@@ -99,7 +99,7 @@ public class XMPRightsManagementSchema e
* @return owners property
*/
public ArrayProperty getOwnersProperty() {
- return (ArrayProperty) getUnqualifiedProperty(OWNER);
+ return (ArrayProperty) getProperty(OWNER);
}
/**
@@ -138,7 +138,7 @@ public class XMPRightsManagementSchema e
* @return Marked property
*/
public BooleanType getMarkedProperty() {
- return (BooleanType) getUnqualifiedProperty(MARKED);
+ return (BooleanType) getProperty(MARKED);
}
/**
@@ -147,7 +147,7 @@ public class XMPRightsManagementSchema e
* @return marked value
*/
public Boolean getMarked() {
- BooleanType bt = ((BooleanType) getUnqualifiedProperty(MARKED));
+ BooleanType bt = ((BooleanType) getProperty(MARKED));
return bt == null ? null : bt.getValue();
}
@@ -191,7 +191,7 @@ public class XMPRightsManagementSchema e
* @return usageterms property
*/
public ArrayProperty getUsageTermsProperty() {
- return (ArrayProperty) getUnqualifiedProperty(USAGETERMS);
+ return (ArrayProperty) getProperty(USAGETERMS);
}
/**
@@ -230,7 +230,7 @@ public class XMPRightsManagementSchema e
* @return Webstatement URL property
*/
public TextType getWebStatementProperty() {
- return ((TextType) getUnqualifiedProperty(WEBSTATEMENT));
+ return ((TextType) getProperty(WEBSTATEMENT));
}
/**
@@ -239,7 +239,7 @@ public class XMPRightsManagementSchema e
* @return webStatement URL value
*/
public String getWebStatement() {
- TextType tt = ((TextType) getUnqualifiedProperty(WEBSTATEMENT));
+ TextType tt = ((TextType) getProperty(WEBSTATEMENT));
return tt == null ? null : tt.getStringValue();
}
@@ -270,7 +270,7 @@ public class XMPRightsManagementSchema e
* @return certificate url property
*/
public TextType getCertificateProperty() {
- return ((TextType) getUnqualifiedProperty(CERTIFICATE));
+ return ((TextType) getProperty(CERTIFICATE));
}
/**
@@ -279,7 +279,7 @@ public class XMPRightsManagementSchema e
* @return certificate URL value
*/
public String getCertificate() {
- TextType tt = ((TextType) getUnqualifiedProperty(CERTIFICATE));
+ TextType tt = ((TextType) getProperty(CERTIFICATE));
return tt == null ? null : tt.getStringValue();
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java Mon Aug 27 19:36:50 2012
@@ -30,6 +30,7 @@ import java.util.List;
import org.apache.padaf.xmpbox.XMPMetadata;
import org.apache.padaf.xmpbox.type.AbstractField;
import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
+import org.apache.padaf.xmpbox.type.AbstractStructuredType;
import org.apache.padaf.xmpbox.type.ArrayProperty;
import org.apache.padaf.xmpbox.type.Attribute;
import org.apache.padaf.xmpbox.type.BadFieldValueException;
@@ -48,7 +49,7 @@ import org.apache.padaf.xmpbox.type.Type
* REPRESENTATION
*
*/
-public class XMPSchema {
+public class XMPSchema extends AbstractStructuredType {
/**
* The standard xmlns namespace.
*/
@@ -56,14 +57,6 @@ public class XMPSchema {
public static final String RDFABOUT = "rdf:about";
- private String localPrefix;
-
- private String localNSUri;
-
- private XMPMetadata metadata;
-
- private ComplexPropertyContainer content;
-
/**
* Create a new blank schema that can be populated.
*
@@ -76,39 +69,12 @@ public class XMPSchema {
*
*/
public XMPSchema(XMPMetadata metadata, String namespaceName, String namespaceURI) {
- this.metadata = metadata;
- content = new ComplexPropertyContainer();
-
- localPrefix = namespaceName;
- localNSUri = namespaceURI;
- content.setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
+ super(metadata, namespaceURI, namespaceName);
+ getContainer().setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
namespaceName, namespaceURI));
}
- private String getQualifiedName (String name) {
- return localPrefix + ':' + name;
- }
-
- /**
- * Get the schema prefix
- *
- * @return Prefix fixed for the schema
- */
- public String getPrefix() {
- return localPrefix;
-
- }
-
- /**
- * Get the namespace URI of this schema
- *
- * @return the namespace URI of this schema
- */
- public String getNamespaceValue() {
- return localNSUri;
- }
-
/**
* Retrieve a generic simple type property
*
@@ -117,11 +83,11 @@ public class XMPSchema {
* @return The generic simple type property according to its qualified Name
*/
public AbstractField getAbstractProperty(String qualifiedName) {
- Iterator<AbstractField> it = content.getAllProperties().iterator();
+ Iterator<AbstractField> it = getContainer().getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getQualifiedName().equals(qualifiedName)) {
+ if (tmp.getPropertyName().equals(qualifiedName)) {
return tmp;
}
}
@@ -135,7 +101,7 @@ public class XMPSchema {
* @return The RDF 'about' attribute.
*/
public Attribute getAboutAttribute() {
- return content.getAttribute(RDFABOUT);
+ return getContainer().getAttribute(RDFABOUT);
}
/**
@@ -144,7 +110,7 @@ public class XMPSchema {
* @return The RDF 'about' value.
*/
public String getAboutValue() {
- Attribute prop = content.getAttribute(RDFABOUT);
+ Attribute prop = getContainer().getAttribute(RDFABOUT);
if (prop != null) {
return prop.getValue();
}
@@ -162,7 +128,7 @@ public class XMPSchema {
public void setAbout(Attribute about) throws BadFieldValueException {
if (about.getQualifiedName().equals(RDFABOUT)
|| about.getQualifiedName().equals("about")) {
- content.setAttribute(about);
+ getContainer().setAttribute(about);
} else {
throw new BadFieldValueException(
"Attribute 'about' must be named 'rdf:about' or 'about'");
@@ -177,9 +143,9 @@ public class XMPSchema {
*/
public void setAboutAsSimple(String about) {
if (about == null) {
- content.removeAttribute(RDFABOUT);
+ getContainer().removeAttribute(RDFABOUT);
} else {
- content.setAttribute(new Attribute(null, "rdf", "about", about));
+ getContainer().setAttribute(new Attribute(null, "rdf", "about", about));
}
}
@@ -201,23 +167,24 @@ public class XMPSchema {
if (propertyValue == null) {
// Search in properties to erase
- Iterator<AbstractField> it = content.getAllProperties().iterator();
+ Iterator<AbstractField> it = getContainer().getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getQualifiedName().equals(qualifiedName)) {
- content.removeProperty(tmp);
+ if (tmp.getPropertyName().equals(qualifiedName)) {
+ getContainer().removeProperty(tmp);
return;
}
}
} else {
AbstractSimpleProperty specifiedTypeProperty;
try {
- TypeMapping tm = metadata.getTypeMapping();
+ TypeMapping tm = getMetadata().getTypeMapping();
specifiedTypeProperty = tm.instanciateSimpleProperty(
- metadata, null,
- splittedQualifiedName[0], splittedQualifiedName[1], propertyValue,
- tm.getType(type));
+ getMetadata(), null,
+ getPrefix(), qualifiedName,
+// splittedQualifiedName[0], splittedQualifiedName[1],
+ propertyValue, tm.getType(type));
} catch (Exception e) {
throw new IllegalArgumentException(
"Failed to create property with the specified type given in parameters",
@@ -225,17 +192,17 @@ public class XMPSchema {
}
// attribute placement for simple property has been removed
// Search in properties to erase
- Iterator<AbstractField> it = content.getAllProperties().iterator();
+ Iterator<AbstractField> it = getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getQualifiedName().equals(qualifiedName)) {
- content.removeProperty(tmp);
- content.addProperty(specifiedTypeProperty);
+ if (tmp.getPropertyName().equals(qualifiedName)) {
+ removeProperty(tmp);
+ addProperty(specifiedTypeProperty);
return;
}
}
- content.addProperty(specifiedTypeProperty);
+ addProperty(specifiedTypeProperty);
}
}
@@ -248,17 +215,17 @@ public class XMPSchema {
private void setSpecifiedSimpleTypeProperty(AbstractSimpleProperty prop) {
// attribute placement for simple property has been removed
// Search in properties to erase
- Iterator<AbstractField> it = content.getAllProperties().iterator();
+ Iterator<AbstractField> it = getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext()) {
tmp = it.next();
- if (tmp.getQualifiedName().equals(prop.getQualifiedName())) {
- content.removeProperty(tmp);
- content.addProperty(prop);
+ if (tmp.getPropertyName().equals(prop.getPropertyName())) {
+ removeProperty(tmp);
+ addProperty(prop);
return;
}
}
- content.addProperty(prop);
+ addProperty(prop);
}
/**
@@ -297,7 +264,7 @@ public class XMPSchema {
*/
public void setTextPropertyValueAsSimple(String simpleName,
String propertyValue) {
- this.setTextPropertyValue(getQualifiedName(simpleName), propertyValue);
+ this.setTextPropertyValue(simpleName, propertyValue);
}
/**
@@ -308,7 +275,7 @@ public class XMPSchema {
* @return The Text Type property wanted
*/
public TextType getUnqualifiedTextProperty(String name) {
- String qualifiedName = getQualifiedName(name);
+ String qualifiedName = name;
AbstractField prop = getAbstractProperty(qualifiedName);
if (prop != null) {
if (prop instanceof TextType) {
@@ -368,7 +335,7 @@ public class XMPSchema {
*
*/
public Calendar getDatePropertyValueAsSimple(String simpleName) {
- return this.getDatePropertyValue(getQualifiedName(simpleName));
+ return this.getDatePropertyValue(simpleName);
}
/**
@@ -414,7 +381,7 @@ public class XMPSchema {
* Passing null will remove the property.
*/
public void setDatePropertyValueAsSimple(String simpleName, Calendar date) {
- this.setDatePropertyValue(getQualifiedName(simpleName), date);
+ this.setDatePropertyValue(simpleName, date);
}
/**
@@ -459,7 +426,7 @@ public class XMPSchema {
* @return The value of the property as a boolean.
*/
public Boolean getBooleanPropertyValueAsSimple(String simpleName) {
- return this.getBooleanPropertyValue(getQualifiedName(simpleName));
+ return this.getBooleanPropertyValue(simpleName);
}
/**
@@ -508,7 +475,7 @@ public class XMPSchema {
* will remove the property.
*/
public void setBooleanPropertyValueAsSimple(String simpleName, Boolean bool) {
- this.setBooleanPropertyValue(getQualifiedName(simpleName), bool);
+ this.setBooleanPropertyValue(simpleName, bool);
}
/**
@@ -552,7 +519,7 @@ public class XMPSchema {
* @return The value of the property as an integer.
*/
public Integer getIntegerPropertyValueAsSimple(String simpleName) {
- return this.getIntegerPropertyValue(getQualifiedName(simpleName));
+ return this.getIntegerPropertyValue(simpleName);
}
/**
@@ -597,7 +564,7 @@ public class XMPSchema {
*/
public void setIntegerPropertyValueAsSimple(String simpleName,
Integer intValue) {
- this.setIntegerPropertyValue(getQualifiedName(simpleName), intValue);
+ this.setIntegerPropertyValue(simpleName, intValue);
}
/**
@@ -622,8 +589,7 @@ public class XMPSchema {
* the field value
*/
private void removeUnqualifiedArrayValue(String arrayName, String fieldValue) {
- String qualifiedArrayName = getQualifiedName(arrayName);
- ArrayProperty array = (ArrayProperty) getAbstractProperty(qualifiedArrayName);
+ ArrayProperty array = (ArrayProperty) getAbstractProperty(arrayName);
if (array != null) {
ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
Iterator<AbstractField> it = array.getContainer()
@@ -665,21 +631,20 @@ public class XMPSchema {
* the string value to add
*/
public void addBagValueAsSimple(String simpleName, String bagValue) {
- this.internalAddBagValue(getQualifiedName(simpleName), bagValue);
+ this.internalAddBagValue(simpleName, bagValue);
}
private void internalAddBagValue(String qualifiedBagName, String bagValue) {
- String[] splittedQualifiedName = qualifiedBagName.split(":");
ArrayProperty bag = (ArrayProperty) getAbstractProperty(qualifiedBagName);
- TextType li = new TextType(metadata,null, "rdf", "li", bagValue);
+ TextType li = new TextType(getMetadata(),null, "rdf", "li", bagValue);
if (bag != null) {
bag.getContainer().addProperty(li);
} else {
- ArrayProperty newBag = new ArrayProperty(metadata,null,
- splittedQualifiedName[0], splittedQualifiedName[1],
+ ArrayProperty newBag = new ArrayProperty(getMetadata(),null,
+ getPrefix(), qualifiedBagName,
ArrayProperty.UNORDERED_ARRAY);
newBag.getContainer().addProperty(li);
- content.addProperty(newBag);
+ addProperty(newBag);
}
}
@@ -692,7 +657,7 @@ public class XMPSchema {
* The value to add to the bagList.
*/
public void addQualifiedBagValue(String simpleName, String bagValue) {
- internalAddBagValue(getQualifiedName(simpleName), bagValue);
+ internalAddBagValue(simpleName, bagValue);
}
/**
@@ -732,7 +697,7 @@ public class XMPSchema {
* @return All values of the bag property in a list.
*/
public List<String> getUnqualifiedBagValueList(String bagName) {
- String qualifiedBagName = getQualifiedName( bagName);
+ String qualifiedBagName = bagName;
return getArrayListToString(qualifiedBagName);
}
@@ -759,7 +724,7 @@ public class XMPSchema {
*/
public void removeUnqualifiedArrayValue(String arrayName,
AbstractField fieldValue) {
- String qualifiedArrayName = getQualifiedName(arrayName);
+ String qualifiedArrayName = arrayName;
ArrayProperty array = (ArrayProperty) getAbstractProperty(qualifiedArrayName);
if (array != null) {
ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
@@ -803,18 +768,17 @@ public class XMPSchema {
* The value to add to the sequence.
*/
public void addUnqualifiedSequenceValue(String simpleSeqName, String seqValue) {
- String qualifiedSeqName = getQualifiedName(simpleSeqName);
- String[] splittedQualifiedName = qualifiedSeqName.split(":");
+ String qualifiedSeqName = simpleSeqName;
ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
- TextType li = new TextType(metadata,null, "rdf", "li", seqValue);
+ TextType li = new TextType(getMetadata(),null, "rdf", "li", seqValue);
if (seq != null) {
seq.getContainer().addProperty(li);
} else {
- ArrayProperty newSeq = new ArrayProperty(metadata,null,
- splittedQualifiedName[0], splittedQualifiedName[1],
+ ArrayProperty newSeq = new ArrayProperty(getMetadata(),null,
+ getPrefix(), simpleSeqName,
ArrayProperty.ORDERED_ARRAY);
newSeq.getContainer().addProperty(li);
- content.addProperty(newSeq);
+ addProperty(newSeq);
}
}
@@ -829,32 +793,18 @@ public class XMPSchema {
* The value to add to the bag.
*/
public void addBagValue(String qualifiedSeqName, AbstractField seqValue) {
-
- String[] splittedQualifiedName = qualifiedSeqName.split(":");
ArrayProperty bag = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
if (bag != null) {
bag.getContainer().addProperty(seqValue);
} else {
- ArrayProperty newBag = new ArrayProperty(metadata,null,
- splittedQualifiedName[0], splittedQualifiedName[1],
+ ArrayProperty newBag = new ArrayProperty(getMetadata(),null,
+ getPrefix(),qualifiedSeqName,
ArrayProperty.UNORDERED_ARRAY);
newBag.getContainer().addProperty(seqValue);
- content.addProperty(newBag);
+ addProperty(newBag);
}
}
-// /**
-// * add a new value to a sequence property using the current prefix.
-// *
-// * @param simpleName
-// * the local name of the property
-// * @param seqValue
-// * the string value to add
-// */
-// public void addSequenceValueAsSimple(String simpleName, String seqValue) {
-// this.internalAddSequenceValue(localPrefixSep + simpleName, seqValue);
-// }
-
/**
* Add a new value to a sequence property.
*
@@ -865,17 +815,16 @@ public class XMPSchema {
* The value to add to the sequence.
*/
public void addUnqualifiedSequenceValue(String seqName, AbstractField seqValue) {
- String qualifiedSeqName = getQualifiedName(seqName);
- String[] splittedQualifiedName = qualifiedSeqName.split(":");
+ String qualifiedSeqName = seqName;
ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
if (seq != null) {
seq.getContainer().addProperty(seqValue);
} else {
- ArrayProperty newSeq = new ArrayProperty(metadata,null,
- splittedQualifiedName[0], splittedQualifiedName[1],
+ ArrayProperty newSeq = new ArrayProperty(getMetadata(),null,
+ getPrefix(), seqName,
ArrayProperty.ORDERED_ARRAY);
newSeq.getContainer().addProperty(seqValue);
- content.addProperty(newSeq);
+ addProperty(newSeq);
}
}
@@ -889,7 +838,7 @@ public class XMPSchema {
* property does not exist.
*/
public List<String> getUnqualifiedSequenceValueList(String seqName) {
- String qualifiedSeqName = getQualifiedName(seqName);
+ String qualifiedSeqName = seqName;
return getArrayListToString(qualifiedSeqName);
}
@@ -903,7 +852,7 @@ public class XMPSchema {
* The date to remove from the sequence property.
*/
public void removeUnqualifiedSequenceDateValue(String seqName, Calendar date) {
- String qualifiedSeqName = getQualifiedName(seqName);
+ String qualifiedSeqName = seqName;
ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
if (seq != null) {
ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
@@ -948,7 +897,7 @@ public class XMPSchema {
* The date to add to the sequence property.
*/
public void addUnqualifiedSequenceDateValue(String seqName, Calendar date) {
- addUnqualifiedSequenceValue(seqName, new DateType(metadata,null, "rdf", "li",
+ addUnqualifiedSequenceValue(seqName, new DateType(getMetadata(),null, "rdf", "li",
date));
}
@@ -964,7 +913,7 @@ public class XMPSchema {
*
*/
public List<Calendar> getUnqualifiedSequenceDateValueList(String seqName) {
- String qualifiedSeqName = getQualifiedName(seqName);
+ String qualifiedSeqName = seqName;
List<Calendar> retval = null;
ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
if (seq != null) {
@@ -1046,7 +995,7 @@ public class XMPSchema {
*/
public void setUnqualifiedLanguagePropertyValue(String name, String language,
String value) {
- String qualifiedName = getQualifiedName(name);
+ String qualifiedName = name;
AbstractField property = getAbstractProperty(qualifiedName);
ArrayProperty prop;
if (property != null) {
@@ -1070,7 +1019,7 @@ public class XMPSchema {
} else {
prop.getContainer().removeProperty(tmp);
TextType langValue;
- langValue = new TextType(metadata, null,"rdf", "li",
+ langValue = new TextType(getMetadata(), null,"rdf", "li",
value);
langValue.setAttribute(new Attribute(null, "xml",
@@ -1083,22 +1032,22 @@ public class XMPSchema {
}
// if no definition found, we add a new one
TextType langValue;
- langValue = new TextType(metadata,null, "rdf", "li", value);
+ langValue = new TextType(getMetadata(),null, "rdf", "li", value);
langValue.setAttribute(new Attribute(null, "xml", "lang",
language));
prop.getContainer().addProperty(langValue);
reorganizeAltOrder(prop.getContainer());
}
} else {
- String[] splittedQualifiedName = qualifiedName.split(":");
- prop = new ArrayProperty(metadata, null, splittedQualifiedName[0],
- splittedQualifiedName[1], ArrayProperty.ALTERNATIVE_ARRAY);
+ prop = new ArrayProperty(getMetadata(), null,
+ getPrefix(), name,
+ ArrayProperty.ALTERNATIVE_ARRAY);
TextType langValue;
- langValue = new TextType(metadata,null, "rdf", "li", value);
+ langValue = new TextType(getMetadata(),null, "rdf", "li", value);
langValue
.setAttribute(new Attribute(null, "xml", "lang", language));
prop.getContainer().addProperty(langValue);
- content.addProperty(prop);
+ addProperty(prop);
}
}
@@ -1114,9 +1063,8 @@ public class XMPSchema {
* @return The value of the language property.
*/
public String getUnqualifiedLanguagePropertyValue(String name, String expectedLanguage) {
- String qualifiedName = getQualifiedName(name);
String language = (expectedLanguage!=null)?expectedLanguage:"x-default";
- AbstractField property = getAbstractProperty(qualifiedName);
+ AbstractField property = getAbstractProperty(name);
if (property != null) {
if (property instanceof ArrayProperty) {
ArrayProperty prop = (ArrayProperty) property;
@@ -1136,7 +1084,7 @@ public class XMPSchema {
return null;
} else {
throw new IllegalArgumentException("The property '"
- + qualifiedName + "' is not of Lang Alt type");
+ + name + "' is not of Lang Alt type");
}
}
return null;
@@ -1155,10 +1103,9 @@ public class XMPSchema {
* if none have been defined.
*/
public List<String> getUnqualifiedLanguagePropertyLanguagesValue(String name) {
- String qualifiedName = getQualifiedName(name);
List<String> retval = new ArrayList<String>();
- AbstractField property = getAbstractProperty(qualifiedName);
+ AbstractField property = getAbstractProperty(name);
if (property != null) {
if (property instanceof ArrayProperty) {
ArrayProperty prop = (ArrayProperty) property;
@@ -1178,7 +1125,7 @@ public class XMPSchema {
return retval;
} else {
throw new IllegalArgumentException("The property '"
- + qualifiedName + "' is not of Lang Alt type");
+ + name + "' is not of Lang Alt type");
}
}
// no property with that name
@@ -1199,27 +1146,26 @@ public class XMPSchema {
throw new IOException("Can only merge schemas of the same type.");
}
- Iterator<Attribute> itAtt = xmpSchema.content.getAllAttributes()
+ Iterator<Attribute> itAtt = xmpSchema.getContainer().getAllAttributes()
.iterator();
Attribute att;
while (itAtt.hasNext()) {
att = itAtt.next();
if (att.getPrefix().equals(getPrefix())) {
- content.setAttribute(att);
+ getContainer().setAttribute(att);
}
}
String analyzedPropQualifiedName;
- Iterator<AbstractField> itProp = xmpSchema.content.getAllProperties()
+ Iterator<AbstractField> itProp = xmpSchema.getContainer().getAllProperties()
.iterator();
AbstractField prop;
while (itProp.hasNext()) {
prop = itProp.next();
if (prop.getPrefix().equals(getPrefix())) {
if (prop instanceof ArrayProperty) {
- analyzedPropQualifiedName = prop.getQualifiedName();
- Iterator<AbstractField> itActualEmbeddedProperties = content
- .getAllProperties().iterator();
+ analyzedPropQualifiedName = prop.getPropertyName();
+ Iterator<AbstractField> itActualEmbeddedProperties = getAllProperties().iterator();
AbstractField tmpEmbeddedProperty;
Iterator<AbstractField> itNewValues;
@@ -1233,7 +1179,7 @@ public class XMPSchema {
while (itActualEmbeddedProperties.hasNext()) {
tmpEmbeddedProperty = itActualEmbeddedProperties.next();
if (tmpEmbeddedProperty instanceof ArrayProperty) {
- if (tmpEmbeddedProperty.getQualifiedName().equals(
+ if (tmpEmbeddedProperty.getPropertyName().equals(
analyzedPropQualifiedName)) {
itNewValues = ((ArrayProperty) prop)
.getContainer().getAllProperties()
@@ -1267,7 +1213,7 @@ public class XMPSchema {
}
}
} else {
- content.addProperty(prop);
+ addProperty(prop);
}
}
}
@@ -1285,13 +1231,12 @@ public class XMPSchema {
*/
public List<AbstractField> getUnqualifiedArrayList(String name)
throws BadFieldValueException {
- String qualifiedName = getQualifiedName(name);
ArrayProperty array = null;
- Iterator<AbstractField> itProp = content.getAllProperties().iterator();
+ Iterator<AbstractField> itProp = getAllProperties().iterator();
AbstractField tmp;
while (itProp.hasNext()) {
tmp = itProp.next();
- if (tmp.getQualifiedName().equals(qualifiedName)) {
+ if (tmp.getPropertyName().equals(name)) {
if (tmp instanceof ArrayProperty) {
array = (ArrayProperty) tmp;
break;
@@ -1315,30 +1260,12 @@ public class XMPSchema {
}
/**
- * Get PropertyContainer of this Schema
- *
- * @return the ComplexProperty which represents the schema content
- */
- public ComplexPropertyContainer getContent() {
- return content;
- }
-
- /**
* Get All attributes defined for this schema
*
* @return Attributes list defined for this schema
*/
public List<Attribute> getAllAttributes() {
- return content.getAllAttributes();
- }
-
- /**
- * Get All properties defined in this schema
- *
- * @return Properties list defined in this schema
- */
- public List<AbstractField> getAllProperties() {
- return content.getAllProperties();
+ return getContainer().getAllAttributes();
}
/**
@@ -1348,80 +1275,18 @@ public class XMPSchema {
* The new Attribute to set
*/
public void setAttribute(Attribute attr) {
- content.setAttribute(attr);
- }
-
- /**
- * Add a new Property to this schema
- *
- * @param obj
- * The new property to add
- */
- public void addProperty(AbstractField obj) {
- content.addProperty(obj);
- }
-
- /**
- * get a Property with its name, using the current prefix
- *
- * @param simpleName
- * the local name of the property
- * @return The property wanted
- */
- protected AbstractField getPropertyAsSimple(String simpleName) {
- return getProperty(getQualifiedName(simpleName));
- }
-
- /**
- * get a Property with its qualified Name (with its prefix)
- *
- * @param qualifiedName
- * The full qualified name of the property wanted
- * @return the property wanted
- */
- // TODO should become private (and then disappear)
- protected AbstractField getProperty(String qualifiedName) {
- Iterator<AbstractField> it = getAllProperties().iterator();
- AbstractField tmp;
- while (it.hasNext()) {
- tmp = it.next();
- if (tmp.getQualifiedName().equals(qualifiedName)) {
- return tmp;
- }
- }
- return null;
- }
-
- protected AbstractField getUnqualifiedProperty (String simpleName) {
- return getProperty(getQualifiedName(simpleName));
+ getContainer().setAttribute(attr);
}
- /**
- * Return local prefix
- *
- * @return current prefix fixed for this schema
- */
- public String getLocalPrefix() {
- return this.localPrefix;
- }
-
protected AbstractSimpleProperty instanciateSimple (String param, Object value) {
- TypeMapping tm = metadata.getTypeMapping();
+ TypeMapping tm = getMetadata().getTypeMapping();
return tm.instanciateSimpleField(
getClass(),
- metadata,
+ getMetadata(),
null,
- localPrefix,
+ getPrefix(),
param,
value);
}
- public XMPMetadata getMetadata () {
- return this.metadata;
- }
-
- public String getLocalNSUri() {
- return localNSUri;
- }
-
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractComplexProperty.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractComplexProperty.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractComplexProperty.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractComplexProperty.java Mon Aug 27 19:36:50 2012
@@ -68,14 +68,14 @@ public abstract class AbstractComplexPro
return container.getAllProperties();
}
- public final AbstractSimpleProperty getProperty (String fieldName) {
+ public final AbstractField getProperty (String fieldName) {
List<AbstractField> list = container.getPropertiesByLocalName(fieldName);
// return null if no property
if (list==null) {
return null;
}
// return the first element of the list
- return (AbstractSimpleProperty)list.get(0);
+ return list.get(0);
}
public final ArrayProperty getArrayProperty (String fieldName) {
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java Mon Aug 27 19:36:50 2012
@@ -83,16 +83,6 @@ public abstract class AbstractField {
}
/**
- * Get the qualified Name of this entity (prefix+localName)
- *
- * @return the full qualified name
- */
- public String getQualifiedName() {
- return prefix + ":" + propertyName;
-
- }
-
- /**
* Get the propertyName (or localName)
*
* @return the local Name
@@ -163,7 +153,7 @@ public abstract class AbstractField {
}
- public XMPMetadata getMetadata() {
+ public final XMPMetadata getMetadata() {
return metadata;
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java Mon Aug 27 19:36:50 2012
@@ -48,7 +48,7 @@ public abstract class AbstractStructured
protected String getPropertyValueAsString (String fieldName) {
- AbstractSimpleProperty absProp = getProperty(fieldName);
+ AbstractSimpleProperty absProp = (AbstractSimpleProperty)getProperty(fieldName);
if (absProp == null) {
return null;
} else {
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java Mon Aug 27 19:36:50 2012
@@ -99,7 +99,7 @@ public abstract class AbstractSchemaTest
AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
getSchema().addProperty(property);
String qn = getPropertyQualifiedName(fieldName);
- Assert.assertNotNull(getSchema().getProperty(qn));
+ Assert.assertNotNull(getSchema().getProperty(fieldName));
// check other properties not modified
List<Field> fields = TypeTestingHelper.getXmpFields(getSchemaClass());
for (Field field : fields) {
@@ -116,9 +116,6 @@ public abstract class AbstractSchemaTest
if (cardinality==Cardinality.Simple) return;
// only test array properties
TypeDescription td =typeMapping.getTypeDescription(type);
- if (td==null) {
- System.err.println(">>>>>>>>>>>>> "+type);
- }
Object value = TypeTestingHelper.getJavaValue(td);
AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
switch (cardinality) {
@@ -126,13 +123,13 @@ public abstract class AbstractSchemaTest
getSchema().addUnqualifiedSequenceValue(property.getPropertyName(), property);
break;
case Bag:
- getSchema().addBagValue(property.getQualifiedName(), property);
+ getSchema().addBagValue(property.getPropertyName(), property);
break;
default :
throw new Exception ("Unexpected case in test : "+cardinality.name());
}
String qn = getPropertyQualifiedName(fieldName);
- Assert.assertNotNull(getSchema().getProperty(qn));
+ Assert.assertNotNull(getSchema().getProperty(fieldName));
// check other properties not modified
List<Field> fields = TypeTestingHelper.getXmpFields(getSchemaClass());
for (Field field : fields) {
@@ -152,12 +149,12 @@ public abstract class AbstractSchemaTest
TypeDescription td = typeMapping.getTypeDescription(type);
Object value = TypeTestingHelper.getJavaValue(td);
AbstractSimpleProperty asp = typeMapping.instanciateSimpleProperty(
- xmp, getSchema().getNamespaceValue(),
- getSchema().getLocalPrefix(), fieldName, value, type);
+ xmp, getSchema().getNamespace(),
+ getSchema().getPrefix(), fieldName, value, type);
Method set = getSchemaClass().getMethod(setter, new Class<?>[] {td.getTypeClass()} );
set.invoke(getSchema(), new Object [] {asp});
// check property set
- AbstractSimpleProperty stored = (AbstractSimpleProperty)getSchema().getProperty(getPropertyQualifiedName(fieldName));
+ AbstractSimpleProperty stored = (AbstractSimpleProperty)getSchema().getProperty(fieldName);
Assert.assertEquals(value, stored.getValue());
// check getter
String getter = TypeTestingHelper.calculateSimpleGetter(fieldName)+"Property";
@@ -209,7 +206,7 @@ public abstract class AbstractSchemaTest
protected String getPropertyQualifiedName (String name) {
StringBuilder sb = new StringBuilder();
- sb.append(getSchema().getLocalPrefix()).append(":").append(name);
+ sb.append(getSchema().getPrefix()).append(":").append(name);
return sb.toString();
}
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java Mon Aug 27 19:36:50 2012
@@ -263,7 +263,7 @@ public abstract class AbstractXMPSchemaT
String setName = setMethod(property);
String getName = getMethod(property);
- BooleanType bt = new BooleanType(metadata,null, schema.getLocalPrefix(),
+ BooleanType bt = new BooleanType(metadata,null, schema.getPrefix(),
property, value);
Method setMethod = schemaClass.getMethod(setName, BooleanType.class);
Method getMethod = schemaClass.getMethod(getName);
@@ -278,7 +278,7 @@ public abstract class AbstractXMPSchemaT
String setName = setMethod(property);
String getName = getMethod(property);
- DateType dt = new DateType(metadata, null, schema.getLocalPrefix(), property,
+ DateType dt = new DateType(metadata, null, schema.getPrefix(), property,
value);
Method setMethod = schemaClass.getMethod(setName, DateType.class);
Method getMethod = schemaClass.getMethod(getName);
@@ -292,7 +292,7 @@ public abstract class AbstractXMPSchemaT
String setName = setMethod(property);
String getName = getMethod(property);
- IntegerType it = new IntegerType(metadata, null,schema.getLocalPrefix(),
+ IntegerType it = new IntegerType(metadata, null,schema.getPrefix(),
property, value);
Method setMethod = schemaClass.getMethod(setName, IntegerType.class);
Method getMethod = schemaClass.getMethod(getName);
@@ -306,7 +306,7 @@ public abstract class AbstractXMPSchemaT
String setName = setMethod(property);
String getName = getMethod(property);
- TextType tt = new TextType(metadata, null,schema.getLocalPrefix(), property,
+ TextType tt = new TextType(metadata, null,schema.getPrefix(), property,
(String)value);
Method setMethod = schemaClass.getMethod(setName, TextType.class);
Method getMethod = schemaClass.getMethod(getName);
@@ -321,7 +321,7 @@ public abstract class AbstractXMPSchemaT
String setName = setMethod(property);
String getName = getMethod(property);
- URIType tt = new URIType(metadata, null,schema.getLocalPrefix(), property,
+ URIType tt = new URIType(metadata, null,schema.getPrefix(), property,
(String)value);
Method setMethod = schemaClass.getMethod(setName, URIType.class);
Method getMethod = schemaClass.getMethod(getName);
Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java?rev=1377804&r1=1377803&r2=1377804&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java Mon Aug 27 19:36:50 2012
@@ -57,16 +57,16 @@ public class AdobePDFErrorsTest {
schem.setProducer(producer);
- Assert.assertEquals("pdf:Keywords", schem.getKeywordsProperty()
- .getQualifiedName());
+ Assert.assertEquals("Keywords", schem.getKeywordsProperty()
+ .getPropertyName());
Assert.assertEquals(keywords, schem.getKeywords());
- Assert.assertEquals("pdf:PDFVersion", schem.getPDFVersionProperty()
- .getQualifiedName());
+ Assert.assertEquals("PDFVersion", schem.getPDFVersionProperty()
+ .getPropertyName());
Assert.assertEquals(pdfVersion, schem.getPDFVersion());
- Assert.assertEquals("pdf:Producer", schem.getProducerProperty()
- .getQualifiedName());
+ Assert.assertEquals("Producer", schem.getProducerProperty()
+ .getPropertyName());
Assert.assertEquals(producer, schem.getProducer());
// check retrieve this schema in metadata