Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
be93da8b
Commit
be93da8b
authored
7 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1710: added entity-lookup API for entity create/update UI (#2)
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
5dfe2023
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
AtlasDiscoveryService.java
...ava/org/apache/atlas/discovery/AtlasDiscoveryService.java
+2
-2
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+5
-5
DiscoveryREST.java
...rc/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+7
-7
No files found.
repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
View file @
be93da8b
...
@@ -47,11 +47,11 @@ public interface AtlasDiscoveryService {
...
@@ -47,11 +47,11 @@ public interface AtlasDiscoveryService {
* @param type entity type.
* @param type entity type.
* @param classification classification name.
* @param classification classification name.
* @param attrName attribute name.
* @param attrName attribute name.
* @param attrValue
attribute value
.
* @param attrValue
Prefix attribute value prefix
.
* @param limit number of resultant rows (for pagination). [ limit > 0 ] and [ limit < maxlimit ]. -1 maps to atlas.search.defaultlimit property.
* @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.
* @param offset offset to the results returned (for pagination). [ offset >= 0 ]. -1 maps to offset 0.
* @return AtlasSearchResult
* @return AtlasSearchResult
*/
*/
AtlasSearchResult
searchUsingBasicQuery
(
String
query
,
String
type
,
String
classification
,
String
attrName
,
AtlasSearchResult
searchUsingBasicQuery
(
String
query
,
String
type
,
String
classification
,
String
attrName
,
String
attrValue
,
int
limit
,
int
offset
)
throws
AtlasBaseException
;
String
attrValue
Prefix
,
int
limit
,
int
offset
)
throws
AtlasBaseException
;
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
be93da8b
...
@@ -160,7 +160,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -160,7 +160,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
@Override
@Override
public
AtlasSearchResult
searchUsingBasicQuery
(
String
query
,
String
typeName
,
String
classification
,
String
attrName
,
public
AtlasSearchResult
searchUsingBasicQuery
(
String
query
,
String
typeName
,
String
classification
,
String
attrName
,
String
attrValue
,
int
limit
,
int
offset
)
throws
AtlasBaseException
{
String
attrValue
Prefix
,
int
limit
,
int
offset
)
throws
AtlasBaseException
{
AtlasSearchResult
ret
=
new
AtlasSearchResult
(
AtlasQueryType
.
BASIC
);
AtlasSearchResult
ret
=
new
AtlasSearchResult
(
AtlasQueryType
.
BASIC
);
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
...
@@ -196,11 +196,11 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -196,11 +196,11 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
ret
.
setClassification
(
classification
);
ret
.
setClassification
(
classification
);
}
}
boolean
isAttributeSearch
=
StringUtils
.
isNotEmpty
(
attrName
)
&&
StringUtils
.
isNotEmpty
(
attrValue
);
boolean
isAttributeSearch
=
StringUtils
.
isNotEmpty
(
attrName
)
&&
StringUtils
.
isNotEmpty
(
attrValue
Prefix
);
if
(
isAttributeSearch
)
{
if
(
isAttributeSearch
)
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Executing attribute search attrName: {} and attrValue: {}"
,
attrName
,
attrValue
);
LOG
.
debug
(
"Executing attribute search attrName: {} and attrValue: {}"
,
attrName
,
attrValue
Prefix
);
}
}
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
typeName
);
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
typeName
);
...
@@ -215,7 +215,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -215,7 +215,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
attrQualifiedName
=
entityType
.
getAttribute
(
attrName
).
getQualifiedName
();
attrQualifiedName
=
entityType
.
getAttribute
(
attrName
).
getQualifiedName
();
}
}
String
attrQuery
=
String
.
format
(
"%s AND (%s *)"
,
attrName
,
attrValue
.
replaceAll
(
"\\."
,
" "
));
String
attrQuery
=
String
.
format
(
"%s AND (%s *)"
,
attrName
,
attrValue
Prefix
.
replaceAll
(
"\\."
,
" "
));
if
(
StringUtils
.
isEmpty
(
query
))
{
if
(
StringUtils
.
isEmpty
(
query
))
{
query
=
attrQuery
;
query
=
attrQuery
;
...
@@ -262,7 +262,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -262,7 +262,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
if
(
isAttributeSearch
)
{
if
(
isAttributeSearch
)
{
String
vertexAttrValue
=
vertex
.
getProperty
(
attrQualifiedName
,
String
.
class
);
String
vertexAttrValue
=
vertex
.
getProperty
(
attrQualifiedName
,
String
.
class
);
if
(
StringUtils
.
isNotEmpty
(
vertexAttrValue
)
&&
!
vertexAttrValue
.
startsWith
(
attrValue
))
{
if
(
StringUtils
.
isNotEmpty
(
vertexAttrValue
)
&&
!
vertexAttrValue
.
startsWith
(
attrValue
Prefix
))
{
continue
;
continue
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
View file @
be93da8b
...
@@ -169,7 +169,7 @@ public class DiscoveryREST {
...
@@ -169,7 +169,7 @@ public class DiscoveryREST {
/**
/**
* Retrieve data for the specified attribute search query
* Retrieve data for the specified attribute search query
* @param attrName Attribute name
* @param attrName Attribute name
* @param attrValue Attibute value to search on
* @param attrValue
Prefix
Attibute value to search on
* @param typeName limit the result to only entities of specified type or its sub-types
* @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 limit limit the result set to only include the specified number of entries
* @param offset start offset of the result set (useful for pagination)
* @param offset start offset of the result set (useful for pagination)
...
@@ -183,8 +183,8 @@ public class DiscoveryREST {
...
@@ -183,8 +183,8 @@ public class DiscoveryREST {
@Path
(
"/attribute"
)
@Path
(
"/attribute"
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
AtlasSearchResult
searchUsingAttribute
(
@QueryParam
(
"
string
Name"
)
String
attrName
,
public
AtlasSearchResult
searchUsingAttribute
(
@QueryParam
(
"
attr
Name"
)
String
attrName
,
@QueryParam
(
"
stringValue"
)
String
attrValue
,
@QueryParam
(
"
attrValuePrefix"
)
String
attrValuePrefix
,
@QueryParam
(
"typeName"
)
String
typeName
,
@QueryParam
(
"typeName"
)
String
typeName
,
@QueryParam
(
"limit"
)
int
limit
,
@QueryParam
(
"limit"
)
int
limit
,
@QueryParam
(
"offset"
)
int
offset
)
throws
AtlasBaseException
{
@QueryParam
(
"offset"
)
int
offset
)
throws
AtlasBaseException
{
...
@@ -193,15 +193,15 @@ public class DiscoveryREST {
...
@@ -193,15 +193,15 @@ public class DiscoveryREST {
try
{
try
{
if
(
AtlasPerfTracer
.
isPerfTraceEnabled
(
PERF_LOG
))
{
if
(
AtlasPerfTracer
.
isPerfTraceEnabled
(
PERF_LOG
))
{
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"DiscoveryREST.searchUsingAttribute("
+
attrName
+
","
+
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"DiscoveryREST.searchUsingAttribute("
+
attrName
+
","
+
attrValue
+
","
+
typeName
+
","
+
limit
+
","
+
offset
+
")"
);
attrValue
Prefix
+
","
+
typeName
+
","
+
limit
+
","
+
offset
+
")"
);
}
}
if
(
StringUtils
.
isEmpty
(
attrName
)
||
StringUtils
.
isEmpty
(
attrValue
))
{
if
(
StringUtils
.
isEmpty
(
attrName
)
||
StringUtils
.
isEmpty
(
attrValue
Prefix
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
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
,
attrValue
Prefix
));
}
}
return
atlasDiscoveryService
.
searchUsingBasicQuery
(
null
,
typeName
,
null
,
attrName
,
attrValue
,
limit
,
offset
);
return
atlasDiscoveryService
.
searchUsingBasicQuery
(
null
,
typeName
,
null
,
attrName
,
attrValue
Prefix
,
limit
,
offset
);
}
finally
{
}
finally
{
AtlasPerfTracer
.
log
(
perf
);
AtlasPerfTracer
.
log
(
perf
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment