Method to add specific relation name for given relational field.

@param rField
relation object.
768217
private void addRelationName(Relation rField)
    {
        if (rField != null && !rField.isRelatedViaJoinTable())
        {
            String relationName = getJoinColumnName(rField.getProperty());
            if (rField.getProperty().isAnnotationPresent(PrimaryKeyJoinColumn.class))
            {
                relationName = this.getIdAttribute().getName();
            }

            addToRelationNameCollection(relationName);
        }
    }
160422
public void addField(JMFType field) {
    if (field == null)
      throw new NullPointerException("Tuple field cannot be null");
    JSType newField = (JSType)field;
    if (fields == null)
      fields = new JSType[1];
    else {
      JSType[] oldFields = fields;
      fields = new JSType[oldFields.length + 1];
      System.arraycopy(oldFields, 0, fields, 0, oldFields.length);
    }
    newField.parent = this;
    newField.siblingPosition = fields.length - 1;
    fields[newField.siblingPosition] = newField;
  }
1209582
private void addJoinTable(List<Relation> relations)
    {
        for (Relation relation : relations)
        {
            if (relation.getType().equals(ForeignKey.MANY_TO_MANY) && relation.isRelatedViaJoinTable())
            {
                String joinTableName = relation.getJoinTableMetadata().getJoinTableName();
                String hTableName = HBaseUtils.getHTableName(databaseName, joinTableName);
                HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(hTableName));
                tableDescriptor.addFamily(new HColumnDescriptor(joinTableName));
                createOrUpdateTable(hTableName, tableDescriptor);
            }
        }
    }
590113
def extract_relation_instance(cls, field_name, field, resource_instance, serializer):
        
        relation_instance = None

        try:
            relation_instance = getattr(resource_instance, field_name)
        except AttributeError:
            try:
                # For ManyRelatedFields if `related_name` is not set
                # we need to access `foo_set` from `source`
                relation_instance = getattr(resource_instance, field.child_relation.source)
            except AttributeError:
                if hasattr(serializer, field.source):
                    serializer_method = getattr(serializer, field.source)
                    relation_instance = serializer_method(resource_instance)
                else:
                    # case when source is a simple remap on resource_instance
                    try:
                        relation_instance = getattr(resource_instance, field.source)
                    except AttributeError:
                        pass

        return relation_instance
783958
public void addRelation(RelationType relationType, RelationDirection direction) {
	int idx = relationType.ordinal();
	directions[idx] = directions[idx].sum(direction);
    }
140062
protected function collectRelations($field, $name)
    {
        if ($field instanceof HasOne && $field->hasRelation()) {
            $relation = $field->getRelation();
            $this->relations[$relation][$name] = $this->input($name);
        }

        if ($field->hasRelation()) {
            $relation = $field->getRelation();

            // register relation
            if (!array_has($this->relations, $relation)) {
                $this->relations[$relation] = [];
            }

            if (!$field->getTranslatable()) {
                $this->relations[$relation][$name] = $this->input("{$relation}.{$name}");
            }
        }
    }
1177266
def add_relation(app_f, app_t, weight=1):
        '''
        
        '''
        recs = TabRel.select().where(
            (TabRel.post_f_id == app_f) & (TabRel.post_t_id == app_t)
        )
        if recs.count() > 1:
            for record in recs:
                MRelation.delete(record.uid)

        if recs.count() == 0:
            uid = tools.get_uuid()
            entry = TabRel.create(
                uid=uid,
                post_f_id=app_f,
                post_t_id=app_t,
                count=1,
            )
            return entry.uid
        elif recs.count() == 1:
            MRelation.update_relation(app_f, app_t, weight)
        else:
            return False
635967
public void addField(CmsSearchField field) {

        if ((field != null) && (field.getName() != null)) {
            m_fields.put(field.getName(), field);
        }
    }
111115
def _track_class_related_field(cls, field):
    
    # field = field on current model
    # related_field = field on related model
    (field, related_field) = field.split('__', 1)
    field_obj = cls._meta.get_field(field)
    related_cls = field_obj.remote_field.model
    related_name = field_obj.remote_field.get_accessor_name()

    if not hasattr(related_cls, '_tracked_related_fields'):
        setattr(related_cls, '_tracked_related_fields', {})
    if related_field not in related_cls._tracked_related_fields.keys():
        related_cls._tracked_related_fields[related_field] = []

    # There can be several field from different or same model
    # related to a single model.
    # Thus _tracked_related_fields will be of the form:
    # {
    #     'field name on related model': [
    #         ('field name on current model', 'field name to current model'),
    #         ('field name on another model', 'field name to another model'),
    #         ...
    #     ],
    #     ...
    # }

    related_cls._tracked_related_fields[related_field].append(
        (field, related_name)
    )
    _add_signals_to_cls(related_cls)
    # Detect m2m fields changes
    if isinstance(related_cls._meta.get_field(related_field), ManyToManyField):
        m2m_changed.connect(
            tracking_m2m,
            sender=getattr(related_cls, related_field).through,
            dispatch_uid=repr(related_cls),
        )
1254203
public final FacetOptions addFacetOnFlieldnames(Collection<String> fieldnames) {
		Assert.notNull(fieldnames, "Fieldnames must not be null!");

		for (String fieldname : fieldnames) {
			addFacetOnField(fieldname);
		}
		return this;
	}
809913
private void addRelations(List<RelationHolder> rlHolders, Map<String, Object> values)
    {
        if (rlHolders != null)
        {
            for (RelationHolder relation : rlHolders)
            {
                values.put(relation.getRelationName(), relation.getRelationValue());
            }
        }
    }
1028016
function addForeignValidator(fieldValidator, relation, _ignoreCallback) {
    let relObj = this.model(relation.name, true),
      relPrimary = relObj.getPrimary(),
      relName = relation.options.foreignKey.name;
    if (relPrimary) {
      addValidator(fieldValidator, relName, relPrimary);
    }
    fieldValidator[relName].fieldName = relName;
    if (relation.options.foreignKey.allowNull) {
      fieldValidator[relName].default(null);
    }
    if (_ignoreCallback === true) return fieldValidator[relName];
    // query the model when an incoming request containing the id comes.
    fieldValidator[relName].callback((val, done) => {
      if (val == null) return done();
      if (typeof val === 'object' && typeof val.get === 'function') return done(null, val); // it was previously queried and fetched.
      let RelModel = this.model(relation.name);
      let where = {};
      if (typeof val === 'function') val = val();
      where[relPrimary.fieldName] = val;
      RelModel.find({
        where: where,
        attributes: [relPrimary.fieldName]  // we just check for existance.
      }).then((rObj) => {
        if (!rObj) {
          return done(thorin.error('INPUT.NOT_VALID', 'Invalid reference for ' + relName, 404));
        }
        done(null, rObj.get(relPrimary.fieldName));  //return with the id
      }).catch((e) => {
        done(thorin.error(e));
      });
    });
    return fieldValidator[relName];
  }
204654
private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException
   {
      int index = 0;
      int length = relationship.length();

      //
      // Extract the identifier
      //
      while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true))
      {
         ++index;
      }

      Integer taskID;
      try
      {
         taskID = Integer.valueOf(relationship.substring(0, index));
      }

      catch (NumberFormatException ex)
      {
         throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
      }

      //
      // Now find the task, so we can extract the unique ID
      //
      Task targetTask;
      if (field == TaskField.PREDECESSORS)
      {
         targetTask = m_projectFile.getTaskByID(taskID);
      }
      else
      {
         targetTask = m_projectFile.getTaskByUniqueID(taskID);
      }

      //
      // If we haven't reached the end, we next expect to find
      // SF, SS, FS, FF
      //
      RelationType type = null;
      Duration lag = null;

      if (index == length)
      {
         type = RelationType.FINISH_START;
         lag = Duration.getInstance(0, TimeUnit.DAYS);
      }
      else
      {
         if ((index + 1) == length)
         {
            throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
         }

         type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2));

         index += 2;

         if (index == length)
         {
            lag = Duration.getInstance(0, TimeUnit.DAYS);
         }
         else
         {
            if (relationship.charAt(index) == '+')
            {
               ++index;
            }

            lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale);
         }
      }

      if (type == null)
      {
         throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
      }

      // We have seen at least one example MPX file where an invalid task ID
      // is present. We'll ignore this as the schedule is otherwise valid.
      if (targetTask != null)
      {
         Relation relation = sourceTask.addPredecessor(targetTask, type, lag);
         m_eventManager.fireRelationReadEvent(relation);
      }
   }
1113547
public void add(final Field _field)
    {
        this.fields.put(_field.getId(), _field);
        this.fieldName2Field.put(_field.getName(), _field);
        if (_field.getReference() != null && _field.getReference().length() > 0) {
            final String ref = _field.getReference();
            int index;
            int end = 0;
            while ((index = ref.indexOf("$<", end)) > 0) {
                index += 2;
                end = ref.indexOf(">", index);
                addFieldExpr(ref.substring(index, end));
            }
        }
        _field.setCollectionUUID(getUUID());
    }
1132684
private String getJoinColumnName(Field relation)
    {
        String columnName = null;
        JoinColumn ann = relation.getAnnotation(JoinColumn.class);
        if (ann != null)
        {
            columnName = ann.name();

        }
        return StringUtils.isBlank(columnName) ? relation.getName() : columnName;
    }
175157
private void populateRelationList(Task task, TaskField field, String data)
   {
      DeferredRelationship dr = new DeferredRelationship();
      dr.setTask(task);
      dr.setField(field);
      dr.setData(data);
      m_deferredRelationships.add(dr);
   }
120164
public void addRelationship(int linkType, Record recLeft, Record recRight, String fldLeft1, String fldRight1, String fldLeft2, String fldRight2, String fldLeft3, String fldRight3)
    {
        new TableLink(this, linkType, recLeft, recRight, fldLeft1, fldRight1, fldLeft2, fldRight2, fldLeft3, fldRight3);
    }