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 2018/08/06 05:40:31 UTC

svn commit: r1837476 - in /manifoldcf/trunk: ./ connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/ connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/

Author: kwright
Date: Mon Aug  6 05:40:31 2018
New Revision: 1837476

URL: http://svn.apache.org/viewvc?rev=1837476&view=rev
Log:
Fix for CONNECTORS-1517.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
    manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_en_US.properties
    manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_es_ES.properties
    manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_fr_FR.properties
    manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_ja_JP.properties
    manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_zh_CN.properties

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Aug  6 05:40:31 2018
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 2.11-dev =====================
 
+CONNECTORS-1517: Documentum mimetypes form didn't allow for no restrictions
+(James Thomas, Karl Wright)
+
 CONNECTORS-1520: Transformation connector registration and de-registration was broken
 due to early cut/paste error.
 (Mike Hugo)

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java Mon Aug  6 05:40:31 2018
@@ -45,6 +45,7 @@ public class DCTM extends org.apache.man
   public static String CONFIG_PARAM_ATTRIBUTENAME = "attrname";
   public static String CONFIG_PARAM_MAXLENGTH = "maxdoclength";
   public static String CONFIG_PARAM_FORMAT = "mimetype";
+  public static String CONFIG_PARAM_FORMAT_ALL = "mimetypeall";
   public static String CONFIG_PARAM_PATHNAMEATTRIBUTE = "pathnameattribute";
   public static String CONFIG_PARAM_PATHMAP = "pathmap";
   public static String CONFIG_PARAM_FILTER = "filter";
@@ -1055,6 +1056,8 @@ public class DCTM extends org.apache.man
     StringBuilder strLocationsClause = new StringBuilder();
     Map<String,Map<String,Map<String,Set<String>>>> tokenList = new HashMap<String,Map<String,Map<String,Set<String>>>>();
     List<String> contentList = null;
+    boolean seenAllMimeTypes = false;
+    boolean allMimeTypes = false;
     String maxSize = null;
 
     for (int i = 0; i < spec.getChildCount(); i++)
@@ -1109,6 +1112,15 @@ public class DCTM extends org.apache.man
           }
         }
       }
+      else if (n.getType().equals(CONFIG_PARAM_FORMAT_ALL))
+      {
+	seenAllMimeTypes = true;
+	String all = n.getAttributeValue("value");
+	if (all.equals("true"))
+	{
+	  allMimeTypes = true;
+	}
+      }
       else if (n.getType().equals(CONFIG_PARAM_FORMAT))
       {
         String docType = n.getAttributeValue("value");
@@ -1153,27 +1165,28 @@ public class DCTM extends org.apache.man
         strDQLend.append(" AND r_content_size<=").append(maxSize);
       }
 
-      String[] dctmTypes = convertToDCTMTypes(contentList);
-      if (dctmTypes != null)
+      // If we don't even see the allmimetypes record, we emit no restriction
+      if (seenAllMimeTypes == true && allMimeTypes == false)
       {
-        if (dctmTypes.length == 0)
-          strDQLend.append(" AND 1<0");
-        else
-        {
-          strDQLend.append(" AND a_content_type IN (");
-          boolean commaNeeded = false;
-          for (String cType : dctmTypes)
-          {
-            if (commaNeeded)
-              strDQLend.append(",");
-            else
-              commaNeeded = true;
-            strDQLend.append(quoteDQLString(cType));
-          }
-          strDQLend.append(")");
-        }
+	String[] dctmTypes = convertToDCTMTypes(contentList);
+	if (dctmTypes == null || dctmTypes.length == 0)
+	  strDQLend.append(" AND 1<0");
+	else
+	{
+	  strDQLend.append(" AND a_content_type IN (");
+	  boolean commaNeeded = false;
+	  for (String cType : dctmTypes)
+	  {
+	    if (commaNeeded)
+	      strDQLend.append(",");
+	    else
+	      commaNeeded = true;
+	    strDQLend.append(quoteDQLString(cType));
+	  }
+	  strDQLend.append(")");
+	}
       }
-
+      
       // End the clause for non-deleted documents
       strDQLend.append("))");
 
@@ -2926,6 +2939,8 @@ public class DCTM extends org.apache.man
 
     // First, build a hash map containing all the currently selected document types
     Set<String> ctMap = null;
+    boolean seenAll = false;
+    boolean doAll = false;
     for (int i = 0; i < ds.getChildCount(); i++)
     {
       SpecificationNode sn = ds.getChild(i);
@@ -2939,14 +2954,51 @@ public class DCTM extends org.apache.man
           ctMap.add(token);
         }
       }
+      else if (sn.getType().equals(CONFIG_PARAM_FORMAT_ALL))
+      {
+	seenAll = true;
+	String value = sn.getAttributeValue("value");
+	if (value.equals("true")) {
+	  doAll = true;
+	}
+      }
     }
 
+    // Hidden variable so we know that the form was posted
+    out.print(
+"<input type=\"hidden\" name=\""+seqPrefix+"specmimetype_posted\" value=\"true\"/>\n"
+    );
+    
     if (tabName.equals(Messages.getString(locale,"DCTM.ContentTypes")) && connectionSequenceNumber == actualSequenceNumber)
     {
       out.print(
 "<table class=\"displaytable\">\n"+
-"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\">\n"
       );
+      
+      // If _ALL record not even seen, do default thing
+      if (seenAll == false || doAll)
+      {
+      out.print(
+"      <input type=\"checkbox\" name=\""+seqPrefix+"specmimetypeall\" checked=\"\" value=\"true\"></input>\n"
+      );
+      }
+      else 
+      {
+      out.print(
+"      <input type=\"checkbox\" name=\""+seqPrefix+"specmimetypeall\" value=\"true\"></input>\n"
+      );
+      }
+      out.print(
+"    </td>\n"+
+"    <td class=\"value\">\n"+
+"      "+Messages.getBodyString(locale,"DCTM.AllContentTypes")+"\n"+
+"    </td>\n"+
+"  </tr>\n"+
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+      );     
       // Need to catch potential license exception here
       try
       {
@@ -2959,7 +3011,7 @@ public class DCTM extends org.apache.man
 "  <tr>\n"+
 "    <td class=\"description\">\n"
             );
-            if (ctMap == null || ctMap.contains(strMimeType))
+            if (ctMap != null && ctMap.contains(strMimeType))
             {
               out.print(
 "      <input type=\"checkbox\" name=\""+seqPrefix+"specmimetype\" checked=\"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strMimeType)+"\"></input>\n"
@@ -3007,6 +3059,10 @@ public class DCTM extends org.apache.man
     }
     else
     {
+      out.print(
+"<input type=\"hidden\" name=\""+seqPrefix+"specmimetypeall\" value=\""+(doAll?"true":"false")+"\"/>\n"
+      );
+
       if (ctMap != null)
       {
         for (String strMimeType : ctMap)
@@ -3397,28 +3453,36 @@ public class DCTM extends org.apache.man
       }
     }
 
-    y = variableContext.getParameterValues(seqPrefix+"specmimetype");
-    if (y != null)
+    if (variableContext.getParameter(seqPrefix+"specmimetype_posted") != null)
     {
+      String all = variableContext.getParameter(seqPrefix+"specmimetypeall");
+      y = variableContext.getParameterValues(seqPrefix+"specmimetype");
       // Delete all file specs first
       int i = 0;
       while (i < ds.getChildCount())
       {
       	SpecificationNode sn = ds.getChild(i);
-      	if (sn.getType().equals(CONFIG_PARAM_FORMAT))
+      	if (sn.getType().equals(CONFIG_PARAM_FORMAT) || sn.getType().equals(CONFIG_PARAM_FORMAT_ALL))
           ds.removeChild(i);
       	else
           i++;
       }
+      
+      SpecificationNode n2 = new SpecificationNode(CONFIG_PARAM_FORMAT_ALL);
+      n2.setAttribute("value",(all!=null&&all.equals("true"))?"true":"false");
+      ds.addChild(ds.getChildCount(),n2);
 
       // Loop through specs
-      i = 0;
-      while (i < y.length)
+      if (y != null)
       {
-      	String fileType = y[i++];
-      	SpecificationNode node = new SpecificationNode(CONFIG_PARAM_FORMAT);
-      	node.setAttribute("value",fileType);
-      	ds.addChild(ds.getChildCount(),node);
+	i = 0;
+	while (i < y.length)
+	{
+	  String fileType = y[i++];
+	  SpecificationNode node = new SpecificationNode(CONFIG_PARAM_FORMAT);
+	  node.setAttribute("value",fileType);
+	  ds.addChild(ds.getChildCount(),node);
+	}
       }
     }
 

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_en_US.properties?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_en_US.properties (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_en_US.properties Mon Aug  6 05:40:31 2018
@@ -25,6 +25,7 @@ DCTM.WebtopBaseURL=Webtop Base URL
 DCTM.Parameters=Parameters:
 DCTM.Paths=Paths
 DCTM.DocumentTypes=Document Types
+DCTM.AllContentTypes=No content type restriction
 DCTM.ContentTypes=Content Types
 DCTM.ContentLength=Content Length
 DCTM.Security=Security

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_es_ES.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_es_ES.properties?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_es_ES.properties (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_es_ES.properties Mon Aug  6 05:40:31 2018
@@ -25,6 +25,7 @@ DCTM.WebtopBaseURL=URL base superior Web
 DCTM.Parameters=Parámetros:
 DCTM.Paths=Caminos
 DCTM.DocumentTypes=Tipos de documentos
+DCTM.AllContentTypes=No content type restriction
 DCTM.ContentTypes=Tipos de contenido
 DCTM.ContentLength=contenido Longitud
 DCTM.Security=Seguridad

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_fr_FR.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_fr_FR.properties?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_fr_FR.properties (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_fr_FR.properties Mon Aug  6 05:40:31 2018
@@ -25,6 +25,7 @@ DCTM.WebtopBaseURL=URL de base du Webtop
 DCTM.Parameters=Paramètres:
 DCTM.Paths=Chemins (Paths)
 DCTM.DocumentTypes=Types de Document
+DCTM.AllContentTypes=No content type restriction
 DCTM.ContentTypes=Types de contenu
 DCTM.ContentLength=Longueur du contenu
 DCTM.Security=Securité

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_ja_JP.properties?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_ja_JP.properties (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_ja_JP.properties Mon Aug  6 05:40:31 2018
@@ -25,6 +25,7 @@ DCTM.WebtopBaseURL=Webtopベーã�
 DCTM.Parameters=引数:
 DCTM.Paths=パス
 DCTM.DocumentTypes=文書タイプ
+DCTM.AllContentTypes=No content type restriction
 DCTM.ContentTypes=コンテンツタイプ
 DCTM.ContentLength=コンテンツ長
 DCTM.Security=セキュリティ

Modified: manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_zh_CN.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_zh_CN.properties?rev=1837476&r1=1837475&r2=1837476&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_zh_CN.properties (original)
+++ manifoldcf/trunk/connectors/documentum/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/DCTM/common_zh_CN.properties Mon Aug  6 05:40:31 2018
@@ -25,6 +25,7 @@ DCTM.WebtopBaseURL=Webtop基URL
 DCTM.Parameters=参数: 
 DCTM.Paths=路径
 DCTM.DocumentTypes=文档类型
+DCTM.AllContentTypes=No content type restriction
 DCTM.ContentTypes=内容类型
 DCTM.ContentLength=内容长度
 DCTM.Security=安全