<< Masa.20100916-understand-limitation-process | 2010 | Masa.20100914-test-import_gkv >>
We got an error mail
Wed Sep 15 02:03:12 2010: de.oddb.org ODDB::Import::Pharma24#import Mechanize::RedirectLimitReachedError Maximum redirect limit (20) reached /usr/lib64/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:605:in `fetch_page' /usr/lib64/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:611:in `fetch_page' /usr/lib64/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:259:in `get' /var/www/de.oddb.org/lib/oddb/import/pharma24.rb:132:in `search' /var/www/de.oddb.org/lib/oddb/import/pharma24.rb:160:in `update_package' /var/www/de.oddb.org/lib/oddb/import/pharma24.rb:20:in `import' /var/www/de.oddb.org/lib/oddb/util/updater.rb:158:in `update_prices' /var/www/de.oddb.org/lib/oddb/util/updater.rb:117:in `call' /var/www/de.oddb.org/lib/oddb/util/updater.rb:117:in `_reported_import' /var/www/de.oddb.org/lib/oddb/util/updater.rb:157:in `update_prices' /var/www/de.oddb.org/jobs/import_pharma24:12 /var/www/de.oddb.org/lib/oddb/util/job.rb:16:in `call' /var/www/de.oddb.org/lib/oddb/util/job.rb:16:in `run' /var/www/de.oddb.org/jobs/import_pharma24:11 Checked 1 Packages Updated 0 Packages Created 0 Companies
Davatz-san Mail
If you search for the products you will find, that the mentioned products in above ticket to not contain an "L" in the search result.
There should be an "L" (for Limitation) and there should also be some text there when you click on the "L" - as for example here:
http://ch.oddb.org/de/gcc/resolve/pointer/%253A%2521registration%252C46928%2521sequence%252C01%2521package%252C016%2521sl_entry%2521limitation_text.
All of the Limitations mentioned in Ticket 242 comment 9 are probably assigned in the XML via the IT-Code and not via the package Tag.
There are three levels of Limitation-assignment:
1. IT (Index Therapeuticus) - I guess not yet implemented
2. Präparat (Produkt) - Implemented
3. Packung (Package) - Implemented
So we need to figure out a way how to show the Limitations belonging to the IT-Code and not to the package.
The Limitations on the IT-Level also have to go into the file oddb.csv.
The Limitations belonging to IT-Codes (1) are all found in the file:
ItCodes.xml
I guess we do not import that yet but I can not confirm that. Also see:
./test/test_plugin/bsv_xml.rb
Test
masa@masa ~/ywesee/oddb.org $ ruby test/test_plugin/bsv_xml.rb
test/test_plugin/bsv_xml.rb:905: warning: parenthesize argument(s) for future version
test/test_plugin/bsv_xml.rb:15: warning: already initialized constant MEDDATA_SERVER
Loaded suite test/test_plugin/bsv_xml
Started
!!!!! DEPRECATION NOTICE !!!!!
The WWW constant is deprecated, please switch to the new top-level Mechanize
constant. WWW will be removed in Mechanize version 2.0
You've referenced the WWW constant from test/test_plugin/bsv_xml.rb:684:in `test_download', please
switch the "WWW" to "Mechanize". Thanks!
Sincerely,
Pew Pew Pew
FE.......
Finished in 0.0777340000000001 seconds.
1) Failure:
test_download(ODDB::TestBsvXmlPlugin) [test/test_plugin/bsv_xml.rb:688]:
Exception raised:
Class: <Errno::ENOENT>
Message: <"No such file or directory - /home/masa/ywesee/oddb.org/test/data/xml/XMLPublications.zip">
---Backtrace---
/usr/lib64/ruby/1.8/fileutils.rb:1200:in `stat'
/usr/lib64/ruby/1.8/fileutils.rb:1200:in `lstat'
/usr/lib64/ruby/1.8/fileutils.rb:1178:in `stat'
/usr/lib64/ruby/1.8/fileutils.rb:1260:in `copy_file'
/usr/lib64/ruby/1.8/fileutils.rb:463:in `copy_file'
/usr/lib64/ruby/1.8/fileutils.rb:383:in `cp'
/usr/lib64/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest'
/usr/lib64/ruby/1.8/fileutils.rb:1411:in `fu_each_src_dest0'
/usr/lib64/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest'
/usr/lib64/ruby/1.8/fileutils.rb:382:in `cp'
test/test_plugin/bsv_xml.rb:680:in `test_download'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:78:in `call'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:78:in `return_value'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:59:in `verify_call'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:42:in `call'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:101:in `method_missing'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:655:in `download_to'
test/test_plugin/bsv_xml.rb:689:in `test_download'
test/test_plugin/bsv_xml.rb:688:in `test_download'
---------------
2) Error:
test_update_it_codes(ODDB::TestBsvXmlPlugin):
Zip::ZipError: File /home/masa/ywesee/oddb.org/test/data/xml/XMLPublications.zip not found
/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1396:in `initialize'
/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1410:in `new'
/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1410:in `open'
test/test_plugin/bsv_xml.rb:701:in `test_update_it_codes'
9 tests, 64 assertions, 1 failures, 1 errors
BraSt
Confirm the result yesterday again
src/model/package.rb
def limitation_text
# @sl_entry.limitation_text unless @sl_entry.nil?
end
Result
BraSt
Check the limitation_text class
def limitation_text
p @sl_entry.limitation_text.class unless @sl_entry.nil?
@sl_entry.limitation_text unless @sl_entry.nil?
end
Result
ODDB::LimitationText NilClass ODDB::LimitationText ODDB::LimitationText ODDB::LimitationText NilClass
Therefore
BraSt
Look for ODDB::LimitationText class
masa@masa ~/ywesee/oddb.org $ grep -r "class LimitationText" src src/model/limitationtext.rb: class LimitationText src/state/drugs/limitationtext.rb:class LimitationText < State::Drugs::Global src/state/drugs/limitationtexts.rb:class LimitationTexts < Global src/state/migel/limitationtext.rb:class LimitationText < State::Migel::Global src/view/drugs/limitationtext.rb:class LimitationTextInnerComposite < HtmlGrid::Composite src/view/drugs/limitationtext.rb:class LimitationTextComposite < HtmlGrid::Composite src/view/drugs/limitationtext.rb:class LimitationText < PrivateTemplate src/view/drugs/limitationtexts.rb:class LimitationTextList < HtmlGrid::List src/view/drugs/limitationtexts.rb:class LimitationTextsComposite < HtmlGrid::Composite src/view/drugs/limitationtexts.rb:class LimitationTexts < ResultTemplate src/view/migel/limitationtext.rb:class LimitationTextInnerComposite < View::Drugs::LimitationTextInnerComposite src/view/migel/limitationtext.rb:class LimitationTextComposite < HtmlGrid::Composite src/view/migel/limitationtext.rb:class LimitationText < View::PrivateTemplate
Notes
Anyway, check them one by one
#!/usr/bin/env ruby
# LimitationText -- oddb -- 10.11.2003 -- mhuggler@ywesee.com
require 'util/language'
module ODDB
class LimitationText
include SimpleLanguage
ODBA_SERIALIZABLE = [ '@descriptions' ]
attr_accessor :code, :type, :niveau, :value, :valid_from
end
end
Notes
BraSt
Experiment
def limitation_text
print @sl_entry.limitation_text.pretty_inspect, "\n" if @sl_entry.limitation_text.class == ODDB::LimitationText
@sl_entry.limitation_text unless @sl_entry.nil?
Result
#<ODDB::LimitationText:0x7f93201c8508
@descriptions=
{"it"=>
#<ODDB::Text::Chapter:0x7f93201c83a0
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f93201c82d8
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f93201c8210
@format=
#<ODDB::Text::Format:0x7f93201c8170
@end=-1,
@start=58,
@values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f93201c8008
@end=16,
@start=0,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7f90
@end=20,
@start=17,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c7ef0
@end=27,
@start=21,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7e78
@end=57,
@start=28,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c8170
@end=-1,
@start=58,
@values=[]>],
@preformatted=false,
@raw_txt=nil,
@text=
u"Ammessi in totale 120 punti. Iniectabilia sine limitatione">],
@subheading="01.04.10.: S\303\251datifs-tranquillisants simples\n">]>,
"de"=>
#<ODDB::Text::Chapter:0x7f93201c7518
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f93201c7450
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f93201c73b0
@format=
#<ODDB::Text::Format:0x7f93201c7360
@end=-1,
@start=63,
@values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f93201c72c0
@end=20,
@start=0,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7220
@end=24,
@start=21,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c7180
@end=32,
@start=25,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7068
@end=62,
@start=33,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c7360
@end=-1,
@start=63,
@values=[]>],
@preformatted=false,
@raw_txt=nil,
@text=
u"Gesamthaft zugelassen 120 Punkte. Iniectabilia sine limitatione">],
@subheading="01.04.10.: Einfache Sedativa/Tranquillantia\n">]>,
"fr"=>
#<ODDB::Text::Chapter:0x7f93201c7b08
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f93201c7a90
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f93201c7a18
@format=
#<ODDB::Text::Format:0x7f93201c79c8
@end=-1,
@start=75,
@values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f93201c78d8
@end=32,
@start=0,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7860
@end=36,
@start=33,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c77e8
@end=44,
@start=37,
@values=[]>,
#<ODDB::Text::Format:0x7f93201c7770
@end=74,
@start=45,
@values=[:bold]>,
#<ODDB::Text::Format:0x7f93201c79c8
@end=-1,
@start=75,
@values=[]>],
@preformatted=false,
@raw_txt=nil,
@text=
u"Prescription limit\303\251e au maximum \303\240 120 points. Iniectabilia sine limitatione">],
@subheading="01.04.10.: S\303\251datifs-tranquillisants simples\n">]>},
@odba_id=10899115,
@odba_observers=[],
@odba_persistent=true,
@oid=10899115,
@pointer=
#<ODDB::Persistence::Pointer:0x7f93201c6ca8
@directions=
[["registration", "38294"],
[:sequence, "01"],
[:package, "016"],
[:sl_entry],
[:limitation_text]]>,
@revision=Fri Apr 03 14:26:11 +0200 2009>
#<ODDB::LimitationText:0x7f93201007d8
@odba_class=nil,
@odba_container=nil,
@odba_id=23135746,
@receiver=nil,
@receiver_loaded=nil>
Analyze
Experiment
def create_limitation_text
p "getin ODDB::SlEntry#create_limitation_text"
@limitation_text = LimitationText.new
end
Result
Experiment
module ODDB
class SlEntry
include Persistence
attr_accessor :limitation, :limitation_points
attr_accessor :introduction_date, :bsv_dossier, :status, :type,
:valid_from, :valid_until
attr_reader :limitation_text
def create_limitation_text
p "getin ODDB::SlEntry#create_limitation_text"
@limitation_text = LimitationText.new
end
def delete_limitation_text
p "getin ODDB::SlEntry#delete_limitation_text"
@limitation_text = nil
self.odba_isolated_store
nil
end
def pointer_descr
p "getin ODDB::SlEntry#pointer"
:sl_entry
end
private
def adjust_types(values, app=nil)
p "getin ODDB::SlEntry#adjust_types"
values = values.dup
values.each { |key, value|
case(key)
when :introduction_date
values[key] = if (value.is_a? Date)
value
else
Date.parse(value.tr('.', '-'))
end
when :limitation
values[key] = ([true, 'true', 'Y'].include? value) ? true : false
when :limitation_points
points = value.to_i
values[key] = (points > 0) ? points : nil
end unless value.nil?
}
end
end
end
Result
BraSt
grep search description
masa@masa ~/ywesee/oddb.org $ grep -r "descriptions" src
src/model/analysis/position.rb: ODBA_SERIALIZABLE = ['@descriptions', '@lab_areas']
src/model/atcclass.rb: ODBA_SERIALIZABLE = [ '@descriptions' ]
src/model/atcclass.rb: attr_writer :sequences, :descriptions
src/model/commercial_form.rb: ODBA_SERIALIZABLE = [ '@descriptions', '@synonyms' ]
src/model/commercial_form.rb: odba_index :name, 'all_descriptions'
src/model/commercial_form.rb: self.synonyms += other.all_descriptions - self.all_descriptions
src/model/galenicform.rb: ODBA_SERIALIZABLE = [ '@descriptions', '@synonyms' ]
src/model/galenicform.rb: odba_index :name, 'all_descriptions'
src/model/galenicform.rb: self.synonyms += other.all_descriptions - self.all_descriptions
src/model/galenicgroup.rb: ODBA_SERIALIZABLE = [ '@descriptions' ]
src/model/index_therapeuticus.rb: ODBA_SERIALIZABLE = ['@descriptions']
src/model/indication.rb: ODBA_SERIALIZABLE = [ '@descriptions', '@synonyms' ]
src/model/indication.rb: ODDB.search_term(self.all_descriptions.join(" "))
src/model/indication.rb: self.synonyms.concat(other.all_descriptions - all_descriptions).uniq!
src/model/limitationtext.rb: ODBA_SERIALIZABLE = [ '@descriptions' ]
src/model/migel/group.rb: ODBA_SERIALIZABLE = ['@descriptions']
src/model/migel/product.rb: ODBA_SERIALIZABLE = ['@descriptions']
src/model/migel/subgroup.rb: ODBA_SERIALIZABLE = ['@descriptions']
src/model/minifi.rb: ODBA_SERIALIZABLE = [ '@descriptions' ]
src/model/orphan.rb: if desc = descriptions.sort.first
src/model/patinfo.rb: @descriptions.odba_store
src/model/substance.rb: ODBA_SERIALIZABLE = [ '@descriptions', '@connection_keys', '@synonyms' ]
src/model/substance.rb: other.descriptions.dup.each { |key, value|
src/model/substance.rb: unless(self.descriptions.has_key?(key))
src/model/substance.rb: self.descriptions.update_values( { key => value } )
src/model/substance.rb: + other.descriptions.values - self.descriptions.values
src/model/substance.rb: # First call to descriptions should go to lazy-initialisator
src/model/substance.rb: if(lt = self.descriptions['lt']) && !lt.empty?
src/model/substance.rb: @descriptions['en'].to_s
src/model/substance.rb: self.descriptions.values + self.synonyms
src/model/substance.rb: keys = self.descriptions.values + self.connection_keys \
src/model/substance.rb: keys = (@connection_keys || []) + self.descriptions.values \
src/model/text.rb: ODBA_SERIALIZABLE = [ '@descriptions' ]
src/plugin/bsv_xml.rb: @descriptions = {}
src/plugin/bsv_xml.rb: @it_descriptions = {}
src/plugin/bsv_xml.rb: subheading = if @it_descriptions
src/plugin/bsv_xml.rb: [@itcode, @it_descriptions[key]].compact.join(': ')
src/plugin/bsv_xml.rb: elsif @it_descriptions
src/plugin/bsv_xml.rb: @it_descriptions[key] = @text
src/plugin/bsv_xml.rb: @descriptions[key] ||= @text
src/plugin/bsv_xml.rb: @it_descriptions = nil
src/plugin/who.rb: sprintf("Updated %3i English descriptions", @created),
src/state/drugs/fachinfo.rb: doc = @model.descriptions.fetch(lang.to_s) {
src/util/language.rb: descriptions[key.to_s] || descriptions.first
src/util/language.rb: def descriptions
src/util/language.rb: @descriptions ||= Descriptions.new
src/util/language.rb: descriptions.has_value?(description)
src/util/language.rb: descriptions.values.any? { |desc| pattern.match(desc) }
src/util/language.rb: if descriptions.empty?
src/util/language.rb: descriptions.first.to_s
src/util/language.rb: descriptions.update_values(descr)
src/util/language.rb: def all_descriptions
src/util/language.rb: self.synonyms + self.descriptions.values
src/util/oddbapp.rb: atc_class.descriptions = atc.descriptions unless(atc.nil?)
src/util/oddbapp.rb: args = form.descriptions
src/view/companies/fipi_overview.rb: && (lang = info.descriptions[language.to_s]) \
Look at src/plugin/bsv_xml.rb
Check
called
called
BraSt
Experiment
src/view/additional_information.rb
def limitation_text(model, session=@session)
p model.limitation_text
if(sltxt = model.limitation_text)
limitation_link(sltxt)
end
end
Result
#<ODBA::Stub:69849760326860#10899115 @odba_class= @odba_container=69849760326980#702814> nil #<ODBA::Stub:69849760073220#23135746 @odba_class=ODDB::LimitationText @odba_container=69849760075500#23135745> #<ODBA::Stub:69849759964480#24323050 @odba_class= @odba_container=69849759965600#24323049> #<ODBA::Stub:69849759857060#10899116 @odba_class= @odba_container=69849759857160#702818> nil
Backtrace from src/model/package.rb
/home/masa/ywesee/oddb.org/src/model/package.rb:236:in `limitation_text' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:112:in `send' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:112:in `method_missing' /home/masa/ywesee/oddb.org/src/view/additional_information.rb:222:in `limitation_text' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `_compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `_compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:67:in `compose_list' /home/masa/ywesee/oddb.org/src/model/dose.rb:117:in `each_with_index' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `each_with_index' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `compose_list' /home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:222:in `compose_list' /home/masa/ywesee/oddb.org/src/model/search_result.rb:120:in `each' /home/masa/ywesee/oddb.org/src/model/search_result.rb:120:in `each' /home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:217:in `compose_list' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:54:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:129:in `init' /home/masa/ywesee/oddb.org/src/view/drugs/resultlist.rb:191:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:59:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:59:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /home/masa/ywesee/oddb.org/src/view/drugs/result.rb:116:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `new' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `content' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:50:in `init' /home/masa/ywesee/oddb.org/src/view/resulttemplate.rb:28:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:269:in `new' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:269:in `view' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:189:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:490:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:169:in `synchronize' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:169:in `drb_process' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1556:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1516:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1590:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1586:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1582:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1431:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1428:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1348:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1628:in `start_service' bin/oddbd:38
def limitation_text
p @sl_entry.class
@sl_entry.limitation_text unless @sl_entry.nil?
end
Result
ODDB::SlEntry ODDB::SlEntry ODDB::SlEntry ODDB::SlEntry ODDB::SlEntry ODDB::SlEntry
def initialize
p "0"
end
def create_limitation_text
p "1"
@limitation_text = LimitationText.new
end
def delete_limitation_text
p "2"
@limitation_text = nil
self.odba_isolated_store
nil
end
def pointer_descr
p "3"
:sl_entry
end
private
def adjust_types(values, app=nil)
p "4"
Result
Qeustion
When is ODDB::SlEntry instance created?
Experiment
module Persistence
include PersistenceMethods
include ODBA::Persistable
ODBA_PREDEFINE_SERIALIZABLE = ['@data_origins']
odba_index :pointer
def initialize(*args)
p self.class
Result
ODDB::AtcClass
Qeustion
When is ODDB::SlEntry instance created?
Read code
module ODDB
class SlEntry
include Persistence
attr_accessor :limitation, :limitation_points
attr_accessor :introduction_date, :bsv_dossier, :status, :type,
:valid_from, :valid_until
attr_reader :limitation_text
def create_limitation_text
p "1"
@limitation_text = LimitationText.new
end
def delete_limitation_text
p "2"
@limitation_text = nil
self.odba_isolated_store
nil
end
Consideration
If many accessors are defined and they are accessed from the other classes, debug will be difficult
Example
class AAA
attr_accessor :test
end
class TEST
attr_reader :test
def initialize
@test = AAA.new
end
end
test = TEST.new
test.test.test = 100
p test.test.test #=> 100
Hypothesis
Experiment src/model/package.rb
def limitation_text
p @sl_entry.limitation_text.class.to_s + ": [" + @sl_entry.limitation_text.instance_variables.join(", ").to_s + "]" unless @sl_entry.nil?
@sl_entry.limitation_text unless @sl_entry.nil?
end
Result
"ODDB::LimitationText: [@odba_persistent, @descriptions, @revision, @pointer, @odba_id, @odba_observers, @oid]" "NilClass: []" "ODDB::LimitationText: [@odba_container, @receiver_loaded, @odba_id, @odba_class]" "ODDB::LimitationText: [@descriptions, @odba_persistent, @revision, @pointer, @odba_id, @odba_observers, @oid]" "ODDB::LimitationText: [@odba_persistent, @descriptions, @revision, @pointer, @odba_id, @odba_observers, @oid]" "NilClass: []"
BraSt
Example
class TEST
def method1
@var1 = 100
end
def method2
@var2 = 200
end
end
test = TEST.new
test.method1
p test.instance_variables
test = TEST.new
test.method2
p test.instance_variables
Result
masa@masa ~/work $ ruby test.rb ["@var1"] ["@var2"]