Module: CaTissue::Annotation::Importer

Includes:
Jinx::Importer
Defined in:
lib/catissue/annotation/importer.rb

Overview

This Annotation Importer module extends the standard Jinx::Importer to import annotation classes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotation_classes<Metadata> (readonly)

Returns this module’s annotation classes.

Returns:

  • (<Metadata>)

    this module’s annotation classes



16
17
18
# File 'lib/catissue/annotation/importer.rb', line 16

def annotation_classes
  @annotation_classes
end

#groupString (readonly)

Returns the group short name.

Returns:

  • (String)

    the group short name



22
23
24
# File 'lib/catissue/annotation/importer.rb', line 22

def group
  @group
end

#proxyProxyClass (readonly)

Returns the annotation proxy class.

Returns:



19
20
21
# File 'lib/catissue/annotation/importer.rb', line 19

def proxy
  @proxy
end

#record_entry_classProxyClass (readonly)

Returns the hook-annotation association class, or nil for 1.1.x caTissue.

Returns:

  • (ProxyClass)

    the hook-annotation association class, or nil for 1.1.x caTissue



25
26
27
# File 'lib/catissue/annotation/importer.rb', line 25

def record_entry_class
  @record_entry_class
end

#record_entry_hook_writerSymbol (readonly)

Returns the #record_entry_class hook writer method, or nil for 1.1.x caTissue.

Returns:



28
29
30
# File 'lib/catissue/annotation/importer.rb', line 28

def record_entry_hook_writer
  @record_entry_hook_writer
end

Instance Method Details

#hookProxyClass#hook

Returns:



66
67
68
# File 'lib/catissue/annotation/importer.rb', line 66

def hook
  @proxy.hook
end

#initialize_annotation(hook, opts) {|proxy| ... } ⇒ Object

Builds this annotation module. This method intended to be called only by Metadata.

Parameters:

  • hook (Class)

    the static hook class

  • the ({Symbol => Object})

    options

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • :package (String)

    the DE package name

  • :service (String)

    the DE service name

  • :group (String)

    the DE group short name

  • :record_entry (String)

    the record entry name class for post-1.1.x caTissue

Yields:

  • (proxy)

    makes the hook => proxy reference attribute

  • (proxy)

    makes the hook => proxy reference attribute

Yield Parameters:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/catissue/annotation/importer.rb', line 43

def initialize_annotation(hook, opts)
  logger.debug { "Building #{hook.qp} annotation #{qp}..." }
  # Make this module an annotation-enabled Jinx::Importer 
  (hook, opts)
  @svc_nm = opts[:service]
  @group = opts[:group]
  @annotation_classes = []
  dei = hook.de_integration_proxy_class
  if dei then
    import_record_entry_class(dei, hook)
    pxy_nm = dei.name.demodulize
  end
  @proxy = import_proxy(hook, pxy_nm)
  # Make the hook => proxy reference
  yield @proxy
  # Fill out the dependency hierarchy.
  @proxy.build_annotation_dependency_hierarchy
  # Print all known annotation classes.
  @annotation_classes.each { |klass| logger.info(klass.pp_s) }
  logger.debug { "Built #{hook.qp} annotation #{qp}." }
end

#persistence_serviceCaRuby::PersistenceService

Returns this module’s application service.

Returns:

  • (CaRuby::PersistenceService)

    this module’s application service



71
72
73
# File 'lib/catissue/annotation/importer.rb', line 71

def persistence_service
  @ann_svc ||= Database.current.annotator.create_annotation_service(self, @svc_nm)
end