manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1844859 - in /manifoldcf/trunk: ./ connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/ connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/ connectors/cmis/conn...
Date Thu, 25 Oct 2018 20:38:28 GMT
Author: piergiorgio
Date: Thu Oct 25 20:38:28 2018
New Revision: 1844859

URL: http://svn.apache.org/viewvc?rev=1844859&view=rev
Log:
added a new field in the CMIS Output Connector configuration for managing the versioning state
(CONNECTORS-1542)

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConfig.java
    manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
    manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_en_US.properties
    manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_es_ES.properties
    manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/editConfiguration_Server.html
    manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/viewConfiguration.html
    manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Oct 25 20:38:28 2018
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 2.12-dev =====================
 
+CONNECTORS-1542:  Add switch to let user select the Version Policy to be applied to ingested
documents
+(Piergiorgio Lucidi)
+
 CONNECTORS-1548: CMIS output connector test fails with versioning state error
 (Piergiorgio Lucidi)
 

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConfig.java?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConfig.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConfig.java
Thu Oct 25 20:38:28 2018
@@ -17,6 +17,7 @@
  * limitations under the License.
  */
 package org.apache.manifoldcf.agents.output.cmisoutput;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.commons.lang.StringUtils;
 
 /** 
@@ -54,6 +55,9 @@ public class CmisOutputConfig {
   /** Create Timestamp Tree **/
   public static final String CREATE_TIMESTAMP_TREE_PARAM = "createTimestampTree";
   
+  /** Create Timestamp Tree **/
+  public static final String VERSIONING_STATE_PARAM = "versioningState";
+  
   //default values
   public static final String USERNAME_DEFAULT_VALUE = "dummyuser";
   public static final String PASSWORD_DEFAULT_VALUE = "dummysecrect";
@@ -67,5 +71,6 @@ public class CmisOutputConfig {
   public static final String BINDING_WS_VALUE = "ws";
   public static final String CMIS_QUERY_DEFAULT_VALUE = "SELECT * FROM cmis:folder WHERE
cmis:name='Apache ManifoldCF'";
   public static final String CREATE_TIMESTAMP_TREE_DEFAULT_VALUE = Boolean.FALSE.toString();
+  public static final String VERSIONING_STATE_DEFAULT_VALUE = VersioningState.NONE.value();
   
 }
\ No newline at end of file

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
Thu Oct 25 20:38:28 2018
@@ -132,6 +132,9 @@ public class CmisOutputConnector extends
   /** Flag for creating the new tree structure using timestamp**/
   protected String createTimestampTree = Boolean.FALSE.toString();
   
+  /** Flag for creating the new tree structure using timestamp**/
+  protected VersioningState versioningState = VersioningState.NONE;
+  
   protected SessionFactory factory = SessionFactoryImpl.newInstance();
   protected Map<String, String> parameters = new HashMap<String, String>();
 
@@ -353,6 +356,7 @@ public class CmisOutputConnector extends
     repositoryId = null;
     cmisQuery = null;
     createTimestampTree = Boolean.FALSE.toString();
+    versioningState = VersioningState.NONE;
 
   }
 
@@ -381,6 +385,10 @@ public class CmisOutputConnector extends
     cmisQuery = params.getParameter(CmisOutputConfig.CMIS_QUERY_PARAM);
     createTimestampTree = params.getParameter(CmisOutputConfig.CREATE_TIMESTAMP_TREE_PARAM);
     
+    if(StringUtils.isNotEmpty(params.getParameter(CmisOutputConfig.VERSIONING_STATE_PARAM)))
{
+    	versioningState = VersioningState.fromValue(params.getParameter(CmisOutputConfig.VERSIONING_STATE_PARAM));
+    }
+    
     if (StringUtils.isNotEmpty(params.getParameter(CmisOutputConfig.REPOSITORY_ID_PARAM)))
{
       repositoryId = params.getParameter(CmisOutputConfig.REPOSITORY_ID_PARAM);
     }
@@ -645,6 +653,7 @@ public class CmisOutputConnector extends
     String binding = parameters.getParameter(CmisOutputConfig.BINDING_PARAM);
     String cmisQuery = parameters.getParameter(CmisOutputConfig.CMIS_QUERY_PARAM);
     String createTimestampTree = parameters.getParameter(CmisOutputConfig.CREATE_TIMESTAMP_TREE_PARAM);
+    String versioningState = parameters.getParameter(CmisOutputConfig.VERSIONING_STATE_PARAM);
     
     if (username == null)
       username = StringUtils.EMPTY;
@@ -668,6 +677,8 @@ public class CmisOutputConnector extends
       cmisQuery = CmisOutputConfig.CMIS_QUERY_DEFAULT_VALUE;
     if(createTimestampTree == null)
       createTimestampTree = CmisOutputConfig.CREATE_TIMESTAMP_TREE_DEFAULT_VALUE;
+    if(versioningState == null)
+    	versioningState = CmisOutputConfig.VERSIONING_STATE_DEFAULT_VALUE;
     
     newMap.put(CmisOutputConfig.USERNAME_PARAM, username);
     newMap.put(CmisOutputConfig.PASSWORD_PARAM, password);
@@ -679,6 +690,7 @@ public class CmisOutputConnector extends
     newMap.put(CmisOutputConfig.BINDING_PARAM, binding);
     newMap.put(CmisOutputConfig.CMIS_QUERY_PARAM, cmisQuery);
     newMap.put(CmisOutputConfig.CREATE_TIMESTAMP_TREE_PARAM, createTimestampTree);
+    newMap.put(CmisOutputConfig.VERSIONING_STATE_PARAM, versioningState);
   }
 
   /**
@@ -825,6 +837,11 @@ public class CmisOutputConnector extends
     if (createTimestampTree != null) {
       parameters.setParameter(CmisOutputConfig.CREATE_TIMESTAMP_TREE_PARAM, createTimestampTree);
     }
+    
+    String versioningState = variableContext.getParameter(CmisOutputConfig.VERSIONING_STATE_PARAM);
+    if (versioningState != null) {
+      parameters.setParameter(CmisOutputConfig.VERSIONING_STATE_PARAM, versioningState);
+    }
 
     String repositoryId = variableContext.getParameter(CmisOutputConfig.REPOSITORY_ID_PARAM);
     if (repositoryId != null) {
@@ -958,9 +975,9 @@ public class CmisOutputConnector extends
         contentStream = new ContentStreamImpl(fileName, BigInteger.valueOf(binaryLength),
mimeType,
           replayableInputStream);
 
-        // create a major version
+        // create a new content
         leafParent = getOrCreateLeafParent(parentDropZoneFolder, creationDate, Boolean.valueOf(createTimestampTree),
primaryPath);
-        leafParent.createDocument(properties, contentStream, VersioningState.NONE);
+        leafParent.createDocument(properties, contentStream, versioningState);
         resultDescription = DOCUMENT_STATUS_ACCEPTED_DESC;
         return DOCUMENT_STATUS_ACCEPTED;
 

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_en_US.properties?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_en_US.properties
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_en_US.properties
Thu Oct 25 20:38:28 2018
@@ -38,6 +38,7 @@ CmisOutputConnector.CMISQuery=CMIS Query
 
 CmisOutputConnector.CMISQueryColon=CMIS Query - Target folder:
 CmisOutputConnector.CreateTimestampTreeColon=Create Timestamp Tree:
+CmisOutputConnector.VersioningStateColon=Versioning State Policy:
 
 CmisOutputConnector.ParametersColon=Parameters:
 CmisOutputConnector.UsernameEquals=username=
@@ -51,3 +52,5 @@ CmisOutputConnector.RepositoryIdEquals=r
 CmisOutputConnector.CreateTimestampTreeEquals=createTimestampTree=
 CmisOutputConnector.CMISQueryEquals=cmisQuery=
 CmisOutputConnector.CMISQueryMustNotBeNull=CMIS Query must be not null
+CmisOutputConnector.VersioningStateEquals=versioningState=
+

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_es_ES.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_es_ES.properties?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_es_ES.properties
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/cmisoutput/common_es_ES.properties
Thu Oct 25 20:38:28 2018
@@ -56,6 +56,7 @@ CmisOutputConnector.PathEquals=camino=
 CmisOutputConnector.RepositoryIdEquals=Depósito ID=
 CmisOutputConnector.CMISQueryEquals=cmisConsulta=
 CmisOutputConnector.CreateTimestampTreeEquals=createTimestampTree=
+CmisOutputConnector.VersioningStateEquals=versioningState=
 
 
 CmisAuthorityConnector.Repository=Depósito

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/editConfiguration_Server.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/editConfiguration_Server.html?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/editConfiguration_Server.html
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/editConfiguration_Server.html
Thu Oct 25 20:38:28 2018
@@ -122,6 +122,30 @@
   <tr>
     <td class="description">
       <nobr>
+        $Encoder.bodyEscape($ResourceBundle.getString('CmisOutputConnector.VersioningStateColon'))
+      </nobr>
+    </td>
+    <td class="value">
+      <select id="versioningState" name="versioningState">
+#if($VERSIONINGSTATE == "none")
+        <option value="major">Major</option>
+        <option value="minor">Minor</option>
+        <option value="none" selected="selected">None</option>
+#elseif($VERSIONINGSTATE == "major")
+        <option value="major" selected="selected">Major</option>
+        <option value="minor">Minor</option>
+        <option value="none">None</option>
+#else($VERSIONINGSTATE == "minor")
+        <option value="major">Major</option>
+        <option value="minor" selected="selected">Minor</option>
+        <option value="none">None</option>
+#end
+      </select>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>
         $Encoder.bodyEscape($ResourceBundle.getString('CmisOutputConnector.CreateTimestampTreeColon'))
       </nobr>
     </td> 
@@ -167,5 +191,6 @@
 <input type="hidden" name="cmisQuery" value="$Encoder.attributeEscape($CMISQUERY)" />
 <input type="hidden" name="createTimestampTree" value="$Encoder.attributeEscape($CREATETIMESTAMPTREE)"/>
 <input type="hidden" name="repositoryId" value="$Encoder.attributeEscape($REPOSITORYID)"
/>
+<input type="hidden" name="versioningState" value="$Encoder.attributeEscape($VERSIONINGSTATE)"
/>
 
 #end

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/viewConfiguration.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/viewConfiguration.html?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/viewConfiguration.html
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/agents/output/cmisoutput/viewConfiguration.html
Thu Oct 25 20:38:28 2018
@@ -60,6 +60,10 @@
       </nobr>
       <br />
       <nobr>
+        $Encoder.bodyEscape($ResourceBundle.getString('CmisOutputConnector.VersioningStateEquals'))$Encoder.bodyEscape($VERSIONINGSTATE)
+      </nobr>
+      <br />
+      <nobr>
         $Encoder.bodyEscape($ResourceBundle.getString('CmisOutputConnector.RepositoryIdEquals'))$Encoder.bodyEscape($REPOSITORYID)
       </nobr>
       <br />

Modified: manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java?rev=1844859&r1=1844858&r2=1844859&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
Thu Oct 25 20:38:28 2018
@@ -381,6 +381,12 @@ public class APISanityHSQLDBIT extends B
       createTimestampTreeNode.setValue(CmisOutputConfig.CREATE_TIMESTAMP_TREE_DEFAULT_VALUE);
       child.addChild(child.getChildCount(), createTimestampTreeNode);
       
+      //versioningState
+      ConfigurationNode versioningStateNode = new ConfigurationNode("_PARAMETER_");
+      versioningStateNode.setAttribute("name", CmisOutputConfig.VERSIONING_STATE_PARAM);
+      versioningStateNode.setValue(CmisOutputConfig.VERSIONING_STATE_DEFAULT_VALUE);
+      child.addChild(child.getChildCount(), versioningStateNode);
+      
       connectionObject.addChild(connectionObject.getChildCount(),child);
 
       requestObject = new Configuration();



Mime
View raw message