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
aa441de4
Commit
aa441de4
authored
Aug 05, 2020
by
Pinal Shah
Committed by
nixonrodrigues
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3876 : Relationship Search API not showing correct approximateCount
Signed-off-by:
nixonrodrigues
<
nixon@apache.org
>
parent
4a57f92f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
209 additions
and
208 deletions
+209
-208
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+6
-1
AtlasDiscoveryService.java
...ava/org/apache/atlas/discovery/AtlasDiscoveryService.java
+2
-1
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+63
-75
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+2
-2
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+4
-0
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+128
-126
DiscoveryREST.java
...rc/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+4
-3
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
aa441de4
...
...
@@ -670,7 +670,7 @@ public class AtlasStructType extends AtlasType {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_ATTRIBUTE
,
attrName
,
structDef
.
getName
());
}
AtlasEntityType
getReferencedEntityType
(
AtlasType
type
)
{
static
AtlasEntityType
getReferencedEntityType
(
AtlasType
type
)
{
if
(
type
instanceof
AtlasArrayType
)
{
type
=
((
AtlasArrayType
)
type
).
getElementType
();
}
...
...
@@ -980,6 +980,11 @@ public class AtlasStructType extends AtlasType {
return
(
relationshipLabel
==
null
)
?
getEdgeLabel
(
qualifiedName
)
:
relationshipLabel
;
}
public
AtlasEntityType
getReferencedEntityType
(
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
AtlasType
type
=
typeRegistry
.
getType
(
attributeDef
.
getTypeName
());
return
AtlasStructType
.
getReferencedEntityType
(
type
);
}
public
static
String
getQualifiedAttributeName
(
AtlasStructDef
structDef
,
String
attrName
)
{
if
(
isRootType
(
structDef
))
{
return
attrName
;
...
...
repository/src/main/java/org/apache/atlas/discovery/AtlasDiscoveryService.java
View file @
aa441de4
...
...
@@ -87,11 +87,12 @@ public interface AtlasDiscoveryService {
* @param sortByAttribute sort the result using this attribute name, default value is 'name'
* @param sortOrder sorting order
* @param excludeDeletedEntities exclude deleted entities in search result.
* @param getApproximateCount
* @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
searchRelatedEntities
(
String
guid
,
String
relation
,
Set
<
String
>
attributes
,
String
sortByAttribute
,
SortOrder
sortOrder
,
boolean
excludeDeletedEntities
,
int
limit
,
int
offset
)
throws
AtlasBaseException
;
AtlasSearchResult
searchRelatedEntities
(
String
guid
,
String
relation
,
Set
<
String
>
attributes
,
String
sortByAttribute
,
SortOrder
sortOrder
,
boolean
excludeDeletedEntities
,
boolean
getApproximateCount
,
int
limit
,
int
offset
)
throws
AtlasBaseException
;
/**
*
...
...
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
aa441de4
...
...
@@ -30,6 +30,7 @@ import org.apache.atlas.model.discovery.*;
import
org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult
;
import
org.apache.atlas.model.discovery.AtlasSearchResult.AtlasQueryType
;
import
org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.profile.AtlasUserSavedSearch
;
...
...
@@ -49,28 +50,33 @@ import org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.util.AtlasGremlinQueryProvider
;
import
org.apache.atlas.util.AtlasGremlinQueryProvider.AtlasGremlinQuery
;
import
org.apache.atlas.util.SearchPredicateUtil
;
import
org.apache.atlas.util.SearchTracker
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.Predicate
;
import
org.apache.commons.collections4.IteratorUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.tinkerpop.gremlin.process.traversal.Order
;
import
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
;
import
org.apache.tinkerpop.gremlin.structure.Vertex
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
import
javax.script.Bindings
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptException
;
import
java.util.*
;
import
static
org
.
apache
.
atlas
.
AtlasErrorCode
.*;
import
static
org
.
apache
.
atlas
.
SortOrder
.
ASCENDING
;
import
static
org
.
apache
.
atlas
.
SortOrder
.
DESCENDING
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
ACTIVE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
DELETED
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
ASSET_ENTITY_TYPE
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
OWNER_ATTRIBUTE
;
import
static
org
.
apache
.
atlas
.
util
.
AtlasGremlinQueryProvider
.
AtlasGremlinQuery
.*;
import
static
org
.
apache
.
atlas
.
util
.
AtlasGremlinQueryProvider
.
AtlasGremlinQuery
.
BASIC_SEARCH_STATE_FILTER
;
import
static
org
.
apache
.
atlas
.
util
.
AtlasGremlinQueryProvider
.
AtlasGremlinQuery
.
TO_RANGE_LIST
;
@Component
public
class
EntityDiscoveryService
implements
AtlasDiscoveryService
{
...
...
@@ -564,13 +570,14 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
@Override
@GraphTransaction
public
AtlasSearchResult
searchRelatedEntities
(
String
guid
,
String
relation
,
Set
<
String
>
attributes
,
String
sortBy
,
SortOrder
sortOrder
,
boolean
excludeDeletedEntities
,
int
limit
,
int
offset
)
throws
AtlasBaseException
{
boolean
excludeDeletedEntities
,
boolean
getApproximateCount
,
int
limit
,
int
offset
)
throws
AtlasBaseException
{
AtlasSearchResult
ret
=
new
AtlasSearchResult
(
AtlasQueryType
.
RELATIONSHIP
);
if
(
StringUtils
.
isEmpty
(
guid
)
||
StringUtils
.
isEmpty
(
relation
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"guid: '"
+
guid
+
"', relation: '"
+
relation
+
"'"
);
}
//validate entity
AtlasVertex
entityVertex
=
entityRetriever
.
getEntityVertex
(
guid
);
String
entityTypeName
=
GraphHelper
.
getTypeName
(
entityVertex
);
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entityTypeName
);
...
...
@@ -579,6 +586,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_RELATIONSHIP_TYPE
,
entityTypeName
,
guid
);
}
//validate relation
AtlasEntityType
endEntityType
=
null
;
AtlasAttribute
attribute
=
entityType
.
getAttribute
(
relation
);
if
(
attribute
==
null
)
{
...
...
@@ -586,57 +595,35 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
}
if
(
attribute
!=
null
)
{
if
(
attribute
.
isObjectRef
())
{
endEntityType
=
attribute
.
getReferencedEntityType
(
typeRegistry
);
if
(
endEntityType
!=
null
)
{
relation
=
attribute
.
getRelationshipEdgeLabel
();
}
else
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_RELATIONSHIP_ATTRIBUTE
,
relation
,
attribute
.
getTypeName
());
}
}
//validate sortBy attribute
String
sortByAttributeName
=
DEFAULT_SORT_ATTRIBUTE_NAME
;
if
(
StringUtils
.
isNotEmpty
(
sortBy
))
{
sortByAttributeName
=
sortBy
;
}
//get entity type of relationship (End vertex entity type) from relationship label
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getAdjacentEdgesByLabel
(
entityVertex
,
AtlasEdgeDirection
.
BOTH
,
relation
);
AtlasEntityType
endEntityType
=
null
;
if
(
edges
!=
null
&&
edges
.
hasNext
())
{
AtlasEdge
relationEdge
=
edges
.
next
();
AtlasVertex
outVertex
=
relationEdge
.
getOutVertex
();
AtlasVertex
inVertex
=
relationEdge
.
getInVertex
();
String
outVertexId
=
outVertex
!=
null
?
outVertex
.
getIdForDisplay
()
:
null
;
AtlasVertex
endVertex
=
StringUtils
.
equals
(
outVertexId
,
entityVertex
.
getIdForDisplay
())
?
inVertex
:
outVertex
;
String
endTypeName
=
GraphHelper
.
getTypeName
(
endVertex
);
endEntityType
=
typeRegistry
.
getEntityTypeByName
(
endTypeName
);
}
if
(
endEntityType
==
null
)
{
ret
.
setEntities
(
new
ArrayList
<>());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Invalid relation : {} "
,
relation
);
}
return
ret
;
}
if
(
endEntityType
!=
null
)
{
AtlasAttribute
sortByAttribute
=
endEntityType
.
getAttribute
(
sortByAttributeName
);
if
(
sortByAttribute
==
null
)
{
sortByAttributeName
=
null
;
sortOrder
=
null
;
if
(
LOG
.
isDebugEnabled
())
{
if
(
StringUtils
.
isNotEmpty
(
sortBy
))
{
LOG
.
debug
(
"Invalid sortBy Attribute {} for entityType {}, Ignoring Sorting"
,
sortBy
,
endEntityType
.
getTypeName
());
LOG
.
info
(
"Invalid sortBy Attribute {} for entityType {}, Ignoring Sorting"
,
sortBy
,
endEntityType
.
getTypeName
());
}
else
{
LOG
.
debug
(
"Invalid Default sortBy Attribute {} for entityType {}, Ignoring Sorting"
,
DEFAULT_SORT_ATTRIBUTE_NAME
,
endEntityType
.
getTypeName
());
}
LOG
.
info
(
"Invalid Default sortBy Attribute {} for entityType {}, Ignoring Sorting"
,
DEFAULT_SORT_ATTRIBUTE_NAME
,
endEntityType
.
getTypeName
());
}
}
else
{
sortByAttributeName
=
sortByAttribute
.
getVertexPropertyName
();
...
...
@@ -644,65 +631,66 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
sortOrder
=
ASCENDING
;
}
}
}
else
{
sortOrder
=
null
;
if
(
StringUtils
.
isNotEmpty
(
sortBy
))
{
LOG
.
info
(
"Invalid sortBy Attribute {}, Ignoring Sorting"
,
sortBy
);
}
}
QueryParams
params
=
QueryParams
.
getNormalizedParams
(
limit
,
offset
);
ScriptEngine
scriptEngine
=
graph
.
getGremlinScriptEngine
();
Bindings
bindings
=
scriptEngine
.
createBindings
();
Set
<
String
>
states
=
getEntityStates
();
String
relatedEntitiesQuery
=
gremlinQueryProvider
.
getQuery
(
RELATIONSHIP_SEARCH
);
//get relationship(end vertices) vertices
GraphTraversal
gt
=
graph
.
V
(
entityVertex
.
getId
()).
bothE
(
relation
).
otherV
();
if
(
excludeDeletedEntities
)
{
states
.
remove
(
DELETED
.
toString
());
gt
.
has
(
Constants
.
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
ACTIVE
.
name
());
}
if
(
sortOrder
!=
null
)
{
if
(
sortOrder
==
ASCENDING
)
{
relatedEntitiesQuery
+=
gremlinQueryProvider
.
getQuery
(
RELATIONSHIP_SEARCH_ASCENDING_SORT
);
bindings
.
put
(
SORT_ATTRIBUTE_NAME
,
sortByAttributeName
);
}
else
if
(
sortOrder
==
DESCENDING
)
{
relatedEntitiesQuery
+=
gremlinQueryProvider
.
getQuery
(
RELATIONSHIP_SEARCH_DESCENDING_SORT
);
bindings
.
put
(
SORT_ATTRIBUTE_NAME
,
sortByAttributeName
);
gt
.
order
().
by
(
sortByAttributeName
,
Order
.
asc
);
}
else
{
gt
.
order
().
by
(
sortByAttributeName
,
Order
.
desc
);
}
}
relatedEntitiesQuery
+=
gremlinQueryProvider
.
getQuery
(
TO_RANGE_LIST
);
bindings
.
put
(
"g"
,
graph
);
bindings
.
put
(
"guid"
,
guid
);
bindings
.
put
(
"relation"
,
relation
);
bindings
.
put
(
"states"
,
Collections
.
unmodifiableSet
(
states
));
bindings
.
put
(
"startIdx"
,
params
.
offset
());
bindings
.
put
(
"endIdx"
,
params
.
offset
()
+
params
.
limit
());
try
{
Object
result
=
graph
.
executeGremlinScript
(
scriptEngine
,
bindings
,
relatedEntitiesQuery
,
false
);
if
(
result
instanceof
List
&&
CollectionUtils
.
isNotEmpty
((
List
)
result
))
{
List
<?>
queryResult
=
(
List
)
result
;
Object
firstElement
=
queryResult
.
get
(
0
);
gt
.
range
(
offset
,
offset
+
limit
);
if
(
firstElement
instanceof
AtlasVertex
)
{
List
<
AtlasVertex
>
vertices
=
(
List
<
AtlasVertex
>)
queryResult
;
List
<
AtlasEntityHeader
>
resultList
=
new
ArrayList
<>(
vertices
.
size
()
);
List
<
AtlasEntityHeader
>
resultList
=
new
ArrayList
<>();
while
(
gt
.
hasNext
())
{
Vertex
v
=
(
Vertex
)
gt
.
next
(
);
for
(
AtlasVertex
vertex
:
vertices
)
{
resultList
.
add
(
entityRetriever
.
toAtlasEntityHeader
(
vertex
,
attributes
));
if
(
v
!=
null
&&
v
.
property
(
Constants
.
GUID_PROPERTY_KEY
).
isPresent
())
{
String
endVertexGuid
=
v
.
property
(
Constants
.
GUID_PROPERTY_KEY
).
value
().
toString
();
resultList
.
add
(
entityRetriever
.
toAtlasEntityHeader
(
endVertexGuid
,
attributes
));
}
}
ret
.
setEntities
(
resultList
);
}
}
if
(
ret
.
getEntities
()
==
null
)
{
ret
.
setEntities
(
new
ArrayList
<>());
}
}
catch
(
ScriptException
e
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Gremlin script execution failed for relationship search query: {}"
,
relatedEntitiesQuery
,
e
);
}
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INTERNAL_ERROR
,
"Relationship search query failed"
);
}
finally
{
graph
.
releaseGremlinScriptEngine
(
scriptEngine
);
//set approximate count
//state of the edge and endVertex will be same
if
(
getApproximateCount
)
{
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getAdjacentEdgesByLabel
(
entityVertex
,
AtlasEdgeDirection
.
BOTH
,
relation
);
if
(
excludeDeletedEntities
)
{
List
<
AtlasEdge
>
edgeList
=
new
ArrayList
<>();
edges
.
forEachRemaining
(
edgeList:
:
add
);
Predicate
activePredicate
=
SearchPredicateUtil
.
getEQPredicateGenerator
().
generatePredicate
(
Constants
.
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
ACTIVE
.
name
(),
String
.
class
);
CollectionUtils
.
filter
(
edgeList
,
activePredicate
);
ret
.
setApproximateCount
(
edgeList
.
size
());
}
else
{
ret
.
setApproximateCount
(
IteratorUtils
.
size
(
edges
));
}
}
scrubSearchResults
(
ret
);
...
...
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
aa441de4
...
...
@@ -75,7 +75,7 @@ public abstract class SearchProcessor {
public
static
final
String
CUSTOM_ATTR_SEARCH_FORMAT
=
"\"\\\"%s\\\":\\\"%s\\\"\""
;
public
static
final
String
CUSTOM_ATTR_SEARCH_FORMAT_GRAPH
=
"\"%s\":\"%s\""
;
private
static
final
Map
<
SearchParameters
.
Operator
,
String
>
OPERATOR_MAP
=
new
HashMap
<>();
private
static
final
Map
<
SearchParameters
.
Operator
,
Vertex
AttributePredicateGenerator
>
OPERATOR_PREDICATE_MAP
=
new
HashMap
<>();
private
static
final
Map
<
SearchParameters
.
Operator
,
Element
AttributePredicateGenerator
>
OPERATOR_PREDICATE_MAP
=
new
HashMap
<>();
static
{
...
...
@@ -697,7 +697,7 @@ public abstract class SearchProcessor {
Predicate
ret
=
null
;
AtlasAttribute
attribute
=
type
.
getAttribute
(
attrName
);
Vertex
AttributePredicateGenerator
predicate
=
OPERATOR_PREDICATE_MAP
.
get
(
op
);
Element
AttributePredicateGenerator
predicate
=
OPERATOR_PREDICATE_MAP
.
get
(
op
);
if
(
attribute
!=
null
&&
predicate
!=
null
)
{
final
AtlasType
attrType
=
attribute
.
getAttributeType
();
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
aa441de4
...
...
@@ -201,6 +201,10 @@ public class EntityGraphRetriever {
return
toAtlasEntityHeader
(
getEntityVertex
(
guid
));
}
public
AtlasEntityHeader
toAtlasEntityHeader
(
String
guid
,
Set
<
String
>
attributes
)
throws
AtlasBaseException
{
return
toAtlasEntityHeader
(
getEntityVertex
(
guid
),
attributes
);
}
public
AtlasEntityHeader
toAtlasEntityHeader
(
AtlasVertex
entityVertex
)
throws
AtlasBaseException
{
return
toAtlasEntityHeader
(
entityVertex
,
Collections
.<
String
>
emptySet
());
}
...
...
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
aa441de4
...
...
@@ -17,6 +17,8 @@
*/
package
org
.
apache
.
atlas
.
util
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasElement
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
@@ -43,12 +45,12 @@ public class SearchPredicateUtil {
}
};
public
static
Vertex
AttributePredicateGenerator
getLTPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getLTPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getLTPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -88,12 +90,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getGTPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getGTPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getGTPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -132,12 +134,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getLTEPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getLTEPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getLTEPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -177,12 +179,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getGTEPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getGTEPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getGTEPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -222,12 +224,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getEQPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getEQPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getEQPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -269,12 +271,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getNEQPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getNEQPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getNEQPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -316,12 +318,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getContainsAnyPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getContainsAnyPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getContainsAnyPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -329,7 +331,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
||
attrVal
==
null
||
!
isValid
(
attrVal
,
attrClass
))
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
CollectionUtils
.
containsAny
((
Collection
)
attrVal
,
(
Collection
)
vertexAttrVal
);
...
...
@@ -351,12 +353,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getContainsAllPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getContainsAllPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getContainsAllPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -364,7 +366,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
||
attrVal
==
null
||
!
isValid
(
attrVal
,
attrClass
))
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
((
Collection
)
attrVal
).
containsAll
((
Collection
)
vertexAttrVal
);
...
...
@@ -386,12 +388,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getINPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getINPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getINPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -399,7 +401,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
||
attrVal
==
null
||
!
isValid
(
attrVal
,
attrClass
))
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
((
Collection
)
attrVal
).
contains
(
vertexAttrVal
);
...
...
@@ -422,12 +424,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getRegexPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getRegexPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getRegexPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -451,12 +453,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getLIKEPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getLIKEPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getLIKEPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -480,12 +482,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getStartsWithPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getStartsWithPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getStartsWithPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -509,12 +511,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getEndsWithPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getEndsWithPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getEndsWithPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -538,12 +540,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getContainsPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getContainsPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getContainsPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -554,7 +556,7 @@ public class SearchPredicateUtil {
ret
=
StringPredicate
.
getContainsPredicate
(
attrName
,
attrClass
,
(
String
)
attrVal
);
}
else
if
(
Collection
.
class
.
isAssignableFrom
(
attrClass
))
{
// Check if the provided value is present in the list of stored values
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
((
Collection
)
vertexAttrVal
).
contains
(
attrVal
);
...
...
@@ -575,12 +577,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getNotContainsPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getNotContainsPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getNotContainsPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -591,7 +593,7 @@ public class SearchPredicateUtil {
ret
=
StringPredicate
.
getNotContainsPredicate
(
attrName
,
attrClass
,
(
String
)
attrVal
);
}
else
if
(
Collection
.
class
.
isAssignableFrom
(
attrClass
))
{
// Check if the provided value is present in the list of stored values
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
!((
Collection
)
vertexAttrVal
).
contains
(
attrVal
);
...
...
@@ -612,12 +614,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getIsNullPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getIsNullPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getIsNullPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -625,7 +627,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
;
...
...
@@ -644,12 +646,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getNotNullPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getNotNullPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getNotNullPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -657,7 +659,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
return
vertexAttrVal
!=
null
;
...
...
@@ -676,12 +678,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getNotEmptyPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getNotEmptyPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getNotEmptyPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -689,7 +691,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
boolean
ret
=
false
;
...
...
@@ -720,12 +722,12 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
Vertex
AttributePredicateGenerator
getIsNullOrEmptyPredicateGenerator
()
{
public
static
Element
AttributePredicateGenerator
getIsNullOrEmptyPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getIsNullOrEmptyPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
Vertex
AttributePredicateGenerator
()
{
ElementAttributePredicateGenerator
ret
=
new
Element
AttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
...
...
@@ -733,7 +735,7 @@ public class SearchPredicateUtil {
if
(
attrName
==
null
||
attrClass
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
Vertex
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
ret
=
new
Element
AttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
final
boolean
ret
;
...
...
@@ -764,20 +766,20 @@ public class SearchPredicateUtil {
return
ret
;
}
public
interface
Vertex
AttributePredicateGenerator
{
public
interface
Element
AttributePredicateGenerator
{
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Class
attrClass
);
}
static
abstract
class
Vertex
AttributePredicate
implements
Predicate
{
static
abstract
class
Element
AttributePredicate
implements
Predicate
{
final
String
attrName
;
final
Class
attrClass
;
final
boolean
isNullValid
;
Vertex
AttributePredicate
(
String
attrName
,
Class
attrClass
)
{
Element
AttributePredicate
(
String
attrName
,
Class
attrClass
)
{
this
(
attrName
,
attrClass
,
false
);
}
Vertex
AttributePredicate
(
String
attrName
,
Class
attrClass
,
boolean
isNullValid
)
{
Element
AttributePredicate
(
String
attrName
,
Class
attrClass
,
boolean
isNullValid
)
{
this
.
attrName
=
attrName
;
this
.
attrClass
=
attrClass
;
this
.
isNullValid
=
isNullValid
;
...
...
@@ -787,14 +789,14 @@ public class SearchPredicateUtil {
public
boolean
evaluate
(
final
Object
object
)
{
final
boolean
ret
;
Atlas
Vertex
vertex
=
(
object
instanceof
AtlasVertex
)
?
(
AtlasVertex
)
object
:
null
;
Atlas
Element
element
=
(
object
instanceof
AtlasVertex
||
object
instanceof
AtlasEdge
)
?
(
AtlasElement
)
object
:
null
;
if
(
vertex
!=
null
)
{
if
(
element
!=
null
)
{
Object
attrValue
;
if
(
Collection
.
class
.
isAssignableFrom
(
attrClass
))
{
attrValue
=
vertex
.
getPropertyValues
(
attrName
,
attrClass
);
attrValue
=
element
.
getPropertyValues
(
attrName
,
attrClass
);
}
else
{
attrValue
=
AtlasGraphUtilsV2
.
getProperty
(
vertex
,
attrName
,
attrClass
);
attrValue
=
AtlasGraphUtilsV2
.
getProperty
(
element
,
attrName
,
attrClass
);
}
ret
=
(
isNullValid
||
attrValue
!=
null
)
&&
compareValue
(
attrValue
);
...
...
@@ -808,7 +810,7 @@ public class SearchPredicateUtil {
protected
abstract
boolean
compareValue
(
Object
vertexAttrVal
);
}
static
abstract
class
BooleanPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
BooleanPredicate
extends
Element
AttributePredicate
{
final
Boolean
value
;
BooleanPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
...
...
@@ -822,7 +824,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
return
new
SearchPredicateUtil
.
BooleanPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Boolean
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -830,7 +832,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
return
new
SearchPredicateUtil
.
BooleanPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Boolean
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -839,7 +841,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
ShortPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
ShortPredicate
extends
Element
AttributePredicate
{
final
Short
value
;
ShortPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
...
...
@@ -853,7 +855,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -861,7 +863,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -869,7 +871,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -877,7 +879,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -885,7 +887,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -893,7 +895,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Short
value
)
{
return
new
ShortPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Short
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -902,7 +904,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
IntegerPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
IntegerPredicate
extends
Element
AttributePredicate
{
final
Integer
value
;
IntegerPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
...
...
@@ -916,7 +918,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -924,7 +926,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -932,7 +934,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -940,7 +942,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -948,7 +950,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -956,7 +958,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Integer
value
)
{
return
new
IntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Integer
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -965,7 +967,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
LongPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
LongPredicate
extends
Element
AttributePredicate
{
final
Long
value
;
LongPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
...
...
@@ -979,7 +981,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -987,7 +989,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -995,7 +997,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1003,7 +1005,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1011,7 +1013,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1019,7 +1021,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1028,7 +1030,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
FloatPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
FloatPredicate
extends
Element
AttributePredicate
{
final
Float
value
;
FloatPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
...
...
@@ -1042,7 +1044,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1050,7 +1052,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1058,7 +1060,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1066,7 +1068,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1074,7 +1076,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1082,7 +1084,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Float
value
)
{
return
new
FloatPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Float
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1091,7 +1093,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
DoublePredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
DoublePredicate
extends
Element
AttributePredicate
{
final
Double
value
;
DoublePredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
...
...
@@ -1105,7 +1107,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1113,7 +1115,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1121,7 +1123,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1129,7 +1131,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1137,7 +1139,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1145,7 +1147,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Double
value
)
{
return
new
DoublePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Double
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1154,7 +1156,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
BytePredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
BytePredicate
extends
Element
AttributePredicate
{
final
Byte
value
;
BytePredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
...
...
@@ -1168,7 +1170,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1176,7 +1178,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1184,7 +1186,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1192,7 +1194,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1200,7 +1202,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1208,7 +1210,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
Byte
value
)
{
return
new
BytePredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Byte
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1217,7 +1219,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
BigIntegerPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
BigIntegerPredicate
extends
Element
AttributePredicate
{
final
BigInteger
value
;
BigIntegerPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
...
...
@@ -1231,7 +1233,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1239,7 +1241,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1247,7 +1249,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1255,7 +1257,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1263,7 +1265,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1271,7 +1273,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
BigInteger
value
)
{
return
new
BigIntegerPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigInteger
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1280,7 +1282,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
BigDecimalPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
BigDecimalPredicate
extends
Element
AttributePredicate
{
final
BigDecimal
value
;
BigDecimalPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
...
...
@@ -1294,7 +1296,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1302,7 +1304,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1310,7 +1312,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1318,7 +1320,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1326,7 +1328,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1334,7 +1336,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
BigDecimal
value
)
{
return
new
BigDecimalPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
BigDecimal
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1343,7 +1345,7 @@ public class SearchPredicateUtil {
}
}
static
abstract
class
StringPredicate
extends
Vertex
AttributePredicate
{
static
abstract
class
StringPredicate
extends
Element
AttributePredicate
{
final
String
value
;
StringPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
...
...
@@ -1357,7 +1359,7 @@ public class SearchPredicateUtil {
this
.
value
=
value
;
}
static
Vertex
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
compareTo
(
value
)
==
0
;
...
...
@@ -1365,7 +1367,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
((
String
)
vertexAttrVal
).
compareTo
(
value
)
!=
0
;
...
...
@@ -1373,7 +1375,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getLTPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
compareTo
(
value
)
<
0
;
...
...
@@ -1381,7 +1383,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getLTEPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
compareTo
(
value
)
<=
0
;
...
...
@@ -1389,7 +1391,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getGTPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
compareTo
(
value
)
>
0
;
...
...
@@ -1397,7 +1399,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getGTEPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
;
...
...
@@ -1405,7 +1407,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getContainsPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getContainsPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
contains
(
value
);
...
...
@@ -1413,7 +1415,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getNotContainsPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getNotContainsPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
,
true
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
vertexAttrVal
==
null
||
!((
String
)
vertexAttrVal
).
contains
(
value
);
...
...
@@ -1421,7 +1423,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getStartsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getStartsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
startsWith
(
value
);
...
...
@@ -1429,7 +1431,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getEndsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getEndsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
endsWith
(
value
);
...
...
@@ -1437,7 +1439,7 @@ public class SearchPredicateUtil {
};
}
static
Vertex
AttributePredicate
getRegexPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
static
Element
AttributePredicate
getRegexPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
Pattern
pattern
=
Pattern
.
compile
(
value
,
Pattern
.
CASE_INSENSITIVE
);
...
...
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
View file @
aa441de4
...
...
@@ -370,6 +370,7 @@ public class DiscoveryREST {
@QueryParam
(
"sortBy"
)
String
sortByAttribute
,
@QueryParam
(
"sortOrder"
)
SortOrder
sortOrder
,
@QueryParam
(
"excludeDeletedEntities"
)
boolean
excludeDeletedEntities
,
@QueryParam
(
"getApproximateCount"
)
boolean
getApproximateCount
,
@QueryParam
(
"limit"
)
int
limit
,
@QueryParam
(
"offset"
)
int
offset
)
throws
AtlasBaseException
{
Servlets
.
validateQueryParamLength
(
"guid"
,
guid
);
...
...
@@ -380,11 +381,11 @@ public class DiscoveryREST {
try
{
if
(
AtlasPerfTracer
.
isPerfTraceEnabled
(
PERF_LOG
))
{
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"DiscoveryREST.relatedEntitiesSearch
UsingGremlin
("
+
guid
+
", "
+
relation
+
", "
+
sortByAttribute
+
", "
+
sortOrder
+
", "
+
excludeDeletedEntities
+
", "
+
", "
+
limit
+
", "
+
offset
+
")"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"DiscoveryREST.relatedEntitiesSearch("
+
guid
+
", "
+
relation
+
", "
+
sortByAttribute
+
", "
+
sortOrder
+
", "
+
excludeDeletedEntities
+
", "
+
getApproximateCount
+
", "
+
limit
+
", "
+
offset
+
")"
);
}
return
discoveryService
.
searchRelatedEntities
(
guid
,
relation
,
attributes
,
sortByAttribute
,
sortOrder
,
excludeDeletedEntities
,
limit
,
offset
);
return
discoveryService
.
searchRelatedEntities
(
guid
,
relation
,
attributes
,
sortByAttribute
,
sortOrder
,
excludeDeletedEntities
,
getApproximateCount
,
limit
,
offset
);
}
finally
{
AtlasPerfTracer
.
log
(
perf
);
}
...
...
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