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/11/06 21:05:04 UTC

svn commit: r1198544 - in /pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox: XMPMetadata.java parser/NSMapping.java schema/PhotoshopSchema.java type/ComplexPropertyContainer.java type/LayerType.java type/ThumbnailType.java

Author: leleueri
Date: Sun Nov  6 20:05:03 2011
New Revision: 1198544

URL: http://svn.apache.org/viewvc?rev=1198544&view=rev
Log:
[PDFBOX-1103] Addition of the Photoshop namespace

Added:
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java   (with props)
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java   (with props)
Modified:
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/NSMapping.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java?rev=1198544&r1=1198543&r2=1198544&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java Sun Nov  6 20:05:03 2011
@@ -32,6 +32,7 @@ import org.apache.padaf.xmpbox.schema.Ad
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
 import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
+import org.apache.padaf.xmpbox.schema.PhotoshopSchema;
 import org.apache.padaf.xmpbox.schema.XMPBasicSchema;
 import org.apache.padaf.xmpbox.schema.XMPMediaManagementSchema;
 import org.apache.padaf.xmpbox.schema.XMPRightsManagementSchema;
@@ -382,6 +383,15 @@ public class XMPMetadata {
 	}
 
 	/**
+	 * Get the Photoshop schema This method return null if not found
+	 * 
+	 * @return The PhotoshopSchema schema or null if not declared
+	 */
+	public PhotoshopSchema getPhotoshopSchema() {
+		return (PhotoshopSchema) getSchema(PhotoshopSchema.PHOTOSHOPURI);
+	}
+	
+	/**
 	 * Create and add a XMP Basic schema to this metadata This method return the
 	 * created schema to enter information
 	 * 
@@ -415,7 +425,19 @@ public class XMPMetadata {
 		addSchema(xmpMM);
 		return xmpMM;
 	}
-
+	
+	/***
+	 * create and add Photoshop Schema to this metadata. This method return 
+	 * the created schema to enter information
+	 * @return
+	 */
+	public PhotoshopSchema createAndAddPhotoshopSchema() {
+		PhotoshopSchema photoshop = new PhotoshopSchema(this);
+		photoshop.setAboutAsSimple("");
+		addSchema(photoshop);
+		return photoshop;
+	}
+	
 	/**
 	 * Get the XMP Media Management schema This method return null if not found
 	 * 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/NSMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/NSMapping.java?rev=1198544&r1=1198543&r2=1198544&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/NSMapping.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/NSMapping.java Sun Nov  6 20:05:03 2011
@@ -38,6 +38,7 @@ import org.apache.padaf.xmpbox.schema.PD
 import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.padaf.xmpbox.schema.PDFAPropertyDescription;
 import org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription;
+import org.apache.padaf.xmpbox.schema.PhotoshopSchema;
 import org.apache.padaf.xmpbox.schema.PropertyAttributesAnnotation;
 import org.apache.padaf.xmpbox.schema.PropertyType;
 import org.apache.padaf.xmpbox.schema.SchemaDescription;
@@ -61,6 +62,7 @@ public class NSMapping {
 	static {
 		BASIC_TYPES = new ArrayList<String>();
 		BASIC_TYPES.add("Text");
+		BASIC_TYPES.add("ProperName");
 		BASIC_TYPES.add("Integer");
 		BASIC_TYPES.add("Boolean");
 		BASIC_TYPES.add("Date");
@@ -78,6 +80,8 @@ public class NSMapping {
 		COMPLEX_BASIC_TYPES = new HashMap<String, String>();
 		COMPLEX_BASIC_TYPES.put("http://ns.adobe.com/xap/1.0/g/img/",
 				"Thumbnail");
+		COMPLEX_BASIC_TYPES.put(PhotoshopSchema.PHOTOSHOPURI,
+				"TextLayers");
 	}
 
 	protected Map<String, XMPSchemaFactory> nsMaps;
@@ -160,6 +164,7 @@ public class NSMapping {
 		addNameSpace("http://ns.adobe.com/pdf/1.3/", AdobePDFSchema.class);
 		addNameSpace("http://www.aiim.org/pdfa/ns/id/",	PDFAIdentificationSchema.class);
 		addNameSpace("http://ns.adobe.com/xap/1.0/rights/",	XMPRightsManagementSchema.class);
+		addNameSpace(PhotoshopSchema.PHOTOSHOPURI,	PhotoshopSchema.class);
 	}
 
 	/**

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java?rev=1198544&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java Sun Nov  6 20:05:03 2011
@@ -0,0 +1,433 @@
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+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.IntegerType;
+import org.apache.padaf.xmpbox.type.LayerType;
+import org.apache.padaf.xmpbox.type.TextType;
+
+public class PhotoshopSchema extends XMPSchema {
+
+	public PhotoshopSchema(XMPMetadata metadata) {
+		super(metadata, PREFERRED_PHOTISHOP_PREFIX, PHOTOSHOPURI);
+	}
+
+	public PhotoshopSchema(XMPMetadata metadata, String ownPrefix) {
+		super(metadata, ownPrefix, PHOTOSHOPURI);
+	}
+				
+	public static final String PREFERRED_PHOTISHOP_PREFIX = "photoshop";
+
+	public static final String PHOTOSHOPURI = "http://ns.adobe.com/photoshop/1.0/";
+
+	@PropertyType(propertyType = "URI")
+	public static final String ANCESTOR = "AncestorID";
+
+	@PropertyType(propertyType = "Text")
+	public static final String AUTHORS_POSITION = "AuthorsPosition";
+
+	@PropertyType(propertyType = "Text")
+	public static final String CAPTION_WRITER = "CaptionWriter";
+	
+	@PropertyType(propertyType = "Text")
+	public static final String CATEGORY = "Category";
+
+	@PropertyType(propertyType = "Text")
+	public static final String CITY = "City";
+
+	@PropertyType(propertyType = "Integer")
+	public static final String COLOR_MODE = "ColorMode";
+
+	@PropertyType(propertyType = "Text")
+	public static final String COUNTRY = "Country";
+
+	@PropertyType(propertyType = "Text")
+	public static final String CREDIT = "Credit";
+
+	@PropertyType(propertyType = "Text")
+	public static final String DATE_CREATED = "DateCreated";
+
+	@PropertyType(propertyType = "bag Text")
+	public static final String DOCUMENT_ANCESTORS = "DocumentAncestors";
+	
+	@PropertyType(propertyType = "Text")
+	public static final String HEADLINE = "Headline";
+
+	@PropertyType(propertyType = "Text")
+	public static final String HISTORY = "History";
+
+	@PropertyType(propertyType = "Text")
+	public static final String ICC_PROFILE = "ICCProfile";
+
+	@PropertyType(propertyType = "Text")
+	public static final String INSTRUCTIONS = "Instructions";
+
+	@PropertyType(propertyType = "Text")
+	public static final String SOURCE = "Source";
+
+	@PropertyType(propertyType = "Text")
+	public static final String STATE = "State";
+
+	@PropertyType(propertyType = "bag Text")
+	public static final String SUPPLEMENTAL_CATEGORIES = "SupplementalCategories";
+
+	@PropertyType(propertyType = "seq Layer")
+	public static final String TEXT_LAYERS = "TextLayers";
+	protected ComplexProperty seqLayer;
+
+	@PropertyType(propertyType = "Text")
+	public static final String TRANSMISSION_REFERENCE = "TransmissionReference";
+
+	@PropertyType(propertyType = "Integer")
+	public static final String URGENCY = "Urgency";
+
+	public TextType getAncestor() {
+		return (TextType) getProperty(localPrefix + ANCESTOR);
+	}
+	
+	public String getAncestorValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + ANCESTOR));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setAncestorValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, ANCESTOR, text));
+	}
+
+	public void setAncestor(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getAuthorsPosition() {
+		return (TextType) getProperty(localPrefix + AUTHORS_POSITION);
+	}
+	
+	public String getAuthorsPositionValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + AUTHORS_POSITION));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setAuthorsPositionValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, AUTHORS_POSITION, text));
+	}
+
+	public void setAuthorsPosition(TextType text) {
+		addProperty(text);
+	}
+
+	public TextType getCaptionWriter() {
+		return (TextType) getProperty(localPrefix + CAPTION_WRITER);
+	}
+	
+	public String getCaptionWriterValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + CAPTION_WRITER));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setCaptionWriterValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, CAPTION_WRITER, text));
+	}
+
+	public void setCaptionWriter(TextType text) {
+		addProperty(text);
+	}
+
+	public TextType getCategory() {
+		return (TextType) getProperty(localPrefix + CATEGORY);
+	}
+	
+	public String getCategoryValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + CATEGORY));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setCategoryValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, CATEGORY, text));
+	}
+
+	public void setCategory(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getCity() {
+		return (TextType) getProperty(localPrefix + CITY);
+	}
+	
+	public String getCityValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + CITY));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setCityValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, CITY, text));
+	}
+
+	public void setCity(TextType text) {
+		addProperty(text);
+	}
+	
+	public IntegerType getColorMode() {
+		return (IntegerType) getProperty(localPrefix + COLOR_MODE);
+	}
+	
+	public Integer getColorModeValue() {
+		IntegerType tt = ((IntegerType) getProperty(localPrefix + COLOR_MODE));
+		return tt == null ? null : tt.getValue();
+	}
+	
+	public void setColorModeValue(String text) {
+		addProperty(new IntegerType(metadata, localPrefix, COLOR_MODE, text));
+	}
+
+	public void setColorMode(IntegerType text) {
+		addProperty(text);
+	}
+
+	public TextType getCountry() {
+		return (TextType) getProperty(localPrefix + COUNTRY);
+	}
+	
+	public String getCountryValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + COUNTRY));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setCountryValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, COUNTRY, text));
+	}
+
+	public void setCountry(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getCredit() {
+		return (TextType) getProperty(localPrefix + CREDIT);
+	}
+	
+	public String getCreditValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + CREDIT));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setCreditValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, CREDIT, text));
+	}
+
+	public void setCredit(TextType text) {
+		addProperty(text);
+	}
+
+	public TextType getDateCreated() {
+		return (TextType) getProperty(localPrefix + DATE_CREATED);
+	}
+	
+	public String getDateCreatedValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + DATE_CREATED));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setDateCreatedValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, DATE_CREATED, text));
+	}
+
+	public void setDateCreated(TextType text) {
+		addProperty(text);
+	}
+	
+	public void addToDocumentAncestorsValue(String text) {
+		addBagValue(localPrefixSep + DOCUMENT_ANCESTORS, text);
+	}
+
+	public ComplexProperty getDocumentAncestors() {
+		return (ComplexProperty) getProperty(localPrefixSep + DOCUMENT_ANCESTORS);
+	}
+
+	public List<String> getDocumentAncestorsValue() {
+		return getBagValueList(localPrefixSep + DOCUMENT_ANCESTORS);
+	}
+
+	public TextType getHeadline() {
+		return (TextType) getProperty(localPrefix + HEADLINE);
+	}
+	
+	public String getHeadlineValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + HEADLINE));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setHeadlineValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, HEADLINE, text));
+	}
+
+	public void setHeadline(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getHistory() {
+		return (TextType) getProperty(localPrefix + HISTORY);
+	}
+	
+	public String getHistoryValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + HISTORY));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setHistoryValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, HISTORY, text));
+	}
+
+	public void setHistory(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getIccProfile() {
+		return (TextType) getProperty(localPrefix + ICC_PROFILE);
+	}
+	
+	public String getIccProfileValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + ICC_PROFILE));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setIccProfileValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, ICC_PROFILE, text));
+	}
+
+	public void setIccProfile(TextType text) {
+		addProperty(text);
+	}
+
+	public TextType getInstructions() {
+		return (TextType) getProperty(localPrefix + INSTRUCTIONS);
+	}
+	
+	public String getInstructionsValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + INSTRUCTIONS));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setInstructionsValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, INSTRUCTIONS, text));
+	}
+
+	public void setInstructions(TextType text) {
+		addProperty(text);
+	}
+
+	public TextType getSource() {
+		return (TextType) getProperty(localPrefix + SOURCE);
+	}
+	
+	public String getSourceValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + SOURCE));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setSourceValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, SOURCE, text));
+	}
+
+	public void setSource(TextType text) {
+		addProperty(text);
+	}
+	
+	public TextType getState() {
+		return (TextType) getProperty(localPrefix + STATE);
+	}
+	
+	public String getStateValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + STATE));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setStateValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, STATE, text));
+	}
+
+	public void setState(TextType text) {
+		addProperty(text);
+	}
+
+	public void addToSupplementalCategoriesValue(String text) {
+		addBagValue(localPrefixSep + SUPPLEMENTAL_CATEGORIES, text);
+	}
+
+	public ComplexProperty getSupplementalCategories() {
+		return (ComplexProperty) getProperty(localPrefixSep + SUPPLEMENTAL_CATEGORIES);
+	}
+
+	public List<String> getSupplementalCategoriesValue() {
+		return getBagValueList(localPrefixSep + SUPPLEMENTAL_CATEGORIES);
+	}
+	
+	public void addTextLayers(String layerName, String layerText) {
+		if (seqLayer == null) {
+			seqLayer = new ComplexProperty(metadata, localPrefix, TEXT_LAYERS,
+					ComplexProperty.ORDERED_ARRAY);
+			addProperty(seqLayer);
+		}
+		LayerType layer = new LayerType(metadata, "rdf", "li");
+		layer.setLayerName(PREFERRED_PHOTISHOP_PREFIX, "LayerName", layerName);
+		layer.setLayerText(PREFERRED_PHOTISHOP_PREFIX, "LayerText", layerText);
+		seqLayer.getContainer().addProperty(layer);
+	}
+	
+	public List<LayerType> getTextLayers() throws BadFieldValueException {
+		List<AbstractField> tmp = getArrayList(localPrefixSep + TEXT_LAYERS);
+		if (tmp != null) {
+			List<LayerType> layers = new ArrayList<LayerType>();
+			for (AbstractField abstractField : tmp) {
+				if (abstractField instanceof LayerType) {
+					layers.add((LayerType) abstractField);
+				} else {
+					throw new BadFieldValueException("Layer expected and "
+							+ abstractField.getClass().getName() + " found.");
+				}
+			}
+			return layers;
+		}
+		return null;
+
+	}
+	
+	public TextType getTransmissionReference() {
+		return (TextType) getProperty(localPrefix + TRANSMISSION_REFERENCE);
+	}
+	
+	public String getTransmissionReferenceValue() {
+		TextType tt = ((TextType) getProperty(localPrefix + TRANSMISSION_REFERENCE));
+		return tt == null ? null : tt.getStringValue();
+	}
+	
+	public void setTransmissionReferenceValue(String text) {
+		addProperty(new TextType(metadata, localPrefix, TRANSMISSION_REFERENCE, text));
+	}
+
+	public void setTransmissionReference(TextType text) {
+		addProperty(text);
+	}
+
+	public IntegerType getUrgency() {
+		return (IntegerType) getProperty(localPrefix + URGENCY);
+	}
+	
+	public Integer getUrgencyValue() {
+		IntegerType tt = ((IntegerType) getProperty(localPrefix + URGENCY));
+		return tt == null ? null : tt.getValue();
+	}
+	
+	public void setUrgencyValue(String text) {
+		addProperty(new IntegerType(metadata, localPrefix, URGENCY, text));
+	}
+
+	public void setUrgency(IntegerType text) {
+		addProperty(text);
+	}
+	
+	
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java?rev=1198544&r1=1198543&r2=1198544&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java Sun Nov  6 20:05:03 2011
@@ -73,6 +73,30 @@ public class ComplexPropertyContainer ex
 		super(metadata, namespaceURI, prefix, propertyName);
 		properties = new ArrayList<AbstractField>();
 	}
+	
+	/**
+	 * Give the first property found in this container with type and localname
+	 * expected
+	 * 
+	 * @param localName
+	 *            the localname of property wanted
+	 * @param type
+	 *            the property type of property wanted
+	 * @return the property wanted
+	 */
+	protected AbstractField getFirstEquivalentProperty(String localName,
+			Class<? extends AbstractField> type) {
+		List<AbstractField> list = getPropertiesByLocalName(localName);
+		if (list != null) {
+			for (AbstractField abstractField : list) {
+				// System.out.println(abstractField.getQualifiedName());
+				if (abstractField.getClass().equals(type)) {
+					return abstractField;
+				}
+			}
+		}
+		return null;
+	}
 
 	/**
 	 * Add a property to the current structure

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java?rev=1198544&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java Sun Nov  6 20:05:03 2011
@@ -0,0 +1,76 @@
+package org.apache.padaf.xmpbox.type;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+
+public class LayerType extends ComplexPropertyContainer {
+	protected XMPMetadata metadata;
+	
+	public LayerType(XMPMetadata metadata, String namespaceURI, String prefix, String propertyName) {
+		super(metadata, namespaceURI, prefix, propertyName);
+		this.metadata = metadata;
+		setAttribute(new Attribute(null, "rdf", "parseType", "Resource"));
+	}
+	
+	public LayerType(XMPMetadata metadata, String prefix, String propertyName) {
+		super(metadata, prefix, propertyName);
+		this.metadata = metadata;
+		setAttribute(new Attribute(null, "rdf", "parseType", "Resource"));
+	}
+	
+	/**
+	 * Get The LayerName data
+	 * 
+	 * @return the LayerName
+	 */
+	public String getLayerName() {
+		AbstractField absProp = getFirstEquivalentProperty("LayerName",
+				TextType.class);
+		if (absProp != null) {
+			return ((TextType) absProp).getStringValue();
+		}
+		return null;
+	}
+
+	/**
+	 * Set LayerName 
+	 * 
+	 * @param prefix
+	 *            the prefix of LayerName property to set
+	 * @param name
+	 *            the name of LayerName property to set
+	 * @param image
+	 *            the value of LayerName property to set
+	 */
+	public void setLayerName(String prefix, String name, String image) {
+		this.addProperty(new TextType(metadata, prefix, name, image));
+	}
+	
+	/**
+	 * Get The LayerText data
+	 * 
+	 * @return the LayerText
+	 */
+	public String getLayerText() {
+		AbstractField absProp = getFirstEquivalentProperty("LayerText",
+				TextType.class);
+		if (absProp != null) {
+			return ((TextType) absProp).getStringValue();
+		}
+		return null;
+	}
+
+	/**
+	 * Set LayerText 
+	 * 
+	 * @param prefix
+	 *            the prefix of LayerText property to set
+	 * @param name
+	 *            the name of LayerText property to set
+	 * @param image
+	 *            the value of LayerText property to set
+	 */
+	public void setLayerText(String prefix, String name, String image) {
+		this.addProperty(new TextType(metadata, prefix, name, image));
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java?rev=1198544&r1=1198543&r2=1198544&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java Sun Nov  6 20:05:03 2011
@@ -21,8 +21,6 @@
 
 package org.apache.padaf.xmpbox.type;
 
-import java.util.List;
-
 import org.apache.padaf.xmpbox.XMPMetadata;
 
 
@@ -69,29 +67,6 @@ public class ThumbnailType extends Compl
 		setAttribute(new Attribute(null, "rdf", "parseType", "Resource"));
 	}
 
-	/**
-	 * Give the first property found in this container with type and localname
-	 * expected
-	 * 
-	 * @param localName
-	 *            the localname of property wanted
-	 * @param type
-	 *            the property type of property wanted
-	 * @return the property wanted
-	 */
-	protected AbstractField getFirstEquivalentProperty(String localName,
-			Class<? extends AbstractField> type) {
-		List<AbstractField> list = getPropertiesByLocalName(localName);
-		if (list != null) {
-			for (AbstractField abstractField : list) {
-				// System.out.println(abstractField.getQualifiedName());
-				if (abstractField.getClass().equals(type)) {
-					return abstractField;
-				}
-			}
-		}
-		return null;
-	}
 
 	/**
 	 * Get Height



Re: svn commit: r1198544 - in /pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox: XMPMetadata.java parser/NSMapping.java schema/PhotoshopSchema.java type/ComplexPropertyContainer.java type/LayerType.java type/ThumbnailType.java

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Sun, Nov 6, 2011 at 9:05 PM,  <le...@apache.org> wrote:
> Added:
>    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java   (with props)
>    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java   (with props)

Please remember to include the Apache license header in new source files.

BR,

Jukka Zitting