Class: CaTissue::Annotation::AnnotationService

Inherits:
CaRuby::PersistenceService
  • Object
show all
Defined in:
lib/catissue/database/annotation/annotation_service.rb

Overview

An AnnotationService queries and saves CaTissue annotations.

Instance Method Summary collapse

Constructor Details

#initialize(database, name, integrator) ⇒ AnnotationService

Creates an AnnotationService for the given CaTissue::Database, service name and options.

Parameters:

  • database (CaTissue::Database)

    the database

  • name (String)

    the caTissue DE service name

  • integrator (Integrator)

    the caTissue annotation integrator



14
15
16
17
18
19
# File 'lib/catissue/database/annotation/annotation_service.rb', line 14

def initialize(database, name, integrator)
  super(name, database.access_properties)
  @database = database
  @database.add_persistence_service(self)
  @intgtr = integrator
end

Instance Method Details

#create(annotation) ⇒ Annotation

Augments the CaRuby::PersistenceService create method to handle caTissue annotation service peculiarities, e.g.:

  • assigns the identifier, since assignment is not done automatically as is the case with the default application service

  • associate the annotation to the hook object

  • Save all referenced annotation objects

This method is only called on Metadata#primary? annotation objects.

Parameters:

  • annotation (Annotation)

    the annotation object to create

Returns:



32
33
34
35
36
37
# File 'lib/catissue/database/annotation/annotation_service.rb', line 32

def create(annotation)
  logger.debug { "Creating annotation #{annotation.qp}..." }
  time { create_annotation(annotation) }
  logger.debug { "Created annotation #{annotation}." }
  annotation
end