public class Neo4jAliasResolver extends Object
| Constructor and Description |
|---|
Neo4jAliasResolver() |
| Modifier and Type | Method and Description |
|---|---|
String |
createAliasForAssociation(String entityAlias,
List<String> propertyPathWithoutAlias,
String targetNodeType,
boolean optionalMatch)
Given the path to an association, it will create an alias to use in the query for the association.
|
String |
createAliasForEmbedded(String entityAlias,
List<String> propertyPathWithoutAlias,
boolean optionalMatch)
Given the path to an embedded property, it will create an alias to use in the query for the embedded containing
the property.
|
String |
findAlias(String entityAlias,
List<String> propertyPathWithoutAlias)
Given the alias of the entity and the path to the relationship it will return the alias
of the component.
|
String |
findAliasForType(String entityType) |
RelationshipAliasTree |
getRelationshipAliasTree(String entityAlias)
Given the alias of the entity it will return a tree structure containing all the aliases for the embedded
properties and associations of the entity.
|
boolean |
isOptionalMatch(String alias)
Tells if the alias has to be used in the OPTIONAL MATCH part of the query.
|
void |
registerEntityAlias(String entityName,
String alias) |
public String createAliasForEmbedded(String entityAlias, List<String> propertyPathWithoutAlias, boolean optionalMatch)
The alias will be saved and can be returned using the method findAlias(String, List).
For example, using n as entity alias and [embedded, anotherEmbedded] as path to the embedded will return "_n2" as alias for "n.embedded.anotherEmbedded".
Note that you need to create an alias for every embedded/association in the path before this one.
entityAlias - the alias of the entity that contains the embeddedpropertyPathWithoutAlias - the path to the property without the aliasoptionalMatch - if true, the alias does not represent a required match in the query (It will appear in the OPTIONAL MATCH clause)public String createAliasForAssociation(String entityAlias, List<String> propertyPathWithoutAlias, String targetNodeType, boolean optionalMatch)
The alias will be saved and can be returned using the method findAlias(String, List).
For example, using n as entity alias and [association, anotherAssociation] as path to the association will return "_n2" as alias for "n.association.anotherAssociation".
Note that you need to create an alias for every embedded/association in the path before this one.
entityAlias - the alias of the entity that contains the embeddedpropertyPathWithoutAlias - the path to the property without the aliastargetNodeType - the name of the target node typeoptionalMatch - if true, the alias does not represent a required match in the query (It will appear in the OPTIONAL MATCH clause)public String findAlias(String entityAlias, List<String> propertyPathWithoutAlias)
entityAlias - the alias of the entitypropertyPathWithoutAlias - the path to the property without the aliaspublic RelationshipAliasTree getRelationshipAliasTree(String entityAlias)
The tree has the entity alias as root and the embedded/association alias as children. For example, a path to two properties like:
n (alias = n)|- first (alias = _n1) -- anotherEmbedded (alias = _n2)
|
-- second (alias = _n3) -- anotherEmbedded (alias = _n4)
entityAlias - the alias of the entity that contains the embeddedRelationshipAliasTree or nullpublic boolean isOptionalMatch(String alias)
alias - the alis to checktrue if the alias should be used in OPTIONAL MATCH part of the query, false otherwiseCopyright © 2010–2016 Hibernate. All rights reserved.