Class ProjectSpecificAnnotationsManager

java.lang.Object
net.sf.basedb.core.ProjectSpecificAnnotationsManager
All Implemented Interfaces:
TransactionalAction

class ProjectSpecificAnnotationsManager extends Object implements TransactionalAction
Internal class for keeping the "override_id" column in the "Annotations" table synchronized when annotations are creted and deleted.
Since:
3.10
Author:
nicklas
  • Field Details

  • Constructor Details

    • ProjectSpecificAnnotationsManager

      ProjectSpecificAnnotationsManager(Session session)
  • Method Details

    • cleanupProjectSpecificAnnotations

      static int cleanupProjectSpecificAnnotations() throws BaseException
      Delete project-specific annotations that belong to projects that no longer exists.
      Returns:
      The number of deleted annotation sets
      Throws:
      BaseException
    • findProjectSpecificAnnotation

      Annotation findProjectSpecificAnnotation(Annotation defaultAnnotation, int projectId)
      Find a project-specific annotation for a given default annotation.
    • primaryCreated

      void primaryCreated(int id, int annotationSet, int annotationType, int project)
      A PRIMARY annotation has been created in this transaction. If this is a DEFAULT annotation (projectId==0) we need to set "override_id" for project-specific annotations to point to this annotation. If this is a PROJECT-SPECIFIC annotation (projectId!=0) we need to find the ID of the default annotation.
      Parameters:
      id - The annotation that was created
      annotationSet - The annotation set the annotation belongs to
      annotationType - The annotation type of the annotation
      project - The id of the project, or 0 for default annotation
    • inheritedCreated

      void inheritedCreated(int id, int annotationSet, int parent, int parentSet, int parentOverride, int project)
      An INHERITED/CLONED annotation has been created in this transaction. If this is a DEFAULT annotation (projectId==0) we need to set "override_id" for project-specific annotations to point to this annotation. If this is a PROJECT-SPECIFIC annotation (projectId!=0) we need to find the ID of the default annotation.
      Parameters:
      id - The annotation that was created
      annotationSet - The annotation set the annotation belongs to
      parent - The id of the parent annotation
      parentSet - The id of the parent annotation set
      parentOverride - The "override_id" column from the parent annotation
      project - The id of the project, or 0 for default annotation
    • defaultDeleted

      void defaultDeleted(int id, boolean isPrimary)
      A default annotation is being deleted in this transaction. We need to set override_id=0 on all other annotations that are referencing this annotation. This method can be used for both primary, inherited and cloned annotations.
    • onBeforeCommit

      public void onBeforeCommit()
      Description copied from interface: TransactionalAction
      This method is called before the commit is about to happen. If this method throws an exception the transaction will be rolled back.
      Specified by:
      onBeforeCommit in interface TransactionalAction
    • onAfterCommit

      public void onAfterCommit()
      Description copied from interface: TransactionalAction
      Called after a successful commit. Implementations should not throw any exceptions from this method. If they do, the message is logged, by no other action is taken.
      Specified by:
      onAfterCommit in interface TransactionalAction
    • onRollback

      public void onRollback()
      Description copied from interface: TransactionalAction
      Called after an unsuccessful commit. Implementations should not throw any exceptions from this method. If they do, the message is logged, by no other action is taken.
      Specified by:
      onRollback in interface TransactionalAction
    • deleteAnnotationsForNonExistingProjects

      int deleteAnnotationsForNonExistingProjects()