/// <summary> /// Handles the import of an item /// </summary> /// <param name="item"></param> /// <returns></returns> public bool Item(RelativityObjectSlim item) { // the handler has to know ahead of the time at which index the // extracted text will be, since RelativityObjectSlim only returns // the values int textIndex = this.ExtractedTextIndex; if (item.Values[textIndex] is string) { // handle exporting string } else if (item.Values[textIndex] is System.IO.Stream) { // handle stream } // thread-safe increment System.Threading.Interlocked.Increment(ref _itemCount); if (_itemCount % _PRINT_FREQ == 0) { Console.WriteLine($"Exported {_itemCount} items"); } return(true); }
private void CloseOpenStreamsInRos(RelativityObjectSlim ros) { foreach (int index in _longTextIds) { object longText = ros.Values[index]; (longText as Stream)?.Close(); } }
public bool Item(RelativityObjectSlim item) { for (int i = 0; i < _fieldData.Count; i++) { Console.WriteLine(_fieldData[i].Name + ": " + item.Values[i]); } Console.WriteLine(); return(true); }
public bool Item(RelativityObjectSlim item) { int currentCount = Interlocked.Increment(ref _count); if (currentCount % 1000 == 0) { Console.WriteLine(currentCount); } Interlocked.Increment(ref _metrics.TotalCount); for (int i = 0; i < _fields.Count; i++) { if (_fields[i].FieldType == FieldType.LongText) { object value = item.Values[i]; if (value is string) { //Console.WriteLine("ExportApiHandler Item " + _count + " called with control of '" + item.Values[0] + "' and text type of String"); long length = _hashCollector.Add((string)value); Interlocked.Add(ref _metrics.TotalSize, length); } else if (value is Stream) { //Console.WriteLine("ExportApiHandler Item " + _count + " called with control of '" + item.Values[0] + "' and text type of Stream"); long length = _hashCollector.Add((Stream)value); Interlocked.Add(ref _metrics.TotalSize, length); } else { Console.WriteLine("ExportApiHandler Item " + _count + " called with control of '" + item.Values[0] + "' and incorrect text type of '" + value.GetType().ToString() + "'"); return(false); } } } return(true); }