Retrieves a value of a metadata field.

 @author Miguel Fonseca
 @since 7.0.0
 @return [String] the value of the metadata field
558213
def metadata_field(file, field)
      until (file.split(File::SEPARATOR) & standard_cookbook_subdirs).empty?
        file = File.absolute_path(File.dirname(file.to_s))
      end
      file = File.dirname(file) unless File.extname(file).empty?

      md_path = File.join(file, "metadata.rb")
      if File.exist?(md_path)
        value = read_ast(md_path).xpath("//stmts_add/
          command[ident/@value='#{field}']/
          descendant::tstring_content/@value").to_s
        raise "Cant read #{field} from #{md_path}" if value.to_s.empty?
        return value
      else
        raise "Cant find #{md_path}"
      end
    end
478646
private Object getEntityFieldValue(EntityMetadata entityMetadata, Object entity, String field)
    {
        Class clazz = entityMetadata.getEntityClazz();
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                entityMetadata.getPersistenceUnit());
        EntityType entityType = metaModel.entity(clazz);

        if (field.indexOf(".") > 0 && entityMetadata.getEntityClazz().equals(entity.getClass()))
        {
            String fieldName = field.substring(field.indexOf(".") + 1, field.length());
            Attribute attribute = entityType.getAttribute(fieldName);
            return PropertyAccessorHelper.getObject(entity, (Field) attribute.getJavaMember());
        }
        else
        {
            // for hbase v2 client (sends arraylist for specific fields)
            if (entity instanceof ArrayList)
            {
                Object element = ((ArrayList) entity).get(0);
                ((ArrayList) entity).remove(0);
                return element;
            }
            else
            {
                return entity;
            }
        }
    }
1072396
def field_value(field)
      element = find_field(field)
      value = (element.tag_name == 'textarea') ? element.text : element.value
      # If field value is an Array, take the first item
      if value.class == Array
        value = value.first
      end
      return value.to_s
    end
456498
def read_output_value(name)
      if get_field(PREVIOUS_CONTEXT_OUTPUTS_META).nil?
        set_field(CONTEXT_OUTPUTS_META, {}) if get_field(CONTEXT_OUTPUTS_META).nil?
        get_field(CONTEXT_OUTPUTS_META)[name]
      else
        get_field(PREVIOUS_CONTEXT_OUTPUTS_META)[name]
      end
    end
1175525
def get_meta_attribute(self, param):
        
        return self._get_meta_value(param, getattr(self.app_config, param)) or ''
720542
def _get_metadata(self, file_id, metadata_fields=''):
        
        '''  '''
        
        title = '%s._get_metadata' % self.__class__.__name__
        
    # construct fields arg
        if not metadata_fields:
            metadata_fields = ','.join(self.object_file.keys())
        else:
            field_list = metadata_fields.split(',')
            for field in field_list:
                if not field in self.object_file.keys():
                    raise ValueError('%s(metadata_fields="%s") is not a valid drive file field' % (title, field))
    
    # send request
        try:
            metadata_details = self.drive.get(fileId=file_id, fields=metadata_fields).execute()
        except:
            raise DriveConnectionError(title)
        
        return metadata_details
1139826
def metadata(self):
        
        # Check exceptional case: return none if no metadata
        if not self._operation.HasField('metadata'):
            return None

        # Return expected metadata
        return _from_any(self._metadata_type, self._operation.metadata)
1247590
def get_field(field):
    """"""
    if isinstance(field, djmodels.fields.Field):
        return field
    elif isinstance(field, basestring):
        field = field.split('.')
        if len(field) == 3:
            model = get_model(app=field[0], model=field[1])
        elif len(field) == 2:
            model = get_model(app=DEFAULT_APP, model=field[0])
        else:
            return None
            raise NotImplementedError("Unknown default model name. Don't know where to look for field %s" % '.'.join(field)) 
        field = model._meta.get_field(field[-1])
    return field
666969
def get_meta_value_for(snapshot, key, default=None):
    
    metadata = get_snapshot_metadata(snapshot)
    return metadata.get(key, default)
1229563
def meta_get(self, key, metafield, default=None):
        '''  '''
        return self._meta.get(key, {}).get(metafield, default)
1279289
def keys(self):
        
        try:
            return self._metadata["fields"]
        except KeyError:
            if self.attached():
                self._session.send()
            while self.attached() and "fields" not in self._metadata:
                self._session.fetch()
            return self._metadata.get("fields")
507936
def metadata
      metadata = {}
      other_chunks.each do |chunk|
        metadata[chunk.keyword] = chunk.value if chunk.respond_to?(:keyword) && chunk.respond_to?(:value)
      end
      metadata
    end
950488
def get_id(self):
        
        _id = self._meta.get("id", None)
        if _id is None:
            _id = self.save()
        return _id
67771
def _get_field_by_name(model_class, field_name):
    
    field = model_class._meta.get_field(field_name)
    return (
        field,                                       # field
        field.model,                                 # model
        not field.auto_created or field.concrete,    # direct
        field.many_to_many                           # m2m
    )
18088
def find_id_metadata(collection_name)
    collection_data = @collections.fetch(collection_name)
    class_metadata = @class_metadata.fetch(collection_data[:type].to_s)
    key = class_metadata.select{|k,h| h.is_key }.collect{|k,h| h.name }[0]
    class_metadata[key]
  end
436075
public function get_metadata() {
		// Fetching the meta-data for the first time.
		if ( is_null( $this->metadata ) ) {
			$this->metadata = $this->fetch_metadata();
		}

		return $this->metadata;
	}
975212
def load_metadata!
        metadata_path = File.join(path, 'metadata.rb')

        @metadata = Stove::Cookbook::Metadata.from_file(metadata_path)
        @name     = @metadata.name
        @version  = @metadata.version

        metadata_path
      end