Repository: incubator-atlas
Updated Branches:
  refs/heads/master 5dfe20232 -> be93da8b8


ATLAS-1710: added entity-lookup API for entity create/update UI (#2)

Signed-off-by: Madhan Neethiraj <[email protected]>


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

Branch: refs/heads/master
Commit: be93da8b83d0b19e4d015ab31190a0922ca48a2c
Parents: 5dfe202
Author: Sarath Subramanian <[email protected]>
Authored: Wed Apr 12 17:54:19 2017 -0700
Committer: Madhan Neethiraj <[email protected]>
Committed: Wed Apr 12 17:54:19 2017 -0700

----------------------------------------------------------------------
 .../apache/atlas/discovery/AtlasDiscoveryService.java |  4 ++--
 .../atlas/discovery/EntityDiscoveryService.java       | 10 +++++-----
 .../java/org/apache/atlas/web/rest/DiscoveryREST.java | 14 +++++++-------
 3 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/be93da8b/repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
----------------------------------------------------------------------
diff --git 
a/repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
 
b/repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
index 24b09dc..30d62a4 100644
--- 
a/repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
+++ 
b/repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
@@ -47,11 +47,11 @@ public interface AtlasDiscoveryService {
      * @param type entity type.
      * @param classification classification name.
      * @param attrName attribute name.
-     * @param attrValue attribute value.
+     * @param attrValuePrefix attribute value prefix.
      * @param limit number of resultant rows (for pagination). [ limit > 0 ] 
and [ limit < maxlimit ]. -1 maps to atlas.search.defaultlimit property.
      * @param offset offset to the results returned (for pagination). [ offset 
>= 0 ]. -1 maps to offset 0.
      * @return AtlasSearchResult
      */
     AtlasSearchResult searchUsingBasicQuery(String query, String type, String 
classification, String attrName,
-                                            String attrValue, int limit, int 
offset) throws AtlasBaseException;
+                                            String attrValuePrefix, int limit, 
int offset) throws AtlasBaseException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/be93da8b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
----------------------------------------------------------------------
diff --git 
a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
 
b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
index e7d6523..07190db 100644
--- 
a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ 
b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -160,7 +160,7 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
 
     @Override
     public AtlasSearchResult searchUsingBasicQuery(String query, String 
typeName, String classification, String attrName,
-                                                   String attrValue, int 
limit, int offset) throws AtlasBaseException {
+                                                   String attrValuePrefix, int 
limit, int offset) throws AtlasBaseException {
         AtlasSearchResult ret = new AtlasSearchResult(AtlasQueryType.BASIC);
 
         if (LOG.isDebugEnabled()) {
@@ -196,11 +196,11 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
             ret.setClassification(classification);
         }
 
-        boolean isAttributeSearch = StringUtils.isNotEmpty(attrName) && 
StringUtils.isNotEmpty(attrValue);
+        boolean isAttributeSearch = StringUtils.isNotEmpty(attrName) && 
StringUtils.isNotEmpty(attrValuePrefix);
 
         if (isAttributeSearch) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Executing attribute search attrName: {} and 
attrValue: {}", attrName, attrValue);
+                LOG.debug("Executing attribute search attrName: {} and 
attrValue: {}", attrName, attrValuePrefix);
             }
 
             AtlasEntityType entityType = 
typeRegistry.getEntityTypeByName(typeName);
@@ -215,7 +215,7 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
                 attrQualifiedName = 
entityType.getAttribute(attrName).getQualifiedName();
             }
 
-            String attrQuery = String.format("%s AND (%s *)", attrName, 
attrValue.replaceAll("\\.", " "));
+            String attrQuery = String.format("%s AND (%s *)", attrName, 
attrValuePrefix.replaceAll("\\.", " "));
 
             if (StringUtils.isEmpty(query)) {
                 query = attrQuery;
@@ -262,7 +262,7 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
                 if (isAttributeSearch) {
                     String vertexAttrValue = 
vertex.getProperty(attrQualifiedName, String.class);
 
-                    if (StringUtils.isNotEmpty(vertexAttrValue) && 
!vertexAttrValue.startsWith(attrValue)) {
+                    if (StringUtils.isNotEmpty(vertexAttrValue) && 
!vertexAttrValue.startsWith(attrValuePrefix)) {
                         continue;
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/be93da8b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
index c294187..836626b 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
@@ -169,7 +169,7 @@ public class DiscoveryREST {
     /**
      * Retrieve data for the specified attribute search query
      * @param attrName  Attribute name
-     * @param attrValue Attibute value to search on
+     * @param attrValuePrefix Attibute value to search on
      * @param typeName limit the result to only entities of specified type or 
its sub-types
      * @param limit limit the result set to only include the specified number 
of entries
      * @param offset start offset of the result set (useful for pagination)
@@ -183,8 +183,8 @@ public class DiscoveryREST {
     @Path("/attribute")
     @Consumes(Servlets.JSON_MEDIA_TYPE)
     @Produces(Servlets.JSON_MEDIA_TYPE)
-    public AtlasSearchResult searchUsingAttribute(@QueryParam("stringName")  
String attrName,
-                                                  @QueryParam("stringValue") 
String attrValue,
+    public AtlasSearchResult searchUsingAttribute(@QueryParam("attrName")  
String attrName,
+                                                  
@QueryParam("attrValuePrefix") String attrValuePrefix,
                                                   @QueryParam("typeName")    
String typeName,
                                                   @QueryParam("limit")       
int    limit,
                                                   @QueryParam("offset")      
int    offset) throws AtlasBaseException {
@@ -193,15 +193,15 @@ public class DiscoveryREST {
         try {
             if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                 perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, 
"DiscoveryREST.searchUsingAttribute(" + attrName + "," +
-                        attrValue + "," + typeName + "," + limit + "," + 
offset + ")");
+                        attrValuePrefix + "," + typeName + "," + limit + "," + 
offset + ")");
             }
 
-            if (StringUtils.isEmpty(attrName) || 
StringUtils.isEmpty(attrValue)) {
+            if (StringUtils.isEmpty(attrName) || 
StringUtils.isEmpty(attrValuePrefix)) {
                 throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS,
-                        String.format("attrName : {0}, attrValue: {1} for 
attribute search.", attrName, attrValue));
+                        String.format("attrName : {0}, attrValue: {1} for 
attribute search.", attrName, attrValuePrefix));
             }
 
-            return atlasDiscoveryService.searchUsingBasicQuery(null, typeName, 
null, attrName, attrValue, limit, offset);
+            return atlasDiscoveryService.searchUsingBasicQuery(null, typeName, 
null, attrName, attrValuePrefix, limit, offset);
 
         } finally {
             AtlasPerfTracer.log(perf);

Reply via email to