You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/06/18 18:11:06 UTC

svn commit: r1603506 - /manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java

Author: kwright
Date: Wed Jun 18 16:11:05 2014
New Revision: 1603506

URL: http://svn.apache.org/r1603506
Log:
Add RepositoryDocument.duplicate() method, to support transformation connectors

Modified:
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java?rev=1603506&r1=1603505&r2=1603506&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java Wed Jun 18 16:11:05 2014
@@ -63,6 +63,45 @@ public class RepositoryDocument
   {
   }
 
+  /** Create an exact duplicate of this Repository Document.  This is how you are expected to write
+  * transformation connectors: you create a duplicate, and override the fields you want to change.
+  * For streams etc, only the overridden fields need to be explicitly managed by the transformation
+  * connector, since the original fields will be handled by the connector's caller.
+  *@return the exact duplicate.
+  */
+  public RepositoryDocument duplicate()
+  {
+    RepositoryDocument rval = new RepositoryDocument();
+    rval.binaryFieldData = binaryFieldData;
+    rval.binaryLength = binaryLength;
+    rval.fileName = fileName;
+    rval.contentMimeType = contentMimeType;
+    rval.createdDate = createdDate;
+    rval.modifiedDate = modifiedDate;
+    rval.indexingDate = indexingDate;
+    for (String key : fields.keySet())
+    {
+      rval.fields.put(key,fields.get(key));
+    }
+    for (String key : stringFields.keySet())
+    {
+      rval.stringFields.put(key,stringFields.get(key));
+    }
+    for (String key : readerFields.keySet())
+    {
+      rval.readerFields.put(key,readerFields.get(key));
+    }
+    for (String key : dateFields.keySet())
+    {
+      rval.dateFields.put(key,dateFields.get(key));
+    }
+    for (String key : securityLevels.keySet())
+    {
+      rval.securityLevels.put(key,securityLevels.get(key));
+    }
+    return rval;
+  }
+  
   /** Set the document's created date.  Use null to indicate that the date is unknown.
   *@param date is the date.
   */