manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1758665 - in /manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch: MCFAuthorizerPlugin.java MCFAuthorizerRestSearchAction.java
Date Wed, 31 Aug 2016 18:46:11 GMT
Author: kwright
Date: Wed Aug 31 18:46:11 2016
New Revision: 1758665

URL: http://svn.apache.org/viewvc?rev=1758665&view=rev
Log:
Get it to build

Modified:
    manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerPlugin.java
    manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java

Modified: manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerPlugin.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerPlugin.java?rev=1758665&r1=1758664&r2=1758665&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerPlugin.java
(original)
+++ manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerPlugin.java
Wed Aug 31 18:46:11 2016
@@ -43,7 +43,7 @@ public class MCFAuthorizerPlugin extends
     return "Plugin to connect elasticsearch with ManifoldCF";
   }
 
-  @Override
+  //@Override
   public void onModule(RestModule module) {
     module.addRestAction(MCFAuthorizerRestSearchAction.class);
   }

Modified: manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java?rev=1758665&r1=1758664&r2=1758665&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
(original)
+++ manifoldcf/integration/elasticsearch-2.0/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
Wed Aug 31 18:46:11 2016
@@ -66,7 +66,7 @@ public class MCFAuthorizerRestSearchActi
   
   protected SearchRequest parseSearchRequestMCF(
     final RestRequest request,
-    final ParseFieldMatcher parseFieldMatcher) throws IOException {
+    final ParseFieldMatcher parseFieldMatcher) throws MCFAuthorizerException {
     final SearchRequest searchRequest;
     if(request.param("u")!=null) {
       searchRequest = new SearchRequest();
@@ -83,18 +83,22 @@ public class MCFAuthorizerRestSearchActi
         ObjectNode modifiedJSON, innerJSON;
         JsonNode requestJSON;
 
-        requestJSON = objectMapper.readTree(RestActions.getRestContent(request).toBytes());
-        if (isTemplateRequest) {
-          modifiedJSON = (ObjectNode) requestJSON;
-          innerJSON = (ObjectNode)requestJSON.findValue("template");
-          filteredQueryBuilder = QueryBuilders.filteredQuery(QueryBuilders.wrapperQuery(innerJSON.findValue("query").toString()),
authorizationFilter);
-          modifiedJSON.replace("template",innerJSON.set("query", objectMapper.readTree(filteredQueryBuilder.buildAsBytes().toBytes())));
-          searchRequest.templateSource(modifiedJSON.toString());
-        } else {
-          filteredQueryBuilder = QueryBuilders.filteredQuery(QueryBuilders.wrapperQuery(requestJSON.findValue("query").toString()),
authorizationFilter);
-          modifiedJSON = (ObjectNode) requestJSON;
-          modifiedJSON.set("query", objectMapper.readTree(filteredQueryBuilder.buildAsBytes().toBytes()));
-          searchRequest.source(modifiedJSON.toString());
+        try {
+          requestJSON = objectMapper.readTree(RestActions.getRestContent(request).toBytes());
+          if (isTemplateRequest) {
+            modifiedJSON = (ObjectNode) requestJSON;
+            innerJSON = (ObjectNode)requestJSON.findValue("template");
+            filteredQueryBuilder = QueryBuilders.filteredQuery(QueryBuilders.wrapperQuery(innerJSON.findValue("query").toString()),
authorizationFilter);
+            modifiedJSON.replace("template",innerJSON.set("query", objectMapper.readTree(filteredQueryBuilder.buildAsBytes().toBytes())));
+            searchRequest.templateSource(modifiedJSON.toString());
+          } else {
+            filteredQueryBuilder = QueryBuilders.filteredQuery(QueryBuilders.wrapperQuery(requestJSON.findValue("query").toString()),
authorizationFilter);
+            modifiedJSON = (ObjectNode) requestJSON;
+            modifiedJSON.set("query", objectMapper.readTree(filteredQueryBuilder.buildAsBytes().toBytes()));
+            searchRequest.source(modifiedJSON.toString());
+          }
+        } catch (IOException e) {
+          throw new MCFAuthorizerException("JSON parser error: "+e.getMessage(), e);
         }
       }
 



Mime
View raw message