Sha256: 20e201bbc41d149ff5f6e410b6f7336e184140a90a59d65e075d28dcd1879f17

Contents?: true

Size: 1.43 KB

Versions: 29

Compression:

Stored size: 1.43 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 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 'blueprint_field'

module GoodData
  module Model
    class ReferenceBlueprintField < BlueprintField
      # Returns the schema that is referenced by this ref
      #
      # @return [GoodData::Model::SchemaBlueprint] the referencesd schema
      def dataset
        dataset_blueprint.find_dataset(reference, include_date_dimensions: true)
      end

      # Returns the string reference of the ref which is string Id of dataset that is referenced.
      #
      # @return [String] Id of the referenced dataset
      def reference
        data[:dataset]
      end

      # Validates the fields in the ref
      #
      # @return [Array] returns list of the errors represented by hash structures
      def validate
        validate_presence_of(:dataset).map do |e|
          { type: :error, message: "Field \"#{e}\" is not defined or empty for reference \"#{data}\"" }
        end
      end

      # Returns the md object in associated project or throws error if not present
      #
      # @return [GoodData::MdObject] md object that is represented in the blueprint
      def in_project(_project)
        fail NotImplementedError, 'Reference does not have representation as an object in datamart'
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
gooddata-edge-0.6.27.edge lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.49 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.48 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.47 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.46 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.45 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.44 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.43 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.42 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.41 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.40 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.39 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.38 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.37 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.36 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.35 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.34 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.33 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.32 lib/gooddata/models/blueprint/reference_field.rb
gooddata-0.6.31 lib/gooddata/models/blueprint/reference_field.rb