You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by je...@apache.org on 2009/12/22 15:41:03 UTC
svn commit: r893190 - in /xmlgraphics/commons/trunk:
src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java
Author: jeremias
Date: Tue Dec 22 14:41:02 2009
New Revision: 893190
URL: http://svn.apache.org/viewvc?rev=893190&view=rev
Log:
Renamed addIdentifier to setIdentifier which makes more sense in this case.
Modified:
xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java?rev=893190&r1=893189&r2=893190&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java Tue Dec 22 14:41:02 2009
@@ -22,6 +22,7 @@
import java.util.Date;
import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.PropertyAccess;
import org.apache.xmlgraphics.xmp.XMPArrayType;
import org.apache.xmlgraphics.xmp.XMPConstants;
import org.apache.xmlgraphics.xmp.XMPProperty;
@@ -105,15 +106,22 @@
}
/**
- * Adds a qualified identifier that unambiguously identify the resource within a given context.
+ * Sets a qualified identifier that unambiguously identify the resource within a given context.
* As qualifier, <code>xmpidq:Scheme</code> is used.
* @param value the identifier value
+ * @param qualifier the qualifier value (for xmpidq:Scheme)
*/
- public void addIdentifier(String value, String qualifier) {
- XMPStructure struct = new XMPStructure();
- struct.setProperty(new XMPProperty(XMPConstants.RDF_VALUE, value));
- struct.setProperty(new XMPProperty(XMPBasicSchema.SCHEME_QUALIFIER, qualifier));
- addObjectToArray(IDENTIFIER, struct, XMPArrayType.BAG);
+ public void setIdentifier(String value, String qualifier) {
+ PropertyAccess pa = findQualifiedStructure(IDENTIFIER,
+ XMPBasicSchema.SCHEME_QUALIFIER, qualifier);
+ if (pa != null) {
+ pa.setProperty(new XMPProperty(XMPConstants.RDF_VALUE, value));
+ } else {
+ XMPStructure struct = new XMPStructure();
+ struct.setProperty(new XMPProperty(XMPConstants.RDF_VALUE, value));
+ struct.setProperty(new XMPProperty(XMPBasicSchema.SCHEME_QUALIFIER, qualifier));
+ addObjectToArray(IDENTIFIER, struct, XMPArrayType.BAG);
+ }
}
/**
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java?rev=893190&r1=893189&r2=893190&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/xmp/XMPPropertyTest.java Tue Dec 22 14:41:02 2009
@@ -167,8 +167,8 @@
XMPBasicAdapter basic = XMPBasicSchema.getAdapter(xmp);
basic.addIdentifier("x123");
- basic.addIdentifier("id1", "system1");
- basic.addIdentifier("12345", "system2");
+ basic.setIdentifier("id1", "system1");
+ basic.setIdentifier("12345", "system2");
String[] ids = basic.getIdentifiers();
assertEquals(3, ids.length);
@@ -178,6 +178,9 @@
assertTrue(set.contains("12345"));
assertEquals("id1", basic.getIdentifier("system1"));
+ basic.setIdentifier("id2", "system1");
+ assertEquals("id2", basic.getIdentifier("system1"));
+ assertEquals(3, basic.getIdentifiers().length);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org