enju_biblio 0.1.0.pre58 → 0.1.0.pre59

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/agent_merge_lists_controller.rb +93 -0
  3. data/app/controllers/agent_merges_controller.rb +87 -0
  4. data/app/controllers/agent_relationships_controller.rb +1 -1
  5. data/app/controllers/agents_controller.rb +1 -3
  6. data/app/controllers/creates_controller.rb +3 -3
  7. data/app/controllers/manifestation_relationships_controller.rb +1 -1
  8. data/app/controllers/manifestations_controller.rb +12 -12
  9. data/app/controllers/owns_controller.rb +3 -3
  10. data/app/controllers/picture_files_controller.rb +1 -1
  11. data/app/controllers/produces_controller.rb +3 -3
  12. data/app/controllers/realizes_controller.rb +3 -3
  13. data/app/controllers/series_statement_merge_lists_controller.rb +92 -0
  14. data/app/controllers/series_statement_merges_controller.rb +90 -0
  15. data/app/controllers/series_statements_controller.rb +1 -3
  16. data/app/helpers/manifestations_helper.rb +17 -17
  17. data/app/models/agent.rb +24 -26
  18. data/app/models/agent_import_file.rb +3 -3
  19. data/app/models/agent_import_result.rb +2 -2
  20. data/app/models/agent_merge.rb +21 -0
  21. data/app/models/agent_merge_list.rb +29 -0
  22. data/app/models/agent_relationship_type.rb +1 -1
  23. data/app/models/agent_type.rb +1 -1
  24. data/app/models/carrier_type.rb +2 -2
  25. data/app/models/content_type.rb +1 -1
  26. data/app/models/country.rb +8 -4
  27. data/app/models/create_type.rb +1 -1
  28. data/app/models/enju_biblio/ability.rb +12 -9
  29. data/app/models/form_of_work.rb +1 -1
  30. data/app/models/frequency.rb +1 -1
  31. data/app/models/identifier.rb +12 -0
  32. data/app/models/identifier_type.rb +2 -2
  33. data/app/models/import_request.rb +2 -1
  34. data/app/models/item.rb +3 -3
  35. data/app/models/language.rb +8 -1
  36. data/app/models/license.rb +1 -1
  37. data/app/models/manifestation.rb +42 -43
  38. data/app/models/manifestation_relationship_type.rb +1 -1
  39. data/app/models/medium_of_performance.rb +1 -1
  40. data/app/models/picture_file.rb +9 -9
  41. data/app/models/produce_type.rb +1 -1
  42. data/app/models/realize_type.rb +1 -1
  43. data/app/models/resource_import_file.rb +118 -63
  44. data/app/models/resource_import_result.rb +5 -4
  45. data/app/models/series_statement.rb +4 -7
  46. data/app/models/series_statement_merge.rb +21 -0
  47. data/app/models/series_statement_merge_list.rb +19 -0
  48. data/app/views/agent_merge_lists/_form.html.erb +11 -0
  49. data/app/views/agent_merge_lists/edit.html.erb +13 -0
  50. data/app/views/agent_merge_lists/index.html.erb +33 -0
  51. data/app/views/agent_merge_lists/new.html.erb +12 -0
  52. data/app/views/agent_merge_lists/show.html.erb +31 -0
  53. data/app/views/agent_merges/edit.html.erb +31 -0
  54. data/app/views/agent_merges/index.html.erb +32 -0
  55. data/app/views/agent_merges/new.html.erb +39 -0
  56. data/app/views/agent_merges/show.html.erb +25 -0
  57. data/app/views/agents/_index.html.erb +1 -3
  58. data/app/views/agents/_index_agent_merge_list.html.erb +53 -0
  59. data/app/views/layouts/manifestations.html.erb +1 -1
  60. data/app/views/manifestations/_form.html.erb +14 -2
  61. data/app/views/manifestations/_index_form_parent.html.erb +1 -1
  62. data/app/views/manifestations/_show.mods.builder +1 -4
  63. data/app/views/manifestations/_show.rdf.builder +1 -4
  64. data/app/views/manifestations/_show_detail_librarian.html.erb +1 -1
  65. data/app/views/manifestations/_show_detail_user.html.erb +1 -1
  66. data/app/views/manifestations/_show_index.html.erb +1 -1
  67. data/app/views/manifestations/_show_index.mobile.erb +2 -2
  68. data/app/views/manifestations/_show_parent_form.html.erb +1 -1
  69. data/app/views/manifestations/_show_series_index.html.erb +1 -1
  70. data/app/views/manifestations/_title.html.erb +1 -1
  71. data/app/views/picture_files/show.html.erb +1 -1
  72. data/app/views/resource_import_files/show.html.erb +9 -0
  73. data/app/views/resource_import_results/index.html.erb +2 -0
  74. data/app/views/resource_import_results/show.html.erb +6 -1
  75. data/app/views/series_statement_merge_lists/_form.html.erb +11 -0
  76. data/app/views/series_statement_merge_lists/edit.html.erb +13 -0
  77. data/app/views/series_statement_merge_lists/index.html.erb +33 -0
  78. data/app/views/series_statement_merge_lists/new.html.erb +12 -0
  79. data/app/views/series_statement_merge_lists/show.html.erb +31 -0
  80. data/app/views/series_statement_merges/_form.html.erb +12 -0
  81. data/app/views/series_statement_merges/edit.html.erb +31 -0
  82. data/app/views/series_statement_merges/index.html.erb +32 -0
  83. data/app/views/series_statement_merges/new.html.erb +39 -0
  84. data/app/views/series_statement_merges/show.html.erb +27 -0
  85. data/config/locales/translation_en.yml +25 -7
  86. data/config/locales/translation_ja.yml +25 -7
  87. data/config/routes.rb +20 -1
  88. data/db/migrate/005_create_manifestations.rb +0 -1
  89. data/db/migrate/133_create_agent_merges.rb +15 -0
  90. data/db/migrate/134_create_agent_merge_lists.rb +13 -0
  91. data/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
  92. data/db/migrate/20140822114527_add_error_message_to_resource_import_result.rb +5 -0
  93. data/db/migrate/20140823083524_add_extent_to_manifestation.rb +5 -0
  94. data/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
  95. data/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
  96. data/lib/enju_biblio.rb +8 -0
  97. data/lib/enju_biblio/version.rb +1 -1
  98. data/lib/tasks/agent_type.rb +15 -0
  99. data/lib/tasks/enju_biblio_tasks.rake +2 -0
  100. data/spec/controllers/agent_merge_lists_controller_spec.rb +456 -0
  101. data/spec/controllers/agent_merges_controller_spec.rb +437 -0
  102. data/spec/controllers/series_statement_merge_lists_controller_spec.rb +439 -0
  103. data/spec/controllers/series_statement_merges_controller_spec.rb +433 -0
  104. data/spec/dummy/app/models/ability.rb +0 -5
  105. data/spec/dummy/db/development.sqlite3 +0 -0
  106. data/spec/dummy/db/schema.rb +22 -14
  107. data/spec/dummy/db/test.sqlite3 +0 -0
  108. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_update_file.tsv +1 -1
  109. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +21 -19
  110. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +21 -19
  111. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/{resource_export_file_20140818-53863-1jz1wlr.txt → resource_export_file_20140824-71278-o9rcl2.txt} +1 -1
  112. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/{resource_export_file_20140818-55246-1rvhs1s.txt → resource_export_file_20140824-76052-14e2vr0.txt} +1 -1
  113. data/spec/dummy/solr/default/data/index/_n.fdt +0 -0
  114. data/spec/dummy/solr/{test/data/index/_49n.fdx → default/data/index/_n.fdx} +0 -0
  115. data/spec/dummy/solr/default/data/index/_n.fnm +0 -0
  116. data/spec/dummy/solr/default/data/index/_n.nvd +0 -0
  117. data/spec/dummy/solr/default/data/index/_n.nvm +0 -0
  118. data/spec/dummy/solr/default/data/index/_n.si +0 -0
  119. data/spec/dummy/solr/default/data/index/_n_Lucene41_0.doc +0 -0
  120. data/spec/dummy/solr/default/data/index/_n_Lucene41_0.pos +0 -0
  121. data/spec/dummy/solr/default/data/index/_n_Lucene41_0.tim +0 -0
  122. data/spec/dummy/solr/default/data/index/_n_Lucene41_0.tip +0 -0
  123. data/spec/dummy/solr/default/data/index/_o.fdt +0 -0
  124. data/spec/dummy/solr/default/data/index/_o.fdx +0 -0
  125. data/spec/dummy/solr/default/data/index/_o.fnm +0 -0
  126. data/spec/dummy/solr/default/data/index/_o.nvd +0 -0
  127. data/spec/dummy/solr/default/data/index/_o.nvm +0 -0
  128. data/spec/dummy/solr/default/data/index/_o.si +0 -0
  129. data/spec/dummy/solr/default/data/index/_o_Lucene41_0.doc +0 -0
  130. data/spec/dummy/solr/default/data/index/_o_Lucene41_0.pos +0 -0
  131. data/spec/dummy/solr/default/data/index/_o_Lucene41_0.tim +0 -0
  132. data/spec/dummy/solr/default/data/index/_o_Lucene41_0.tip +0 -0
  133. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  134. data/spec/dummy/solr/default/data/index/segments_15 +0 -0
  135. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000030 +0 -0
  136. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000031 +0 -0
  137. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000032 +0 -0
  138. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000033 +0 -0
  139. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000034 +0 -0
  140. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000035 +0 -0
  141. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000036 +0 -0
  142. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000037 +0 -0
  143. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000038 +0 -0
  144. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000039 +0 -0
  145. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  146. data/spec/dummy/solr/test/data/index/segments_401 +0 -0
  147. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005178 +0 -0
  148. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005179 +0 -0
  149. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005180 +0 -0
  150. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005181 +0 -0
  151. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005182 +0 -0
  152. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005183 +0 -0
  153. data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
  154. data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
  155. data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
  156. data/spec/dummy/tmp/cache/assets/test/sprockets/{173711a319dbf01f35a2ad8e1efe08b9 → 016035697c13f20f5d2b52792d85c604} +0 -0
  157. data/spec/dummy/tmp/cache/assets/test/sprockets/{0440b81b0aae840cf287a686585a8cec → 016f9220091ee2a634e3a6c7fbe9c147} +0 -0
  158. data/spec/dummy/tmp/cache/assets/test/sprockets/{19a44bc29c5173edea456f9416243854 → 052185a11dac17697ab8119d0eae969d} +0 -0
  159. data/spec/dummy/tmp/cache/assets/test/sprockets/091f6b71beeef71345e4cb87e0e0f60e +0 -0
  160. data/spec/dummy/tmp/cache/assets/test/sprockets/0e3e358e4fe4601ba5e435f6d0c86f12 +0 -0
  161. data/spec/dummy/tmp/cache/assets/test/sprockets/{e58908ad0ccad6546faf9bcab669b0cd → 11bb992144d5d72e1251e5d4cf370f86} +0 -0
  162. data/spec/dummy/tmp/cache/assets/test/sprockets/{64ee480e95febf6b404c1264755ea42e → 120d4c2662a2d695d86719703963cbc2} +0 -0
  163. data/spec/dummy/tmp/cache/assets/test/sprockets/12c4795597f72ed1be53a24203b9605a +0 -0
  164. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  165. data/spec/dummy/tmp/cache/assets/test/sprockets/{0c8f59d97121b79a2e2a0d009d6da9c3 → 1462d348fc6af4ed5164bd969f65ef40} +0 -0
  166. data/spec/dummy/tmp/cache/assets/test/sprockets/1ba5d9cae60d012a67e6c857c0f5aa3c +0 -0
  167. data/spec/dummy/tmp/cache/assets/test/sprockets/1c1fbab93e4552626da626e0dbe70c74 +0 -0
  168. data/spec/dummy/tmp/cache/assets/test/sprockets/27e1b4616976bb325e2963da52263610 +0 -0
  169. data/spec/dummy/tmp/cache/assets/test/sprockets/29755b7a6522fd2bd21a5821dcc1024c +0 -0
  170. data/spec/dummy/tmp/cache/assets/test/sprockets/{0d8876cd5c35974067b09df39826ad64 → 2a4804739761c332dbea9b545ebdc90b} +0 -0
  171. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  172. data/spec/dummy/tmp/cache/assets/test/sprockets/3013236b88f48eb1a0e36f7ce20e9278 +0 -0
  173. data/spec/dummy/tmp/cache/assets/test/sprockets/306cf2727f2c4d5bcc3318fdf704f9f8 +0 -0
  174. data/spec/dummy/tmp/cache/assets/test/sprockets/{1d0caee819e97b6e819aff48d160ba0e → 3137d593e6b38d7364165258707ba168} +0 -0
  175. data/spec/dummy/tmp/cache/assets/test/sprockets/3417713460df81bb2349531adec5f348 +0 -0
  176. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  177. data/spec/dummy/tmp/cache/assets/test/sprockets/3ef32f79b6e9b4487b09c38d17e96c5b +0 -0
  178. data/spec/dummy/tmp/cache/assets/test/sprockets/45f3c74e1e31b58d9bda6908d5623290 +0 -0
  179. data/spec/dummy/tmp/cache/assets/test/sprockets/4982460b51d59b2a6ca1a2a62f578883 +0 -0
  180. data/spec/dummy/tmp/cache/assets/test/sprockets/{2b35ad8fee7e1228e205669278e2adda → 4c00935da384db345e9d75e427a6ecfd} +0 -0
  181. data/spec/dummy/tmp/cache/assets/test/sprockets/{a2474b74df12470fb37c668b85b562c6 → 4d6ee78c9b5a731d2770590bdca965db} +0 -0
  182. data/spec/dummy/tmp/cache/assets/test/sprockets/{267e026cf7dcb8ed5ca66aa83dff1a87 → 4ec967e0b0aa8965b00d8d02580cb1e8} +0 -0
  183. data/spec/dummy/tmp/cache/assets/test/sprockets/{01c388ec88c5fa6d00409d725549a506 → 524145c58d27d8645853427057c8e352} +0 -0
  184. data/spec/dummy/tmp/cache/assets/test/sprockets/53f3ea63c7f59d989da4e7299c5ebef6 +0 -0
  185. data/spec/dummy/tmp/cache/assets/test/sprockets/{86dfe8a3e156aeb6ebcd456b2251fab7 → 5401d1bbdbcca869f9ec530be8954c7b} +0 -0
  186. data/spec/dummy/tmp/cache/assets/test/sprockets/5657f9c72ff547052db9db89e95d1758 +0 -0
  187. data/spec/dummy/tmp/cache/assets/test/sprockets/5762cca052dd5d3eb8bb35e2ed9a59b8 +0 -0
  188. data/spec/dummy/tmp/cache/assets/test/sprockets/5e6bfa8ff735312df3c6e3ab5e4544dd +0 -0
  189. data/spec/dummy/tmp/cache/assets/test/sprockets/617d3692a7e14d57d7d7c18e62988c56 +0 -0
  190. data/spec/dummy/tmp/cache/assets/test/sprockets/6a45e3c9461983dc78a7a4f06326d98a +0 -0
  191. data/spec/dummy/tmp/cache/assets/test/sprockets/6ef07ba38c3fb7876f0dd5a9580ddb09 +0 -0
  192. data/spec/dummy/tmp/cache/assets/test/sprockets/{15aaed1a5a5f4f98d5c8d19084d7980d → 726c9190898ab9d89a285df9f73fc835} +0 -0
  193. data/spec/dummy/tmp/cache/assets/test/sprockets/768618b68fc55616affb09d1366839bf +0 -0
  194. data/spec/dummy/tmp/cache/assets/test/sprockets/7cf6f7130d3eca66452321d70d360864 +0 -0
  195. data/spec/dummy/tmp/cache/assets/test/sprockets/7e097aef96e9d7a3f16e013b6f612b68 +0 -0
  196. data/spec/dummy/tmp/cache/assets/test/sprockets/84c8a64682205dba3f8edd60fc1ec8e5 +0 -0
  197. data/spec/dummy/tmp/cache/assets/test/sprockets/8c36936509297e044c5353b3c57148f9 +0 -0
  198. data/spec/dummy/tmp/cache/assets/test/sprockets/{0483120d2ec851526d1beb322a87b34d → 8fe57feab5051fd40f4878b7a740486f} +0 -0
  199. data/spec/dummy/tmp/cache/assets/test/sprockets/{0dfa4223643dd4c4e2f977989012a78f → 94fe70b1fcf11d0f4ba62fd956b13410} +0 -0
  200. data/spec/dummy/tmp/cache/assets/test/sprockets/{16262df7c7e382ef78b21f453750ea94 → 9757a9437821225e1c033c19725d7f29} +0 -0
  201. data/spec/dummy/tmp/cache/assets/test/sprockets/9872a7a2c1dbfa71b55ebcf97dfa07b1 +0 -0
  202. data/spec/dummy/tmp/cache/assets/test/sprockets/9a11ac4cf3c8597981773b8ea1c36659 +0 -0
  203. data/spec/dummy/tmp/cache/assets/test/sprockets/9ad166e60e3d477c78328181979a7b77 +0 -0
  204. data/spec/dummy/tmp/cache/assets/test/sprockets/9c500035359d42d1d6eb3152407753da +0 -0
  205. data/spec/dummy/tmp/cache/assets/test/sprockets/{0c0062cfb97ef1437ab0020e724876c6 → a0d32bfbf69edb9affa96b926037041a} +0 -0
  206. data/spec/dummy/tmp/cache/assets/test/sprockets/aa0c14240f47d6746cd5d3bf2fe4b936 +0 -0
  207. data/spec/dummy/tmp/cache/assets/test/sprockets/aff11c6f1bdcce6d91baf69968f93ad6 +0 -0
  208. data/spec/dummy/tmp/cache/assets/test/sprockets/b1cfee6085e55e41f311c5dfeda8661b +0 -0
  209. data/spec/dummy/tmp/cache/assets/test/sprockets/b4125d2c5630528bd1587b244a3303d6 +0 -0
  210. data/spec/dummy/tmp/cache/assets/test/sprockets/{1572dfd6f1e555f4be1aa60ddc3cb0c0 → b4857dbfaac3e3d5aeb45b1beff2b88b} +0 -0
  211. data/spec/dummy/tmp/cache/assets/test/sprockets/{e8f801eeda49cba4a03cfd9e2a4562ae → b4f5eca040699a5d38403ce80236bc12} +0 -0
  212. data/spec/dummy/tmp/cache/assets/test/sprockets/b530f21ccf5882027bf2aff5502dc79e +0 -0
  213. data/spec/dummy/tmp/cache/assets/test/sprockets/{24051f5752691433a5a205b04a62fca1 → b6fec44e6e93be3375951dad4faa2c14} +0 -0
  214. data/spec/dummy/tmp/cache/assets/test/sprockets/{305729f8ea45e96c3a7e75df920aa125 → b943165df1109f3c68280a04e5e960f8} +0 -0
  215. data/spec/dummy/tmp/cache/assets/test/sprockets/{2d65b40e585725207fd52ce4cf5134f4 → c48a5c8c0b091de16e629df2f6145f67} +0 -0
  216. data/spec/dummy/tmp/cache/assets/test/sprockets/{40e90f0c329b14292a9ff1a2fe907b39 → c5602b825ee6f6e1946e61a5c607d444} +0 -0
  217. data/spec/dummy/tmp/cache/assets/test/sprockets/ca2bbe58fd1ca1ca98a242a18b3f4ef3 +0 -0
  218. data/spec/dummy/tmp/cache/assets/test/sprockets/cdad6edc528defc97cc803f9b28f4a71 +0 -0
  219. data/spec/dummy/tmp/cache/assets/test/sprockets/cfb9cef7d320ba59870855aa2306bddd +0 -0
  220. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  221. data/spec/dummy/tmp/cache/assets/test/sprockets/d626bad4b5037b4ffa8b7f7d15d76a53 +0 -0
  222. data/spec/dummy/tmp/cache/assets/test/sprockets/d648a0b0abb7fd7ff579d72ffe033d50 +0 -0
  223. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  224. data/spec/dummy/tmp/cache/assets/test/sprockets/d8e283e15fd77782ae12f9b18e5be456 +0 -0
  225. data/spec/dummy/tmp/cache/assets/test/sprockets/{479d8a0e6643a473b785734c1fb0655b → ddcad094e1d77a1ec8d17b77f1161b47} +0 -0
  226. data/spec/dummy/tmp/cache/assets/test/sprockets/e18b88fcf05f32d6b7e22c426144a580 +0 -0
  227. data/spec/dummy/tmp/cache/assets/test/sprockets/{45adf514664dd4134fb290b1938c56d8 → e1cad328d04e160bea05772ab16eacbc} +0 -0
  228. data/spec/dummy/tmp/cache/assets/test/sprockets/e1fcfb0faa3c12467a1c35251e04c8b1 +0 -0
  229. data/spec/dummy/tmp/cache/assets/test/sprockets/e52bd8c13070b84565f76938fe68458c +0 -0
  230. data/spec/dummy/tmp/cache/assets/test/sprockets/ea20f8df525b74f3cb6581c9c8c10831 +0 -0
  231. data/spec/dummy/tmp/cache/assets/test/sprockets/{3fc2b4de95dbb94dfe82ccfc97265cc4 → f02885699e51e1515eb7fd0a2f17cef7} +0 -0
  232. data/spec/dummy/tmp/cache/assets/test/sprockets/f6a963700cd75861fcdc6fd9474e5e77 +0 -0
  233. data/spec/dummy/tmp/cache/assets/test/sprockets/f70653c23b5a12c74bf82c0e9afe906b +0 -0
  234. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  235. data/spec/dummy/tmp/cache/assets/test/sprockets/fb4d31a0ce2d585e276e7e5fc9407aba +0 -0
  236. data/spec/dummy/tmp/cache/assets/test/sprockets/ffb3c7ae1ec3a76cac3e94303559fe51 +0 -0
  237. data/spec/dummy/tmp/cache/assets/test/sprockets/ffb98f25d690ed017b364714434126e5 +0 -0
  238. data/spec/dummy/tmp/cache/stdout +168 -6132
  239. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  240. data/spec/factories/agent_merge.rb +6 -0
  241. data/spec/factories/agent_merge_list.rb +5 -0
  242. data/spec/factories/series_statement_merge.rb +6 -0
  243. data/spec/factories/series_statement_merge_list.rb +5 -0
  244. data/spec/fixtures/agent_merge_lists.yml +27 -0
  245. data/spec/fixtures/agent_merges.yml +31 -0
  246. data/spec/fixtures/content_types.yml +13 -0
  247. data/spec/fixtures/frequencies.yml +13 -0
  248. data/spec/fixtures/manifestations.yml +7 -7
  249. data/spec/fixtures/resource_import_results.yml +1 -1
  250. data/spec/fixtures/series_statement_merge_lists.yml +27 -0
  251. data/spec/fixtures/series_statement_merges.yml +31 -0
  252. data/spec/models/agent_merge_list_spec.rb +18 -0
  253. data/spec/models/agent_merge_spec.rb +19 -0
  254. data/spec/models/manifestation_spec.rb +4 -4
  255. data/spec/models/resource_import_file_spec.rb +22 -11
  256. data/spec/models/resource_import_result_spec.rb +1 -1
  257. data/spec/models/series_statement_merge_list_spec.rb +20 -0
  258. data/spec/models/series_statement_merge_spec.rb +17 -0
  259. data/spec/requests/series_statement_merge_lists_spec.rb +11 -0
  260. data/spec/requests/series_statement_merges_spec.rb +11 -0
  261. data/spec/routing/series_statement_merge_lists_routing_spec.rb +35 -0
  262. data/spec/routing/series_statement_merges_routing_spec.rb +35 -0
  263. data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +18 -0
  264. data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +22 -0
  265. data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +18 -0
  266. data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +15 -0
  267. data/spec/views/series_statement_merges/edit.html.erb_spec.rb +23 -0
  268. data/spec/views/series_statement_merges/index.html.erb_spec.rb +27 -0
  269. data/spec/views/series_statement_merges/new.html.erb_spec.rb +23 -0
  270. data/spec/views/series_statement_merges/show.html.erb_spec.rb +17 -0
  271. metadata +313 -311
  272. data/app/controllers/extents_controller.rb +0 -83
  273. data/app/models/agent_sweeper.rb +0 -29
  274. data/app/models/extent.rb +0 -20
  275. data/app/models/page_sweeper.rb +0 -35
  276. data/app/views/extents/_form.html.erb +0 -19
  277. data/app/views/extents/edit.html.erb +0 -13
  278. data/app/views/extents/index.html.erb +0 -52
  279. data/app/views/extents/new.html.erb +0 -12
  280. data/app/views/extents/show.html.erb +0 -29
  281. data/db/migrate/20090719201843_create_extents.rb +0 -12
  282. data/db/migrate/20140817155043_add_extent_of_text_to_manifestation.rb +0 -5
  283. data/spec/controllers/extents_controller_spec.rb +0 -167
  284. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50651-14mi4s9.txt +0 -147
  285. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50742-1fdbjo6.txt +0 -147
  286. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140704-12784-ozvvo.txt +0 -147
  287. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-18550-cc3qx2.txt +0 -147
  288. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-19313-rlc624.txt +0 -147
  289. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-20440-1o0htch.txt +0 -147
  290. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-28145-o9qcd4.txt +0 -147
  291. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140722-98727-1jesse9.txt +0 -147
  292. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-17115-1c1tv13.txt +0 -147
  293. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-18348-14d01b3.txt +0 -147
  294. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60268-1psjqua.txt +0 -147
  295. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60996-1cy28m2.txt +0 -147
  296. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-67507-19qjhj3.txt +0 -147
  297. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-69234-1cllrec.txt +0 -147
  298. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-76875-1os6joy.txt +0 -147
  299. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-1148-136brhb.txt +0 -147
  300. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-473-1c326dm.txt +0 -147
  301. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-93795-1x882ik.txt +0 -147
  302. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94274-1xr9d9e.txt +0 -147
  303. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94643-1fjcept.txt +0 -147
  304. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-97947-mfqh5b.txt +0 -147
  305. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98488-126cvb4.txt +0 -147
  306. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98849-1lg47mm.txt +0 -147
  307. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140820-19805-1p3heid.txt +0 -147
  308. data/spec/dummy/solr/default/data/index/segments_1 +0 -0
  309. data/spec/dummy/solr/test/data/index/_49n.fdt +0 -0
  310. data/spec/dummy/solr/test/data/index/_49n.fnm +0 -0
  311. data/spec/dummy/solr/test/data/index/_49n.nvd +0 -0
  312. data/spec/dummy/solr/test/data/index/_49n.nvm +0 -0
  313. data/spec/dummy/solr/test/data/index/_49n.si +0 -0
  314. data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.doc +0 -0
  315. data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.pos +0 -0
  316. data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.tim +0 -0
  317. data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.tip +0 -0
  318. data/spec/dummy/solr/test/data/index/segments_62f +0 -0
  319. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007855 +0 -0
  320. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007856 +0 -0
  321. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007857 +0 -0
  322. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007858 +0 -0
  323. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007859 +0 -0
  324. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007860 +0 -0
  325. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007861 +0 -0
  326. data/spec/dummy/test/integration/resource_export_file_test.rb +0 -7
  327. data/spec/dummy/tmp/cache/assets/test/sprockets/1eeeee88b80ad204f61af2154ab097db +0 -0
  328. data/spec/dummy/tmp/cache/assets/test/sprockets/36fe3bdb5b7a6e84e23515bca1842154 +0 -0
  329. data/spec/dummy/tmp/cache/assets/test/sprockets/3ed0e4936463665c59155042a650dfa5 +0 -0
  330. data/spec/dummy/tmp/cache/assets/test/sprockets/46ed442c54e0ad50ed9cbff91bca2c03 +0 -0
  331. data/spec/dummy/tmp/cache/assets/test/sprockets/4aa18096a209e515f5f1df487622cdf4 +0 -0
  332. data/spec/dummy/tmp/cache/assets/test/sprockets/4db7c7b5ea13aacccd89ea32460e2de0 +0 -0
  333. data/spec/dummy/tmp/cache/assets/test/sprockets/4facb9d4adad5d1f55e19897f19ff502 +0 -0
  334. data/spec/dummy/tmp/cache/assets/test/sprockets/51df74c0fa7fbfa41670caa0f4268d54 +0 -0
  335. data/spec/dummy/tmp/cache/assets/test/sprockets/53ce49f7cb73ec18bfefea19be486fd5 +0 -0
  336. data/spec/dummy/tmp/cache/assets/test/sprockets/55de678ed3c84c51b3a4b4cf473da823 +0 -0
  337. data/spec/dummy/tmp/cache/assets/test/sprockets/5686725a34a5b152399098fe6811dfcc +0 -0
  338. data/spec/dummy/tmp/cache/assets/test/sprockets/59d9f2ec47e055feaa8deb88dd230fd9 +0 -0
  339. data/spec/dummy/tmp/cache/assets/test/sprockets/5d30286c45c334a3e08806b2713ddbcd +0 -0
  340. data/spec/dummy/tmp/cache/assets/test/sprockets/5f084c5c398edfb6e223c67ec8fbf80d +0 -0
  341. data/spec/dummy/tmp/cache/assets/test/sprockets/60d030b3fef398bd6c75b5342c1e6951 +0 -0
  342. data/spec/dummy/tmp/cache/assets/test/sprockets/6273ac5ec2eeeb08808c520e45e7c353 +0 -0
  343. data/spec/dummy/tmp/cache/assets/test/sprockets/64513343a4d1500f6642a9797f2d6caf +0 -0
  344. data/spec/dummy/tmp/cache/assets/test/sprockets/6580b1bd3cb606ae0cc6a660e43ee91d +0 -0
  345. data/spec/dummy/tmp/cache/assets/test/sprockets/66e8ff0ee49363fdd0e1866807515228 +0 -0
  346. data/spec/dummy/tmp/cache/assets/test/sprockets/67ef1f14c3ad48997b6d2971949a9974 +0 -0
  347. data/spec/dummy/tmp/cache/assets/test/sprockets/6cf8b3b420dc28c045daec27150ade0a +0 -0
  348. data/spec/dummy/tmp/cache/assets/test/sprockets/7395823b7ae60934b3053f26fdb362d4 +0 -0
  349. data/spec/dummy/tmp/cache/assets/test/sprockets/74c056fa2e48770cba3499207a5027f5 +0 -0
  350. data/spec/dummy/tmp/cache/assets/test/sprockets/796cd029cd1ff06c3212795cdcc5a7c4 +0 -0
  351. data/spec/dummy/tmp/cache/assets/test/sprockets/7de140ed6f303b9d00d8d703cced3349 +0 -0
  352. data/spec/dummy/tmp/cache/assets/test/sprockets/7ef97a0c04f996570fa8d054e77614e4 +0 -0
  353. data/spec/dummy/tmp/cache/assets/test/sprockets/80348afae86df384b25e1e3bff21b13e +0 -0
  354. data/spec/dummy/tmp/cache/assets/test/sprockets/814bc1bed3effa0bb4588eb8b75ab92a +0 -0
  355. data/spec/dummy/tmp/cache/assets/test/sprockets/8488002e0e6035b7d00c3800c2c0e27e +0 -0
  356. data/spec/dummy/tmp/cache/assets/test/sprockets/89c9228bae34e0ff18fd8fe7f6eb5847 +0 -0
  357. data/spec/dummy/tmp/cache/assets/test/sprockets/8e2bf5102d77a2cff3dda27a5617a79d +0 -0
  358. data/spec/dummy/tmp/cache/assets/test/sprockets/9411c91747cff7187d3b5eb3d5401758 +0 -0
  359. data/spec/dummy/tmp/cache/assets/test/sprockets/98d02556564ee10aef4c3397bb94d5b9 +0 -0
  360. data/spec/dummy/tmp/cache/assets/test/sprockets/994c519d4fdf48cadf8846c64a7c217d +0 -0
  361. data/spec/dummy/tmp/cache/assets/test/sprockets/a2ee8688f63b884277632a234086f7df +0 -0
  362. data/spec/dummy/tmp/cache/assets/test/sprockets/a3cea75f1356ef55329e78f86b4c72b1 +0 -0
  363. data/spec/dummy/tmp/cache/assets/test/sprockets/a5ff35005a82346756c8a2d9b564aa8e +0 -0
  364. data/spec/dummy/tmp/cache/assets/test/sprockets/a72fe28675ab93fbb5f1fab49703e8b8 +0 -0
  365. data/spec/dummy/tmp/cache/assets/test/sprockets/aa2e1ada35daa496bb08e85fcb817536 +0 -0
  366. data/spec/dummy/tmp/cache/assets/test/sprockets/b0e11c6d89683eaa7256a44a164a2a12 +0 -0
  367. data/spec/dummy/tmp/cache/assets/test/sprockets/b62c2d32477b85c1a8e33a4b3ba86483 +0 -0
  368. data/spec/dummy/tmp/cache/assets/test/sprockets/b817a9a61cc21da35abec9d0dfb2a143 +0 -0
  369. data/spec/dummy/tmp/cache/assets/test/sprockets/b9ad765321d7527b38c851119d4d6f41 +0 -0
  370. data/spec/dummy/tmp/cache/assets/test/sprockets/bc086c9c936e5b91659a438d35126a90 +0 -0
  371. data/spec/dummy/tmp/cache/assets/test/sprockets/bf17ca8affe2a1febca7f2a4e37cd77b +0 -0
  372. data/spec/dummy/tmp/cache/assets/test/sprockets/c21a9a8a5166b51d4c2737ad4b99c16b +0 -0
  373. data/spec/dummy/tmp/cache/assets/test/sprockets/c36b7431da1ae91722b1c4091e4ba084 +0 -0
  374. data/spec/dummy/tmp/cache/assets/test/sprockets/c3e87e99d52cd8082c8548a7aa63b9da +0 -0
  375. data/spec/dummy/tmp/cache/assets/test/sprockets/c40786442706ae0cc6c793c6ee2500d3 +0 -0
  376. data/spec/dummy/tmp/cache/assets/test/sprockets/c42ec68313928d1544e733ae8383ef6d +0 -0
  377. data/spec/dummy/tmp/cache/assets/test/sprockets/c488c91e58a235d36a0ff8058e5a1004 +0 -0
  378. data/spec/dummy/tmp/cache/assets/test/sprockets/c4dbc19d89022a35885f5621f6b86eb3 +0 -0
  379. data/spec/dummy/tmp/cache/assets/test/sprockets/c6bbf5ca5c9b58807ba226fde0ccc60f +0 -0
  380. data/spec/dummy/tmp/cache/assets/test/sprockets/c7b0db461dfcfc1108bf9a6a87fb909d +0 -0
  381. data/spec/dummy/tmp/cache/assets/test/sprockets/c9d565eb8899b86408d9fd06fbf039be +0 -0
  382. data/spec/dummy/tmp/cache/assets/test/sprockets/cfeee09fa6b6ec2344a7b44bf0676028 +0 -0
  383. data/spec/dummy/tmp/cache/assets/test/sprockets/d8d8b7e606faf0fa1c22a6c2ebc2b58f +0 -0
  384. data/spec/dummy/tmp/cache/assets/test/sprockets/d909adefad62117a3e85463b83954827 +0 -0
  385. data/spec/dummy/tmp/cache/assets/test/sprockets/e22f9546f5d75bd3549886e979dcb96e +0 -0
  386. data/spec/dummy/tmp/cache/assets/test/sprockets/e577e9ce00153ad2e59111f761d0fb15 +0 -0
  387. data/spec/dummy/tmp/cache/assets/test/sprockets/ea6fdf5f7aa83bf540d26f1ae12159a8 +0 -0
  388. data/spec/dummy/tmp/cache/assets/test/sprockets/eef93e7d091d8118419fb96adf80387b +0 -0
  389. data/spec/dummy/tmp/cache/assets/test/sprockets/efd104c04916854411c86a5440ba30e0 +0 -0
  390. data/spec/dummy/tmp/cache/assets/test/sprockets/f32a42f77e45018f7748de516be3c393 +0 -0
  391. data/spec/dummy/tmp/cache/assets/test/sprockets/fb91323d4585f2e27d281cdb4193beb1 +0 -0
  392. data/spec/dummy/tmp/cache/assets/test/sprockets/fd080bad11122c7c3147a3fe1964c396 +0 -0
  393. data/spec/dummy/tmp/cache/assets/test/sprockets/fd88f9f1128cbff14dd2fa00800cfa10 +0 -0
  394. data/spec/dummy/tmp/cache/assets/test/sprockets/fe5bcfd29764185be3d476dee4108595 +0 -0
  395. data/spec/dummy/tmp/cache/assets/test/sprockets/ff64e9ded481959dfa8c78718e59e607 +0 -0
  396. data/spec/factories/extent.rb +0 -5
  397. data/spec/fixtures/extents.yml +0 -29
  398. data/spec/models/extent_spec.rb +0 -21
@@ -1,7 +1,7 @@
1
1
  class ManifestationRelationshipType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope order: 'manifestation_relationship_types.position'
4
+ default_scope { order('manifestation_relationship_types.position') }
5
5
  has_many :manifestation_relationships
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  class MediumOfPerformance < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope order: 'medium_of_performances.position'
4
+ default_scope { order('medium_of_performances.position') }
5
5
  has_many :works
6
6
  end
7
7
 
@@ -1,23 +1,23 @@
1
1
  class PictureFile < ActiveRecord::Base
2
2
  attr_accessible :picture, :picture_attachable_id,
3
3
  :picture_attachable_type
4
- scope :attached, where('picture_attachable_id IS NOT NULL')
5
- belongs_to :picture_attachable, :polymorphic => true, validate: true
4
+ scope :attached, -> { where('picture_attachable_id IS NOT NULL') }
5
+ belongs_to :picture_attachable, polymorphic: true, validate: true
6
6
 
7
7
  if Setting.uploaded_file.storage == :s3
8
- has_attached_file :picture, :storage => :s3, :styles => { :medium => "600x600>", :thumb => "100x100>" },
9
- :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
10
- :s3_permissions => :private
8
+ has_attached_file :picture, storage: :s3, styles: { medium: "600x600>", thumb: "100x100>" },
9
+ s3_credentials: "#{Rails.root}/config/s3.yml",
10
+ s3_permissions: :private
11
11
  else
12
- has_attached_file :picture, :styles => { :medium => "600x600>", :thumb => "100x100>" },
12
+ has_attached_file :picture, styles: { medium: "600x600>", thumb: "100x100>" },
13
13
  path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
14
14
  end
15
15
  validates_attachment_presence :picture
16
- validates_attachment_content_type :picture, :content_type => ["image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/svg+xml"], on: :create
16
+ validates_attachment_content_type :picture, content_type: ["image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/svg+xml"], on: :create
17
17
 
18
- validates :picture_attachable_type, presence: true, :inclusion => {:in => ['Event', 'Manifestation', 'Agent', 'Shelf']}
18
+ validates :picture_attachable_type, presence: true, inclusion: { in: ['Event', 'Manifestation', 'Agent', 'Shelf'] }
19
19
  validates_associated :picture_attachable
20
- default_scope order: 'picture_files.position'
20
+ default_scope { order('picture_files.position') }
21
21
  # http://railsforum.com/viewtopic.php?id=11615
22
22
  acts_as_list scope: 'picture_attachable_type=\'#{picture_attachable_type}\''
23
23
  normalize_attributes :picture_attachable_type
@@ -1,7 +1,7 @@
1
1
  class ProduceType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note, :position
3
3
  include MasterModel
4
- default_scope order: 'produce_types.position'
4
+ default_scope { order('produce_types.position') }
5
5
  end
6
6
 
7
7
  # == Schema Information
@@ -1,7 +1,7 @@
1
1
  class RealizeType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note, :position
3
3
  include MasterModel
4
- default_scope order: 'realize_types.position'
4
+ default_scope { order('realize_types.position') }
5
5
  end
6
6
 
7
7
  # == Schema Information
@@ -4,13 +4,13 @@ class ResourceImportFile < ActiveRecord::Base
4
4
  include ImportFile
5
5
  attr_accessible :resource_import, :edit_mode, :user_encoding, :mode,
6
6
  :default_shelf_id, :library_id
7
- default_scope {order('resource_import_files.id DESC')}
8
- scope :not_imported, -> {in_state(:pending)}
9
- scope :stucked, -> {in_state(:pending).where('resource_import_files.created_at < ?', 1.hour.ago)}
7
+ default_scope { order('resource_import_files.id DESC') }
8
+ scope :not_imported, -> { in_state(:pending) }
9
+ scope :stucked, -> { in_state(:pending).where('resource_import_files.created_at < ?', 1.hour.ago) }
10
10
 
11
11
  if Setting.uploaded_file.storage == :s3
12
12
  has_attached_file :resource_import, storage: :s3, s3_credentials: "#{Setting.amazon}",
13
- :s3_permissions => :private
13
+ s3_permissions: :private
14
14
  else
15
15
  has_attached_file :resource_import,
16
16
  path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
@@ -55,32 +55,51 @@ class ResourceImportFile < ActiveRecord::Base
55
55
 
56
56
  def import
57
57
  transition_to!(:started)
58
- num = {:manifestation_imported => 0, :item_imported => 0, :manifestation_found => 0, :item_found => 0, :failed => 0}
58
+ num = {
59
+ manifestation_imported: 0,
60
+ item_imported: 0,
61
+ manifestation_found: 0,
62
+ item_found: 0,
63
+ failed: 0
64
+ }
59
65
  rows = open_import_file(create_import_temp_file(resource_import))
60
66
  row_num = 1
61
67
 
62
- field = rows.first
63
- if [field['isbn'], field['original_title']].reject{|field| field.to_s.strip == ""}.empty?
64
- raise "You should specify isbn or original_title in the first line"
65
- end
68
+ #field = rows.first
69
+ #if [field['manifestation_id'], field['manifestation_identifier'], field['isbn'], field['original_title']].reject{|f|
70
+ # f.to_s.strip == ''
71
+ #}.empty?
72
+ # raise "You should specify isbn or original_title in the first line"
73
+ #end
66
74
 
67
75
  rows.each do |row|
68
76
  row_num += 1
69
- next if row['dummy'].to_s.strip.present?
70
- import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, body: row.fields.join("\t"))
77
+ import_result = ResourceImportResult.create!(resource_import_file_id: id, body: row.fields.join("\t"))
78
+ if row['dummy'].to_s.strip.present?
79
+ import_result.error_message = "line #{row_num}: #{I18n.t('import.dummy')}"
80
+ import_result.save!
81
+ next
82
+ end
71
83
 
72
84
  item_identifier = row['item_identifier'].to_s.strip
73
85
  item = Item.where(item_identifier: item_identifier).first
74
86
  if item
75
87
  import_result.item = item
76
88
  import_result.manifestation = item.manifestation
89
+ import_result.error_message = "line #{row_num}: #{I18n.t('import.item_found')}"
77
90
  import_result.save!
78
91
  num[:item_found] += 1
79
92
  next
80
93
  end
81
94
 
82
95
  if row['manifestation_identifier'].present?
83
- manifestation = Manifestation.where(:manifestation_identifier => row['manifestation_identifier'].to_s.strip).first
96
+ manifestation = Manifestation.where(manifestation_identifier: row['manifestation_identifier'].to_s.strip).first
97
+ end
98
+
99
+ unless manifestation
100
+ if row['manifestation_id'].present?
101
+ manifestation = Manifestation.where(id: row['manifestation_id'].to_s.strip).first
102
+ end
84
103
  end
85
104
 
86
105
  unless manifestation
@@ -108,7 +127,11 @@ class ResourceImportFile < ActiveRecord::Base
108
127
  end
109
128
  end
110
129
  end
111
- num[:manifestation_found] += 1 if manifestation
130
+
131
+ if manifestation
132
+ import_result.error_message = "line #{row_num}: #{I18n.t('import.manifestation_found')}"
133
+ num[:manifestation_found] += 1
134
+ end
112
135
 
113
136
  if row['original_title'].blank?
114
137
  unless manifestation
@@ -131,7 +154,7 @@ class ResourceImportFile < ActiveRecord::Base
131
154
  end
132
155
  import_result.manifestation = manifestation
133
156
 
134
- if manifestation and item_identifier.present?
157
+ if manifestation && item_identifier.present?
135
158
  import_result.item = create_item(row, manifestation)
136
159
  manifestation.index
137
160
  else
@@ -167,6 +190,7 @@ class ResourceImportFile < ActiveRecord::Base
167
190
  num
168
191
  rescue => e
169
192
  self.error_message = "line #{row_num}: #{e.message}"
193
+ save
170
194
  transition_to!(:failed)
171
195
  raise e
172
196
  end
@@ -213,16 +237,16 @@ class ResourceImportFile < ActiveRecord::Base
213
237
 
214
238
  # TODO
215
239
  for record in reader
216
- manifestation = Manifestation.new(:original_title => expression.original_title)
240
+ manifestation = Manifestation.new(original_title: expression.original_title)
217
241
  manifestation.carrier_type = CarrierType.find(1)
218
242
  manifestation.frequency = Frequency.find(1)
219
243
  manifestation.language = Language.find(1)
220
244
  manifestation.save
221
245
 
222
246
  full_name = record['700']['a']
223
- publisher = Agent.where(:full_name => record['700']['a']).first
247
+ publisher = Agent.where(full_name: record['700']['a']).first
224
248
  unless publisher
225
- publisher = Agent.new(:full_name => full_name)
249
+ publisher = Agent.new(full_name: full_name)
226
250
  publisher.save
227
251
  end
228
252
  manifestation.publishers << publisher
@@ -296,7 +320,7 @@ class ResourceImportFile < ActiveRecord::Base
296
320
  item.save!
297
321
  else
298
322
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
299
- manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first if manifestation_identifier.present?
323
+ manifestation = Manifestation.where(manifestation_identifier: manifestation_identifier).first if manifestation_identifier.present?
300
324
  unless manifestation
301
325
  manifestation = Manifestation.where(id: row['manifestation_id']).first
302
326
  end
@@ -308,6 +332,7 @@ class ResourceImportFile < ActiveRecord::Base
308
332
  transition_to!(:completed)
309
333
  rescue => e
310
334
  self.error_message = "line #{row_num}: #{e.message}"
335
+ save
311
336
  transition_to!(:failed)
312
337
  raise e
313
338
  end
@@ -328,6 +353,7 @@ class ResourceImportFile < ActiveRecord::Base
328
353
  transition_to!(:completed)
329
354
  rescue => e
330
355
  self.error_message = "line #{row_num}: #{e.message}"
356
+ save
331
357
  transition_to!(:failed)
332
358
  raise e
333
359
  end
@@ -345,17 +371,17 @@ class ResourceImportFile < ActiveRecord::Base
345
371
  end
346
372
 
347
373
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
348
- manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first
374
+ manifestation = Manifestation.where(manifestation_identifier: manifestation_identifier).first
349
375
  unless manifestation
350
376
  manifestation = Manifestation.where(id: row['manifestation_id'].to_s.strip).first
351
377
  end
352
378
 
353
- if item and manifestation
379
+ if item && manifestation
354
380
  item.manifestation = manifestation
355
381
  item.save!
356
382
  end
357
383
 
358
- import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, body: row.fields.join("\t"))
384
+ import_result = ResourceImportResult.create!(resource_import_file_id: id, body: row.fields.join("\t"))
359
385
  import_result.item = item
360
386
  import_result.manifestation = manifestation
361
387
  import_result.save!
@@ -370,7 +396,7 @@ class ResourceImportFile < ActiveRecord::Base
370
396
  header_columns = %w(
371
397
  original_title manifestation_identifier item_identifier shelf note
372
398
  title_transcription title_alternative title_alternative_transcription
373
- periodical manifestation_id publication_place carrier_type
399
+ serial manifestation_id publication_place carrier_type
374
400
  series_statement_identifier series_original_title series_creator_string
375
401
  series_title_transcription series_volume_number_string
376
402
  series_title_subseries series_title_subseries_transcription
@@ -381,7 +407,7 @@ class ResourceImportFile < ActiveRecord::Base
381
407
  edition edition_string serial_number isbn issn manifestation_price
382
408
  width height depth number_of_pages jpno lccn budget_type bookstore
383
409
  language fulltext_content required_role doi content_type frequency
384
- extent_of_text start_page end_page
410
+ extent start_page end_page dimensions
385
411
  statement_of_responsibility acquired_at call_number circulation_status
386
412
  binding_item_identifier binding_call_number binded_at item_price
387
413
  use_restriction include_supplements item_note item_url
@@ -397,7 +423,7 @@ class ResourceImportFile < ActiveRecord::Base
397
423
  save!
398
424
  end
399
425
  rows = CSV.open(tempfile, headers: header, col_sep: "\t")
400
- ResourceImportResult.create!(:resource_import_file_id => self.id, body: header.join("\t"))
426
+ ResourceImportResult.create!(resource_import_file_id: id, body: header.join("\t"))
401
427
  tempfile.close(true)
402
428
  file.close
403
429
  rows
@@ -405,26 +431,51 @@ class ResourceImportFile < ActiveRecord::Base
405
431
 
406
432
  def import_subject(row)
407
433
  subjects = []
408
- row['subject'].to_s.split('//').each do |s|
409
- # TODO: Subject typeの設定
410
- subject = Subject.new(:term => s.to_s.strip)
411
- subject.subject_type = SubjectType.where(name: 'concept').first
412
- subject.subject_heading_type = SubjectHeadingType.where(name: 'unknown').first
413
- subjects << subject
414
- end
434
+ subject_list = YAML.load(row['subject'].to_s)
435
+ # TODO: Subject typeの設定
436
+ return subjects unless subject_list
437
+ subject_list.map{|k, v|
438
+ subject_heading_type = SubjectHeadingType.where(name: k.downcase).first
439
+ next unless subject_heading_type
440
+ if v.is_a?(Array)
441
+ v.each do |term|
442
+ subject = Subject.new(term: term)
443
+ subject.subject_heading_type = subject_heading_type
444
+ subject.subject_type = SubjectType.where(name: 'concept').first
445
+ subject.save!
446
+ subjects << subject
447
+ end
448
+ else
449
+ subject = Subject.new(term: v)
450
+ subject.subject_heading_type = subject_heading_type
451
+ subject.subject_type = SubjectType.where(name: 'concept').first
452
+ subject.save!
453
+ subjects << subject
454
+ end
455
+ }
415
456
  subjects
416
457
  end
417
458
 
418
459
  def import_classification(row)
419
460
  classifications = []
420
461
  classification_number = YAML.load(row['classification'].to_s)
421
- return nil unless classification_number
462
+ return classifications unless classification_number
422
463
  classification_number.map{|k, v|
423
464
  classification_type = ClassificationType.where(name: k.downcase).first
424
- classification = Classification.new(:category => v.to_s)
425
- classification.classification_type = classification_type
426
- classification.save!
427
- classifications << classification
465
+ next unless classification_type
466
+ if v.is_a?(Array)
467
+ v.each do |category|
468
+ classification = Classification.new(category: category)
469
+ classification.classification_type = classification_type
470
+ classification.save!
471
+ classifications << classification
472
+ end
473
+ else
474
+ classification = Classification.new(category: v)
475
+ classification.classification_type = classification_type
476
+ classification.save!
477
+ classifications << classification
478
+ end
428
479
  }
429
480
  classifications
430
481
  end
@@ -472,7 +523,6 @@ class ResourceImportFile < ActiveRecord::Base
472
523
  end
473
524
 
474
525
  def fetch(row, options = {edit_mode: 'create'})
475
- shelf = Shelf.where(name: row['shelf'].to_s.strip).first || Shelf.web
476
526
  case options[:edit_mode]
477
527
  when 'create'
478
528
  manifestation = nil
@@ -480,7 +530,7 @@ class ResourceImportFile < ActiveRecord::Base
480
530
  manifestation = Item.where(item_identifier: row['item_identifier'].to_s.strip).first.try(:manifestation)
481
531
  unless manifestation
482
532
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
483
- manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first if manifestation_identifier
533
+ manifestation = Manifestation.where(manifestation_identifier: manifestation_identifier).first if manifestation_identifier
484
534
  manifestation = Manifestation.where(id: row['manifestation_id']).first unless manifestation
485
535
  end
486
536
  end
@@ -497,15 +547,10 @@ class ResourceImportFile < ActiveRecord::Base
497
547
  title[:title_alternative_transcription] = manifestation.title_alternative_transcription if row['title_alternative_transcription'].to_s.strip.blank?
498
548
  end
499
549
  #title[:title_transcription_alternative] = row['title_transcription_alternative']
500
- if title[:original_title].blank? and options[:edit_mode] == 'create'
550
+ if title[:original_title].blank? && options[:edit_mode] == 'create'
501
551
  return nil
502
552
  end
503
553
 
504
- lisbn = Lisbn.new(row['isbn'].to_s.strip)
505
- if lisbn.isbn.valid?
506
- isbn = lisbn.isbn
507
- end
508
-
509
554
  # TODO: 小数点以下の表現
510
555
  language = Language.where(name: row['language'].to_s.strip.camelize).first
511
556
  language = Language.where(iso_639_2: row['language'].to_s.strip.downcase).first unless language
@@ -515,25 +560,24 @@ class ResourceImportFile < ActiveRecord::Base
515
560
  content_type = ContentType.where(name: row['content_type'].to_s.strip).first
516
561
  frequency = Frequency.where(name: row['frequency'].to_s.strip).first
517
562
 
518
- identifier = set_identifier(row)
519
-
563
+ fulltext_content = serial = nil
520
564
  if %w(t true).include?(row['fulltext_content'].to_s.downcase.strip)
521
565
  fulltext_content = true
522
566
  end
523
567
 
524
- if %w(t true).include?(row['periodical'].to_s.downcase.strip)
525
- periodical = true
568
+ if %w(t true).include?(row['serial'].to_s.downcase.strip)
569
+ serial = true
526
570
  end
527
571
 
528
572
  creators = row['creator'].to_s.split('//')
529
573
  creator_transcriptions = row['creator_transcription'].to_s.split('//')
530
- creators_list = creators.zip(creator_transcriptions).map{|f,t| {:full_name => f.to_s.strip, :full_name_transcription => t.to_s.strip}}
574
+ creators_list = creators.zip(creator_transcriptions).map{|f,t| {full_name: f.to_s.strip, full_name_transcription: t.to_s.strip}}
531
575
  contributors = row['contributor'].to_s.split('//')
532
576
  contributor_transcriptions = row['contributor_transcription'].to_s.split('//')
533
- contributors_list = contributors.zip(contributor_transcriptions).map{|f,t| {:full_name => f.to_s.strip, :full_name_transcription => t.to_s.strip}}
577
+ contributors_list = contributors.zip(contributor_transcriptions).map{|f,t| {full_name: f.to_s.strip, full_name_transcription: t.to_s.strip}}
534
578
  publishers = row['publisher'].to_s.split('//')
535
579
  publisher_transcriptions = row['publisher_transcription'].to_s.split('//')
536
- publishers_list = publishers.zip(publisher_transcriptions).map{|f,t| {:full_name => f.to_s.strip, :full_name_transcription => t.to_s.strip}}
580
+ publishers_list = publishers.zip(publisher_transcriptions).map{|f,t| {full_name: f.to_s.strip, full_name_transcription: t.to_s.strip}}
537
581
  ResourceImportFile.transaction do
538
582
  creator_agents = Agent.import_agents(creators_list)
539
583
  contributor_agents = Agent.import_agents(contributors_list)
@@ -579,12 +623,12 @@ class ResourceImportFile < ActiveRecord::Base
579
623
  :statement_of_responsibility => row['statement_of_responsibility'],
580
624
  :access_address => row['access_address'],
581
625
  :manifestation_identifier => row['manifestation_identifier'],
582
- :fulltext_content => fulltext_content,
583
626
  :publication_place => row['publication_place'],
584
- :extent_of_text => row['extent_of_text'],
627
+ :extent => row['extent'],
628
+ :dimensions => row['dimensions'],
585
629
  :start_page => row['start_page'],
586
- :end_page => row['end_page']
587
- }.delete_if{|key, value| value.nil?}
630
+ :end_page => row['end_page'],
631
+ }.delete_if{|_key, value| value.nil?}
588
632
 
589
633
  manifestation = self.class.import_manifestation(expression, publisher_agents, attributes,
590
634
  {
@@ -592,13 +636,13 @@ class ResourceImportFile < ActiveRecord::Base
592
636
  })
593
637
 
594
638
  required_role = Role.where(name: row['required_role_name'].to_s.strip.camelize).first
595
- if required_role and row['required_role_name'].present?
639
+ if required_role && row['required_role_name'].present?
596
640
  manifestation.required_role = required_role
597
641
  else
598
642
  manifestation.required_role = Role.where(name: 'Guest').first unless manifestation.required_role
599
643
  end
600
644
 
601
- if language and row['language'].present?
645
+ if language && row['language'].present?
602
646
  manifestation.language = language
603
647
  else
604
648
  manifestation.language = Language.where(name: 'unknown').first unless manifestation.language
@@ -609,6 +653,8 @@ class ResourceImportFile < ActiveRecord::Base
609
653
  manifestation.frequency = frequency if frequency
610
654
  #manifestation.start_page = row[:start_page].to_i if row[:start_page]
611
655
  #manifestation.end_page = row[:end_page].to_i if row[:end_page]
656
+ manifestation.serial = serial if row['serial']
657
+ manifestation.fulltext_content = fulltext_content if row['fulltext_content']
612
658
 
613
659
  if row['series_original_title'].to_s.strip.present?
614
660
  Manifestation.transaction do
@@ -630,18 +676,26 @@ class ResourceImportFile < ActiveRecord::Base
630
676
  end
631
677
  end
632
678
 
679
+ identifier = set_identifier(row)
680
+
633
681
  if manifestation.save
634
682
  Manifestation.transaction do
635
- manifestation.identifiers.delete_all if manifestation.identifiers.exists?
636
- identifier.each do |k, v|
637
- manifestation.identifiers << v if v.valid?
683
+ if options[:edit_mode] == 'update'
684
+ unless identifier.empty?
685
+ identifier.map{|_k, v|
686
+ v.manifestation = manifestation
687
+ v.save!
688
+ }
689
+ end
690
+ else
691
+ manifestation.identifiers << identifier.map{|_k, v| v}
638
692
  end
639
693
  end
640
694
 
641
695
  if defined?(EnjuSubject)
642
696
  classifications = import_classification(row)
643
697
  if classifications.present?
644
- manifestation.classifications << classifications
698
+ manifestation.classifications = classifications
645
699
  end
646
700
  end
647
701
  end
@@ -665,8 +719,9 @@ class ResourceImportFile < ActiveRecord::Base
665
719
  identifier = {}
666
720
  %w(isbn issn doi jpno).each do |id_type|
667
721
  if row["#{id_type}"].present?
668
- identifier[:"#{id_type}"] = Identifier.new(body: row["#{id_type}"])
669
- identifier[:"#{id_type}"].identifier_type = IdentifierType.where(name: id_type).first_or_create
722
+ import_id = Identifier.new(body: row["#{id_type}"])
723
+ import_id.identifier_type = IdentifierType.where(name: id_type).first_or_create
724
+ identifier[:"#{id_type}"] = import_id if import_id.valid?
670
725
  end
671
726
  end
672
727
  identifier