Creates a relation between event and content_object.
        See EventRelation for help on distinction.
433967
def create_relation(self, event, content_object, distinction=''):
        
        return EventRelation.objects.create(
            event=event,
            distinction=distinction,
            content_object=content_object)
769605
public boolean process(ContentEvent event) {
        // distinguish between ClusteringContentEvent and ClusteringEvaluationContentEvent
        if (event instanceof ClusteringContentEvent) {
            ClusteringContentEvent cce = (ClusteringContentEvent) event;
            outputStream.put(event);
            if (cce.isSample()) {
                evaluationStream.put(new ClusteringEvaluationContentEvent(null, new DataPoint(cce.getInstance(), numInstances++), cce.isLastEvent()));
            }
        } else if (event instanceof ClusteringEvaluationContentEvent) {
            evaluationStream.put(event);
        }
        return true;
    }
197990
def create(cls, receiver_id, user_id=None):
        """"""
        event = cls(id=uuid.uuid4(), receiver_id=receiver_id, user_id=user_id)
        event.payload = event.receiver.extract_payload()
        return event
873836
def AddEventSource(self, event_source):
    
    self._RaiseIfNotWritable()

    self._AddAttributeContainer(
        self._CONTAINER_TYPE_EVENT_SOURCE, event_source)
1083009
public boolean addRelatedObject(String objectType, String id, String content)
    {
        Map<String, Object> container = new HashMap<String, Object>();
        
        if (objectType != null)
        {
            container.put("objectType", objectType);
        }
        else
        {
            return false;
        }
        if (id != null)
        {
            container.put("id", id);
        }
        if (content != null)
        {
            container.put("content", content);
        }

        related.add(container);
        return true;
    }
189813
def record(self,
               event_type: str,
               event_data: Mapping = None,
               instance: Any = None,
               **kwargs) -> 'Event':
        
        if not self.is_setup:
            return
        if not self.can_handle(event_type=event_type):
            return

        event = self.get_event(event_type=event_type,
                               event_data=event_data,
                               instance=instance,
                               **kwargs)
        self.record_event(event)
        return event
1286660
def item_from_event(self, domain_event):
        
        item_args = self.construct_item_args(domain_event)
        return self.construct_sequenced_item(item_args)
869769
def _create_update_tracking_related_event(instance):
    
    events = {}
    # Create a dict mapping related model field to modified fields
    for field, related_fields in instance._tracked_related_fields.items():
        if not isinstance(instance._meta.get_field(field), ManyToManyField):
            if isinstance(instance._meta.get_field(field), ForeignKey):
                # Compare pk
                value = getattr(instance, '{0}_id'.format(field))
            else:
                value = getattr(instance, field)
            if instance._original_fields[field] != value:
                for related_field in related_fields:
                    events.setdefault(related_field, []).append(field)

    # Create the events from the events dict
    for related_field, fields in events.items():
        try:
            related_instances = getattr(instance, related_field[1])
        except ObjectDoesNotExist:
            continue

        # FIXME: isinstance(related_instances, RelatedManager ?)
        if hasattr(related_instances, 'all'):
            related_instances = related_instances.all()
        else:
            related_instances = [related_instances]
        for related_instance in related_instances:
            event = _create_event(related_instance, UPDATE)
            for field in fields:
                fieldname = '{0}__{1}'.format(related_field[0], field)
                _create_tracked_field(
                    event, instance, field, fieldname=fieldname
                )
1207857
static function removeRelationObject( $contentObjectAttribute, $deletionItem )
    {
        if ( self::isItemPublished( $deletionItem ) )
        {
            return;
        }

        $hostObject = $contentObjectAttribute->attribute( 'object' );
        $hostObjectID = $hostObject->attribute( 'id' );

        // Do not try removing the object if present in trash
        // Only objects being really orphaned (not even being in trash) should be removed by this method.
        // See issue #019457
        if (
            (int)eZPersistentObject::count(
                eZContentObjectTrashNode::definition(),
                array( "contentobject_id" => $hostObjectID )
            ) > 0
        )
        {
            return;
        }

        $hostObjectVersions = $hostObject->versions();
        $isDeletionAllowed = true;

        // check if the relation item to be deleted is unique in the domain of all host-object versions
        foreach ( $hostObjectVersions as $version )
        {
            if ( $isDeletionAllowed and
                 $version->attribute( 'version' ) != $contentObjectAttribute->attribute( 'version' ) )
            {
                $relationAttribute = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(),
                                                                           null,
                                                                           array( 'version' => $version->attribute( 'version' ),
                                                                                  'contentobject_id' => $hostObjectID,
                                                                                  'contentclassattribute_id' => $contentObjectAttribute->attribute( 'contentclassattribute_id' ) ) );

                if ( count( $relationAttribute ) > 0 )
                {
                    $relationContent = $relationAttribute[0]->content();
                    if ( is_array( $relationContent ) and
                         is_array( $relationContent['relation_list'] ) )
                    {
                        foreach( $relationContent['relation_list'] as $relationItem )
                        {
                            if ( $deletionItem['contentobject_id'] == $relationItem['contentobject_id'] &&
                                 $deletionItem['contentobject_version'] == $relationItem['contentobject_version'] )
                            {
                                $isDeletionAllowed = false;
                                break 2;
                            }
                        }
                    }
                }
            }
        }

        if ( $isDeletionAllowed )
        {
            $subObjectVersion = eZContentObjectVersion::fetchVersion( $deletionItem['contentobject_version'],
                                                                      $deletionItem['contentobject_id'] );
            if ( $subObjectVersion instanceof eZContentObjectVersion )
            {
                $subObjectVersion->removeThis();
            }
            else
            {
                eZDebug::writeError( 'Cleanup of subobject-version failed. Could not fetch object from relation list.\n' .
                                     'Requested subobject id: ' . $deletionItem['contentobject_id'] . '\n' .
                                     'Requested Subobject version: ' . $deletionItem['contentobject_version'],
                                     __METHOD__ );
            }
        }
    }
672153
def new_event(event):
    
    op_name = event.EventType.DESCRIPTOR.values_by_number[event.type].name
    if op_name == 'PUT':
        cls = PutEvent
    elif op_name == 'DELETE':
        cls = DeleteEvent
    else:
        raise Exception('Invalid op_name')

    return cls(event)
951118
function(view, event_name, event_object) {

		var targets = view.getContainer().getEventTargets(event_name);

		if (targets) {

			this.dispatchEvent(view, event_name, event_object, targets);

		}

	}
278107
private function createEventFromResponseContent(array $content): Event
    {
        $type = $content['eventType'];
        $version = (int) $content['eventNumber'];
        $data = $content['data'];
        $metadata = (!empty($content['metadata'])) ? $content['metadata'] : null;
        $eventId = (!empty($content['eventId']) ? UUID::fromNative($content['eventId']) : null);

        return new Event($type, $version, $data, $metadata, $eventId);
    }
915899
function (contentIndex) {
    var itemViewClass, childView;

    itemViewClass = this.itemViewForIndex(contentIndex);
    childView = this.createChildView(itemViewClass);
    this.pushObject(childView);
  }
1206338
function _connect(nodeOrId, event, eventHandler) {
		var node = lib.node(nodeOrId);
		if (node) {
			node.addEventListener(event, eventHandler, false);
		}
	}
480252
def create_event(self, event):
        
        ev = api.Event.create(self.journal.collection, event)
        ev.save()
838570
def prime_event(event, source, **kwargs):
    
    if not isinstance(event, Event):
        event = Event(event, source=source, **kwargs)

    return event
282655
function(self, eventType, content) {
    return self.client.sendEvent(self.roomId, eventType, content);
}