Package com.polarion.platform.context
Interface IContextService
public interface IContextService
This service builds the logical structure of contexts on top of the
repository (repository service) to be used by the rest of the application.
The context hierarchy is a tree structure, which can be traversed and which
can dynamically change in time (i.g. nodes can be added and removed).
The nodes can be of several natures, which can have the one of these values:
null REPOSITORY PROJECT-GROUP PROJECT
these natures tag a special kinds of contexts.
- Author:
- dobisekm
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Subscribes to all events in the context hierarchy.void
Subscribes to the evens in the subtree below (inclusive) the given context.boolean
Checks whether context with given id exists.getAllSubcontextIds
(IContextId parent) getDirectSubcontextIds
(IContextId parent) getHistoricalLocations
(String projectId) getLocationContext
(ILocation loc, boolean includeContent) Returns the context related to the given location.getParentContextId
(IContextId subContext) The root context is the entry point to the hierarchy.void
This method is for internal use only.void
Removes the listener from all contexts, it's listening to.
-
Field Details
-
ROOT_CTX_NAME
- See Also:
-
-
Method Details
-
getRootContextId
IContextId getRootContextId()The root context is the entry point to the hierarchy.- Returns:
- the root context
-
contextExists
Checks whether context with given id exists.- Since:
- 3.10.1
-
getContextforId
- Returns:
- The context object for the given id.
- Throws:
IllegalArgumentException
- if no such context exists or id isnull
.
-
getAllSubcontextIds
- Parameters:
parent
-- Returns:
- List of
IContextId
objects, representing the whole subtree of the given context. The list is ordered in such a way that parent ids always comes before it's children. - Throws:
IllegalArgumentException
- if parent context does not exist.
-
getDirectSubcontextIds
- Parameters:
parent
-- Returns:
- List of
IContextId
objects, representing all immediate children of the given context. - Throws:
IllegalArgumentException
- if parent context does not exist.
-
getParentContextId
- Parameters:
subContext
- can't be anull
- Returns:
- the parent context Id, for root context return
null
-
getContextPath
- Parameters:
id
-- Returns:
- List of
IContext
objects, representing the path from given context (inclusive) to the root contect (inclusive).
-
getLocationContext
Returns the context related to the given location. Depending on theincludeContent
parameter, the function logic is different.For
includeContent == true
the function returns the most nested context, which contains the given location. If the location does not fall below any context (e.g. it has unknown repository name), then the root context is returned (since, by definition, all locations fall below it).Null
is never returned in this situation. Note, that both leave and inner contexts can be returned.For
includeContent == false
the context, whose location exactly corresponds to the given location is returned. If no such exists thennull
is returned.- Parameters:
loc
- The location. Must be absolute, with the repository name set. Fornull
location, the Root context is returned.includeContent
- Whether to include context content. See above for description.- Returns:
- The found context or
null
(se above for conditions). - Throws:
IllegalArgumentException
- if the location is relative or has no repository
-
addContextListener
Subscribes to all events in the context hierarchy. Equivalent toaddContextListener(l, getRootContext().getId())
- Parameters:
l
-
-
addContextListener
Subscribes to the evens in the subtree below (inclusive) the given context.- Parameters:
l
-ctx
-
-
removeContextListener
Removes the listener from all contexts, it's listening to.- Parameters:
l
-
-
reconsiderLocation
This method is for internal use only. It asks the context service to reevaluate the nature for given location.It is used during project creations and deletions.
- Parameters:
l
-
-
getHistoricalLocations
- Since:
- 3.5.3
-