manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1603506 - /manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/RepositoryDocument.java
Date Wed, 18 Jun 2014 16:11:06 GMT
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.
   */



Mime
View raw message