This will set the association ID based on the internal parts
        of the association.
        To be used in cases where an external association identifier
        should be used.

        :param assoc_id:

        :return:
428366
def set_association_id(self, assoc_id=None):
        
        if assoc_id is None:
            self.assoc_id = self.make_association_id(
                self.definedby, self.sub, self.rel, self.obj)
        else:
            self.assoc_id = assoc_id

        return self.assoc_id
1001331
def association_chain
        @association_chain ||=
          symbols_for_association_chain.inject([begin_of_association_chain]) do |chain, symbol|
            chain << evaluate_parent(symbol, resources_configuration[symbol], chain.last)
          end.compact.freeze
      end
110422
def associate_by_user_id(backend, details, response, user=None, *args, **kwargs):
    
    if user:
        return None

    user_id = response.get('id')
    if user_id:
        # Try to associate accounts registered with the same Google user_id.
        for provider in ('google-appengine-oauth', 'google-appengine-oauth2'):
            social = backend.strategy.storage.user.get_social_auth(provider, user_id)
            if social:
                user = social.user
                if user:
                    return {'user': user}
605175
async function _setAssociation(
  ownerModel,
  ownerObject,
  childModel,
  childId,
  associationName,
  payload,
  Log
) {
  let childObject

  childObject = await childModel.findOne({ _id: childId })
  if (childObject) {
    let association = ownerModel.routeOptions.associations[associationName]
    let extraFields = false
    if (association.type === 'ONE_MANY') {
      // EXPL: one-many associations are virtual, so only update the child reference
      childObject[association.foreignField] = ownerObject._id
      await childObject.save()
    } else if (association.type === 'MANY_MANY') {
      // EXPL: the payload is an array of Ids. No extra fields
      if (
        typeof payload[0] === 'string' ||
        payload[0] instanceof String ||
        payload[0]._bsontype === 'ObjectID'
      ) {
        payload = {}

        extraFields = false
      } else {
        payload = payload.filter(object => {
          // EXPL: the payload contains extra fields
          return object.childId.toString() === childObject._id.toString()
        })

        payload = payload[0]

        payload = Object.assign({}, payload) // EXPL: break the reference to the original payload

        delete payload.childId

        extraFields = true
      }

      // EXPL: if linking models aren't embeded, just upsert the linking model collection
      let embedAssociation =
        association.embedAssociation === undefined
          ? config.embedAssociations
          : association.embedAssociation
      if (!embedAssociation) {
        const linkingModel = association.include.through
        let query = {}
        query[ownerModel.modelName] = ownerObject._id
        query[childModel.modelName] = childObject._id

        payload[ownerModel.modelName] = ownerObject._id
        payload[childModel.modelName] = childObject._id

        await linkingModel.findOneAndUpdate(query, payload, {
          new: true,
          upsert: true,
          runValidators: config.enableMongooseRunValidators
        })
      } else {
        payload[childModel.modelName] = childObject._id

        let duplicate = ownerObject[associationName].filter(
          associationObject => {
            return (
              associationObject[childModel.modelName].toString() ===
              childId.toString()
            )
          }
        )
        duplicate = duplicate[0]

        let duplicateIndex = ownerObject[associationName].indexOf(duplicate)

        if (duplicateIndex < 0) {
          // EXPL: if the association doesn't already exist, create it, otherwise update the extra fields
          ownerObject[associationName].push(payload)
        } else if (extraFields) {
          // EXPL: only update if there are extra fields TODO: reference MANY_MANY bug where updating association that's just an id (i.e. no extra fields) causes an error and reference this as the fix
          payload._id = ownerObject[associationName][duplicateIndex]._id // EXPL: retain the association instance id for consistency
          ownerObject[associationName][duplicateIndex] = payload
        }

        payload = Object.assign({}, payload) // EXPL: break the reference to the original payload
        delete payload._id

        delete payload[childModel.modelName]
        payload[ownerModel.modelName] = ownerObject._id
        let childAssociation = {}
        let childAssociations = childModel.routeOptions.associations
        for (let childAssociationKey in childAssociations) {
          let association = childAssociations[childAssociationKey]
          if (
            association.model === ownerModel.modelName &&
            association.type === 'MANY_MANY'
          ) {
            // TODO: Add issue referencing a conflict when a model has two associations of the same model and one is a MANY_MANY, and reference this change as the fix
            childAssociation = association
          }
        }

        if (!childAssociation.include) {
          throw Boom.badRequest(
            'Missing association between ' +
              ownerModel.modelName +
              ' and ' +
              childModel.modelName +
              '.'
          )
        }

        let childAssociationName = childAssociation.include.as

        if (!childObject[childAssociationName]) {
          throw Boom.badRequest(
            childAssociationName + ' association does not exist.'
          )
        }

        duplicate = childObject[childAssociationName].filter(
          associationObject => {
            return (
              associationObject[ownerModel.modelName].toString() ===
              ownerObject._id.toString()
            )
          }
        )
        duplicate = duplicate[0]

        duplicateIndex = childObject[childAssociationName].indexOf(duplicate)

        if (duplicateIndex < 0) {
          // EXPL: if the association doesn't already exist, create it, otherwise update the extra fields
          childObject[childAssociationName].push(payload)
        } else {
          payload._id = childObject[childAssociationName][duplicateIndex]._id // EXPL: retain the association instance id for consistency
          childObject[childAssociationName][duplicateIndex] = payload
        }

        await Promise.all([
          ownerModel.findByIdAndUpdate(ownerObject._id, ownerObject, {
            runValidators: config.enableMongooseRunValidators
          }),
          childModel.findByIdAndUpdate(childObject._id, childObject, {
            runValidators: config.enableMongooseRunValidators
          })
        ])
      }
    } else if (association.type === '_MANY') {
      let duplicate = ownerObject[associationName].filter(_childId => {
        return _childId.toString() === childId.toString()
      })
      duplicate = duplicate[0]

      let duplicateIndex = ownerObject[associationName].indexOf(duplicate)

      if (duplicateIndex < 0) {
        // EXPL: if the association doesn't already exist, create it
        ownerObject[associationName].push(childId)
      }

      await Promise.all([
        ownerModel.findByIdAndUpdate(ownerObject._id, ownerObject, {
          runValidators: config.enableMongooseRunValidators
        })
      ])
    } else {
      throw Boom.badRequest('Association type incorrectly defined.')
    }
  } else {
    throw Boom.notFound('Child object not found.')
  }
}
35290
public void setAssociationIds(java.util.Collection<String> associationIds) {
        if (associationIds == null) {
            this.associationIds = null;
            return;
        }

        this.associationIds = new com.amazonaws.internal.SdkInternalList<String>(associationIds);
    }
656785
def reference_id_parts(reference_id):
    
    m = consts.REFERENCE_ID_PATTERN.match(reference_id)
    if m:
        return m.groups()
    raise ValueError('Illegal reference identifier: "%s"' % reference_id)
621483
def habtm_assoc_ids(habtm_assoc)
      current = @record.send(habtm_assoc.name).to_a.map(&:id) # TODO: `pluck` would use less memory
      removed = @record.paper_trail_habtm.try(:[], habtm_assoc.name).try(:[], :removed) || []
      added = @record.paper_trail_habtm.try(:[], habtm_assoc.name).try(:[], :added) || []
      current + removed - added
    end
763342
def monitor_association_changes(association)
      define_method "#{association}=" do |value|
        attribute_will_change!(association.to_s) if _association_will_change?(association, value)
        super(value)
      end

      ids = "#{association.to_s.singularize}_ids"

      define_method "#{ids}=" do |value|
        attribute_will_change!(association.to_s) if _ids_will_change?(ids, value)
        super(value)
      end

      define_method "#{association}_attributes=" do |value|
        attribute_will_change!(association.to_s) if _nested_attributes_will_change?(value)
        super(value)
      end

      [association, ids].each do |name|
        define_method "#{name}_change" do
          changes[name]
        end

        define_method "#{name}_changed?" do
          changes.has_key?(association.to_s)
        end

        define_method "#{name}_previously_changed?" do
          previous_changes.has_key?(association.to_s)
        end
      end
    end
875809
def associate(self, eip_or_aid,
                  instance_id='', network_interface_id='', private_ip=''):
        
        if "." in eip_or_aid:               # If an IP is given (Classic)
            return self.call("AssociateAddress",
                             PublicIp=eip_or_aid,
                             InstanceId=instance_id,
                             NetworkInterfaceId=network_interface_id,
                             PrivateIpAddress=private_ip)
        else:                               # If an AID is given (VPC)
            return self.call("AssociateAddress",
                             AllocationId=eip_or_aid,
                             InstanceId=instance_id,
                             NetworkInterfaceId=network_interface_id,
                             PrivateIpAddress=private_ip)
759835
def _association(args, default_options={})
      return if options.nil?

      options = args.first

      if options.is_a?(Hash)
        options     = {}.merge(options)
        name        = options.keys.first
        properties  = options.delete(name)

        @associations[name] = default_options.merge({ :include => properties }).merge(options)
      elsif options.is_a?(Array)
        options.each do |option|
          association option
        end
      else
        @associations[options] = args[1] || {}
      end
    end
592860
function associationKey($server_url, $handle = null) 
    {
        return $this->prefix .
               'openid_association_' .
               sha1($server_url) . '_' . sha1($handle);
    }
845749
def set_id id
      @id = id
      if @id.nil?
        t = Time.now
        parts = %w[y m d H M S Z].map{ |p| t.strftime "%#{p}" }
        @id = "experiment_#{parts.join('_')}"
      end
    end
765402
def get_associations(self, env):
        

        if env.is_root:
            return None

        associations = self.associations.get_all()
        return [assoc for assoc in associations
                if associations[assoc] == self._get_view_path(env)]
413413
def module_set_id(self) -> str:
        
        fnames = sorted(["@".join(m) for m in self.schema_data.modules])
        return hashlib.sha1("".join(fnames).encode("ascii")).hexdigest()
852375
def chk_associations(self, fout_err="gaf.err"):
        """"""
        obj = GafData("2.1")
        return obj.chk(self.associations, fout_err)
1215712
def openid_associate(self, request):
        
        # XXX: TESTME
        assoc_type = request.assoc_type
        session_type = request.session.session_type
        if self.negotiator.isAllowed(assoc_type, session_type):
            assoc = self.signatory.createAssociation(dumb=False,
                                                     assoc_type=assoc_type)
            return request.answer(assoc)
        else:
            message = ('Association type %r is not supported with '
                       'session type %r' % (assoc_type, session_type))
            (preferred_assoc_type, preferred_session_type) = \
                                   self.negotiator.getAllowedType()
            return request.answerUnsupported(
                message,
                preferred_assoc_type,
                preferred_session_type)
683535
def set_id(self, dxid):
        '''
        
        '''
        if dxid is not None:
            verify_string_dxid(dxid, self._class)

        self._dxid = dxid