public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (this.GetType() != obj.GetType()) { return(false); } IncidentEntity other = (IncidentEntity)obj; if (string.ReferenceEquals(id, null)) { if (!string.ReferenceEquals(other.id, null)) { return(false); } } else if (!id.Equals(other.id)) { return(false); } return(true); }
/// <summary> /// Instantiate recursive a new incident a super execution /// (i.e. super process instance) which is affected from this /// incident. /// For example: a super process instance called via CallActivity /// a new process instance on which an incident happened, so that /// the super process instance has an incident too. /// </summary> protected internal virtual void createRecursiveIncidents(string rootCauseIncidentId, IList <IncidentEntity> createdIncidents) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final ExecutionEntity execution = getExecution(); ExecutionEntity execution = Execution; if (execution != null) { ExecutionEntity superExecution = execution.getProcessInstance().getSuperExecution(); if (superExecution != null) { // create a new incident IncidentEntity newIncident = create(incidentType); newIncident.Execution = superExecution; newIncident.ActivityId = superExecution.CurrentActivityId; newIncident.ProcessDefinitionId = superExecution.ProcessDefinitionId; newIncident.TenantId = superExecution.TenantId; // set cause and root cause newIncident.CauseIncidentId = id; newIncident.RootCauseIncidentId = rootCauseIncidentId; // insert new incident (and create a new historic incident) insert(newIncident); // add new incident to result set createdIncidents.Add(newIncident); newIncident.createRecursiveIncidents(rootCauseIncidentId, createdIncidents); } } }
protected internal static void insert(IncidentEntity incident) { // persist new incident Context.CommandContext.DbEntityManager.insert(incident); incident.fireHistoricIncidentEvent(HistoryEventTypes.INCIDENT_CREATE); }
public static IncidentEntity createAndInsertIncident(string incidentType, IncidentContext context, string message) { // create new incident IncidentEntity newIncident = create(incidentType); newIncident.IncidentMessage = message; // set properties from incident context newIncident.Configuration = context.Configuration; newIncident.ActivityId = context.ActivityId; newIncident.ProcessDefinitionId = context.ProcessDefinitionId; newIncident.TenantId = context.TenantId; newIncident.JobDefinitionId = context.JobDefinitionId; if (!string.ReferenceEquals(context.ExecutionId, null)) { // fetch execution ExecutionEntity execution = Context.CommandContext.ExecutionManager.findExecutionById(context.ExecutionId); if (execution != null) { // link incident with execution newIncident.Execution = execution; } else { LOG.executionNotFound(context.ExecutionId); } } // insert new incident (and create a new historic incident) insert(newIncident); return(newIncident); }
protected internal static IncidentEntity create(string incidentType) { string incidentId = Context.ProcessEngineConfiguration.DbSqlSessionFactory.IdGenerator.NextId; // decorate new incident IncidentEntity newIncident = new IncidentEntity(); newIncident.Id = incidentId; newIncident.IncidentTimestamp = ClockUtil.CurrentTime; newIncident.IncidentType = incidentType; newIncident.CauseIncidentId = incidentId; newIncident.RootCauseIncidentId = incidentId; return(newIncident); }
protected internal virtual void remove(bool resolved) { ExecutionEntity execution = Execution; if (execution != null) { // Extract possible super execution of the assigned execution ExecutionEntity superExecution = null; if (execution.Id.Equals(execution.ProcessInstanceId)) { superExecution = execution.getSuperExecution(); } else { superExecution = execution.getProcessInstance().getSuperExecution(); } if (superExecution != null) { // get the incident, where this incident is the cause IncidentEntity parentIncident = superExecution.getIncidentByCauseIncidentId(Id); if (parentIncident != null) { // remove the incident parentIncident.remove(resolved); } } // remove link to execution execution.removeIncident(this); } // always delete the incident Context.CommandContext.DbEntityManager.delete(this); // update historic incident HistoryEventType eventType = resolved ? HistoryEventTypes.INCIDENT_RESOLVE : HistoryEventTypes.INCIDENT_DELETE; fireHistoricIncidentEvent(eventType); }
public HistoryEventCreatorAnonymousInnerClass(IncidentEntity outerInstance, HistoryEventType eventType) { this.outerInstance = outerInstance; this.eventType = eventType; }