Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F2049C6B for ; Wed, 6 Mar 2013 15:58:25 +0000 (UTC) Received: (qmail 41251 invoked by uid 500); 6 Mar 2013 15:58:25 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 41144 invoked by uid 500); 6 Mar 2013 15:58:24 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 41058 invoked by uid 99); 6 Mar 2013 15:58:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 15:58:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 15:58:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C03492388AC8; Wed, 6 Mar 2013 15:57:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1453395 [3/11] - in /pdfbox/trunk/xmpbox: ./ src/main/java/org/apache/xmpbox/ src/main/java/org/apache/xmpbox/schema/ src/main/java/org/apache/xmpbox/type/ src/main/java/org/apache/xmpbox/xml/ src/test/java/org/apache/xmpbox/ src/test/java... Date: Wed, 06 Mar 2013 15:57:52 -0000 To: commits@pdfbox.apache.org From: gbailleul@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130306155758.C03492388AC8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicSchema.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicSchema.java (original) +++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPBasicSchema.java Wed Mar 6 15:57:44 2013 @@ -37,539 +37,584 @@ import org.apache.xmpbox.type.PropertyTy import org.apache.xmpbox.type.StructuredType; import org.apache.xmpbox.type.TextType; import org.apache.xmpbox.type.ThumbnailType; -import org.apache.xmpbox.type.TypeMapping; import org.apache.xmpbox.type.Types; import org.apache.xmpbox.type.URLType; - /** * Representation of XMPBasic Schema * * @author a183132 * */ -@StructuredType(preferedPrefix="xmp",namespace="http://ns.adobe.com/xap/1.0/") -public class XMPBasicSchema extends XMPSchema { +@StructuredType(preferedPrefix = "xmp", namespace = "http://ns.adobe.com/xap/1.0/") +public class XMPBasicSchema extends XMPSchema +{ - @PropertyType(type = Types.XPath, card = Cardinality.Bag) - public static final String ADVISORY = "Advisory"; + @PropertyType(type = Types.XPath, card = Cardinality.Bag) + public static final String ADVISORY = "Advisory"; - @PropertyType(type = Types.URL, card = Cardinality.Simple) - public static final String BASEURL = "BaseURL"; + @PropertyType(type = Types.URL, card = Cardinality.Simple) + public static final String BASEURL = "BaseURL"; - @PropertyType(type = Types.Date, card = Cardinality.Simple) - public static final String CREATEDATE = "CreateDate"; - - @PropertyType(type = Types.AgentName, card = Cardinality.Simple) - public static final String CREATORTOOL = "CreatorTool"; - - @PropertyType(type = Types.Text, card = Cardinality.Bag) - public static final String IDENTIFIER = "Identifier"; - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String LABEL = "Label"; - - @PropertyType(type = Types.Date, card = Cardinality.Simple) - public static final String METADATADATE = "MetadataDate"; - - @PropertyType(type = Types.Date, card = Cardinality.Simple) - public static final String MODIFYDATE = "ModifyDate"; - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String NICKNAME = "Nickname"; - - @PropertyType(type = Types.Integer, card = Cardinality.Simple) - public static final String RATING = "Rating"; - - @PropertyType(type = Types.Thumbnail, card = Cardinality.Alt) - public static final String THUMBNAILS = "Thumbnails"; - - private ArrayProperty altThumbs; - - /** - * Constructor of XMPBasic schema with preferred prefix - * - * @param metadata - * The metadata to attach this schema - */ - public XMPBasicSchema(XMPMetadata metadata) { - super(metadata); - - } - - /** - * Constructor of XMPBasic schema with specified prefix - * - * @param metadata - * The metadata to attach this schema - * @param ownPrefix - * The prefix to assign - */ - public XMPBasicSchema(XMPMetadata metadata, String ownPrefix) { - super(metadata, ownPrefix); - - } - - /** - * Add thumbnail to thumbnails list - * - * @param height - * height format - * @param width - * width format - * @param format - * thumbnail format - * @param img - * Image data - */ - public void addThumbnails(Integer height, Integer width, String format, - String img) { - if (altThumbs == null) { - altThumbs = createArrayProperty( THUMBNAILS, Cardinality.Alt); - addProperty(altThumbs); - } - ThumbnailType thumb = new ThumbnailType(getMetadata()); - thumb.setHeight( height); - thumb.setWidth( width); - thumb.setFormat( format); - thumb.setImage( img); - altThumbs.getContainer().addProperty(thumb); - } - - /** - * Add a property specification that were edited outside the authoring - * application - * - * @param xpath - * the value to add - */ - public void addAdvisory(String xpath) { - addQualifiedBagValue(ADVISORY, xpath); - } - - public void removeAdvisory (String xpath) { - removeUnqualifiedBagValue(ADVISORY, xpath); - } - - /** - * Set the base URL for relative URLs in the document content - * - * @param url - * the Base url value to set - */ - public void setBaseURL(String url) { - URLType tt = (URLType)instanciateSimple(BASEURL, url); - setBaseURLProperty(tt); - } - - /** - * Set the base URL property - * - * @param url - * the Base url property to set - */ - public void setBaseURLProperty(URLType url) { - addProperty(url); - } - - /** - * Set the date and time the resource was originally created - * - * @param date - * the value to set - */ - public void setCreateDate(Calendar date) { - DateType tt = (DateType)instanciateSimple(CREATEDATE, date); - setCreateDateProperty(tt); - } - - /** - * Set the create date property - * - * @param date - * the create date property to set - */ - public void setCreateDateProperty(DateType date) { - addProperty(date); - } - - /** - * set the name of the first known tool used to create this resource - * - * @param creatorTool - * the creator tool value to set - */ - public void setCreatorTool(String creatorTool) { - AgentNameType tt = (AgentNameType)instanciateSimple(CREATORTOOL, creatorTool); - setCreatorToolProperty(tt); - } - - /** - * set the creatorTool property - * - * @param creatorTool - * the creator tool property to set - */ - public void setCreatorToolProperty(AgentNameType creatorTool) { - addProperty(creatorTool); - } - - /** - * Add a text string which unambiguously identify the resource within a - * given context - * - * @param text - * the identifier value to add - */ - public void addIdentifier(String text) { - addQualifiedBagValue(IDENTIFIER, text); - } - - public void removeIdentifier(String text) { - removeUnqualifiedBagValue(IDENTIFIER, text); - } - - /** - * set a word or a short phrase which identifies a document as a member of a - * user-defined collection - * - * @param text - * the label value to set - */ - public void setLabel(String text) { - TextType tt = (TextType)instanciateSimple(LABEL, text); - setLabelProperty(tt); - } - - /** - * set the label property - * - * @param text - * the label property to set - */ - public void setLabelProperty(TextType text) { - addProperty(text); - } - - /** - * Set the date and time that any metadata for this resource was last - * changed. (should be equals or more recent than the createDate) - * - * @param date - * the Metadata Date value to set - */ - public void setMetadataDate(Calendar date) { - DateType tt =(DateType)instanciateSimple(METADATADATE, date); - setMetadataDateProperty(tt); -} + @PropertyType(type = Types.Date, card = Cardinality.Simple) + public static final String CREATEDATE = "CreateDate"; + + @PropertyType(type = Types.AgentName, card = Cardinality.Simple) + public static final String CREATORTOOL = "CreatorTool"; + + @PropertyType(type = Types.Text, card = Cardinality.Bag) + public static final String IDENTIFIER = "Identifier"; + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String LABEL = "Label"; + + @PropertyType(type = Types.Date, card = Cardinality.Simple) + public static final String METADATADATE = "MetadataDate"; + + @PropertyType(type = Types.Date, card = Cardinality.Simple) + public static final String MODIFYDATE = "ModifyDate"; + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String NICKNAME = "Nickname"; + + @PropertyType(type = Types.Integer, card = Cardinality.Simple) + public static final String RATING = "Rating"; + + @PropertyType(type = Types.Thumbnail, card = Cardinality.Alt) + public static final String THUMBNAILS = "Thumbnails"; + + private ArrayProperty altThumbs; + + /** + * Constructor of XMPBasic schema with preferred prefix + * + * @param metadata + * The metadata to attach this schema + */ + public XMPBasicSchema(XMPMetadata metadata) + { + super(metadata); + + } + + /** + * Constructor of XMPBasic schema with specified prefix + * + * @param metadata + * The metadata to attach this schema + * @param ownPrefix + * The prefix to assign + */ + public XMPBasicSchema(XMPMetadata metadata, String ownPrefix) + { + super(metadata, ownPrefix); + + } + + /** + * Add thumbnail to thumbnails list + * + * @param height + * height format + * @param width + * width format + * @param format + * thumbnail format + * @param img + * Image data + */ + public void addThumbnails(Integer height, Integer width, String format, String img) + { + if (altThumbs == null) + { + altThumbs = createArrayProperty(THUMBNAILS, Cardinality.Alt); + addProperty(altThumbs); + } + ThumbnailType thumb = new ThumbnailType(getMetadata()); + thumb.setHeight(height); + thumb.setWidth(width); + thumb.setFormat(format); + thumb.setImage(img); + altThumbs.getContainer().addProperty(thumb); + } + + /** + * Add a property specification that were edited outside the authoring application + * + * @param xpath + * the value to add + */ + public void addAdvisory(String xpath) + { + addQualifiedBagValue(ADVISORY, xpath); + } - /** - * Set the MetadataDate property - * - * @param date - * the Metadata Date property to set - */ - public void setMetadataDateProperty(DateType date) { - addProperty(date); - } - - /** - * Set the date and time the resource was last modified - * - * @param date - * the Modify Date value to set - */ - public void setModifyDate(Calendar date) { - DateType tt = (DateType)instanciateSimple(MODIFYDATE, date); - setModifyDateProperty(tt); - } - - /** - * Set the ModifyDate property - * - * @param date - * the Modify Date property to set - */ - public void setModifyDateProperty(DateType date) { - addProperty(date); - } - - /** - * Set a short informal name for the resource - * - * @param text - * the Nickname value to set - */ - public void setNickname(String text) { - TextType tt = (TextType)instanciateSimple(NICKNAME, text); - setNicknameProperty(tt); - } - - /** - * Set the NickName property - * - * @param text - * the Nickname property to set - */ - public void setNicknameProperty(TextType text) { - addProperty(text); - } - - /** - * Set a number that indicates a document's status relative to other - * documents, used to organize documents in a file browser (values are - * user-defined within an application-defined range) - * - * @param rate - * the rate value to set - */ - public void setRating(Integer rate) { -// addProperty(new IntegerType(metadata, localPrefix, RATING, rate)); - IntegerType tt = (IntegerType)instanciateSimple(RATING, rate); - setRatingProperty(tt); - - } - - /** - * Set Rating Property - * - * @param rate - * the rate property to set - */ - public void setRatingProperty(IntegerType rate) { - addProperty(rate); - } - - /** - * Get the Advisory property - * - * @return the advisory property - */ - public ArrayProperty getAdvisoryProperty() { - return (ArrayProperty) getProperty(ADVISORY); - } - - /** - * Get the Advisory property values - * - * @return list of adivory values - */ - public List getAdvisory() { - return getUnqualifiedBagValueList(ADVISORY); - } + public void removeAdvisory(String xpath) + { + removeUnqualifiedBagValue(ADVISORY, xpath); + } + + /** + * Set the base URL for relative URLs in the document content + * + * @param url + * the Base url value to set + */ + public void setBaseURL(String url) + { + URLType tt = (URLType) instanciateSimple(BASEURL, url); + setBaseURLProperty(tt); + } + + /** + * Set the base URL property + * + * @param url + * the Base url property to set + */ + public void setBaseURLProperty(URLType url) + { + addProperty(url); + } + + /** + * Set the date and time the resource was originally created + * + * @param date + * the value to set + */ + public void setCreateDate(Calendar date) + { + DateType tt = (DateType) instanciateSimple(CREATEDATE, date); + setCreateDateProperty(tt); + } + + /** + * Set the create date property + * + * @param date + * the create date property to set + */ + public void setCreateDateProperty(DateType date) + { + addProperty(date); + } + + /** + * set the name of the first known tool used to create this resource + * + * @param creatorTool + * the creator tool value to set + */ + public void setCreatorTool(String creatorTool) + { + AgentNameType tt = (AgentNameType) instanciateSimple(CREATORTOOL, creatorTool); + setCreatorToolProperty(tt); + } + + /** + * set the creatorTool property + * + * @param creatorTool + * the creator tool property to set + */ + public void setCreatorToolProperty(AgentNameType creatorTool) + { + addProperty(creatorTool); + } + + /** + * Add a text string which unambiguously identify the resource within a given context + * + * @param text + * the identifier value to add + */ + public void addIdentifier(String text) + { + addQualifiedBagValue(IDENTIFIER, text); + } + + public void removeIdentifier(String text) + { + removeUnqualifiedBagValue(IDENTIFIER, text); + } + + /** + * set a word or a short phrase which identifies a document as a member of a user-defined collection + * + * @param text + * the label value to set + */ + public void setLabel(String text) + { + TextType tt = (TextType) instanciateSimple(LABEL, text); + setLabelProperty(tt); + } + + /** + * set the label property + * + * @param text + * the label property to set + */ + public void setLabelProperty(TextType text) + { + addProperty(text); + } + + /** + * Set the date and time that any metadata for this resource was last changed. (should be equals or more recent than + * the createDate) + * + * @param date + * the Metadata Date value to set + */ + public void setMetadataDate(Calendar date) + { + DateType tt = (DateType) instanciateSimple(METADATADATE, date); + setMetadataDateProperty(tt); + } + + /** + * Set the MetadataDate property + * + * @param date + * the Metadata Date property to set + */ + public void setMetadataDateProperty(DateType date) + { + addProperty(date); + } + + /** + * Set the date and time the resource was last modified + * + * @param date + * the Modify Date value to set + */ + public void setModifyDate(Calendar date) + { + DateType tt = (DateType) instanciateSimple(MODIFYDATE, date); + setModifyDateProperty(tt); + } + + /** + * Set the ModifyDate property + * + * @param date + * the Modify Date property to set + */ + public void setModifyDateProperty(DateType date) + { + addProperty(date); + } + + /** + * Set a short informal name for the resource + * + * @param text + * the Nickname value to set + */ + public void setNickname(String text) + { + TextType tt = (TextType) instanciateSimple(NICKNAME, text); + setNicknameProperty(tt); + } + + /** + * Set the NickName property + * + * @param text + * the Nickname property to set + */ + public void setNicknameProperty(TextType text) + { + addProperty(text); + } + + /** + * Set a number that indicates a document's status relative to other documents, used to organize documents in a file + * browser (values are user-defined within an application-defined range) + * + * @param rate + * the rate value to set + */ + public void setRating(Integer rate) + { + // addProperty(new IntegerType(metadata, localPrefix, RATING, rate)); + IntegerType tt = (IntegerType) instanciateSimple(RATING, rate); + setRatingProperty(tt); + + } + + /** + * Set Rating Property + * + * @param rate + * the rate property to set + */ + public void setRatingProperty(IntegerType rate) + { + addProperty(rate); + } + + /** + * Get the Advisory property + * + * @return the advisory property + */ + public ArrayProperty getAdvisoryProperty() + { + return (ArrayProperty) getProperty(ADVISORY); + } + + /** + * Get the Advisory property values + * + * @return list of adivory values + */ + public List getAdvisory() + { + return getUnqualifiedBagValueList(ADVISORY); + } /** * Convenience method for jempbox signature compatibility - * + * * @see XMPBasicSchema#getAdvisory() */ - @Deprecated + @Deprecated public List getAdvisories() { return getAdvisory(); } - - /** - * Get the BaseURL property - * - * @return the base url property - */ - public TextType getBaseURLProperty() { - return (TextType) getProperty(BASEURL); - } - - /** - * Get the BaseURL property value - * - * @return the base url value - */ - public String getBaseURL() { - TextType tt = ((TextType) getProperty(BASEURL)); - return tt == null ? null : tt.getStringValue(); - } - - /** - * Get the CreateDate property - * - * @return the CreateDate property - */ - public DateType getCreateDateProperty() { - return (DateType) getProperty(CREATEDATE); - } - - /** - * Get the CreateDate property value - * - * @return the CreateDate value - */ - public Calendar getCreateDate() { - DateType createDate = (DateType) getProperty(CREATEDATE); - if (createDate != null) { - return createDate.getValue(); - } - return null; - } - - /** - * Get the CreationTool property - * - * @return the CreationTool property - */ - public TextType getCreatorToolProperty() { - return (TextType) getProperty(CREATORTOOL); - } - - /** - * Get the CreationTool property value - * - * @return the CreationTool value - */ - public String getCreatorTool() { - TextType tt = ((TextType) getProperty(CREATORTOOL)); - return tt == null ? null : tt.getStringValue(); - } - - /** - * Get the Identifier property - * - * @return the Identifier property - */ - public ArrayProperty getIdentifiersProperty() { - return (ArrayProperty) getProperty(IDENTIFIER); - } - - /** - * Get the Identifier property values - * - * @return list of all identifier values - */ - public List getIdentifiers() { - return getUnqualifiedBagValueList(IDENTIFIER); - } - - /** - * Get the label property - * - * @return the label property - */ - public TextType getLabelProperty() { - return (TextType) getProperty(LABEL); - } - - /** - * Get the label property value - * - * @return the label value - */ - public String getLabel() { - TextType tt = ((TextType) getProperty(LABEL)); - return tt == null ? null : tt.getStringValue(); - } - - /** - * Get the MetadataDate property - * - * @return the MetadataDate property - */ - public DateType getMetadataDateProperty() { - return (DateType) getProperty(METADATADATE); - } - - /** - * Get the MetadataDate property value - * - * @return the MetadataDate value - */ - public Calendar getMetadataDate() { - DateType dt = ((DateType) getProperty(METADATADATE)); - return dt == null ? null : dt.getValue(); - } - - /** - * Get the ModifyDate property - * - * @return the ModifyDate property - */ - public DateType getModifyDateProperty() { - return (DateType) getProperty(MODIFYDATE); - } - - /** - * Get the ModifyDate property value - * - * @return the ModifyDate value - */ - public Calendar getModifyDate() { - DateType modifyDate = (DateType) getProperty(MODIFYDATE); - if (modifyDate != null) { - return modifyDate.getValue(); - } - return null; - - } - - /** - * Get the Nickname property - * - * @return the Nickname property - */ - public TextType getNicknameProperty() { - return (TextType) getProperty(NICKNAME); - } - - /** - * Get the Nickname property value - * - * @return the Nickname value - */ - public String getNickname() { - TextType tt = ((TextType) getProperty(NICKNAME)); - return tt == null ? null : tt.getStringValue(); - } - - /** - * Get the Rating property - * - * @return the Rating property - */ - public IntegerType getRatingProperty() { - return ((IntegerType) getProperty(RATING)); - } - - /** - * Get the Rating property value - * - * @return the Rating value - */ - public Integer getRating() { - IntegerType it = ((IntegerType) getProperty(RATING)); - return it == null ? null : it.getValue(); - } - - /** - * Get list of Thumbnails - * - * @return List of all thumbnails properties defined - * @throws BadFieldValueException - * if one thumbnail is not thumbnail type - */ - public List getThumbnailsProperty() throws BadFieldValueException { - List tmp = getUnqualifiedArrayList(THUMBNAILS); - if (tmp != null) { - List thumbs = new ArrayList(); - for (AbstractField abstractField : tmp) { - if (abstractField instanceof ThumbnailType) { - thumbs.add((ThumbnailType) abstractField); - } else { - throw new BadFieldValueException("Thumbnail expected and " - + abstractField.getClass().getName() + " found."); - } - } - return thumbs; - } - return null; + /** + * Get the BaseURL property + * + * @return the base url property + */ + public TextType getBaseURLProperty() + { + return (TextType) getProperty(BASEURL); + } + + /** + * Get the BaseURL property value + * + * @return the base url value + */ + public String getBaseURL() + { + TextType tt = ((TextType) getProperty(BASEURL)); + return tt == null ? null : tt.getStringValue(); + } + + /** + * Get the CreateDate property + * + * @return the CreateDate property + */ + public DateType getCreateDateProperty() + { + return (DateType) getProperty(CREATEDATE); + } + + /** + * Get the CreateDate property value + * + * @return the CreateDate value + */ + public Calendar getCreateDate() + { + DateType createDate = (DateType) getProperty(CREATEDATE); + if (createDate != null) + { + return createDate.getValue(); + } + return null; + } + + /** + * Get the CreationTool property + * + * @return the CreationTool property + */ + public TextType getCreatorToolProperty() + { + return (TextType) getProperty(CREATORTOOL); + } + + /** + * Get the CreationTool property value + * + * @return the CreationTool value + */ + public String getCreatorTool() + { + TextType tt = ((TextType) getProperty(CREATORTOOL)); + return tt == null ? null : tt.getStringValue(); + } + + /** + * Get the Identifier property + * + * @return the Identifier property + */ + public ArrayProperty getIdentifiersProperty() + { + return (ArrayProperty) getProperty(IDENTIFIER); + } + + /** + * Get the Identifier property values + * + * @return list of all identifier values + */ + public List getIdentifiers() + { + return getUnqualifiedBagValueList(IDENTIFIER); + } + + /** + * Get the label property + * + * @return the label property + */ + public TextType getLabelProperty() + { + return (TextType) getProperty(LABEL); + } - } + /** + * Get the label property value + * + * @return the label value + */ + public String getLabel() + { + TextType tt = ((TextType) getProperty(LABEL)); + return tt == null ? null : tt.getStringValue(); + } + + /** + * Get the MetadataDate property + * + * @return the MetadataDate property + */ + public DateType getMetadataDateProperty() + { + return (DateType) getProperty(METADATADATE); + } + + /** + * Get the MetadataDate property value + * + * @return the MetadataDate value + */ + public Calendar getMetadataDate() + { + DateType dt = ((DateType) getProperty(METADATADATE)); + return dt == null ? null : dt.getValue(); + } + + /** + * Get the ModifyDate property + * + * @return the ModifyDate property + */ + public DateType getModifyDateProperty() + { + return (DateType) getProperty(MODIFYDATE); + } + + /** + * Get the ModifyDate property value + * + * @return the ModifyDate value + */ + public Calendar getModifyDate() + { + DateType modifyDate = (DateType) getProperty(MODIFYDATE); + if (modifyDate != null) + { + return modifyDate.getValue(); + } + return null; + + } + + /** + * Get the Nickname property + * + * @return the Nickname property + */ + public TextType getNicknameProperty() + { + return (TextType) getProperty(NICKNAME); + } + + /** + * Get the Nickname property value + * + * @return the Nickname value + */ + public String getNickname() + { + TextType tt = ((TextType) getProperty(NICKNAME)); + return tt == null ? null : tt.getStringValue(); + } + + /** + * Get the Rating property + * + * @return the Rating property + */ + public IntegerType getRatingProperty() + { + return ((IntegerType) getProperty(RATING)); + } + + /** + * Get the Rating property value + * + * @return the Rating value + */ + public Integer getRating() + { + IntegerType it = ((IntegerType) getProperty(RATING)); + return it == null ? null : it.getValue(); + } + + /** + * Get list of Thumbnails + * + * @return List of all thumbnails properties defined + * @throws BadFieldValueException + * if one thumbnail is not thumbnail type + */ + public List getThumbnailsProperty() throws BadFieldValueException + { + List tmp = getUnqualifiedArrayList(THUMBNAILS); + if (tmp != null) + { + List thumbs = new ArrayList(); + for (AbstractField abstractField : tmp) + { + if (abstractField instanceof ThumbnailType) + { + thumbs.add((ThumbnailType) abstractField); + } + else + { + throw new BadFieldValueException("Thumbnail expected and " + abstractField.getClass().getName() + + " found."); + } + } + return thumbs; + } + return null; + + } } Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPMediaManagementSchema.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPMediaManagementSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPMediaManagementSchema.java (original) +++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPMediaManagementSchema.java Wed Mar 6 15:57:44 2013 @@ -32,11 +32,8 @@ import org.apache.xmpbox.type.RenditionC import org.apache.xmpbox.type.ResourceRefType; import org.apache.xmpbox.type.StructuredType; import org.apache.xmpbox.type.TextType; -import org.apache.xmpbox.type.TypeMapping; import org.apache.xmpbox.type.Types; import org.apache.xmpbox.type.URIType; -import org.apache.xmpbox.type.VersionType; - /** * Representation of XMPMediaManagement Schema @@ -44,656 +41,709 @@ import org.apache.xmpbox.type.VersionTyp * @author gbailleul * */ -@StructuredType(preferedPrefix="xmpMM",namespace="http://ns.adobe.com/xap/1.0/mm/") -public class XMPMediaManagementSchema extends XMPSchema { - - /** - * Constructor of XMPMediaManagement Schema with preferred prefix - * - * @param metadata - * The metadata to attach this schema - */ - public XMPMediaManagementSchema(XMPMetadata metadata) { - super(metadata); - - } - - /** - * Constructor of XMPMediaManagementSchema schema with specified prefix - * - * @param metadata - * The metadata to attach this schema - * @param ownPrefix - * The prefix to assign - */ - public XMPMediaManagementSchema(XMPMetadata metadata, String ownPrefix) { - super(metadata, ownPrefix); - - } - - // -------------------------------- ResourceRef -------------------- - - @PropertyType(type = Types.ResourceRef, card = Cardinality.Simple) - public static final String DERIVED_FROM = "DerivedFrom"; - - /** - * Set ResourceRef property - * - * @param tt - * ResourceRef property to set - */ - public void setDerivedFromProperty(ResourceRefType tt) { - addProperty(tt); - } - - /** - * Get ResourceRef property - * - * @return ResourceRef property - */ - public ResourceRefType getResourceRefProperty() { - return (ResourceRefType)getProperty(DERIVED_FROM); - } - - - - // --------------------------------------- DocumentID - // ---------------------------- - - @PropertyType(type = Types.URI, card = Cardinality.Simple) - public static final String DOCUMENTID = "DocumentID"; - - /** - * Set DocumentId value - * - * @param url - * DocumentId value to set - */ - public void setDocumentID(String url) { - URIType tt = (URIType)instanciateSimple(DOCUMENTID, url); - setDocumentIDProperty(tt); - } - - /** - * Set DocumentId Property - * - * @param tt - * DocumentId Property to set - */ - public void setDocumentIDProperty(URIType tt) { - addProperty(tt); - } - - /** - * Get DocumentId property - * - * @return DocumentId property - */ - public TextType getDocumentIDProperty() { - return (TextType) getProperty(DOCUMENTID); - } - - /** - * Get DocumentId value - * - * @return DocumentId value - */ - public String getDocumentID() { - TextType tt = getDocumentIDProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- Manager - // ---------------------------- - - @PropertyType(type = Types.AgentName, card = Cardinality.Simple) - public static final String MANAGER = "Manager"; - - /** - * Set Manager value - * - * @param url - * Manager value to set - */ - public void setManager(String value) { - AgentNameType tt = (AgentNameType)instanciateSimple(MANAGER, value); - setManagerProperty(tt); - } - - /** - * Set Manager property - * - * @param tt - * Manager property to set - */ - public void setManagerProperty(AgentNameType tt) { - addProperty(tt); - } - - /** - * Get Manager property - * - * @return Manager property - */ - public TextType getManagerProperty() { - return (TextType) getProperty(MANAGER); - } - - /** - * Get Manager value - * - * @return Manager value - */ - public String getManager() { - TextType tt = getManagerProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- ManageTo - // ---------------------------- - - @PropertyType(type = Types.URI, card = Cardinality.Simple) - public static final String MANAGETO = "ManageTo"; - - /** - * Set ManageTo Value - * - * @param value - * ManageTo Value to set - */ - public void setManageTo(String value) { - URIType tt = (URIType)instanciateSimple(MANAGETO, value); - setManageToProperty(tt); - } - - /** - * Set ManageTo property - * - * @param tt - * ManageTo property to set - */ - public void setManageToProperty(URIType tt) { - addProperty(tt); - } - - /** - * get ManageTo property - * - * @return ManageTo property - */ - public TextType getManageToProperty() { - return (TextType) getProperty(MANAGETO); - } - - /** - * get ManageTo value - * - * @return ManageTo value - */ - public String getManageTo() { - TextType tt = getManageToProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- ManageUI - // ---------------------------- - - @PropertyType(type = Types.URI, card = Cardinality.Simple) - public static final String MANAGEUI = "ManageUI"; - - /** - * Set ManageUI value - * - * @param url - * ManageUI value to set - */ - public void setManageUI(String value) { - URIType tt = (URIType)instanciateSimple(MANAGEUI, value); - setManageUIProperty(tt); - } - - /** - * Set ManageUI property - * - * @param tt - * ManageUI property to set - */ - public void setManageUIProperty(URIType tt) { - addProperty(tt); - } - - /** - * Get ManageUI property - * - * @return ManageUI property - */ - public TextType getManageUIProperty() { - return (TextType) getProperty(MANAGEUI); - } - - /** - * Get ManageUI Value - * - * @return ManageUI Value - */ - public String getManageUI() { - TextType tt = getManageUIProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- ManagerVariant - // ---------------------------- - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String MANAGERVARIANT = "ManagerVariant"; - - /** - * Set ManagerVariant value - * - * @param url - * ManagerVariant value to set - */ - public void setManagerVariant(String value) { - TextType tt = (TextType)instanciateSimple(MANAGERVARIANT, value); - setManagerVariantProperty(tt); - } - - /** - * Set ManagerVariant Property - * - * @param tt - * ManagerVariant Property to set - */ - public void setManagerVariantProperty(TextType tt) { - addProperty(tt); - } - - /** - * Get ManagerVariant property - * - * @return ManagerVariant property - */ - public TextType getManagerVariantProperty() { - return (TextType) getProperty(MANAGERVARIANT); - } - - /** - * Get ManagerVariant value - * - * @return ManagerVariant value - */ - public String getManagerVariant() { - TextType tt = getManagerVariantProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- InstanceID - // ---------------------------- - - @PropertyType(type = Types.URI, card = Cardinality.Simple) - public static final String INSTANCEID = "InstanceID"; - - /** - * Set InstanceId value - * - * @param url - * InstanceId value to set - */ - public void setInstanceID(String value) { - URIType tt = (URIType)instanciateSimple(INSTANCEID, value); - setInstanceIDProperty(tt); - } - - /** - * Set InstanceId property - * - * @param tt - * InstanceId property to set - */ - public void setInstanceIDProperty(URIType tt) { - addProperty(tt); - } - - /** - * Get InstanceId property - * - * @return InstanceId property - */ - public TextType getInstanceIDProperty() { - return (TextType) getProperty(INSTANCEID); - } - - /** - * Get InstanceId value - * - * @return InstanceId value - */ - public String getInstanceID() { - TextType tt = getInstanceIDProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- ManageFrom - // ---------------------------- - - @PropertyType(type = Types.ResourceRef, card = Cardinality.Simple) - public static final String MANAGED_FROM = "ManagedFrom"; - -// /** -// * set ManageFrom Value -// * -// * @param url -// * ManageFrom Value to set -// */ -// public void setManagedFrom(ResourceRefType resourceRef) { -// -// setManagedFromProperty(new TextType(metadata, localPrefix, MANAGED_FROM, url)); -// } - - /** - * set ManageFrom Property - * - * @param tt - * ManageFrom Property to set - */ - public void setManagedFromProperty(ResourceRefType resourceRef) { - addProperty(resourceRef); - } - - /** - * get ManageFrom Property - * - * @return ManageFrom Property - */ - public ResourceRefType getManagedFromProperty() { - return (ResourceRefType) getProperty(MANAGED_FROM); - } - -// /** -// * Get ManageFrom value -// * -// * @return ManageFrom value -// */ -// public String getManagedFrom() { -// TextType tt = getManagedFromProperty(); -// return tt != null ? tt.getStringValue() : null; -// } - - // --------------------------------------- OriginalDocumentID - // ---------------------------- - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String ORIGINALDOCUMENTID = "OriginalDocumentID"; - - /** - * Set OriginalDocumentId value - * - * @param url - * OriginalDocumentId value to set - */ - public void setOriginalDocumentID(String url) { - TextType tt = (TextType)instanciateSimple(ORIGINALDOCUMENTID, url); - setOriginalDocumentIDProperty(tt); - } - - /** - * Set OriginalDocumentId property - * - * @param tt - * OriginalDocumentId property to set - */ - public void setOriginalDocumentIDProperty(TextType tt) { - addProperty(tt); - } - - /** - * Get OriginalDocumentId property - * - * @return OriginalDocumentId property - */ - public TextType getOriginalDocumentIDProperty() { - return (TextType) getProperty(ORIGINALDOCUMENTID); - } - - /** - * Get OriginalDocumentId value - * - * @return OriginalDocumentId value - */ - public String getOriginalDocumentID() { - TextType tt = getOriginalDocumentIDProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- RenditionClass - // ---------------------------- - - @PropertyType(type = Types.RenditionClass, card = Cardinality.Simple) - public static final String RENDITIONCLASS = "RenditionClass"; - - /** - * Set renditionClass Value - * - * @param url - * renditionClass Value to set - */ - public void setRenditionClass(String value) { - RenditionClassType tt = (RenditionClassType)instanciateSimple(RENDITIONCLASS, value); - setRenditionClassProperty(tt); - } - - /** - * Set RenditionClass Property - * - * @param tt - * renditionClass Property to set - */ - public void setRenditionClassProperty(RenditionClassType tt) { - addProperty(tt); - } - - /** - * Get RenditionClass property - * - * @return RenditionClass property - */ - public TextType getRenditionClassProperty() { - return (TextType) getProperty(RENDITIONCLASS); - } - - /** - * Get RenditionClass value - * - * @return RenditionClass value - */ - public String getRenditionClass() { - TextType tt = getRenditionClassProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- RenditionParams - // ---------------------------- - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String RENDITIONPARAMS = "RenditionParams"; - - /** - * Set RenditionParams Value - * - * @param url - * RenditionParams Value to set - */ - public void setRenditionParams(String url) { - TextType tt = (TextType)instanciateSimple(RENDITIONPARAMS, url); - setRenditionParamsProperty(tt); - } - - /** - * Set RenditionParams property - * - * @param tt - * RenditionParams property to set - */ - public void setRenditionParamsProperty(TextType tt) { - addProperty(tt); - } - - /** - * Get RenditionParams property - * - * @return RenditionParams property - */ - public TextType getRenditionParamsProperty() { - return (TextType) getProperty(RENDITIONPARAMS); - } - - /** - * Get RenditionParams value - * - * @return RenditionParams value - */ - public String getRenditionParams() { - TextType tt = getRenditionParamsProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- VersionID - // ---------------------------- - - @PropertyType(type = Types.Text, card = Cardinality.Simple) - public static final String VERSIONID = "VersionID"; - - /** - * Set VersionId value - * - * @param url - * VersionId value to set - */ - public void setVersionID(String value) { - TextType tt = (TextType)instanciateSimple(VERSIONID, value); - setVersionIDProperty(tt); - } - - /** - * Set VersionId property - * - * @param tt - * VersionId property to set - */ - public void setVersionIDProperty(TextType tt) { - addProperty(tt); - } - - /** - * Get VersionId property - * - * @return VersionId property - */ - public TextType getVersionIDProperty() { - return (TextType) getProperty(VERSIONID); - } - - /** - * Get VersionId value - * - * @return VersionId value - */ - public String getVersionID() { - TextType tt = getVersionIDProperty(); - return tt != null ? tt.getStringValue() : null; - } - - // --------------------------------------- Versions - // ---------------------------- - - @PropertyType(type = Types.Version, card = Cardinality.Seq) - public static final String VERSIONS = "Versions"; - - - public void addVersions(String value) { - addQualifiedBagValue(VERSIONS, value); - } - - /** - * Get Versions property - * - * @return version property to set - */ - public ArrayProperty getVersionsProperty() { - return (ArrayProperty) getProperty(VERSIONS); - } - - public List getVersions() { - return getUnqualifiedBagValueList(VERSIONS); - } - - - // --------------------------------------- History - // ---------------------------- - - @PropertyType(type = Types.ResourceEvent, card = Cardinality.Seq) - public static final String HISTORY = "History"; - - /** - * Add a History Value - * - * @param history - * History Value to add - */ - public void addHistory(String history) { - addUnqualifiedSequenceValue(HISTORY, history); - } - - /** - * Get History Property - * - * @return History Property - */ - public ArrayProperty getHistoryProperty() { - return (ArrayProperty) getProperty(HISTORY); - } - - /** - * Get List of History values - * - * @return List of History values - */ - public List getHistory() { - return getUnqualifiedSequenceValueList(HISTORY); - } - - // --------------------------------------- Ingredients - // ---------------------------- - - @PropertyType(type = Types.Text, card = Cardinality.Bag) - public static final String INGREDIENTS = "Ingredients"; - - /** - * Add an Ingredients value - * - * @param ingredients - * Ingredients value to add - */ - public void addIngredients(String ingredients) { - addQualifiedBagValue(INGREDIENTS, ingredients); - } - - /** - * . Get Ingredients Property - * - * @return Ingredients property - */ - public ArrayProperty getIngredientsProperty() { - return (ArrayProperty) getProperty(INGREDIENTS); - } - - /** - * Get List of Ingredients values - * - * @return List of Ingredients values - */ - public List getIngredients() { - return getUnqualifiedBagValueList(INGREDIENTS); - } +@StructuredType(preferedPrefix = "xmpMM", namespace = "http://ns.adobe.com/xap/1.0/mm/") +public class XMPMediaManagementSchema extends XMPSchema +{ + + /** + * Constructor of XMPMediaManagement Schema with preferred prefix + * + * @param metadata + * The metadata to attach this schema + */ + public XMPMediaManagementSchema(XMPMetadata metadata) + { + super(metadata); + + } + + /** + * Constructor of XMPMediaManagementSchema schema with specified prefix + * + * @param metadata + * The metadata to attach this schema + * @param ownPrefix + * The prefix to assign + */ + public XMPMediaManagementSchema(XMPMetadata metadata, String ownPrefix) + { + super(metadata, ownPrefix); + + } + + // -------------------------------- ResourceRef -------------------- + + @PropertyType(type = Types.ResourceRef, card = Cardinality.Simple) + public static final String DERIVED_FROM = "DerivedFrom"; + + /** + * Set ResourceRef property + * + * @param tt + * ResourceRef property to set + */ + public void setDerivedFromProperty(ResourceRefType tt) + { + addProperty(tt); + } + + /** + * Get ResourceRef property + * + * @return ResourceRef property + */ + public ResourceRefType getResourceRefProperty() + { + return (ResourceRefType) getProperty(DERIVED_FROM); + } + + // --------------------------------------- DocumentID + // ---------------------------- + + @PropertyType(type = Types.URI, card = Cardinality.Simple) + public static final String DOCUMENTID = "DocumentID"; + + /** + * Set DocumentId value + * + * @param url + * DocumentId value to set + */ + public void setDocumentID(String url) + { + URIType tt = (URIType) instanciateSimple(DOCUMENTID, url); + setDocumentIDProperty(tt); + } + + /** + * Set DocumentId Property + * + * @param tt + * DocumentId Property to set + */ + public void setDocumentIDProperty(URIType tt) + { + addProperty(tt); + } + + /** + * Get DocumentId property + * + * @return DocumentId property + */ + public TextType getDocumentIDProperty() + { + return (TextType) getProperty(DOCUMENTID); + } + + /** + * Get DocumentId value + * + * @return DocumentId value + */ + public String getDocumentID() + { + TextType tt = getDocumentIDProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- Manager + // ---------------------------- + + @PropertyType(type = Types.AgentName, card = Cardinality.Simple) + public static final String MANAGER = "Manager"; + + /** + * Set Manager value + * + * @param url + * Manager value to set + */ + public void setManager(String value) + { + AgentNameType tt = (AgentNameType) instanciateSimple(MANAGER, value); + setManagerProperty(tt); + } + + /** + * Set Manager property + * + * @param tt + * Manager property to set + */ + public void setManagerProperty(AgentNameType tt) + { + addProperty(tt); + } + + /** + * Get Manager property + * + * @return Manager property + */ + public TextType getManagerProperty() + { + return (TextType) getProperty(MANAGER); + } + + /** + * Get Manager value + * + * @return Manager value + */ + public String getManager() + { + TextType tt = getManagerProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- ManageTo + // ---------------------------- + + @PropertyType(type = Types.URI, card = Cardinality.Simple) + public static final String MANAGETO = "ManageTo"; + + /** + * Set ManageTo Value + * + * @param value + * ManageTo Value to set + */ + public void setManageTo(String value) + { + URIType tt = (URIType) instanciateSimple(MANAGETO, value); + setManageToProperty(tt); + } + + /** + * Set ManageTo property + * + * @param tt + * ManageTo property to set + */ + public void setManageToProperty(URIType tt) + { + addProperty(tt); + } + + /** + * get ManageTo property + * + * @return ManageTo property + */ + public TextType getManageToProperty() + { + return (TextType) getProperty(MANAGETO); + } + + /** + * get ManageTo value + * + * @return ManageTo value + */ + public String getManageTo() + { + TextType tt = getManageToProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- ManageUI + // ---------------------------- + + @PropertyType(type = Types.URI, card = Cardinality.Simple) + public static final String MANAGEUI = "ManageUI"; + + /** + * Set ManageUI value + * + * @param url + * ManageUI value to set + */ + public void setManageUI(String value) + { + URIType tt = (URIType) instanciateSimple(MANAGEUI, value); + setManageUIProperty(tt); + } + + /** + * Set ManageUI property + * + * @param tt + * ManageUI property to set + */ + public void setManageUIProperty(URIType tt) + { + addProperty(tt); + } + + /** + * Get ManageUI property + * + * @return ManageUI property + */ + public TextType getManageUIProperty() + { + return (TextType) getProperty(MANAGEUI); + } + + /** + * Get ManageUI Value + * + * @return ManageUI Value + */ + public String getManageUI() + { + TextType tt = getManageUIProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- ManagerVariant + // ---------------------------- + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String MANAGERVARIANT = "ManagerVariant"; + + /** + * Set ManagerVariant value + * + * @param url + * ManagerVariant value to set + */ + public void setManagerVariant(String value) + { + TextType tt = (TextType) instanciateSimple(MANAGERVARIANT, value); + setManagerVariantProperty(tt); + } + + /** + * Set ManagerVariant Property + * + * @param tt + * ManagerVariant Property to set + */ + public void setManagerVariantProperty(TextType tt) + { + addProperty(tt); + } + + /** + * Get ManagerVariant property + * + * @return ManagerVariant property + */ + public TextType getManagerVariantProperty() + { + return (TextType) getProperty(MANAGERVARIANT); + } + + /** + * Get ManagerVariant value + * + * @return ManagerVariant value + */ + public String getManagerVariant() + { + TextType tt = getManagerVariantProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- InstanceID + // ---------------------------- + + @PropertyType(type = Types.URI, card = Cardinality.Simple) + public static final String INSTANCEID = "InstanceID"; + + /** + * Set InstanceId value + * + * @param url + * InstanceId value to set + */ + public void setInstanceID(String value) + { + URIType tt = (URIType) instanciateSimple(INSTANCEID, value); + setInstanceIDProperty(tt); + } + + /** + * Set InstanceId property + * + * @param tt + * InstanceId property to set + */ + public void setInstanceIDProperty(URIType tt) + { + addProperty(tt); + } + + /** + * Get InstanceId property + * + * @return InstanceId property + */ + public TextType getInstanceIDProperty() + { + return (TextType) getProperty(INSTANCEID); + } + + /** + * Get InstanceId value + * + * @return InstanceId value + */ + public String getInstanceID() + { + TextType tt = getInstanceIDProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- ManageFrom + // ---------------------------- + + @PropertyType(type = Types.ResourceRef, card = Cardinality.Simple) + public static final String MANAGED_FROM = "ManagedFrom"; + + // /** + // * set ManageFrom Value + // * + // * @param url + // * ManageFrom Value to set + // */ + // public void setManagedFrom(ResourceRefType resourceRef) { + // + // setManagedFromProperty(new TextType(metadata, localPrefix, MANAGED_FROM, + // url)); + // } + + /** + * set ManageFrom Property + * + * @param tt + * ManageFrom Property to set + */ + public void setManagedFromProperty(ResourceRefType resourceRef) + { + addProperty(resourceRef); + } + + /** + * get ManageFrom Property + * + * @return ManageFrom Property + */ + public ResourceRefType getManagedFromProperty() + { + return (ResourceRefType) getProperty(MANAGED_FROM); + } + + // /** + // * Get ManageFrom value + // * + // * @return ManageFrom value + // */ + // public String getManagedFrom() { + // TextType tt = getManagedFromProperty(); + // return tt != null ? tt.getStringValue() : null; + // } + + // --------------------------------------- OriginalDocumentID + // ---------------------------- + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String ORIGINALDOCUMENTID = "OriginalDocumentID"; + + /** + * Set OriginalDocumentId value + * + * @param url + * OriginalDocumentId value to set + */ + public void setOriginalDocumentID(String url) + { + TextType tt = (TextType) instanciateSimple(ORIGINALDOCUMENTID, url); + setOriginalDocumentIDProperty(tt); + } + + /** + * Set OriginalDocumentId property + * + * @param tt + * OriginalDocumentId property to set + */ + public void setOriginalDocumentIDProperty(TextType tt) + { + addProperty(tt); + } + + /** + * Get OriginalDocumentId property + * + * @return OriginalDocumentId property + */ + public TextType getOriginalDocumentIDProperty() + { + return (TextType) getProperty(ORIGINALDOCUMENTID); + } + + /** + * Get OriginalDocumentId value + * + * @return OriginalDocumentId value + */ + public String getOriginalDocumentID() + { + TextType tt = getOriginalDocumentIDProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- RenditionClass + // ---------------------------- + + @PropertyType(type = Types.RenditionClass, card = Cardinality.Simple) + public static final String RENDITIONCLASS = "RenditionClass"; + + /** + * Set renditionClass Value + * + * @param url + * renditionClass Value to set + */ + public void setRenditionClass(String value) + { + RenditionClassType tt = (RenditionClassType) instanciateSimple(RENDITIONCLASS, value); + setRenditionClassProperty(tt); + } + + /** + * Set RenditionClass Property + * + * @param tt + * renditionClass Property to set + */ + public void setRenditionClassProperty(RenditionClassType tt) + { + addProperty(tt); + } + + /** + * Get RenditionClass property + * + * @return RenditionClass property + */ + public TextType getRenditionClassProperty() + { + return (TextType) getProperty(RENDITIONCLASS); + } + + /** + * Get RenditionClass value + * + * @return RenditionClass value + */ + public String getRenditionClass() + { + TextType tt = getRenditionClassProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- RenditionParams + // ---------------------------- + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String RENDITIONPARAMS = "RenditionParams"; + + /** + * Set RenditionParams Value + * + * @param url + * RenditionParams Value to set + */ + public void setRenditionParams(String url) + { + TextType tt = (TextType) instanciateSimple(RENDITIONPARAMS, url); + setRenditionParamsProperty(tt); + } + + /** + * Set RenditionParams property + * + * @param tt + * RenditionParams property to set + */ + public void setRenditionParamsProperty(TextType tt) + { + addProperty(tt); + } + + /** + * Get RenditionParams property + * + * @return RenditionParams property + */ + public TextType getRenditionParamsProperty() + { + return (TextType) getProperty(RENDITIONPARAMS); + } + + /** + * Get RenditionParams value + * + * @return RenditionParams value + */ + public String getRenditionParams() + { + TextType tt = getRenditionParamsProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- VersionID + // ---------------------------- + + @PropertyType(type = Types.Text, card = Cardinality.Simple) + public static final String VERSIONID = "VersionID"; + + /** + * Set VersionId value + * + * @param url + * VersionId value to set + */ + public void setVersionID(String value) + { + TextType tt = (TextType) instanciateSimple(VERSIONID, value); + setVersionIDProperty(tt); + } + + /** + * Set VersionId property + * + * @param tt + * VersionId property to set + */ + public void setVersionIDProperty(TextType tt) + { + addProperty(tt); + } + + /** + * Get VersionId property + * + * @return VersionId property + */ + public TextType getVersionIDProperty() + { + return (TextType) getProperty(VERSIONID); + } + + /** + * Get VersionId value + * + * @return VersionId value + */ + public String getVersionID() + { + TextType tt = getVersionIDProperty(); + return tt != null ? tt.getStringValue() : null; + } + + // --------------------------------------- Versions + // ---------------------------- + + @PropertyType(type = Types.Version, card = Cardinality.Seq) + public static final String VERSIONS = "Versions"; + + public void addVersions(String value) + { + addQualifiedBagValue(VERSIONS, value); + } + + /** + * Get Versions property + * + * @return version property to set + */ + public ArrayProperty getVersionsProperty() + { + return (ArrayProperty) getProperty(VERSIONS); + } + + public List getVersions() + { + return getUnqualifiedBagValueList(VERSIONS); + } + + // --------------------------------------- History + // ---------------------------- + + @PropertyType(type = Types.ResourceEvent, card = Cardinality.Seq) + public static final String HISTORY = "History"; + + /** + * Add a History Value + * + * @param history + * History Value to add + */ + public void addHistory(String history) + { + addUnqualifiedSequenceValue(HISTORY, history); + } + + /** + * Get History Property + * + * @return History Property + */ + public ArrayProperty getHistoryProperty() + { + return (ArrayProperty) getProperty(HISTORY); + } + + /** + * Get List of History values + * + * @return List of History values + */ + public List getHistory() + { + return getUnqualifiedSequenceValueList(HISTORY); + } + + // --------------------------------------- Ingredients + // ---------------------------- + + @PropertyType(type = Types.Text, card = Cardinality.Bag) + public static final String INGREDIENTS = "Ingredients"; + + /** + * Add an Ingredients value + * + * @param ingredients + * Ingredients value to add + */ + public void addIngredients(String ingredients) + { + addQualifiedBagValue(INGREDIENTS, ingredients); + } + + /** + * . Get Ingredients Property + * + * @return Ingredients property + */ + public ArrayProperty getIngredientsProperty() + { + return (ArrayProperty) getProperty(INGREDIENTS); + } + + /** + * Get List of Ingredients values + * + * @return List of Ingredients values + */ + public List getIngredients() + { + return getUnqualifiedBagValueList(INGREDIENTS); + } } Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPRightsManagementSchema.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPRightsManagementSchema.java?rev=1453395&r1=1453394&r2=1453395&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPRightsManagementSchema.java (original) +++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPRightsManagementSchema.java Wed Mar 6 15:57:44 2013 @@ -33,320 +33,341 @@ import org.apache.xmpbox.type.TextType; import org.apache.xmpbox.type.Types; import org.apache.xmpbox.type.URLType; - /** * Representation of XMP Rights Management Schema * * @author a183132 * */ -@StructuredType(preferedPrefix="xmpRights",namespace="http://ns.adobe.com/xap/1.0/rights/") -public class XMPRightsManagementSchema extends XMPSchema { +@StructuredType(preferedPrefix = "xmpRights", namespace = "http://ns.adobe.com/xap/1.0/rights/") +public class XMPRightsManagementSchema extends XMPSchema +{ + + @PropertyType(type = Types.URL, card = Cardinality.Simple) + public static final String CERTIFICATE = "Certificate"; + + @PropertyType(type = Types.Boolean, card = Cardinality.Simple) + public static final String MARKED = "Marked"; + + @PropertyType(type = Types.ProperName, card = Cardinality.Bag) + public static final String OWNER = "Owner"; + + @PropertyType(type = Types.LangAlt, card = Cardinality.Simple) + public static final String USAGETERMS = "UsageTerms"; + + @PropertyType(type = Types.URL, card = Cardinality.Simple) + public static final String WEBSTATEMENT = "WebStatement"; + + /** + * Constructor of XMPRightsManagement Schema with preferred prefix + * + * @param metadata + * The metadata to attach this schema + */ + public XMPRightsManagementSchema(XMPMetadata metadata) + { + super(metadata); + } + + /** + * Constructor of XMPRightsManagement schema with specified prefix + * + * @param metadata + * The metadata to attach this schema + * @param ownPrefix + * The prefix to assign + */ + public XMPRightsManagementSchema(XMPMetadata metadata, String ownPrefix) + { + super(metadata, ownPrefix); + } + + /** + * Add a legal owner for the described resource. + * + * @param value + * value to add + */ + public void addOwner(String value) + { + addQualifiedBagValue(OWNER, value); + } + + public void removeOwner(String value) + { + removeUnqualifiedBagValue(OWNER, value); + } + + /** + * Return the Bag of owner(s) + * + * @return owners property + */ + public ArrayProperty getOwnersProperty() + { + return (ArrayProperty) getProperty(OWNER); + } - @PropertyType(type = Types.URL, card = Cardinality.Simple) - public static final String CERTIFICATE = "Certificate"; + /** + * Return a String list of owner(s) + * + * @return list of defined owners + */ + public List getOwners() + { + return getUnqualifiedBagValueList(OWNER); + } - @PropertyType(type = Types.Boolean, card = Cardinality.Simple) - public static final String MARKED = "Marked"; + /** + * Set Marked value + * + * @param marked + * value to add + */ + public void setMarked(Boolean marked) + { + BooleanType tt = (BooleanType) instanciateSimple(MARKED, marked ? BooleanType.TRUE : BooleanType.FALSE); + setMarkedProperty(tt); + } - @PropertyType(type = Types.ProperName, card = Cardinality.Bag) - public static final String OWNER = "Owner"; - - @PropertyType(type = Types.LangAlt, card = Cardinality.Simple) - public static final String USAGETERMS = "UsageTerms"; - - @PropertyType(type = Types.URL, card = Cardinality.Simple) - public static final String WEBSTATEMENT = "WebStatement"; - - /** - * Constructor of XMPRightsManagement Schema with preferred prefix - * - * @param metadata - * The metadata to attach this schema - */ - public XMPRightsManagementSchema(XMPMetadata metadata) { - super(metadata); - } - - /** - * Constructor of XMPRightsManagement schema with specified prefix - * - * @param metadata - * The metadata to attach this schema - * @param ownPrefix - * The prefix to assign - */ - public XMPRightsManagementSchema(XMPMetadata metadata, String ownPrefix) { - super(metadata, ownPrefix); - } - - /** - * Add a legal owner for the described resource. - * - * @param value - * value to add - */ - public void addOwner(String value) { - addQualifiedBagValue(OWNER, value); - } - - public void removeOwner (String value) { - removeUnqualifiedBagValue(OWNER, value); - } - - /** - * Return the Bag of owner(s) - * - * @return owners property - */ - public ArrayProperty getOwnersProperty() { - return (ArrayProperty) getProperty(OWNER); - } - - /** - * Return a String list of owner(s) - * - * @return list of defined owners - */ - public List getOwners() { - return getUnqualifiedBagValueList(OWNER); - } - - /** - * Set Marked value - * - * @param marked - * value to add - */ - public void setMarked(Boolean marked) { - BooleanType tt = (BooleanType)instanciateSimple(MARKED, marked?BooleanType.TRUE:BooleanType.FALSE); - setMarkedProperty(tt); - } - - /** - * Set Marked property - * - * @param marked - * Marked property to set - */ - public void setMarkedProperty(BooleanType marked) { - addProperty(marked); - } - - /** - * Get Marked property - * - * @return Marked property - */ - public BooleanType getMarkedProperty() { - return (BooleanType) getProperty(MARKED); - } - - /** - * Get Marked value - * - * @return marked value - */ - public Boolean getMarked() { - BooleanType bt = ((BooleanType) getProperty(MARKED)); - return bt == null ? null : bt.getValue(); - } - - /** - * Add an usageTerms value - * - * @param lang - * concerned language - * @param value - * value to set - */ - public void addUsageTerms(String lang, String value) { - setUnqualifiedLanguagePropertyValue(USAGETERMS, lang, value); - } + /** + * Set Marked property + * + * @param marked + * Marked property to set + */ + public void setMarkedProperty(BooleanType marked) + { + addProperty(marked); + } + + /** + * Get Marked property + * + * @return Marked property + */ + public BooleanType getMarkedProperty() + { + return (BooleanType) getProperty(MARKED); + } + + /** + * Get Marked value + * + * @return marked value + */ + public Boolean getMarked() + { + BooleanType bt = ((BooleanType) getProperty(MARKED)); + return bt == null ? null : bt.getValue(); + } + + /** + * Add an usageTerms value + * + * @param lang + * concerned language + * @param value + * value to set + */ + public void addUsageTerms(String lang, String value) + { + setUnqualifiedLanguagePropertyValue(USAGETERMS, lang, value); + } /** * Set the default usage terms for this resource. - * - * @param terms The resource usage terms. + * + * @param terms + * The resource usage terms. */ - public void setUsageTerms( String terms ) + public void setUsageTerms(String terms) { addUsageTerms(null, terms); } /** * Convenience method for jempbox signature compatibility - * + * * @see XMPRightsManagementSchema#addUsageTerms(String, String) */ @Deprecated - public void setDescription( String language, String terms ) + public void setDescription(String language, String terms) + { + addUsageTerms(language, terms); + } + + /** + * Return the Lang alt UsageTerms + * + * @return usageterms property + */ + public ArrayProperty getUsageTermsProperty() { - addUsageTerms(language, terms); + return (ArrayProperty) getProperty(USAGETERMS); } - - /** - * Return the Lang alt UsageTerms - * - * @return usageterms property - */ - public ArrayProperty getUsageTermsProperty() { - return (ArrayProperty) getProperty(USAGETERMS); - } - - /** - * Return a list of languages defined in description property - * - * @return list of languages defined for usageterms - */ - public List getUsageTermsLanguages() { - return getUnqualifiedLanguagePropertyLanguagesValue(USAGETERMS); - } - - /** - * Return a language value for description property - * - * @param lang - * concerned language - * @return value of specified language - */ - public String getUsageTerms(String lang) { - return getUnqualifiedLanguagePropertyValue(USAGETERMS, lang); - } + /** + * Return a list of languages defined in description property + * + * @return list of languages defined for usageterms + */ + public List getUsageTermsLanguages() + { + return getUnqualifiedLanguagePropertyLanguagesValue(USAGETERMS); + } + + /** + * Return a language value for description property + * + * @param lang + * concerned language + * @return value of specified language + */ + public String getUsageTerms(String lang) + { + return getUnqualifiedLanguagePropertyValue(USAGETERMS, lang); + } /** * Get the default usage terms for the document. - * + * * @return The terms for this resource. */ public String getUsageTerms() { return getUsageTerms(null); } - - /** - * Return the WebStatement URL as TextType. - * - * @return Webstatement URL property - */ - public TextType getWebStatementProperty() { - return ((TextType) getProperty(WEBSTATEMENT)); - } - - /** - * Return the WebStatement URL as String. - * - * @return webStatement URL value - */ - public String getWebStatement() { - TextType tt = ((TextType) getProperty(WEBSTATEMENT)); - return tt == null ? null : tt.getStringValue(); - } - - /** - * Set the WebStatement url - * - * @param url - * WebStatemen url value to set - */ - public void setWebStatement(String url) { - URLType tt = (URLType)instanciateSimple(WEBSTATEMENT, url); - setWebStatementProperty(tt); - } - - /** - * Set the WebStatement url - * - * @param url - * WebStatemen url property to set - */ - public void setWebStatementProperty(URLType url) { - addProperty(url); - } - - /** - * Return the Certificate URL as TextType. - * - * @return certificate url property - */ - public TextType getCertificateProperty() { - return ((TextType) getProperty(CERTIFICATE)); - } - - /** - * Return the Certificate URL as String. - * - * @return certificate URL value - */ - public String getCertificate() { - TextType tt = ((TextType) getProperty(CERTIFICATE)); - return tt == null ? null : tt.getStringValue(); - } + + /** + * Return the WebStatement URL as TextType. + * + * @return Webstatement URL property + */ + public TextType getWebStatementProperty() + { + return ((TextType) getProperty(WEBSTATEMENT)); + } + + /** + * Return the WebStatement URL as String. + * + * @return webStatement URL value + */ + public String getWebStatement() + { + TextType tt = ((TextType) getProperty(WEBSTATEMENT)); + return tt == null ? null : tt.getStringValue(); + } + + /** + * Set the WebStatement url + * + * @param url + * WebStatemen url value to set + */ + public void setWebStatement(String url) + { + URLType tt = (URLType) instanciateSimple(WEBSTATEMENT, url); + setWebStatementProperty(tt); + } + + /** + * Set the WebStatement url + * + * @param url + * WebStatemen url property to set + */ + public void setWebStatementProperty(URLType url) + { + addProperty(url); + } + + /** + * Return the Certificate URL as TextType. + * + * @return certificate url property + */ + public TextType getCertificateProperty() + { + return ((TextType) getProperty(CERTIFICATE)); + } + + /** + * Return the Certificate URL as String. + * + * @return certificate URL value + */ + public String getCertificate() + { + TextType tt = ((TextType) getProperty(CERTIFICATE)); + return tt == null ? null : tt.getStringValue(); + } /** * Convenience method for jempbox signature compatibility - * + * * @see XMPRightsManagementSchema#getCertificate() */ - @Deprecated - public String getCopyright () { - return getCertificate(); - } - + @Deprecated + public String getCopyright() + { + return getCertificate(); + } + /** * Convenience method for jempbox signature compatibility - * + * * @see XMPRightsManagementSchema#getCertificate() */ - @Deprecated + @Deprecated public String getCertificateURL() { return getCertificate(); } - - /** - * Set the Certificate URL. - * - * @param url - * certficate url value to set - */ - public void setCertificate(String url) { - URLType tt = (URLType)instanciateSimple(CERTIFICATE, url); - setCertificateProperty(tt); - } + /** + * Set the Certificate URL. + * + * @param url + * certficate url value to set + */ + public void setCertificate(String url) + { + URLType tt = (URLType) instanciateSimple(CERTIFICATE, url); + setCertificateProperty(tt); + } /** * Convenience method for jempbox signature compatibility - * + * * @see XMPRightsManagementSchema#setCertificate(String) */ - @Deprecated - public void setCertificateURL( String certificate ) + @Deprecated + public void setCertificateURL(String certificate) { setCertificate(certificate); } /** * Convenience method for jempbox signature compatibility - * + * * @see XMPRightsManagementSchema#setCertificate(String) */ - @Deprecated - public void setCopyright( String certificate ) + @Deprecated + public void setCopyright(String certificate) { setCertificate(certificate); } - - /** - * Set the Certificate URL. - * - * @param url - * certificate url property to set - */ - public void setCertificateProperty(URLType url) { - addProperty(url); - } + /** + * Set the Certificate URL. + * + * @param url + * certificate url property to set + */ + public void setCertificateProperty(URLType url) + { + addProperty(url); + } }