/// <summary> /// Resolve the Event Destination for any K2 FinancialAuthorisation tasks for the given Claim Transaction Header ID /// </summary> /// <param name="processName">Process Name</param> /// <param name="componentId">Componet ID</param> /// <param name="eventDestination">output Event Destination</param> /// <returns>True / False</returns> private bool TryFindEventDestinationForProcess(string processName, long componentId, out IEventDestination eventDestination) { // Get a link to the TaskService (K2) var taskService = ObjectFactory.Resolve<ITaskService>(); long systemComponentId = SystemComponentConstants.ClaimTransaction; if (_Logger.IsDebugEnabled) { _Logger.Debug(string.Format("FindProcessEvents({0}, {1}, {2})", processName, componentId, systemComponentId)); } // Find all tasks for the Process Name (FinancialAuthorisation), the Claim Transaction Header ID for Claim Transactions (system Component) var processEvents = taskService.FindProcessEvents(processName, componentId, systemComponentId); if (processEvents == null || processEvents.Count() == 0) { if (_Logger.IsDebugEnabled) { _Logger.Debug(string.Format("TryFindEventDestinationForProcess({0}, {1}) - no process event found", processName, componentId.ToString())); } // Return null if we have no tasks. eventDestination = null; return false; } else if (processEvents.Count() > 1) { if (_Logger.IsDebugEnabled) { _Logger.Debug(string.Format("TryFindEventDestinationForProcess({0}, {1}) - Found more than one process event", processName, componentId.ToString())); } // Return null if we have multiple tasks eventDestination = null; return false; } // We have ONE task so get the Event Destination from it. var eventDestinations = taskService.GetEventDestinationsForProcessEvent(processEvents.Single().ProcessEventID); if (eventDestinations.Count() == 0) { if (_Logger.IsDebugEnabled) { _Logger.Debug(string.Format("TryFindEventDestinationForProcess({0}, {1}) - No EventDestination found", processName, componentId.ToString())); } // No destination user so return null eventDestination = null; return false; } // Return the Event Destination eventDestination = eventDestinations.First(); return true; }
public DogExceptions(IEventDestination eventDestination) { _eventDestination = eventDestination; }