[dna-commits] DNA SVN: r202 - trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Tue May 27 17:50:04 EDT 2008


Author: rhauch
Date: 2008-05-27 17:50:04 -0400 (Tue, 27 May 2008)
New Revision: 202

Modified:
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
Log:
DNA-77: SequencerOutput setProperty and setReference method signatures need to be changed
http://jira.jboss.org/jira/browse/DNA-77

Minor change to correctly convert SPI graph property values to JCR property values.


Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java	2008-05-27 21:31:52 UTC (rev 201)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java	2008-05-27 21:50:04 UTC (rev 202)
@@ -22,7 +22,9 @@
 package org.jboss.dna.repository.sequencers;
 
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.Set;
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
@@ -35,6 +37,8 @@
 import org.jboss.dna.repository.observation.NodeChange;
 import org.jboss.dna.repository.util.ExecutionContext;
 import org.jboss.dna.repository.util.RepositoryNodePath;
+import org.jboss.dna.spi.graph.Binary;
+import org.jboss.dna.spi.graph.DateTime;
 import org.jboss.dna.spi.graph.Name;
 import org.jboss.dna.spi.graph.NamespaceRegistry;
 import org.jboss.dna.spi.graph.Path;
@@ -209,6 +213,8 @@
                     targetNode.setProperty(propertyName, ((Boolean)value).booleanValue());
                 } else if (value instanceof String) {
                     targetNode.setProperty(propertyName, (String)value);
+                } else if (value instanceof String[]) {
+                    targetNode.setProperty(propertyName, (String[])value);
                 } else if (value instanceof Integer) {
                     targetNode.setProperty(propertyName, ((Integer)value).intValue());
                 } else if (value instanceof Short) {
@@ -219,8 +225,27 @@
                     targetNode.setProperty(propertyName, ((Float)value).floatValue());
                 } else if (value instanceof Double) {
                     targetNode.setProperty(propertyName, ((Double)value).doubleValue());
+                } else if (value instanceof Binary) {
+                    Binary binaryValue = (Binary)value;
+                    try {
+                        binaryValue.acquire();
+                        targetNode.setProperty(propertyName, binaryValue.getStream());
+                    } finally {
+                        binaryValue.release();
+                    }
+                } else if (value instanceof BigDecimal) {
+                    targetNode.setProperty(propertyName, ((BigDecimal)value).doubleValue());
+                } else if (value instanceof DateTime) {
+                    targetNode.setProperty(propertyName, ((DateTime)value).toCalendar());
+                } else if (value instanceof Date) {
+                    DateTime instant = context.getValueFactories().getDateFactory().create((Date)value);
+                    targetNode.setProperty(propertyName, instant.toCalendar());
                 } else if (value instanceof Calendar) {
                     targetNode.setProperty(propertyName, (Calendar)value);
+                } else if (value instanceof Name) {
+                    Name nameValue = (Name)value;
+                    String stringValue = nameValue.getString(namespaceRegistry);
+                    targetNode.setProperty(propertyName, stringValue);
                 } else if (value instanceof Path) {
                     // Find the path to reference node ...
                     Path pathToReferencedNode = (Path)value;




More information about the dna-commits mailing list