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 Details

  • Method Details

    • getRootContextId

      IContextId getRootContextId()
      The root context is the entry point to the hierarchy.
      Returns:
      the root context
    • contextExists

      boolean contextExists(@NotNull IContextId id)
      Checks whether context with given id exists.
      Since:
      3.10.1
    • getContextforId

      IContext getContextforId(IContextId id)
      Returns:
      The context object for the given id.
      Throws:
      IllegalArgumentException - if no such context exists or id is null.
    • getAllSubcontextIds

      List<IContextId> getAllSubcontextIds(IContextId parent)
      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

      List<IContextId> getDirectSubcontextIds(IContextId parent)
      Parameters:
      parent -
      Returns:
      List of IContextId objects, representing all immediate children of the given context.
      Throws:
      IllegalArgumentException - if parent context does not exist.
    • getParentContextId

      IContextId getParentContextId(IContextId subContext)
      Parameters:
      subContext - can't be a null
      Returns:
      the parent context Id, for root context return null
    • getContextPath

      List<IContext> getContextPath(IContextId id)
      Parameters:
      id -
      Returns:
      List of IContext objects, representing the path from given context (inclusive) to the root contect (inclusive).
    • getLocationContext

      IContext getLocationContext(ILocation loc, boolean includeContent)
      Returns the context related to the given location. Depending on the includeContent 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 then null is returned.

      Parameters:
      loc - The location. Must be absolute, with the repository name set. For null 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

      void addContextListener(IContextListener l)
      Subscribes to all events in the context hierarchy. Equivalent to addContextListener(l, getRootContext().getId())
      Parameters:
      l -
    • addContextListener

      void addContextListener(IContextListener l, IContextId ctx)
      Subscribes to the evens in the subtree below (inclusive) the given context.
      Parameters:
      l -
      ctx -
    • removeContextListener

      void removeContextListener(IContextListener l)
      Removes the listener from all contexts, it's listening to.
      Parameters:
      l -
    • reconsiderLocation

      void reconsiderLocation(ILocation l)
      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

      Collection<ILocation> getHistoricalLocations(String projectId)
      Since:
      3.5.3