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
a92ddec0
Commit
a92ddec0
authored
6 years ago
by
Diego Marino Monetti
Committed by
Madhan Neethiraj
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3180: enhanced typedef retrieval to support filter by serviceType
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
be9df1c3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
SearchFilter.java
intg/src/main/java/org/apache/atlas/model/SearchFilter.java
+2
-0
FilterUtil.java
...ain/java/org/apache/atlas/repository/util/FilterUtil.java
+30
-0
No files found.
intg/src/main/java/org/apache/atlas/model/SearchFilter.java
View file @
a92ddec0
...
...
@@ -43,7 +43,9 @@ public class SearchFilter {
public
static
final
String
PARAM_TYPE
=
"type"
;
public
static
final
String
PARAM_NAME
=
"name"
;
public
static
final
String
PARAM_SUPERTYPE
=
"supertype"
;
public
static
final
String
PARAM_SERVICETYPE
=
"servicetype"
;
public
static
final
String
PARAM_NOT_SUPERTYPE
=
"notsupertype"
;
public
static
final
String
PARAM_NOT_SERVICETYPE
=
"notservicetype"
;
public
static
final
String
PARAM_NOT_NAME
=
"notname"
;
/**
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java
View file @
a92ddec0
...
...
@@ -40,7 +40,9 @@ public class FilterUtil {
final
String
type
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_TYPE
);
final
String
name
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_NAME
);
final
String
supertype
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_SUPERTYPE
);
final
String
serviceType
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_SERVICETYPE
);
final
String
notSupertype
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_NOT_SUPERTYPE
);
final
String
notServiceType
=
searchFilter
.
getParam
(
SearchFilter
.
PARAM_NOT_SERVICETYPE
);
final
List
<
String
>
notNames
=
searchFilter
.
getParams
(
SearchFilter
.
PARAM_NOT_NAME
);
// Add filter for the type/category
...
...
@@ -53,6 +55,11 @@ public class FilterUtil {
predicates
.
add
(
getNamePredicate
(
name
));
}
// Add filter for the serviceType
if
(
StringUtils
.
isNotBlank
(
serviceType
))
{
predicates
.
add
(
getServiceTypePredicate
(
serviceType
));
}
// Add filter for the supertype
if
(
StringUtils
.
isNotBlank
(
supertype
))
{
predicates
.
add
(
getSuperTypePredicate
(
supertype
));
...
...
@@ -63,6 +70,16 @@ public class FilterUtil {
predicates
.
add
(
new
NotPredicate
(
getSuperTypePredicate
(
notSupertype
)));
}
// Add filter for the serviceType negation
// NOTE: Creating code for the exclusion of multiple service types is currently useless.
// In fact the getSearchFilter in TypeREST.java uses the HttpServletRequest.getParameter(key)
// that if the key takes more values it takes only the first the value. Could be useful
// to change the getSearchFilter to use getParameterValues instead of getParameter.
if
(
StringUtils
.
isNotBlank
(
notServiceType
))
{
predicates
.
add
(
new
NotPredicate
(
getServiceTypePredicate
(
notServiceType
)));
}
// Add filter for the type negation
if
(
CollectionUtils
.
isNotEmpty
(
notNames
))
{
for
(
String
notName
:
notNames
)
{
...
...
@@ -86,6 +103,19 @@ public class FilterUtil {
};
}
private
static
Predicate
getServiceTypePredicate
(
final
String
serviceType
)
{
return
new
Predicate
()
{
private
boolean
isAtlasType
(
Object
o
)
{
return
o
instanceof
AtlasType
;
}
@Override
public
boolean
evaluate
(
Object
o
)
{
return
isAtlasType
(
o
)
&&
Objects
.
equals
(((
AtlasType
)
o
).
getServiceType
(),
serviceType
);
}
};
}
private
static
Predicate
getSuperTypePredicate
(
final
String
supertype
)
{
return
new
Predicate
()
{
private
boolean
isClassificationType
(
Object
o
)
{
...
...
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