Class: ODDB::AnalysisPlugin

Inherits:
Plugin show all
Defined in:
src/plugin/analysis.rb

Constant Summary

ANALYSIS_PARSER =
DRbObject.new(nil, ANALYSISPARSE_URI)

Constants inherited from Plugin

ARCHIVE_PATH, RECIPIENTS

Instance Method Summary (collapse)

Methods inherited from Plugin

#initialize, #l10n_sessions, #log_info, #recipients, #report, #resolve_link, #update_rss_feeds

Methods included from HttpFile

#http_body, #http_file

Constructor Details

This class inherits a constructor from ODDB::Plugin

Instance Method Details

- (Object) delete_position(group, position)



24
25
26
27
# File 'src/plugin/analysis.rb', line 24

def delete_position(group, position)
  ## TODO
  #  position.odba_delete
end

- (Object) update(path, lang)



13
14
15
16
17
18
19
20
21
22
23
# File 'src/plugin/analysis.rb', line 13

def update(path, lang)
  ANALYSIS_PARSER.parse_pdf(path).each { |position|
    group = update_group(position)
    if(position[:analysis_revision] == 'S')
      delete_position(group, position)
    else
      position = update_position(group, position, lang)
    end
  }
  @app.recount
end

- (Object) update_dacapo



86
87
88
89
90
91
92
93
94
95
96
97
# File 'src/plugin/analysis.rb', line 86

def update_dacapo
  ANALYSIS_PARSER.dacapo { |code, info|
    unless(info.empty?)
      groupcd, poscd = code.split('.')
      if((grp = @app.analysis_group(groupcd)) \
         && (pos = grp.position(poscd)))
        ptr = pos.pointer + [:detail_info, :dacapo]
        @app.update(ptr.creator, info)  
      end
    end
  }
end

- (Object) update_group(position)



28
29
30
31
32
# File 'src/plugin/analysis.rb', line 28

def update_group(position)
  groupcd = position.delete(:group)
  ptr = Persistence::Pointer.new([:analysis_group, groupcd])
  @app.create(ptr)
end

- (Object) update_position(group, position, language)



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'src/plugin/analysis.rb', line 33

def update_position(group, position, language)
  poscd = position.delete(:position)
  position.delete(:code)
  position.store(language, position.delete(:description))
  if(perms = position.delete(:permissions))
    perms.collect! { |pair|
      Analysis::Permission.new(*pair)  
    }
  end
  lim_txt = position.delete(:limitation)
  footnote = position.delete(:footnote)
  list_title = position.delete(:list_title)
  taxnote = position.delete(:taxnote)
  ptr = group.pointer + [:position, poscd]
  pos = @app.update(ptr.creator, position)
  if(lim_txt)
    lim_ptr = pos.pointer + :limitation_text
    args = {language => lim_txt}
    @app.update(lim_ptr.creator, args)
  elsif(lim = pos.limitation_text)
    @app.delete(lim.pointer)
  end
  if(footnote)
    ft_ptr = pos.pointer + :footnote
    args = {language => footnote}
    if(footnote != nil)
    end
    @app.update(ft_ptr.creator, args)
  elsif(note = pos.footnote)
    @app.delete(note.pointer)
  end
  if(list_title)
    lt_ptr = pos.pointer + :list_title
    args = {language => list_title}
    @app.update(lt_ptr.creator, args)
  elsif(title = pos.list_title)
    @app.delete(title.pointer)
  end
  if(taxnote)
    tn_ptr = pos.pointer + :taxnote
    args = {language => taxnote}
    @app.update(tn_ptr.creator, args)
  elsif(tnote = pos.taxnote)
    @app.delete(tnote.pointer)
  end
  if(perms)
    perm_ptr = pos.pointer + :permissions
    args = {language => perms}
    @app.update(perm_ptr.creator, args)
  elsif(ps = pos.permissions)
    @app.delete(ps.pointer)
  end
end