Author: kwright
Date: Mon Nov 28 14:31:07 2016
New Revision: 1771749

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

Modified:
    manifoldcf/trunk/CHANGES.txt
    
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1771749&r1=1771748&r2=1771749&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Nov 28 14:31:07 2016
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.6-dev =====================
 
+CONNECTORS-1355: Missing code for API deletion of mapping and
+transformation connections.
+(Julien Massiera, Karl Wright)
+
 CONNECTORS-1344: Adds Slack Notification Connector
 (Odilo Oehmichen, Markus Schuch, Rüdiger Kurz)
 

Modified: 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1771749&r1=1771748&r2=1771749&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
 (original)
+++ 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
 Mon Nov 28 14:31:07 2016
@@ -4314,6 +4314,46 @@ public class ManifoldCF extends org.apac
     }
     return DELETERESULT_FOUND;
   }
+  
+  /** Delete mapping connection.
+  */
+  protected static int apiDeleteMappingConnection(IThreadContext tc, 
Configuration output, String connectionName, IAuthorizer authorizer)
+    throws ManifoldCFException
+  {
+    if (!authorizer.checkAllowed(tc, IAuthorizer.CAPABILITY_EDIT_CONNECTIONS))
+      return READRESULT_NOTALLOWED;
+
+    try
+    {
+      IMappingConnectionManager connectionManager = 
MappingConnectionManagerFactory.make(tc);
+      connectionManager.delete(connectionName);
+    }
+    catch (ManifoldCFException e)
+    {
+      createErrorNode(output,e);
+    }
+    return DELETERESULT_FOUND;
+  }
+
+  /** Delete transformation connection.
+  */
+  protected static int apiDeleteTransformationConnection(IThreadContext tc, 
Configuration output, String connectionName, IAuthorizer authorizer)
+    throws ManifoldCFException
+  {
+    if (!authorizer.checkAllowed(tc, IAuthorizer.CAPABILITY_EDIT_CONNECTIONS))
+      return READRESULT_NOTALLOWED;
+
+    try
+    {
+      ITransformationConnectionManager connectionManager = 
TransformationConnectionManagerFactory.make(tc);
+      connectionManager.delete(connectionName);
+    }
+    catch (ManifoldCFException e)
+    {
+      createErrorNode(output,e);
+    }
+    return DELETERESULT_FOUND;
+  }
 
   /** Delete repository connection.
   */
@@ -4379,11 +4419,21 @@ public class ManifoldCF extends org.apac
       String connectionName = 
decodeAPIPathElement(path.substring("outputconnections/".length()));
       return apiDeleteOutputConnection(tc,output,connectionName,authorizer);
     }
+    else if (path.startsWith("mappingconnections/"))
+    {
+      String connectionName = 
decodeAPIPathElement(path.substring("mappingconnections/".length()));
+      return apiDeleteAuthorityConnection(tc,output,connectionName,authorizer);
+    }
     else if (path.startsWith("authorityconnections/"))
     {
       String connectionName = 
decodeAPIPathElement(path.substring("authorityconnections/".length()));
       return apiDeleteAuthorityConnection(tc,output,connectionName,authorizer);
     }
+    else if (path.startsWith("transformationconnections/"))
+    {
+      String connectionName = 
decodeAPIPathElement(path.substring("transformationconnections/".length()));
+      return 
apiDeleteTransformationConnection(tc,output,connectionName,authorizer);
+    }
     else if (path.startsWith("repositoryconnections/"))
     {
       String connectionName = 
decodeAPIPathElement(path.substring("repositoryconnections/".length()));


Reply via email to