Sha256: 15ad74d417a46a945469780225730c099137b6b91892b151e446981d39884bc5

Contents?: true

Size: 1.83 KB

Versions: 66

Compression:

Stored size: 1.83 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative 'base_action'

module GoodData
  module LCM2
    class ImportObjectCollections < BaseAction
      DESCRIPTION = 'Import all objects in CollectXXX action to master projects'

      PARAMS = define_params(self) do
        description 'Client Used for Connecting to GD'
        param :gdc_gd_client, instance_of(Type::GdClientType), required: true

        description 'Client used to connecting to development domain'
        param :development_client, instance_of(Type::GdClientType), required: true

        description 'Synchronization Info'
        param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
      end

      class << self
        def call(params)
          results = []

          client = params.gdc_gd_client
          development_client = params.development_client

          params.synchronize.peach do |info|
            from = info.from
            to_projects = info.to
            transfer_uris = info.transfer_uris

            from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")

            to_projects.peach do |entry|
              pid = entry[:pid]
              to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")

              if transfer_uris.any?
                from_project.partial_md_export(transfer_uris, project: to_project)
              end

              results << {
                from: from,
                to: pid,
                status: 'ok'
              }
            end
          end

          results
        end
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
gooddata-2.1.10-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.10 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.9-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.9 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.8-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.8 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.7-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.7 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.6-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.6 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.5-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.5 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.4-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.4 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.3-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.3 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.2-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.2 lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.1-java lib/gooddata/lcm/actions/import_object_collections.rb
gooddata-2.1.1 lib/gooddata/lcm/actions/import_object_collections.rb