Interface OverviewContext

All Known Implementing Classes:

public interface OverviewContext
Interface that should be implemented by overview generating classes. This interface defines service methods that overview generating class to NodeLoader:s and NodeValidator:s so that they can do their job.
Last modified
$Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
  • Method Details

    • getNodeLoaderFactory

      NodeLoaderFactory getNodeLoaderFactory()
      Get the node loader factory that is used to create node loaders.
      A node loader factory
    • getNodeValidatorFactory

      NodeValidatorFactory getNodeValidatorFactory()
      Get the node validator factory that is used to create node validators.
      A node loader factory
    • getSnapshotManager

      SnapshotManager getSnapshotManager()
      Get the snapshot manager that is used to load annotation values. This method may re-use an existing snapshot manager as long as a transaction is active. Once the transaction has been committed (or rollbacked) the snapshot manager should no longer be used since it may hold inconsistent data. Note that it is always safe to create a new snapshot manager.
    • getProject

      Project getProject()
      Get the project the overview is using as the "current" project. This is mostly needed by validators to check if items are using the project default protocols, software, etc.
      A project, or null
    • getValidationOptions

      ValidationOptions getValidationOptions()
      Get the validation options that are currently in effect.
    • setCachedObject

      void setCachedObject(Object cacheKey, Object value)
      Store an auxilliary object in the overview cache. This is a service provided by the overview implementation that can be used by node loaders and/or validators to store information that may be needed again in the future and is expensive to retreive (eg. from the database). This is for example used to store annotation types that have been marked as "Required by MIAME", parents to annotatable items and more.

      Note! The overview impementation is not forced to implement a cache, or it may optionally decide to disable the cache. Node loaders and validators should not depend on the cache for correct functionality.

      cacheKey - The key to store the value under
      value - The value to store in the cache, or null to remove the entry
      See Also:
    • getCachedObject

      Object getCachedObject(Object cacheKey)
      Retreive an object stored in the overview cache.
      cacheKey - The key to use for cache lookup
      The object, or null if no object has been cached with the given key
      See Also:
    • createFailure

      Failure createFailure(Validator validator, Node node, String message, Fix... fixes)
      Register the failure of a validation rule.

      Note! The overview implementation is not forced to register the failure, or it may optioanlly only register certain types of failures.

      validator - The validation rule that fails
      node - The node that was validated
      message - An optional message, if null the message from Validator.getFailureSummary() is used
      fixes - Optional fixes that may be used to correct the problem
    • initQuery

      <I extends BasicItem> ItemQuery<I> initQuery(ItemQuery<I> query, String sortby)
      Same as initQuery(ItemQuery, Order...) but easier to use when sorting the items in ascending order by a single column.
      query - The query that should be initialised
      sortby - The property name to sort by (may be null)
      The same query object
    • initQuery

      <I extends BasicItem> ItemQuery<I> initQuery(ItemQuery<I> query, Order... sortby)
      Initialise a query with "global options" and optionally a sort order.

      Note! The "global options" can differ between overview implementation, but typically include settings some restrictions base on Include options, or permissions on the query.

      query - The query that should be initialised
      sortby - An array with Order objects (may be null)
      The same query object
      See Also:
    • getNodeCache

      NodeCache<Object> getNodeCache()
      Get the current node cache. Node loaders may use the cache to store nodes for already seen items. Then, when the same item is seen again the existing node (including all children) is simply cloned. This can make the performance a lot better.
      A node cache, or null if the current overview doesn't want to use a cache