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.
- checksums.yaml +4 -4
- data/app/controllers/agent_merge_lists_controller.rb +93 -0
- data/app/controllers/agent_merges_controller.rb +87 -0
- data/app/controllers/agent_relationships_controller.rb +1 -1
- data/app/controllers/agents_controller.rb +1 -3
- data/app/controllers/creates_controller.rb +3 -3
- data/app/controllers/manifestation_relationships_controller.rb +1 -1
- data/app/controllers/manifestations_controller.rb +12 -12
- data/app/controllers/owns_controller.rb +3 -3
- data/app/controllers/picture_files_controller.rb +1 -1
- data/app/controllers/produces_controller.rb +3 -3
- data/app/controllers/realizes_controller.rb +3 -3
- data/app/controllers/series_statement_merge_lists_controller.rb +92 -0
- data/app/controllers/series_statement_merges_controller.rb +90 -0
- data/app/controllers/series_statements_controller.rb +1 -3
- data/app/helpers/manifestations_helper.rb +17 -17
- data/app/models/agent.rb +24 -26
- data/app/models/agent_import_file.rb +3 -3
- data/app/models/agent_import_result.rb +2 -2
- data/app/models/agent_merge.rb +21 -0
- data/app/models/agent_merge_list.rb +29 -0
- data/app/models/agent_relationship_type.rb +1 -1
- data/app/models/agent_type.rb +1 -1
- data/app/models/carrier_type.rb +2 -2
- data/app/models/content_type.rb +1 -1
- data/app/models/country.rb +8 -4
- data/app/models/create_type.rb +1 -1
- data/app/models/enju_biblio/ability.rb +12 -9
- data/app/models/form_of_work.rb +1 -1
- data/app/models/frequency.rb +1 -1
- data/app/models/identifier.rb +12 -0
- data/app/models/identifier_type.rb +2 -2
- data/app/models/import_request.rb +2 -1
- data/app/models/item.rb +3 -3
- data/app/models/language.rb +8 -1
- data/app/models/license.rb +1 -1
- data/app/models/manifestation.rb +42 -43
- data/app/models/manifestation_relationship_type.rb +1 -1
- data/app/models/medium_of_performance.rb +1 -1
- data/app/models/picture_file.rb +9 -9
- data/app/models/produce_type.rb +1 -1
- data/app/models/realize_type.rb +1 -1
- data/app/models/resource_import_file.rb +118 -63
- data/app/models/resource_import_result.rb +5 -4
- data/app/models/series_statement.rb +4 -7
- data/app/models/series_statement_merge.rb +21 -0
- data/app/models/series_statement_merge_list.rb +19 -0
- data/app/views/agent_merge_lists/_form.html.erb +11 -0
- data/app/views/agent_merge_lists/edit.html.erb +13 -0
- data/app/views/agent_merge_lists/index.html.erb +33 -0
- data/app/views/agent_merge_lists/new.html.erb +12 -0
- data/app/views/agent_merge_lists/show.html.erb +31 -0
- data/app/views/agent_merges/edit.html.erb +31 -0
- data/app/views/agent_merges/index.html.erb +32 -0
- data/app/views/agent_merges/new.html.erb +39 -0
- data/app/views/agent_merges/show.html.erb +25 -0
- data/app/views/agents/_index.html.erb +1 -3
- data/app/views/agents/_index_agent_merge_list.html.erb +53 -0
- data/app/views/layouts/manifestations.html.erb +1 -1
- data/app/views/manifestations/_form.html.erb +14 -2
- data/app/views/manifestations/_index_form_parent.html.erb +1 -1
- data/app/views/manifestations/_show.mods.builder +1 -4
- data/app/views/manifestations/_show.rdf.builder +1 -4
- data/app/views/manifestations/_show_detail_librarian.html.erb +1 -1
- data/app/views/manifestations/_show_detail_user.html.erb +1 -1
- data/app/views/manifestations/_show_index.html.erb +1 -1
- data/app/views/manifestations/_show_index.mobile.erb +2 -2
- data/app/views/manifestations/_show_parent_form.html.erb +1 -1
- data/app/views/manifestations/_show_series_index.html.erb +1 -1
- data/app/views/manifestations/_title.html.erb +1 -1
- data/app/views/picture_files/show.html.erb +1 -1
- data/app/views/resource_import_files/show.html.erb +9 -0
- data/app/views/resource_import_results/index.html.erb +2 -0
- data/app/views/resource_import_results/show.html.erb +6 -1
- data/app/views/series_statement_merge_lists/_form.html.erb +11 -0
- data/app/views/series_statement_merge_lists/edit.html.erb +13 -0
- data/app/views/series_statement_merge_lists/index.html.erb +33 -0
- data/app/views/series_statement_merge_lists/new.html.erb +12 -0
- data/app/views/series_statement_merge_lists/show.html.erb +31 -0
- data/app/views/series_statement_merges/_form.html.erb +12 -0
- data/app/views/series_statement_merges/edit.html.erb +31 -0
- data/app/views/series_statement_merges/index.html.erb +32 -0
- data/app/views/series_statement_merges/new.html.erb +39 -0
- data/app/views/series_statement_merges/show.html.erb +27 -0
- data/config/locales/translation_en.yml +25 -7
- data/config/locales/translation_ja.yml +25 -7
- data/config/routes.rb +20 -1
- data/db/migrate/005_create_manifestations.rb +0 -1
- data/db/migrate/133_create_agent_merges.rb +15 -0
- data/db/migrate/134_create_agent_merge_lists.rb +13 -0
- data/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
- data/db/migrate/20140822114527_add_error_message_to_resource_import_result.rb +5 -0
- data/db/migrate/20140823083524_add_extent_to_manifestation.rb +5 -0
- data/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
- data/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
- data/lib/enju_biblio.rb +8 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/tasks/agent_type.rb +15 -0
- data/lib/tasks/enju_biblio_tasks.rake +2 -0
- data/spec/controllers/agent_merge_lists_controller_spec.rb +456 -0
- data/spec/controllers/agent_merges_controller_spec.rb +437 -0
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +439 -0
- data/spec/controllers/series_statement_merges_controller_spec.rb +433 -0
- data/spec/dummy/app/models/ability.rb +0 -5
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +22 -14
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_update_file.tsv +1 -1
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +21 -19
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +21 -19
- 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
- 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
- data/spec/dummy/solr/default/data/index/_n.fdt +0 -0
- data/spec/dummy/solr/{test/data/index/_49n.fdx → default/data/index/_n.fdx} +0 -0
- data/spec/dummy/solr/default/data/index/_n.fnm +0 -0
- data/spec/dummy/solr/default/data/index/_n.nvd +0 -0
- data/spec/dummy/solr/default/data/index/_n.nvm +0 -0
- data/spec/dummy/solr/default/data/index/_n.si +0 -0
- data/spec/dummy/solr/default/data/index/_n_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/default/data/index/_n_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/default/data/index/_n_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/_n_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/default/data/index/_o.fdt +0 -0
- data/spec/dummy/solr/default/data/index/_o.fdx +0 -0
- data/spec/dummy/solr/default/data/index/_o.fnm +0 -0
- data/spec/dummy/solr/default/data/index/_o.nvd +0 -0
- data/spec/dummy/solr/default/data/index/_o.nvm +0 -0
- data/spec/dummy/solr/default/data/index/_o.si +0 -0
- data/spec/dummy/solr/default/data/index/_o_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/default/data/index/_o_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/default/data/index/_o_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/_o_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_15 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000030 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000031 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000032 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000033 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000034 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000035 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000036 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000037 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000038 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000039 +0 -0
- data/spec/dummy/solr/test/data/index/segments.gen +0 -0
- data/spec/dummy/solr/test/data/index/segments_401 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005178 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005179 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005180 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005181 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005182 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000005183 +0 -0
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
- data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{173711a319dbf01f35a2ad8e1efe08b9 → 016035697c13f20f5d2b52792d85c604} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0440b81b0aae840cf287a686585a8cec → 016f9220091ee2a634e3a6c7fbe9c147} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{19a44bc29c5173edea456f9416243854 → 052185a11dac17697ab8119d0eae969d} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/091f6b71beeef71345e4cb87e0e0f60e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0e3e358e4fe4601ba5e435f6d0c86f12 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{e58908ad0ccad6546faf9bcab669b0cd → 11bb992144d5d72e1251e5d4cf370f86} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{64ee480e95febf6b404c1264755ea42e → 120d4c2662a2d695d86719703963cbc2} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/12c4795597f72ed1be53a24203b9605a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0c8f59d97121b79a2e2a0d009d6da9c3 → 1462d348fc6af4ed5164bd969f65ef40} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1ba5d9cae60d012a67e6c857c0f5aa3c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1c1fbab93e4552626da626e0dbe70c74 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/27e1b4616976bb325e2963da52263610 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/29755b7a6522fd2bd21a5821dcc1024c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0d8876cd5c35974067b09df39826ad64 → 2a4804739761c332dbea9b545ebdc90b} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3013236b88f48eb1a0e36f7ce20e9278 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/306cf2727f2c4d5bcc3318fdf704f9f8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{1d0caee819e97b6e819aff48d160ba0e → 3137d593e6b38d7364165258707ba168} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3417713460df81bb2349531adec5f348 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3ef32f79b6e9b4487b09c38d17e96c5b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/45f3c74e1e31b58d9bda6908d5623290 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4982460b51d59b2a6ca1a2a62f578883 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{2b35ad8fee7e1228e205669278e2adda → 4c00935da384db345e9d75e427a6ecfd} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{a2474b74df12470fb37c668b85b562c6 → 4d6ee78c9b5a731d2770590bdca965db} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{267e026cf7dcb8ed5ca66aa83dff1a87 → 4ec967e0b0aa8965b00d8d02580cb1e8} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{01c388ec88c5fa6d00409d725549a506 → 524145c58d27d8645853427057c8e352} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/53f3ea63c7f59d989da4e7299c5ebef6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{86dfe8a3e156aeb6ebcd456b2251fab7 → 5401d1bbdbcca869f9ec530be8954c7b} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5657f9c72ff547052db9db89e95d1758 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5762cca052dd5d3eb8bb35e2ed9a59b8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5e6bfa8ff735312df3c6e3ab5e4544dd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/617d3692a7e14d57d7d7c18e62988c56 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6a45e3c9461983dc78a7a4f06326d98a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6ef07ba38c3fb7876f0dd5a9580ddb09 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{15aaed1a5a5f4f98d5c8d19084d7980d → 726c9190898ab9d89a285df9f73fc835} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/768618b68fc55616affb09d1366839bf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7cf6f7130d3eca66452321d70d360864 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7e097aef96e9d7a3f16e013b6f612b68 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/84c8a64682205dba3f8edd60fc1ec8e5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8c36936509297e044c5353b3c57148f9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0483120d2ec851526d1beb322a87b34d → 8fe57feab5051fd40f4878b7a740486f} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0dfa4223643dd4c4e2f977989012a78f → 94fe70b1fcf11d0f4ba62fd956b13410} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{16262df7c7e382ef78b21f453750ea94 → 9757a9437821225e1c033c19725d7f29} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9872a7a2c1dbfa71b55ebcf97dfa07b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9a11ac4cf3c8597981773b8ea1c36659 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9ad166e60e3d477c78328181979a7b77 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9c500035359d42d1d6eb3152407753da +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0c0062cfb97ef1437ab0020e724876c6 → a0d32bfbf69edb9affa96b926037041a} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/aa0c14240f47d6746cd5d3bf2fe4b936 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/aff11c6f1bdcce6d91baf69968f93ad6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b1cfee6085e55e41f311c5dfeda8661b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b4125d2c5630528bd1587b244a3303d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{1572dfd6f1e555f4be1aa60ddc3cb0c0 → b4857dbfaac3e3d5aeb45b1beff2b88b} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{e8f801eeda49cba4a03cfd9e2a4562ae → b4f5eca040699a5d38403ce80236bc12} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b530f21ccf5882027bf2aff5502dc79e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{24051f5752691433a5a205b04a62fca1 → b6fec44e6e93be3375951dad4faa2c14} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{305729f8ea45e96c3a7e75df920aa125 → b943165df1109f3c68280a04e5e960f8} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{2d65b40e585725207fd52ce4cf5134f4 → c48a5c8c0b091de16e629df2f6145f67} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{40e90f0c329b14292a9ff1a2fe907b39 → c5602b825ee6f6e1946e61a5c607d444} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ca2bbe58fd1ca1ca98a242a18b3f4ef3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cdad6edc528defc97cc803f9b28f4a71 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cfb9cef7d320ba59870855aa2306bddd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d626bad4b5037b4ffa8b7f7d15d76a53 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d648a0b0abb7fd7ff579d72ffe033d50 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d8e283e15fd77782ae12f9b18e5be456 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{479d8a0e6643a473b785734c1fb0655b → ddcad094e1d77a1ec8d17b77f1161b47} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e18b88fcf05f32d6b7e22c426144a580 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{45adf514664dd4134fb290b1938c56d8 → e1cad328d04e160bea05772ab16eacbc} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1fcfb0faa3c12467a1c35251e04c8b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e52bd8c13070b84565f76938fe68458c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea20f8df525b74f3cb6581c9c8c10831 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{3fc2b4de95dbb94dfe82ccfc97265cc4 → f02885699e51e1515eb7fd0a2f17cef7} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f6a963700cd75861fcdc6fd9474e5e77 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f70653c23b5a12c74bf82c0e9afe906b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fb4d31a0ce2d585e276e7e5fc9407aba +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ffb3c7ae1ec3a76cac3e94303559fe51 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ffb98f25d690ed017b364714434126e5 +0 -0
- data/spec/dummy/tmp/cache/stdout +168 -6132
- data/spec/dummy/tmp/pids/redis-test.pid +1 -1
- data/spec/factories/agent_merge.rb +6 -0
- data/spec/factories/agent_merge_list.rb +5 -0
- data/spec/factories/series_statement_merge.rb +6 -0
- data/spec/factories/series_statement_merge_list.rb +5 -0
- data/spec/fixtures/agent_merge_lists.yml +27 -0
- data/spec/fixtures/agent_merges.yml +31 -0
- data/spec/fixtures/content_types.yml +13 -0
- data/spec/fixtures/frequencies.yml +13 -0
- data/spec/fixtures/manifestations.yml +7 -7
- data/spec/fixtures/resource_import_results.yml +1 -1
- data/spec/fixtures/series_statement_merge_lists.yml +27 -0
- data/spec/fixtures/series_statement_merges.yml +31 -0
- data/spec/models/agent_merge_list_spec.rb +18 -0
- data/spec/models/agent_merge_spec.rb +19 -0
- data/spec/models/manifestation_spec.rb +4 -4
- data/spec/models/resource_import_file_spec.rb +22 -11
- data/spec/models/resource_import_result_spec.rb +1 -1
- data/spec/models/series_statement_merge_list_spec.rb +20 -0
- data/spec/models/series_statement_merge_spec.rb +17 -0
- data/spec/requests/series_statement_merge_lists_spec.rb +11 -0
- data/spec/requests/series_statement_merges_spec.rb +11 -0
- data/spec/routing/series_statement_merge_lists_routing_spec.rb +35 -0
- data/spec/routing/series_statement_merges_routing_spec.rb +35 -0
- data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +22 -0
- data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +15 -0
- data/spec/views/series_statement_merges/edit.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/index.html.erb_spec.rb +27 -0
- data/spec/views/series_statement_merges/new.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/show.html.erb_spec.rb +17 -0
- metadata +313 -311
- data/app/controllers/extents_controller.rb +0 -83
- data/app/models/agent_sweeper.rb +0 -29
- data/app/models/extent.rb +0 -20
- data/app/models/page_sweeper.rb +0 -35
- data/app/views/extents/_form.html.erb +0 -19
- data/app/views/extents/edit.html.erb +0 -13
- data/app/views/extents/index.html.erb +0 -52
- data/app/views/extents/new.html.erb +0 -12
- data/app/views/extents/show.html.erb +0 -29
- data/db/migrate/20090719201843_create_extents.rb +0 -12
- data/db/migrate/20140817155043_add_extent_of_text_to_manifestation.rb +0 -5
- data/spec/controllers/extents_controller_spec.rb +0 -167
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50651-14mi4s9.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50742-1fdbjo6.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140704-12784-ozvvo.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-18550-cc3qx2.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-19313-rlc624.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-20440-1o0htch.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-28145-o9qcd4.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140722-98727-1jesse9.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-17115-1c1tv13.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-18348-14d01b3.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60268-1psjqua.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60996-1cy28m2.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-67507-19qjhj3.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-69234-1cllrec.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-76875-1os6joy.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-1148-136brhb.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-473-1c326dm.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-93795-1x882ik.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94274-1xr9d9e.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94643-1fjcept.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-97947-mfqh5b.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98488-126cvb4.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98849-1lg47mm.txt +0 -147
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140820-19805-1p3heid.txt +0 -147
- data/spec/dummy/solr/default/data/index/segments_1 +0 -0
- data/spec/dummy/solr/test/data/index/_49n.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_49n.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_49n.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_49n.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_49n.si +0 -0
- data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_49n_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/segments_62f +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007855 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007856 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007857 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007858 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007859 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007860 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007861 +0 -0
- data/spec/dummy/test/integration/resource_export_file_test.rb +0 -7
- data/spec/dummy/tmp/cache/assets/test/sprockets/1eeeee88b80ad204f61af2154ab097db +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/36fe3bdb5b7a6e84e23515bca1842154 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3ed0e4936463665c59155042a650dfa5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/46ed442c54e0ad50ed9cbff91bca2c03 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4aa18096a209e515f5f1df487622cdf4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4db7c7b5ea13aacccd89ea32460e2de0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4facb9d4adad5d1f55e19897f19ff502 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/51df74c0fa7fbfa41670caa0f4268d54 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/53ce49f7cb73ec18bfefea19be486fd5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/55de678ed3c84c51b3a4b4cf473da823 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5686725a34a5b152399098fe6811dfcc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/59d9f2ec47e055feaa8deb88dd230fd9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5d30286c45c334a3e08806b2713ddbcd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5f084c5c398edfb6e223c67ec8fbf80d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/60d030b3fef398bd6c75b5342c1e6951 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6273ac5ec2eeeb08808c520e45e7c353 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/64513343a4d1500f6642a9797f2d6caf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6580b1bd3cb606ae0cc6a660e43ee91d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/66e8ff0ee49363fdd0e1866807515228 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/67ef1f14c3ad48997b6d2971949a9974 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6cf8b3b420dc28c045daec27150ade0a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7395823b7ae60934b3053f26fdb362d4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/74c056fa2e48770cba3499207a5027f5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/796cd029cd1ff06c3212795cdcc5a7c4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7de140ed6f303b9d00d8d703cced3349 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7ef97a0c04f996570fa8d054e77614e4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/80348afae86df384b25e1e3bff21b13e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/814bc1bed3effa0bb4588eb8b75ab92a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8488002e0e6035b7d00c3800c2c0e27e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/89c9228bae34e0ff18fd8fe7f6eb5847 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8e2bf5102d77a2cff3dda27a5617a79d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9411c91747cff7187d3b5eb3d5401758 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/98d02556564ee10aef4c3397bb94d5b9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/994c519d4fdf48cadf8846c64a7c217d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a2ee8688f63b884277632a234086f7df +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a3cea75f1356ef55329e78f86b4c72b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a5ff35005a82346756c8a2d9b564aa8e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a72fe28675ab93fbb5f1fab49703e8b8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/aa2e1ada35daa496bb08e85fcb817536 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b0e11c6d89683eaa7256a44a164a2a12 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b62c2d32477b85c1a8e33a4b3ba86483 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b817a9a61cc21da35abec9d0dfb2a143 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b9ad765321d7527b38c851119d4d6f41 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bc086c9c936e5b91659a438d35126a90 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bf17ca8affe2a1febca7f2a4e37cd77b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c21a9a8a5166b51d4c2737ad4b99c16b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c36b7431da1ae91722b1c4091e4ba084 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c3e87e99d52cd8082c8548a7aa63b9da +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c40786442706ae0cc6c793c6ee2500d3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c42ec68313928d1544e733ae8383ef6d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c488c91e58a235d36a0ff8058e5a1004 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c4dbc19d89022a35885f5621f6b86eb3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c6bbf5ca5c9b58807ba226fde0ccc60f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c7b0db461dfcfc1108bf9a6a87fb909d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c9d565eb8899b86408d9fd06fbf039be +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cfeee09fa6b6ec2344a7b44bf0676028 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d8d8b7e606faf0fa1c22a6c2ebc2b58f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d909adefad62117a3e85463b83954827 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e22f9546f5d75bd3549886e979dcb96e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e577e9ce00153ad2e59111f761d0fb15 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea6fdf5f7aa83bf540d26f1ae12159a8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/eef93e7d091d8118419fb96adf80387b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/efd104c04916854411c86a5440ba30e0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f32a42f77e45018f7748de516be3c393 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fb91323d4585f2e27d281cdb4193beb1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fd080bad11122c7c3147a3fe1964c396 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fd88f9f1128cbff14dd2fa00800cfa10 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fe5bcfd29764185be3d476dee4108595 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ff64e9ded481959dfa8c78718e59e607 +0 -0
- data/spec/factories/extent.rb +0 -5
- data/spec/fixtures/extents.yml +0 -29
- 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
|
4
|
+
default_scope { order('manifestation_relationship_types.position') }
|
5
5
|
has_many :manifestation_relationships
|
6
6
|
end
|
7
7
|
|
data/app/models/picture_file.rb
CHANGED
@@ -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, :
|
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, :
|
9
|
-
:
|
10
|
-
:
|
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, :
|
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, :
|
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, :
|
18
|
+
validates :picture_attachable_type, presence: true, inclusion: { in: ['Event', 'Manifestation', 'Agent', 'Shelf'] }
|
19
19
|
validates_associated :picture_attachable
|
20
|
-
default_scope order
|
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
|
data/app/models/produce_type.rb
CHANGED
data/app/models/realize_type.rb
CHANGED
@@ -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
|
-
:
|
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 = {
|
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{|
|
64
|
-
|
65
|
-
|
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
|
-
|
70
|
-
|
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(:
|
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
|
-
|
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
|
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(:
|
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(:
|
247
|
+
publisher = Agent.where(full_name: record['700']['a']).first
|
224
248
|
unless publisher
|
225
|
-
publisher = Agent.new(:
|
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(:
|
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(:
|
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
|
379
|
+
if item && manifestation
|
354
380
|
item.manifestation = manifestation
|
355
381
|
item.save!
|
356
382
|
end
|
357
383
|
|
358
|
-
import_result = ResourceImportResult.create!(:
|
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
|
-
|
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
|
-
|
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!(:
|
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
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
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
|
462
|
+
return classifications unless classification_number
|
422
463
|
classification_number.map{|k, v|
|
423
464
|
classification_type = ClassificationType.where(name: k.downcase).first
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
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(:
|
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?
|
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
|
-
|
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['
|
525
|
-
|
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| {:
|
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| {:
|
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| {:
|
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
|
-
:
|
627
|
+
:extent => row['extent'],
|
628
|
+
:dimensions => row['dimensions'],
|
585
629
|
:start_page => row['start_page'],
|
586
|
-
:end_page => row['end_page']
|
587
|
-
}.delete_if{|
|
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
|
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
|
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
|
-
|
636
|
-
|
637
|
-
|
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
|
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
|
-
|
669
|
-
|
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
|