pub struct OcpmEvent {Show 15 fields
pub event_id: Uuid,
pub activity_id: String,
pub activity_name: String,
pub timestamp: DateTime<Utc>,
pub lifecycle: EventLifecycle,
pub resource_id: String,
pub resource_name: Option<String>,
pub company_code: String,
pub object_refs: Vec<EventObjectRef>,
pub attributes: HashMap<String, ObjectAttributeValue>,
pub document_ref: Option<String>,
pub journal_entry_id: Option<Uuid>,
pub is_anomaly: bool,
pub anomaly_type: Option<String>,
pub case_id: Option<Uuid>,
}Expand description
An event instance in OCPM event log.
Fields§
§event_id: UuidUnique event ID
activity_id: StringActivity type that occurred
activity_name: StringActivity name (for convenience)
timestamp: DateTime<Utc>Event timestamp
lifecycle: EventLifecycleLifecycle transition (Start, Complete, Abort, etc.)
resource_id: StringResource (user/system) that performed the event
resource_name: Option<String>Resource name (for convenience)
company_code: StringCompany code
object_refs: Vec<EventObjectRef>Objects involved in this event (many-to-many)
attributes: HashMap<String, ObjectAttributeValue>Event attributes
document_ref: Option<String>Related document reference (JE, PO number, etc.)
journal_entry_id: Option<Uuid>Related journal entry ID
is_anomaly: boolAnomaly flag
anomaly_type: Option<String>Anomaly type if applicable
case_id: Option<Uuid>Case ID for process instance tracking
Implementations§
Source§impl OcpmEvent
impl OcpmEvent
Sourcepub fn new(
activity_id: &str,
activity_name: &str,
timestamp: DateTime<Utc>,
resource_id: &str,
company_code: &str,
) -> Self
pub fn new( activity_id: &str, activity_name: &str, timestamp: DateTime<Utc>, resource_id: &str, company_code: &str, ) -> Self
Create a new event.
Sourcepub fn with_lifecycle(self, lifecycle: EventLifecycle) -> Self
pub fn with_lifecycle(self, lifecycle: EventLifecycle) -> Self
Set the lifecycle phase.
Sourcepub fn with_resource_name(self, name: &str) -> Self
pub fn with_resource_name(self, name: &str) -> Self
Set the resource name.
Sourcepub fn with_object(self, object_ref: EventObjectRef) -> Self
pub fn with_object(self, object_ref: EventObjectRef) -> Self
Add an object reference.
Sourcepub fn with_objects(self, refs: Vec<EventObjectRef>) -> Self
pub fn with_objects(self, refs: Vec<EventObjectRef>) -> Self
Add multiple object references.
Sourcepub fn with_attribute(self, key: &str, value: ObjectAttributeValue) -> Self
pub fn with_attribute(self, key: &str, value: ObjectAttributeValue) -> Self
Add an attribute.
Sourcepub fn with_document_ref(self, doc_ref: &str) -> Self
pub fn with_document_ref(self, doc_ref: &str) -> Self
Set document reference.
Sourcepub fn with_journal_entry(self, je_id: Uuid) -> Self
pub fn with_journal_entry(self, je_id: Uuid) -> Self
Set journal entry ID.
Sourcepub fn mark_anomaly(&mut self, anomaly_type: &str)
pub fn mark_anomaly(&mut self, anomaly_type: &str)
Mark as anomalous.
Sourcepub fn object_ids(&self) -> Vec<Uuid>
pub fn object_ids(&self) -> Vec<Uuid>
Get all object IDs involved in this event.
Sourcepub fn objects_of_type(&self, type_id: &str) -> Vec<&EventObjectRef>
pub fn objects_of_type(&self, type_id: &str) -> Vec<&EventObjectRef>
Get object refs of a specific type.
Sourcepub fn creates_objects(&self) -> bool
pub fn creates_objects(&self) -> bool
Check if this event creates any object.
Sourcepub fn completes_objects(&self) -> bool
pub fn completes_objects(&self) -> bool
Check if this event completes any object.