public class ReferenceViewImpl extends java.lang.Object implements ReferenceView
Constructor and Description |
---|
ReferenceViewImpl(ConfigContextImpl configContext)
constructor
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<Ref> |
findDependencies(Ref ref, java.util.Set<java.lang.String> typeIds, java.util.Set<java.lang.String> frontier, boolean includeMissingRefs)
Returns the list of all dependencies recursively starting from the given ref.
|
java.util.Set<Ref> |
findDependents(Ref ref, java.util.Set<java.lang.String> typeIds, java.util.Set<java.lang.String> frontier)
Returns the list of all dependents recursively starting from the given ref.
|
java.util.Set<Ref> |
getChildren(Ref ref)
returns the children contained in the parent ref.
|
java.util.Set<Ref> |
getDependencies(Ref ref)
returns the dependencies (resources) for the given ref.
|
java.util.Set<Ref> |
getDependents(Ref ref)
returns the dependents (resources) for the given ref - i.e.
|
Ref |
getParent(Ref ref)
returns the parent for the given child ref.
|
boolean |
hasCycle(Ref ref)
returns whether the given ref defines a cycle.
|
boolean |
hasCycle(Ref ref, java.util.Set<Ref> futureReferences)
returns whether the given ref will define a cycle if added the given references.
|
boolean |
hasDependencies(Ref ref)
returns whether the given ref has dependencies
|
boolean |
hasDependents(Ref ref)
returns whether the given ref has dependents
|
boolean |
isInCycle(Ref ref, java.util.Set<Ref> cycle)
returns whether the given ref is 'in' a cycle.
|
void |
sort(java.util.List<Ref> refs)
sorts the given list of resources (the list must allow sorting) by deletion order - i.e.
|
public ReferenceViewImpl(ConfigContextImpl configContext)
public boolean hasDependencies(Ref ref) throws NotFoundException
ReferenceView
hasDependencies
in interface ReferenceView
NotFoundException
public java.util.Set<Ref> getDependencies(Ref ref) throws NotFoundException
ReferenceView
For a resource, this basically returns the result of calling computeExternalReferences on this resource type def. For a location, this is the set of all resources that are outside this location but referenced by at least one resource in that location.
getDependencies
in interface ReferenceView
NotFoundException
public java.util.Set<Ref> findDependencies(Ref ref, java.util.Set<java.lang.String> typeIds, java.util.Set<java.lang.String> frontier, boolean includeMissingRefs) throws NotFoundException
ReferenceView
findDependencies
in interface ReferenceView
ref
- the ref to start fromtypeIds
- types of references to consider. If null, consider all types of referencesfrontier
- indicates when to stop recursing (searching) along an edge. If non-null, and if recursing along an edge from Node A to Node B, the search stops along that edge stops after processing B. In other words there will be no recursing from Node B to its dependencies. If the value is null, the search does not stop based on the node type.includeMissingRefs
- whether to include a reference in the result set even if it does not exist.NotFoundException
public boolean hasDependents(Ref ref)
ReferenceView
note: a resource may have dependents even it if does not exist. This can happen if A depends on B and B gets deleted.
hasDependents
in interface ReferenceView
public java.util.Set<Ref> getDependents(Ref ref)
ReferenceView
For a location, this is the set of all resources that are outside this location but that reference a resource in that location.
note: a resource may have dependents even it if does not exist. This can happen if A depends on B and B gets deleted.
getDependents
in interface ReferenceView
public java.util.Set<Ref> findDependents(Ref ref, java.util.Set<java.lang.String> typeIds, java.util.Set<java.lang.String> frontier)
ReferenceView
note: a resource may have dependents even it if does not exist. This can happen if A depends on B and B gets deleted.
findDependents
in interface ReferenceView
ref
- the ref to start fromtypeIds
- types of references to consider. If null, consider all types of referencesfrontier
- indicates when to stop recursing (searching) along an edge. If non-null, and if recursing along an edge from Node A to Node B, the search stops along that edge stops after processing B. In other words there will be no recursing from Node B to its dependents. If the value is null, the search does not stop based on the node type.public boolean hasCycle(Ref ref) throws NotFoundException
ReferenceView
hasCycle
in interface ReferenceView
NotFoundException
public boolean hasCycle(Ref ref, java.util.Set<Ref> futureReferences) throws NotFoundException
ReferenceView
hasCycle
in interface ReferenceView
NotFoundException
public boolean isInCycle(Ref ref, java.util.Set<Ref> cycle) throws NotFoundException
ReferenceView
isInCycle
in interface ReferenceView
NotFoundException
public Ref getParent(Ref ref) throws ValidationException
ReferenceView
ChildType
.getParent
in interface ReferenceView
ValidationException
- thrown if the parent cannot be found or if multiple parent existspublic java.util.Set<Ref> getChildren(Ref ref) throws NotFoundException
ReferenceView
ParentType
.getChildren
in interface ReferenceView
NotFoundException
public void sort(java.util.List<Ref> refs) throws NotFoundException
ReferenceView
sort
in interface ReferenceView
NotFoundException