application_model.rb 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. class ApplicationModel < ActiveRecord::Base
  3. include ApplicationModel::Assets
  4. include ApplicationModel::HistoryLogBase
  5. include ApplicationModel::ActivityStreamBase
  6. include ApplicationModel::SearchIndexBase
  7. self.abstract_class = true
  8. before_create :check_attributes_protected, :check_limits, :cache_delete, :fill_up_user_create
  9. before_update :check_limits, :cache_delete_before, :fill_up_user_update
  10. before_destroy :cache_delete_before, :destroy_dependencies
  11. after_create :cache_delete
  12. after_update :cache_delete
  13. after_destroy :cache_delete
  14. after_create :attachments_buffer_check
  15. after_update :attachments_buffer_check
  16. after_create :activity_stream_create
  17. after_update :activity_stream_update
  18. after_destroy :activity_stream_destroy
  19. after_create :history_create
  20. after_update :history_update
  21. after_destroy :history_destroy
  22. after_create :search_index_update
  23. after_update :search_index_update
  24. after_destroy :search_index_destroy
  25. # create instance accessor
  26. class << self
  27. attr_accessor :activity_stream_support_config, :history_support_config, :search_index_support_config
  28. end
  29. attr_accessor :history_changes_last_done
  30. @@import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::Priority', 'Group', 'User' ]
  31. def check_attributes_protected
  32. if Setting.get('import_mode') && @@import_class_list.include?( self.class.to_s )
  33. # do noting, use id as it is
  34. else
  35. self[:id] = nil
  36. end
  37. end
  38. =begin
  39. remove all not used model attributes of params
  40. result = Model.param_cleanup(params)
  41. returns
  42. result = params # params with valid attributes of model
  43. =end
  44. def self.param_cleanup(params)
  45. if params == nil
  46. raise "No params for #{self.to_s}!"
  47. end
  48. # only use object attributes
  49. data = {}
  50. self.new.attributes.each {|item|
  51. if params.has_key?(item[0])
  52. # puts 'use ' + item[0].to_s + '-' + params[item[0]].to_s
  53. data[item[0].to_sym] = params[item[0]]
  54. end
  55. }
  56. # we do want to set this via database
  57. self.param_validation(data)
  58. end
  59. =begin
  60. set rellations of model based on params
  61. model = Model.find(1)
  62. result = model.param_set_associations(params)
  63. returns
  64. result = true|false
  65. =end
  66. def param_set_associations(params)
  67. # set relations
  68. self.class.reflect_on_all_associations.map { |assoc|
  69. real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
  70. if params.has_key?( real_key.to_sym )
  71. list_of_items = params[ real_key.to_sym ]
  72. if params[ real_key.to_sym ].class != Array
  73. list_of_items = [ params[ real_key.to_sym ] ]
  74. end
  75. list = []
  76. list_of_items.each {|item|
  77. list.push( assoc.klass.find(item) )
  78. }
  79. self.send( assoc.name.to_s + '=', list )
  80. end
  81. }
  82. end
  83. =begin
  84. get rellations of model based on params
  85. model = Model.find(1)
  86. attributes = model.attributes_with_associations
  87. returns
  88. hash with attributes and association ids
  89. =end
  90. def attributes_with_associations
  91. # set relations
  92. attributes = self.attributes
  93. self.class.reflect_on_all_associations.map { |assoc|
  94. real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
  95. if self.respond_to?( real_key )
  96. attributes[ real_key ] = self.send( real_key )
  97. end
  98. }
  99. attributes
  100. end
  101. =begin
  102. remove all not used params of object (per default :updated_at, :created_at, :updated_by_id and :created_by_id)
  103. result = Model.param_validation(params)
  104. returns
  105. result = params # params without listed attributes
  106. =end
  107. def self.param_validation(data)
  108. # we do want to set this via database
  109. data.delete( :updated_at )
  110. data.delete( :created_at )
  111. data.delete( :updated_by_id )
  112. data.delete( :created_by_id )
  113. if data.respond_to?('permit!')
  114. data.permit!
  115. end
  116. data
  117. end
  118. =begin
  119. set created_by_id & updated_by_id if not given based on UserInfo (current session)
  120. Used as before_create callback, no own use needed
  121. result = Model.fill_up_user_create(params)
  122. returns
  123. result = params # params with updated_by_id & created_by_id if not given based on UserInfo (current session)
  124. =end
  125. def fill_up_user_create
  126. if self.class.column_names.include? 'updated_by_id'
  127. if UserInfo.current_user_id
  128. if self.updated_by_id && self.updated_by_id != UserInfo.current_user_id
  129. puts "NOTICE create - self.updated_by_id is different: #{self.updated_by_id.to_s}/#{UserInfo.current_user_id.to_s}"
  130. end
  131. self.updated_by_id = UserInfo.current_user_id
  132. end
  133. end
  134. if self.class.column_names.include? 'created_by_id'
  135. if UserInfo.current_user_id
  136. if self.created_by_id && self.created_by_id != UserInfo.current_user_id
  137. puts "NOTICE create - self.created_by_id is different: #{self.created_by_id.to_s}/#{UserInfo.current_user_id.to_s}"
  138. end
  139. self.created_by_id = UserInfo.current_user_id
  140. end
  141. end
  142. end
  143. =begin
  144. set updated_by_id if not given based on UserInfo (current session)
  145. Used as before_update callback, no own use needed
  146. result = Model.fill_up_user_update(params)
  147. returns
  148. result = params # params with updated_by_id & created_by_id if not given based on UserInfo (current session)
  149. =end
  150. def fill_up_user_update
  151. return if !self.class.column_names.include? 'updated_by_id'
  152. if UserInfo.current_user_id
  153. self.updated_by_id = UserInfo.current_user_id
  154. end
  155. end
  156. def cache_update(o)
  157. # puts 'u ' + self.class.to_s
  158. if self.respond_to?('cache_delete') then self.cache_delete end
  159. # puts 'g ' + group.class.to_s
  160. if o.respond_to?('cache_delete') then o.cache_delete end
  161. end
  162. def cache_delete_before
  163. old_object = self.class.where( :id => self.id ).first
  164. if old_object
  165. old_object.cache_delete
  166. end
  167. self.cache_delete
  168. end
  169. def cache_delete
  170. key = self.class.to_s + '::' + self.id.to_s
  171. Cache.delete( key.to_s )
  172. key = self.class.to_s + ':f:' + self.id.to_s
  173. Cache.delete( key.to_s )
  174. if self[:name]
  175. key = self.class.to_s + '::' + self.name.to_s
  176. Cache.delete( key.to_s )
  177. key = self.class.to_s + ':f:' + self.name.to_s
  178. Cache.delete( key.to_s )
  179. end
  180. if self[:login]
  181. key = self.class.to_s + '::' + self.login.to_s
  182. Cache.delete( key.to_s )
  183. key = self.class.to_s + ':f:' + self.login.to_s
  184. Cache.delete( key.to_s )
  185. end
  186. end
  187. def self.cache_set(data_id, data, full = false)
  188. if !full
  189. key = self.to_s + '::' + data_id.to_s
  190. else
  191. key = self.to_s + ':f:' + data_id.to_s
  192. end
  193. Cache.write( key.to_s, data )
  194. end
  195. def self.cache_get(data_id, full = false)
  196. if !full
  197. key = self.to_s + '::' + data_id.to_s
  198. else
  199. key = self.to_s + ':f:' + data_id.to_s
  200. end
  201. Cache.get( key.to_s )
  202. end
  203. =begin
  204. lookup model from cache (if exists) or retrieve it from db, id, name or login possible
  205. result = Model.lookup( :id => 123 )
  206. result = Model.lookup( :name => 'some name' )
  207. result = Model.lookup( :login => 'some login' )
  208. returns
  209. result = model # with all attributes
  210. =end
  211. def self.lookup(data)
  212. if data[:id]
  213. # puts "GET- + #{self.to_s}.#{data[:id].to_s}"
  214. cache = self.cache_get( data[:id] )
  215. return cache if cache
  216. # puts "Fillup- + #{self.to_s}.#{data[:id].to_s}"
  217. record = self.where( :id => data[:id] ).first
  218. self.cache_set( data[:id], record )
  219. return record
  220. elsif data[:name]
  221. cache = self.cache_get( data[:name] )
  222. return cache if cache
  223. records = self.where( :name => data[:name] )
  224. records.each {|record|
  225. if record.name == data[:name]
  226. self.cache_set( data[:name], record )
  227. return record
  228. end
  229. }
  230. return
  231. elsif data[:login]
  232. cache = self.cache_get( data[:login] )
  233. return cache if cache
  234. records = self.where( :login => data[:login] )
  235. records.each {|record|
  236. if record.login == data[:login]
  237. self.cache_set( data[:login], record )
  238. return record
  239. end
  240. }
  241. return
  242. else
  243. raise "Need name, id or login for lookup()"
  244. end
  245. end
  246. =begin
  247. create model if not exists (check exists based on id, name, login or locale)
  248. result = Model.create_if_not_exists( attributes )
  249. returns
  250. result = model # with all attributes
  251. =end
  252. def self.create_if_not_exists(data)
  253. if data[:id]
  254. record = self.where( :id => data[:id] ).first
  255. return record if record
  256. elsif data[:name]
  257. records = self.where( :name => data[:name] )
  258. records.each {|record|
  259. return record if record.name == data[:name]
  260. }
  261. elsif data[:login]
  262. records = self.where( :login => data[:login] )
  263. records.each {|record|
  264. return record if record.login == data[:login]
  265. }
  266. elsif data[:locale] && data[:source]
  267. records = self.where( :locale => data[:locale], :source => data[:source] )
  268. records.each {|record|
  269. return record if record.source == data[:source]
  270. }
  271. end
  272. self.create(data)
  273. end
  274. =begin
  275. create or update model (check exists based on name, login or locale)
  276. result = Model.create_or_update( attributes )
  277. returns
  278. result = model # with all attributes
  279. =end
  280. def self.create_or_update(data)
  281. if data[:name]
  282. records = self.where( :name => data[:name] )
  283. records.each {|record|
  284. if record.name == data[:name]
  285. record.update_attributes( data )
  286. return record
  287. end
  288. }
  289. record = self.new( data )
  290. record.save
  291. return record
  292. elsif data[:login]
  293. records = self.where( :login => data[:login] )
  294. records.each {|record|
  295. if record.login.downcase == data[:login].downcase
  296. record.update_attributes( data )
  297. return record
  298. end
  299. }
  300. record = self.new( data )
  301. record.save
  302. return record
  303. elsif data[:locale]
  304. records = self.where( :locale => data[:locale] )
  305. records.each {|record|
  306. if record.locale.downcase == data[:locale].downcase
  307. record.update_attributes( data )
  308. return record
  309. end
  310. }
  311. record = self.new( data )
  312. record.save
  313. return record
  314. else
  315. raise "Need name, login or locale for create_or_update()"
  316. end
  317. end
  318. =begin
  319. notify_clients_after_create after model got created
  320. used as callback in model file
  321. class OwnModel < ApplicationModel
  322. after_create :notify_clients_after_create
  323. after_update :notify_clients_after_update
  324. after_destroy :notify_clients_after_destroy
  325. [...]
  326. =end
  327. def notify_clients_after_create
  328. # return if we run import mode
  329. return if Setting.get('import_mode')
  330. puts "#{ self.class.name }.find(#{ self.id }) notify created " + self.created_at.to_s
  331. class_name = self.class.name
  332. class_name.gsub!(/::/, '')
  333. Sessions.broadcast(
  334. :event => class_name + ':create',
  335. :data => { :id => self.id, :updated_at => self.updated_at }
  336. )
  337. end
  338. =begin
  339. notify_clients_after_update after model got updated
  340. used as callback in model file
  341. class OwnModel < ApplicationModel
  342. after_create :notify_clients_after_create
  343. after_update :notify_clients_after_update
  344. after_destroy :notify_clients_after_destroy
  345. [...]
  346. =end
  347. def notify_clients_after_update
  348. # return if we run import mode
  349. return if Setting.get('import_mode')
  350. puts "#{ self.class.name }.find(#{ self.id }) notify UPDATED " + self.updated_at.to_s
  351. class_name = self.class.name
  352. class_name.gsub!(/::/, '')
  353. Sessions.broadcast(
  354. :event => class_name + ':update',
  355. :data => { :id => self.id, :updated_at => self.updated_at }
  356. )
  357. end
  358. =begin
  359. notify_clients_after_destroy after model got destroyed
  360. used as callback in model file
  361. class OwnModel < ApplicationModel
  362. after_create :notify_clients_after_create
  363. after_update :notify_clients_after_update
  364. after_destroy :notify_clients_after_destroy
  365. [...]
  366. =end
  367. def notify_clients_after_destroy
  368. # return if we run import mode
  369. return if Setting.get('import_mode')
  370. puts "#{ self.class.name }.find(#{ self.id }) notify DESTOY " + self.updated_at.to_s
  371. class_name = self.class.name
  372. class_name.gsub!(/::/, '')
  373. Sessions.broadcast(
  374. :event => class_name + ':destroy',
  375. :data => { :id => self.id, :updated_at => self.updated_at }
  376. )
  377. end
  378. =begin
  379. serve methode to configure and enable search index support for this model
  380. class Model < ApplicationModel
  381. search_index_support :ignore_attributes => {
  382. :create_article_type_id => true,
  383. :create_article_sender_id => true,
  384. :article_count => true,
  385. }
  386. end
  387. =end
  388. def self.search_index_support(data = {})
  389. @search_index_support_config = data
  390. end
  391. =begin
  392. update search index, if configured - will be executed automatically
  393. model = Model.find(123)
  394. model.search_index_update
  395. =end
  396. def search_index_update
  397. return if !self.class.search_index_support_config
  398. # start background job to transfer data to search index
  399. return if !SearchIndexBackend.enabled?
  400. Delayed::Job.enqueue( ApplicationModel::BackgroundJobSearchIndex.new( self.class.to_s, self.id ) )
  401. end
  402. =begin
  403. delete search index object, will be executed automatically
  404. model = Model.find(123)
  405. model.search_index_destroy
  406. =end
  407. def search_index_destroy
  408. return if !self.class.search_index_support_config
  409. SearchIndexBackend.remove( self.class.to_s, self.id )
  410. end
  411. =begin
  412. reload search index with full data
  413. Model.search_index_reload
  414. =end
  415. def self.search_index_reload
  416. return if !@search_index_support_config
  417. self.all.order('created_at DESC').each { |item|
  418. item.search_index_update_backend
  419. }
  420. end
  421. =begin
  422. serve methode to configure and enable activity stream support for this model
  423. class Model < ApplicationModel
  424. activity_stream_support :role => 'Admin'
  425. end
  426. =end
  427. def self.activity_stream_support(data = {})
  428. @activity_stream_support_config = data
  429. end
  430. =begin
  431. log object create activity stream, if configured - will be executed automatically
  432. model = Model.find(123)
  433. model.activity_stream_create
  434. =end
  435. def activity_stream_create
  436. return if !self.class.activity_stream_support_config
  437. activity_stream_log( 'created', self['created_by_id'] )
  438. end
  439. =begin
  440. log object update activity stream, if configured - will be executed automatically
  441. model = Model.find(123)
  442. model.activity_stream_update
  443. =end
  444. def activity_stream_update
  445. return if !self.class.activity_stream_support_config
  446. return if !self.changed?
  447. # default ignored attributes
  448. ignore_attributes = {
  449. :created_at => true,
  450. :updated_at => true,
  451. :created_by_id => true,
  452. :updated_by_id => true,
  453. }
  454. if self.class.activity_stream_support_config[:ignore_attributes]
  455. self.class.activity_stream_support_config[:ignore_attributes].each {|key, value|
  456. ignore_attributes[key] = value
  457. }
  458. end
  459. log = false
  460. self.changes.each {|key, value|
  461. # do not log created_at and updated_at attributes
  462. next if ignore_attributes[key.to_sym] == true
  463. log = true
  464. }
  465. return if !log
  466. activity_stream_log( 'updated', self['updated_by_id'] )
  467. end
  468. =begin
  469. delete object activity stream, will be executed automatically
  470. model = Model.find(123)
  471. model.activity_stream_destroy
  472. =end
  473. def activity_stream_destroy
  474. return if !self.class.activity_stream_support_config
  475. ActivityStream.remove( self.class.to_s, self.id )
  476. end
  477. =begin
  478. serve methode to configure and enable history support for this model
  479. class Model < ApplicationModel
  480. history_support
  481. end
  482. class Model < ApplicationModel
  483. history_support :ignore_attributes => { :article_count => true }
  484. end
  485. =end
  486. def self.history_support(data = {})
  487. @history_support_config = data
  488. end
  489. =begin
  490. log object create history, if configured - will be executed automatically
  491. model = Model.find(123)
  492. model.history_create
  493. =end
  494. def history_create
  495. return if !self.class.history_support_config
  496. #puts 'create ' + self.changes.inspect
  497. self.history_log( 'created', self.created_by_id )
  498. end
  499. =begin
  500. log object update history with all updated attributes, if configured - will be executed automatically
  501. model = Model.find(123)
  502. model.history_update
  503. =end
  504. def history_update
  505. return if !self.class.history_support_config
  506. return if !self.changed?
  507. # return if it's no update
  508. return if self.new_record?
  509. # new record also triggers update, so ignore new records
  510. changes = self.changes
  511. if self.history_changes_last_done
  512. self.history_changes_last_done.each {|key, value|
  513. if changes.has_key?(key) && changes[key] == value
  514. changes.delete(key)
  515. end
  516. }
  517. end
  518. self.history_changes_last_done = changes
  519. #puts 'updated ' + self.changes.inspect
  520. return if changes['id'] && !changes['id'][0]
  521. # default ignored attributes
  522. ignore_attributes = {
  523. :created_at => true,
  524. :updated_at => true,
  525. :created_by_id => true,
  526. :updated_by_id => true,
  527. }
  528. if self.class.history_support_config[:ignore_attributes]
  529. self.class.history_support_config[:ignore_attributes].each {|key, value|
  530. ignore_attributes[key] = value
  531. }
  532. end
  533. changes.each {|key, value|
  534. # do not log created_at and updated_at attributes
  535. next if ignore_attributes[key.to_sym] == true
  536. # get attribute name
  537. attribute_name = key.to_s
  538. if attribute_name[-3,3] == '_id'
  539. attribute_name = attribute_name[ 0, attribute_name.length-3 ]
  540. end
  541. value_id = []
  542. value_str = [ value[0], value[1] ]
  543. if key.to_s[-3,3] == '_id'
  544. value_id[0] = value[0]
  545. value_id[1] = value[1]
  546. if self.respond_to?( attribute_name ) && self.send(attribute_name)
  547. relation_class = self.send(attribute_name).class
  548. if relation_class && value_id[0]
  549. relation_model = relation_class.lookup( :id => value_id[0] )
  550. if relation_model
  551. if relation_model['name']
  552. value_str[0] = relation_model['name']
  553. elsif relation_model.respond_to?('fullname')
  554. value_str[0] = relation_model.send('fullname')
  555. end
  556. end
  557. end
  558. if relation_class && value_id[1]
  559. relation_model = relation_class.lookup( :id => value_id[1] )
  560. if relation_model
  561. if relation_model['name']
  562. value_str[1] = relation_model['name']
  563. elsif relation_model.respond_to?('fullname')
  564. value_str[1] = relation_model.send('fullname')
  565. end
  566. end
  567. end
  568. end
  569. end
  570. data = {
  571. :history_attribute => attribute_name,
  572. :value_from => value_str[0].to_s,
  573. :value_to => value_str[1].to_s,
  574. :id_from => value_id[0],
  575. :id_to => value_id[1],
  576. }
  577. #puts "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}"
  578. self.history_log( 'updated', self.updated_by_id, data )
  579. }
  580. end
  581. =begin
  582. delete object history, will be executed automatically
  583. model = Model.find(123)
  584. model.history_destroy
  585. =end
  586. def history_destroy
  587. return if !self.class.history_support_config
  588. History.remove( self.class.to_s, self.id )
  589. end
  590. =begin
  591. get list of attachments of this object
  592. item = Model.find(123)
  593. list = item.attachments
  594. returns
  595. # array with Store model objects
  596. =end
  597. def attachments
  598. Store.list( :object => self.class.to_s, :o_id => self.id )
  599. end
  600. =begin
  601. store attachments for this object
  602. item = Model.find(123)
  603. item.attachments = [ Store-Object1, Store-Object2 ]
  604. =end
  605. def attachments=(attachments)
  606. self.attachments_buffer = attachments
  607. # update if object already exists
  608. if self.id && self.id != 0
  609. attachments_buffer_check
  610. end
  611. end
  612. private
  613. def attachments_buffer
  614. @attachments_buffer_data
  615. end
  616. def attachments_buffer=(attachments)
  617. @attachments_buffer_data = attachments
  618. end
  619. def attachments_buffer_check
  620. # do nothing if no attachment exists
  621. return 1 if attachments_buffer == nil
  622. # store attachments
  623. article_store = []
  624. attachments_buffer.each do |attachment|
  625. article_store.push Store.add(
  626. :object => self.class.to_s,
  627. :o_id => self.id,
  628. :data => attachment.content,
  629. :filename => attachment.filename,
  630. :preferences => attachment.preferences,
  631. :created_by_id => self.created_by_id,
  632. )
  633. end
  634. attachments_buffer = nil
  635. end
  636. =begin
  637. check string/varchar size and cut them if needed
  638. =end
  639. def check_limits
  640. self.attributes.each {|attribute|
  641. next if !self[ attribute[0] ]
  642. next if self[ attribute[0] ].class != String
  643. next if self[ attribute[0] ].empty?
  644. column = self.class.columns_hash[ attribute[0] ]
  645. limit = column.limit
  646. if column && limit
  647. current_length = attribute[1].to_s.length
  648. if limit < current_length
  649. puts "WARNING: cut string because of database length #{self.class.to_s}.#{attribute[0]}(#{limit} but is #{current_length}:#{attribute[1].to_s})"
  650. self[ attribute[0] ] = attribute[1][ 0, limit ]
  651. end
  652. end
  653. # strip 4 bytes utf8 chars if needed
  654. if column && self[ attribute[0] ]
  655. self[attribute[0]] = self[ attribute[0] ].utf8_to_3bytesutf8
  656. end
  657. }
  658. end
  659. =begin
  660. destory object dependencies, will be executed automatically
  661. =end
  662. def destroy_dependencies
  663. end
  664. end