atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1644: Taxonomy API /api/atlas/v1/taxonomies is broken
Date Tue, 07 Mar 2017 03:01:10 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 6a4fcb95d -> f673eba40


ATLAS-1644: Taxonomy API /api/atlas/v1/taxonomies is broken

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/f673eba4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/f673eba4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/f673eba4

Branch: refs/heads/master
Commit: f673eba408f25be7574391254f91dc7522c44d75
Parents: 6a4fcb9
Author: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Authored: Mon Mar 6 18:05:15 2017 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Mon Mar 6 18:23:06 2017 -0800

----------------------------------------------------------------------
 .../apache/atlas/catalog/query/BaseQuery.java   | 41 +++++++++++++++++++-
 .../atlas/repository/graphdb/AtlasElement.java  |  2 +
 .../graphdb/titan0/Titan0Element.java           |  3 +-
 .../graphdb/titan1/Titan1Element.java           |  4 +-
 .../apache/atlas/web/resources/BaseService.java |  1 +
 5 files changed, 46 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f673eba4/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java b/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
index 18d87ea..ff48020 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
@@ -20,8 +20,10 @@ package org.apache.atlas.catalog.query;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 
 import org.apache.atlas.catalog.Request;
 import org.apache.atlas.catalog.VertexWrapper;
@@ -31,7 +33,9 @@ import org.apache.atlas.catalog.projection.Projection;
 import org.apache.atlas.catalog.projection.ProjectionResult;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.apache.atlas.repository.graphdb.AtlasElement;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.persistence.Id;
 
 import com.tinkerpop.blueprints.Compare;
@@ -113,7 +117,42 @@ public abstract class BaseQuery implements AtlasQuery {
     protected abstract Pipe getQueryPipe();
 
     protected GremlinPipeline getRootVertexPipeline() {
-        return new GremlinPipeline(getGraph().getVertices());
+        return new GremlinPipeline(unWrapVertices());
+    }
+
+    protected Iterable<Object> unWrapVertices() {
+        final Iterable<AtlasVertex> vertices = getGraph().getVertices();
+
+        Iterable<Object> vertexIterable = new Iterable<Object>() {
+            Iterator<Object> iterator = new Iterator<Object>() {
+                Iterator<AtlasVertex> wrapperIterator = vertices.iterator();
+
+                @Override
+                public boolean hasNext() {
+                    return wrapperIterator.hasNext();
+                }
+
+                @Override
+                public Object next() {
+                    if (hasNext()) {
+                        return ((AtlasElement) wrapperIterator.next().getV()).getWrappedElement();
+                    } else {
+                        throw new NoSuchElementException();
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    throw new UnsupportedOperationException("Remove not supported");
+                }
+            };
+
+            @Override
+            public Iterator<Object> iterator() {
+                return iterator;
+            }
+        };
+        return vertexIterable;
     }
 
     protected Pipe getNotDeletedPipe() {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f673eba4/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
index 24f7a7d..42837f4 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
@@ -166,4 +166,6 @@ public interface AtlasElement {
      * @return
      */
     boolean isIdAssigned();
+
+    <T> T getWrappedElement();
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f673eba4/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Element.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Element.java
b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Element.java
index 468c2a7..3b50633 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Element.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Element.java
@@ -17,6 +17,7 @@
  */
 package org.apache.atlas.repository.graphdb.titan0;
 
+import java.lang.Override;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -134,7 +135,7 @@ public class Titan0Element<T extends Element> implements AtlasElement
{
 
     }
 
-    // not in interface
+    @Override
     public T getWrappedElement() {
         return wrappedElement;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f673eba4/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Element.java
----------------------------------------------------------------------
diff --git a/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Element.java
b/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Element.java
index 985294e..b1cd458 100644
--- a/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Element.java
+++ b/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Element.java
@@ -48,7 +48,6 @@ import com.thinkaurelius.titan.core.TitanElement;
  */
 public class Titan1Element<T extends Element> implements AtlasElement {
 
-
     private T element;
     protected Titan1Graph graph;
 
@@ -121,8 +120,7 @@ public class Titan1Element<T extends Element> implements AtlasElement
{
         return element.id();
     }
 
-
-    //not in interface
+    @Override
     public T getWrappedElement() {
         return element;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f673eba4/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
index 2e999fc..a013494 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
@@ -65,6 +65,7 @@ public abstract class BaseService {
         try {
             return provider.getResources(request);
         } catch (RuntimeException e) {
+            LOG.error("Error while retrieving taxonomy ", e);
             throw wrapRuntimeException(e);
         }
     }


Mime
View raw message