/// <summary> /// Inserts a batch of event annotations. /// </summary> /// <param name="workflowInstanceSummary"> /// A <see cref="WorkflowInstanceSummary" /> representing a workflow instance /// aInt64 with all its type information. /// </param> /// <param name="type"> /// The type of tracking record to associate the annotations with. /// </param> /// <param name="annotations"> /// An <see cref="IList{T}" /> containing a batch of annotations /// to be inserted into the tracking store. /// </param> protected override void InsertEventAnnotationBatch(WorkflowInstanceSummary workflowInstanceSummary, TrackingRecordType type, IList <KeyValuePair <Int64, String> > annotations) { if (annotations.Count == 0 || annotations.Count > EventAnnotationBatchSize) { throw new ArgumentOutOfRangeException("annotations"); } using (OracleCommand oracleCommand = (OracleCommand)CreateCommand("WORKFLOW_TRACKING_PKG.InsertEventAnnotation", CommandType.StoredProcedure)) { Int64[] workflowInstanceIds = new Int64[annotations.Count]; Int64[] eventIds = new Int64[annotations.Count]; String[] eventTypes = new String[annotations.Count]; String[] eventAnnotations = new String[annotations.Count]; String eventType = null; switch (type) { case TrackingRecordType.Activity: eventType = "A"; break; case TrackingRecordType.User: eventType = "U"; break; case TrackingRecordType.Workflow: eventType = "W"; break; } for (int i = 0; i < annotations.Count; i++) { workflowInstanceIds[i] = (Int64)workflowInstanceSummary.InternalId; eventIds[i] = annotations[i].Key; eventTypes[i] = eventType; eventAnnotations[i] = annotations[i].Value; } oracleCommand.ArrayBindCount = annotations.Count; AddParameter(oracleCommand, "p_WORKFLOW_INSTANCE_ID", workflowInstanceIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_ID", eventIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_TYPE", eventTypes, AdoDbType.String); AddParameter(oracleCommand, "p_ANNOTATION", eventAnnotations, AdoDbType.String); oracleCommand.ExecuteNonQuery(); } }
/// <summary> /// Inserts a batch of tracking data items. /// </summary> /// <param name="workflowInstanceSummary"> /// A <see cref="WorkflowInstanceSummary" /> representing a workflow instance /// aInt64 with all its type information. /// </param> /// <param name="type"> /// The type of tracking record to associate the tracking data items with. /// </param> /// <param name="trackingDataItems"> /// An <see cref="IList{T}" /> containing a batch of tracking data items /// to be inserted into the tracking store. /// </param> /// <returns> /// An <see cref="IDictionary{TKey,TValue}" /> containing the inserted /// records and indexed by their unique identifiers. /// </returns> protected override IDictionary <Int64, SerialisableTrackingDataItem> InsertTrackingDataItemBatch( WorkflowInstanceSummary workflowInstanceSummary, TrackingRecordType type, IList <KeyValuePair <Int64, SerialisableTrackingDataItem> > trackingDataItems) { if (trackingDataItems.Count == 0 || trackingDataItems.Count > TrackingDataItemBatchSize) { throw new ArgumentOutOfRangeException("trackingDataItems"); } Dictionary <Int64, SerialisableTrackingDataItem> trackingDataItemsById = new Dictionary <Int64, SerialisableTrackingDataItem>(); using (OracleCommand oracleCommand = (OracleCommand)CreateCommand("WORKFLOW_TRACKING_PKG.InsertTrackingDataItem", CommandType.StoredProcedure)) { Int64[] workflowInstanceIds = new Int64[trackingDataItems.Count]; Int64[] eventIds = new Int64[trackingDataItems.Count]; String[] eventTypes = new String[trackingDataItems.Count]; String[] fieldNames = new String[trackingDataItems.Count]; String [] typeFullNames = new String[trackingDataItems.Count]; String[] assemblyFullNames = new String[trackingDataItems.Count]; String[] dataStrings = new String[trackingDataItems.Count]; Byte[][] dataBlobs = new Byte[trackingDataItems.Count][]; Boolean[] dataNonSerialisable = new Boolean[trackingDataItems.Count]; String eventType = null; switch (type) { case TrackingRecordType.Activity: eventType = "A"; break; case TrackingRecordType.User: eventType = "U"; break; case TrackingRecordType.Workflow: eventType = "W"; break; } for (int i = 0; i < trackingDataItems.Count; i++) { SerialisableTrackingDataItem trackingDataItem = trackingDataItems[i].Value; workflowInstanceIds[i] = (Int64)workflowInstanceSummary.InternalId; eventIds[i] = trackingDataItems[i].Key; eventTypes[i] = eventType; fieldNames[i] = trackingDataItem.FieldName; typeFullNames[i] = trackingDataItem.Data.Type.FullName; assemblyFullNames[i] = trackingDataItem.Data.Type.Assembly.FullName; dataStrings[i] = trackingDataItem.Data.StringData; dataBlobs[i] = trackingDataItem.Data.SerialisedData; dataNonSerialisable[i] = trackingDataItem.Data.NonSerialisable; } oracleCommand.ArrayBindCount = trackingDataItems.Count; AddParameter(oracleCommand, "p_WORKFLOW_INSTANCE_ID", workflowInstanceIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_ID", eventIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_TYPE", eventTypes, AdoDbType.String); AddParameter(oracleCommand, "p_FIELD_NAME", fieldNames, AdoDbType.String); AddParameter(oracleCommand, "p_TYPE_FULL_NAME", typeFullNames, AdoDbType.String); AddParameter(oracleCommand, "p_ASSEMBLY_FULL_NAME", assemblyFullNames, AdoDbType.String); AddParameter(oracleCommand, "p_DATA_STR", dataStrings, AdoDbType.String); AddParameter(oracleCommand, "p_DATA_BLOB", dataBlobs, AdoDbType.Binary); AddParameter(oracleCommand, "p_DATA_NON_SERIALISABLE", dataNonSerialisable, AdoDbType.Boolean); OracleParameter trackingDataItemId = (OracleParameter)AddParameter( oracleCommand, "p_TRACKING_DATA_ITEM_ID", AdoDbType.Int64, ParameterDirection.Output); oracleCommand.ExecuteNonQuery(); Int64[] trackingDataItemIds = (Int64[])trackingDataItemId.Value; for (int i = 0; i < trackingDataItems.Count; i++) { trackingDataItemsById.Add(trackingDataItemIds[i], trackingDataItems[i].Value); } } return(trackingDataItemsById); }
/// <summary> /// Inserts a batch of tracking data items. /// </summary> /// <param name="workflowInstanceSummary"> /// A <see cref="WorkflowInstanceSummary" /> representing a workflow instance /// aInt64 with all its type information. /// </param> /// <param name="type"> /// The type of tracking record to associate the tracking data items with. /// </param> /// <param name="trackingDataItems"> /// An <see cref="IList{T}" /> containing a batch of tracking data items /// to be inserted into the tracking store. /// </param> /// <returns> /// An <see cref="IDictionary{TKey,TValue}" /> containing the inserted /// records and indexed by their unique identifiers. /// </returns> protected override IDictionary<Int64, SerialisableTrackingDataItem> InsertTrackingDataItemBatch( WorkflowInstanceSummary workflowInstanceSummary, TrackingRecordType type, IList<KeyValuePair<Int64, SerialisableTrackingDataItem>> trackingDataItems) { if (trackingDataItems.Count == 0 || trackingDataItems.Count > TrackingDataItemBatchSize) throw new ArgumentOutOfRangeException("trackingDataItems"); Dictionary<Int64, SerialisableTrackingDataItem> trackingDataItemsById = new Dictionary<Int64, SerialisableTrackingDataItem>(); using (OracleCommand oracleCommand = (OracleCommand) CreateCommand("WORKFLOW_TRACKING_PKG.InsertTrackingDataItem", CommandType.StoredProcedure)) { Int64[] workflowInstanceIds = new Int64[trackingDataItems.Count]; Int64[] eventIds = new Int64[trackingDataItems.Count]; String[] eventTypes = new String[trackingDataItems.Count]; String[] fieldNames = new String[trackingDataItems.Count]; String [] typeFullNames = new String[trackingDataItems.Count]; String[] assemblyFullNames = new String[trackingDataItems.Count]; String[] dataStrings = new String[trackingDataItems.Count]; Byte[][] dataBlobs = new Byte[trackingDataItems.Count][]; Boolean[] dataNonSerialisable = new Boolean[trackingDataItems.Count]; String eventType = null; switch (type) { case TrackingRecordType.Activity: eventType = "A"; break; case TrackingRecordType.User: eventType = "U"; break; case TrackingRecordType.Workflow: eventType = "W"; break; } for (int i = 0; i < trackingDataItems.Count; i ++) { SerialisableTrackingDataItem trackingDataItem = trackingDataItems[i].Value; workflowInstanceIds[i] = (Int64) workflowInstanceSummary.InternalId; eventIds[i] = trackingDataItems[i].Key; eventTypes[i] = eventType; fieldNames[i] = trackingDataItem.FieldName; typeFullNames[i] = trackingDataItem.Data.Type.FullName; assemblyFullNames[i] = trackingDataItem.Data.Type.Assembly.FullName; dataStrings[i] = trackingDataItem.Data.StringData; dataBlobs[i] = trackingDataItem.Data.SerialisedData; dataNonSerialisable[i] = trackingDataItem.Data.NonSerialisable; } oracleCommand.ArrayBindCount = trackingDataItems.Count; AddParameter(oracleCommand, "p_WORKFLOW_INSTANCE_ID", workflowInstanceIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_ID", eventIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_TYPE", eventTypes, AdoDbType.String); AddParameter(oracleCommand, "p_FIELD_NAME", fieldNames, AdoDbType.String); AddParameter(oracleCommand, "p_TYPE_FULL_NAME", typeFullNames, AdoDbType.String); AddParameter(oracleCommand, "p_ASSEMBLY_FULL_NAME", assemblyFullNames, AdoDbType.String); AddParameter(oracleCommand, "p_DATA_STR", dataStrings, AdoDbType.String); AddParameter(oracleCommand, "p_DATA_BLOB", dataBlobs, AdoDbType.Binary); AddParameter(oracleCommand, "p_DATA_NON_SERIALISABLE", dataNonSerialisable, AdoDbType.Boolean); OracleParameter trackingDataItemId = (OracleParameter) AddParameter( oracleCommand, "p_TRACKING_DATA_ITEM_ID", AdoDbType.Int64, ParameterDirection.Output); oracleCommand.ExecuteNonQuery(); Int64[] trackingDataItemIds = (Int64[]) trackingDataItemId.Value; for (int i = 0; i < trackingDataItems.Count; i++) trackingDataItemsById.Add(trackingDataItemIds[i], trackingDataItems[i].Value); } return trackingDataItemsById; }
/// <summary> /// Inserts a batch of event annotations. /// </summary> /// <param name="workflowInstanceSummary"> /// A <see cref="WorkflowInstanceSummary" /> representing a workflow instance /// aInt64 with all its type information. /// </param> /// <param name="type"> /// The type of tracking record to associate the annotations with. /// </param> /// <param name="annotations"> /// An <see cref="IList{T}" /> containing a batch of annotations /// to be inserted into the tracking store. /// </param> protected override void InsertEventAnnotationBatch(WorkflowInstanceSummary workflowInstanceSummary, TrackingRecordType type, IList<KeyValuePair<Int64, String>> annotations) { if (annotations.Count == 0 || annotations.Count > EventAnnotationBatchSize) throw new ArgumentOutOfRangeException("annotations"); using (OracleCommand oracleCommand = (OracleCommand) CreateCommand("WORKFLOW_TRACKING_PKG.InsertEventAnnotation", CommandType.StoredProcedure)) { Int64[] workflowInstanceIds = new Int64[annotations.Count]; Int64[] eventIds = new Int64[annotations.Count]; String[] eventTypes = new String[annotations.Count]; String[] eventAnnotations = new String[annotations.Count]; String eventType = null; switch (type) { case TrackingRecordType.Activity: eventType = "A"; break; case TrackingRecordType.User: eventType = "U"; break; case TrackingRecordType.Workflow: eventType = "W"; break; } for (int i = 0; i < annotations.Count; i++) { workflowInstanceIds[i] = (Int64) workflowInstanceSummary.InternalId; eventIds[i] = annotations[i].Key; eventTypes[i] = eventType; eventAnnotations[i] = annotations[i].Value; } oracleCommand.ArrayBindCount = annotations.Count; AddParameter(oracleCommand, "p_WORKFLOW_INSTANCE_ID", workflowInstanceIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_ID", eventIds, AdoDbType.Int64); AddParameter(oracleCommand, "p_EVENT_TYPE", eventTypes, AdoDbType.String); AddParameter(oracleCommand, "p_ANNOTATION", eventAnnotations, AdoDbType.String); oracleCommand.ExecuteNonQuery(); } }