Class: TriplestoreSyncController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- TriplestoreSyncController
- Includes:
- RdfSyncService::Helper
- Defined in:
- app/controllers/triplestore_sync_controller.rb
Overview
Copyright 2011-2013 innoQ Deutschland GmbH
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Instance Method Summary collapse
Methods included from RdfSyncService::Helper
Instance Method Details
#index ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/triplestore_sync_controller.rb', line 20 def index :sync, :triplestore flash.now[:info] = [I18n.t('txt.controllers.triplestore_sync.batch_hint', host: root_url(lang: nil))] if Iqvoc.config['triplestore.url'] == Iqvoc.config.defaults['triplestore.url'] flash.now[:warning] = I18n.t('txt.controllers.triplestore_sync.config_warning') else host = Iqvoc.config['triplestore.url'] username = Iqvoc.config['triplestore.username'].presence password = Iqvoc.config['triplestore.password'].presence target_info = host if username && password target_info = "#{target_info} (as #{username} with password)" # XXX: i18n elsif username target_info = "#{target_info} (as #{username})" # XXX: i18n end flash.now[:info] << I18n.t('txt.controllers.triplestore_sync.config_info', target_info: target_info) end # per-class pagination @candidates = RdfSyncService.candidates.map do |records| records.page(params[:page]) end end |
#sync ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/triplestore_sync_controller.rb', line 48 def sync :sync, :triplestore flash[:error] = [] begin success = triplestore_syncer.all # XXX: long-running rescue => exc success = false flash[:error] << exc. end if success flash[:success] = I18n.t('txt.controllers.triplestore_sync.success') else flash[:error] << I18n.t('txt.controllers.triplestore_sync.error') end redirect_to action: 'index' end |