Configure the metadata for the entity this repository interacts with

Override this method to set additional fields or define relationships with other entities
15077
protected function configureMetadata()
    {
        $this->entityMetadata->setCollection($this->collectionName);
        if (!empty($this->primaryKey)) {
            $this->entityMetadata->setPrimaryKey($this->primaryKey);
        }
    }
620443
def add_entity(self, entity):
        
        self._ensure_loaded()
        self.entities[str(entity)] = entity
340803
def metadata(namespace: :default)
      entity = current_entity
      if entity
        entity.metadata(namespace: namespace)
      else
        FacadeMetadata
      end
    end
257766
def _init_metadata(self, **kwargs):
        """"""
        osid_objects.OsidRelationshipForm._init_metadata(self, **kwargs)
        update_display_text_defaults(self._mdata['text'], self._locale_map)
        self._text_default = dict(self._mdata['text']['default_string_values'][0])
        self._rating_default = self._mdata['rating']['default_id_values'][0]
126339
@Override
  protected void configure() {

    bind(DiscoveryService.class).to(BaseDiscoveryService.class);

    bind(OperatingSystemDetectionStrategy.class)
        .to(NameSubstringBasedOperatingSystemDetectionStrategy.class);
  }
508364
def _setup_configuration(self):
        
        self.configuration = dict(
            schema_cls=self.schema_cls,
            allowed_actions=self.allowed_actions,
            filter_by_fields=self.filter_by_fields,
            order_by_fields=self.order_by_fields,
            aggregate_by_fields=self.aggregate_by_fields,
            default_offset=self.default_offset,
            default_limit=self.default_limit)

        authentication = self.authentication_cls(schema_cls=self.schema_cls)
        authorization = self.authorization_cls(schema_cls=self.schema_cls)
        request_params_validation = self.request_params_validation_cls(
            schema_cls=self.schema_cls,
            filter_by_fields=self.filter_by_fields,
            order_by_fields=self.order_by_fields,
            aggregate_by_fields=self.aggregate_by_fields
        )
        schema_validation = self.schema_validation_cls(
            schema_cls=self.schema_cls)
        data_cleaner = self.data_cleaner_cls(schema_cls=self.schema_cls)
        entity_actions = self.entity_actions_cls(
            schema_cls=self.schema_cls,
            default_limit=self.default_limit,
            default_offset=self.default_offset)
        post_action_hooks = self.post_action_hooks_cls(
            schema_cls=self.schema_cls)
        response_converter = self.response_converter_cls(
            schema_cls=self.schema_cls)
        serializer = self.serializer_cls(schema_cls=self.schema_cls)

        self.configuration.update(dict(
            authentication=authentication,
            authorization=authorization,
            request_params_validation=request_params_validation,
            schema_validation=schema_validation,
            data_cleaner=data_cleaner,
            entity_actions=entity_actions,
            post_action_hooks=post_action_hooks,
            response_converter=response_converter,
            serializer=serializer))
758342
private <X> void populateRelationMetaData(EntityType entityType, Class<X> clazz, EntityMetadata metadata)
    {
        Set<Attribute> attributes = entityType.getAttributes();

        for (Attribute attribute : attributes)
        {
            if (attribute.isAssociation())
            {

                addRelationIntoMetadata(clazz, (Field) attribute.getJavaMember(), metadata);
            }
        }

    }
701331
protected function setup_metadata() {
		if ( ! $this->meta_type ) {
			return;
		}

		$metadata = $this->get_metadata();
		foreach ( $this->get_mapping() as $attribute => $meta ) {
			if ( isset( $metadata[ $meta ] ) ) {
				$this->set_attribute( $attribute, $metadata[ $meta ] );
			}
		}
	}
671254
protected function configure()
    {
        $this->bind()->annotatedWith(ImportAppConfig::class)->toInstance($this->importAppConfig);
        $this->bind(SchemeCollectionInterface::class)->toProvider(ImportSchemeCollectionProvider::class);
    }
594088
def set_metadata(self, metadata):
        
        if metadata is not None:
            metadata = np.array(metadata, copy=False).ravel()
        self.metadata = metadata
331276
protected function configure()
    {
        $this
            ->setDescription('Make a query')
            ->addArgument(
                'app-name',
                InputArgument::REQUIRED,
                'App name'
            )
            ->addArgument(
                'index-name',
                InputArgument::REQUIRED,
                'Index name'
            )
            ->addArgument(
                'query',
                InputArgument::OPTIONAL,
                'Query text',
                ''
            )
            ->addOption(
                'page',
                null,
                InputOption::VALUE_OPTIONAL,
                'Page',
                ModelQuery::DEFAULT_PAGE
            )
            ->addOption(
                'size',
                null,
                InputOption::VALUE_OPTIONAL,
                'Number of results',
                ModelQuery::DEFAULT_SIZE
            )
            ->addOption(
                'parameter',
                null,
                InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
                'Query parameters',
                []
            );
    }
367677
@Override
    public void addRelationIntoMetadata(Field relationField, EntityMetadata metadata)
    {
        // taking field's type as foreign entity, ignoring "targetEntity"
        Class<?> targetEntity = relationField.getType();

        ManyToOne ann = relationField.getAnnotation(ManyToOne.class);
        Relation relation = new Relation(relationField, targetEntity, null, ann.fetch(), Arrays.asList(ann.cascade()),
                ann.optional(), null, // mappedBy is null
                Relation.ForeignKey.MANY_TO_ONE);

        boolean isJoinedByFK = relationField.isAnnotationPresent(JoinColumn.class);

        if (relationField.isAnnotationPresent(AssociationOverride.class))
        {
            AssociationOverride annotation = relationField.getAnnotation(AssociationOverride.class);
            JoinColumn[] joinColumns = annotation.joinColumns();

            relation.setJoinColumnName(joinColumns[0].name());

        }
        else if (isJoinedByFK)
        {
            JoinColumn joinColumnAnn = relationField.getAnnotation(JoinColumn.class);
            relation.setJoinColumnName(StringUtils.isBlank(joinColumnAnn.name()) ? relationField.getName()
                    : joinColumnAnn.name());
        }
        else
        {
            relation.setJoinColumnName(relationField.getName());
        }

        relation.setBiDirectionalField(metadata.getEntityClazz());
        metadata.addRelation(relationField.getName(), relation);

    }
860115
public function addMetadata(Metadata $metadata)
    {
        if (isset($this->metadata[$metadata->getEntityClass()])) {
            throw new MetadataException(sprintf('Metadata for entity "%s" is already added.', $metadata->getEntityClass()));
        }

        $this->metadata[$metadata->getEntityClass()] = $metadata;
    }
1051420
public function merge(MetadataInterface $metadata): void
    {
        parent::merge($metadata);

        $this->customRepositoryClassName = $this->customRepositoryClassName ?? $metadata->customRepositoryClassName;
        $this->collectionName = $this->collectionName ?? $metadata->collectionName;
        $this->identifier = $this->identifier ?? $metadata->identifier;
        $this->idGeneratorType = $this->idGeneratorType ?? $metadata->idGeneratorType;

        $this->eagerFieldNames = array_unique(array_merge($this->eagerFieldNames, $metadata->eagerFieldNames));
        sort($this->eagerFieldNames);
    }
1192819
def initialize_fields(self):
        
        # # Pull all the "normal" fields off the model instance meta.
        for name, field in self.instance._meta.fields.items():
            if getattr(field, 'primary_key', False):
                continue
            self._meta.fields[name] = self.convert_field(name, field)

        # Many-to-many fields are not stored in the meta fields dict.
        # Pull them directly off the class.
        for name in dir(type(self.instance)):
            field = getattr(type(self.instance), name, None)
            if isinstance(field, ManyToManyField):
                self._meta.fields[name] = self.convert_field(name, field)

        super().initialize_fields()
745455
def set_meta(self, meta=None, **kwargs):
        '''
        
        '''
        if meta is None:
            meta = self.get_meta(**kwargs)
        setattr(self, '_meta', meta)
740628
protected void addEntityFieldsToDocument(EntityMetadata metadata, Object entity, Document document,
        MetamodelImpl metaModel) {
        String indexName = metadata.getIndexName();
        Map<String, PropertyIndex> indexProperties = metadata.getIndexProperties();
        for (String columnName : indexProperties.keySet()) {
            PropertyIndex index = indexProperties.get(columnName);
            java.lang.reflect.Field property = index.getProperty();
            String propertyName = index.getName();
            addFieldToDocument(entity, document, property, propertyName, indexName);
        }

        if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
            Object id = PropertyAccessorHelper.getId(entity, metadata);
            EmbeddableType embeddableId = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
            Set<Attribute> embeddedAttributes = embeddableId.getAttributes();
            indexCompositeKey(embeddedAttributes, metadata, id, document, metaModel);
        }
    }