Ejemplo n.º 1
0
        private SmartCitizenCard getSmartCitizenCardForPerson(RecordIdentifier personIdentifier)
        {
            SmartCitizenCard      cardForPerson     = new SmartCitizenCard();
            GetCardholderResponse cardHolderDetails = _cmClient.GetCardholder(new GetCardholderData()
            {
                CardholderIdentifier = personIdentifier
            });

            if (cardHolderDetails.Identifier.CardID != null)
            {
                CheckCardResponse cardCheckResponse =
                    _cmClient.CheckCard(new CheckCardData()
                {
                    CardIdentifier = cardHolderDetails.Identifier.CardID
                });
                cardForPerson.IsValid = cardCheckResponse.CardValid;
                cardForPerson.ISRN    = cardHolderDetails.Identifier.CardID;
                DateTime expiryDate;
                DateTime.TryParse(
                    cardHolderDetails.CitizenData.XPathSelectElement("Services/Service/Item[@name='EXPIRY DATE']")
                    .Value, out expiryDate);
                cardForPerson.ExpiryDate = expiryDate;
            }
            return(cardForPerson);
        }
Ejemplo n.º 2
0
        private void AddResultRow(bool optimizeForSpeed, UPMResultSection resultSection, UPCRMResultRow dataRow)
        {
            if (resultSection == null)
            {
                throw new ArgumentNullException(nameof(resultSection));
            }

            if (dataRow == null)
            {
                throw new ArgumentNullException(nameof(dataRow));
            }

            if (optimizeForSpeed)
            {
                ((UPResultRowFromCRMResultRows)resultSection.ResultRowProvider).AddRow(dataRow);
            }
            else
            {
                var identifier = new RecordIdentifier(this.InfoAreaId, dataRow.RecordIdAtIndex(0));
                var resultRow  = new UPMResultRow(identifier);
                this.ResultContext.RowDictionary[resultRow.Key] = new UPCoreMappingResultRowContext(dataRow, this.ResultContext);
                resultRow.Invalid   = true;
                resultRow.DataValid = true;
                resultSection?.AddResultRow(resultRow);
            }
        }
Ejemplo n.º 3
0
        private void IssuePass()
        {
            CreateCardholderData createCardholderRequest = new CreateCardholderData();

            using (var txtReader = new XmlTextReader(appDataPath + "WCCTestXmlFragment3.xml"))
            {
                createCardholderRequest.CitizenData = XElement.Load(txtReader);
                createCardholderRequest.StageID     = 1;
                try
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(SerializeObj(createCardholderRequest));
                    }
                    RecordIdentifier id = _cmClient.CreateCardholder(createCardholderRequest);
                    if (log.IsInfoEnabled)
                    {
                        log.Info("Record Created. Record ID:" + id.CardholderID);
                    }
                }
                catch (Exception ex)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Could not create CardHolder." + ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates page instance
        /// </summary>
        /// <returns><see cref="UPMSearchPage"/></returns>
        public override UPMSearchPage CreatePageInstance()
        {
            this.LinkRecordIdentification = this.ViewReference.ContextValueForKey(@"RecordId");
            if (string.IsNullOrEmpty(this.LinkRecordIdentification))
            {
                this.LinkRecordIdentification = this.ViewReference.ContextValueForKey(@"LinkRecord");
            }

            if (!string.IsNullOrEmpty(this.LinkRecordIdentification) && this.LinkRecordIdentification.IsRecordIdentification())
            {
                this.LinkRecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(this.LinkRecordIdentification);
                string linkIdObject = this.ViewReference.ContextValueForKey(@"LinkId");
                this.LinkId = !string.IsNullOrEmpty(linkIdObject) ? Convert.ToInt32(linkIdObject) : 0;
            }
            else
            {
                this.LinkRecordIdentification = null;
                this.LinkId = -1;
            }

            this.ParentLinkString = this.ViewReference.ContextValueForKey(@"ParentLink");

            if (!string.IsNullOrEmpty(this.LinkRecordIdentification))
            {
                var infoAreaIdentifier = new RecordIdentifier(this.InfoAreaId, null);
                var multiIdentifier    = new MultipleIdentifier(new List <IIdentifier> {
                    infoAreaIdentifier, new RecordIdentifier(this.LinkRecordIdentification)
                });
                return(this.CreatePageInstance(multiIdentifier));
            }

            return(this.CreatePageInstance(new RecordIdentifier(this.InfoAreaId, null)));
        }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            RecordIdentifier recordidentifier = db.RecordIdentifiers.Find(id);

            db.RecordIdentifiers.Remove(recordidentifier);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private UPMGroup GroupFromParticipantControl()
        {
            UPMRepeatableEditGroup repeatableEditGroup = new UPMRepeatableEditGroup(this.TabIdentifierForRecordIdentification(this.LinkRecordIdentification));

            repeatableEditGroup.LabelText = this.TabLabel;
            this.selectorArray            = new List <UPRecordSelector>();

            for (int fieldNumber = 0; fieldNumber < this.TabConfig.NumberOfFields; fieldNumber++)
            {
                UPConfigFieldControlField configFieldControlField = this.TabConfig.Fields[fieldNumber];
                var selector = configFieldControlField.Attributes.Selector;

                if (selector != null)
                {
                    var recordSelector = new UPRecordSelector("KP", null, -1, selector, null, this.ParticipantsField);
                    this.selectorArray.Add(recordSelector);
                }
            }

            if (this.selectorArray.Count < 1)
            {
                repeatableEditGroup.AddingEnabled = false;
                if (this.ParticipantsControl.Participants.Count < 1)
                {
                    this.Group           = null;
                    this.ControllerState = GroupModelControllerState.Empty;
                    return(null);
                }
            }
            else
            {
                repeatableEditGroup.AddGroupLabelText = LocalizedString.TextAddNewGroup;
                repeatableEditGroup.AddingEnabled     = this.AddRecordEnabled;
            }

            foreach (UPCRMLinkParticipant participant in this.ParticipantsControl.Participants)
            {
                string           recordIdentification  = participant.RecordIdentification;
                IIdentifier      participantIdentifier = new RecordIdentifier(recordIdentification);
                UPMStandardGroup group = new UPMStandardGroup(participantIdentifier);
                string           num   = participant.Options.ValueOrDefault("must") as string;
                group.Deletable = !participant.MayNotBeDeleted && this.DeleteRecordEnabled && num.ToInt() == 0;
                UPMDependsEditField editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);
                editField.MainField.FieldValue = participant.Name;
                ((UPMParticipantsRecordSelectorEditField)editField.MainField).Participant = participant;
                editField.DependField.FieldValue  = participant.AcceptanceText;
                editField.DependField2.FieldValue = participant.RequirementText;
                bool editOfflineRecord = ConfigurationUnitStore.DefaultStore.ConfigValueIsSetDefaultValue("RecordSelect.EditOfflineRecord", false);
                editField.Deletable = !participant.IsOfflineEmptyParticipant || editOfflineRecord;
                group.AddField(editField);
                repeatableEditGroup.AddChild(group);
                this.AddGroupForKey(group, participant.Key);
            }

            this.Group           = repeatableEditGroup;
            this.ControllerState = GroupModelControllerState.Finished;
            return(repeatableEditGroup);
        }
Ejemplo n.º 7
0
 public ActionResult Edit(RecordIdentifier recordidentifier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recordidentifier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(recordidentifier));
 }
Ejemplo n.º 8
0
        //
        // GET: /RecordIdentifier/Delete/5

        public ActionResult Delete(int id = 0)
        {
            RecordIdentifier recordidentifier = db.RecordIdentifiers.Find(id);

            if (recordidentifier == null)
            {
                return(HttpNotFound());
            }
            return(View(recordidentifier));
        }
Ejemplo n.º 9
0
        public ActionResult Create(RecordIdentifier recordidentifier)
        {
            if (ModelState.IsValid)
            {
                db.RecordIdentifiers.Add(recordidentifier);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(recordidentifier));
        }
        /// <summary>
        /// Results the section for search result.
        /// </summary>
        /// <param name="preparedSearch">The prepared search.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public virtual UPMResultSection ResultSectionForSearchResult(UPSearchPageModelControllerPreparedSearch preparedSearch, UPCRMResult result)
        {
            var configStore   = ConfigurationUnitStore.DefaultStore;
            var resultContext = new UPCoreMappingResultContext(result, preparedSearch.CombinedControl, preparedSearch.ListFieldControl.NumberOfFields);

            this.SectionContexts.SetObjectForKey(resultContext, preparedSearch.InfoAreaId);
            var resultSection  = new UPMResultSection(StringIdentifier.IdentifierWithStringId($"Search_{preparedSearch.InfoAreaId}"));
            var infoAreaConfig = configStore.InfoAreaConfigById(preparedSearch.InfoAreaId);

            if (infoAreaConfig != null)
            {
                var colorKey = infoAreaConfig.ColorKey;
                if (!string.IsNullOrEmpty(colorKey))
                {
                    resultSection.BarColor = AureaColor.ColorWithString(colorKey);
                }

                var imageName = infoAreaConfig.ImageName;
                if (!string.IsNullOrEmpty(imageName))
                {
                    var fileResource = configStore.ResourceByName(imageName);
                    if (fileResource != null)
                    {
                        resultSection.GlobalSearchIconName = fileResource.FileName;
                    }
                }
            }

            resultSection.SectionField = new UPMField(StringIdentifier.IdentifierWithStringId("SectionLabel"));
            var sectionName = infoAreaConfig?.PluralName;

            if (string.IsNullOrEmpty(sectionName))
            {
                var tableInfo = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(preparedSearch.InfoAreaId);
                sectionName = tableInfo != null ? tableInfo.Label : preparedSearch.InfoAreaId;
            }

            resultSection.SectionField.FieldValue = sectionName;
            var count = result.RowCount;

            for (var j = 0; j < count; j++)
            {
                var dataRow    = result.ResultRowAtIndex(j) as UPCRMResultRow;
                var identifier = new RecordIdentifier(preparedSearch.InfoAreaId, dataRow.RecordIdAtIndex(0));
                var resultRow  = new UPMResultRow(identifier);
                resultContext.RowDictionary.Add(resultRow.Key, new UPCoreMappingResultRowContext(dataRow, resultContext));
                resultContext.ExpandMapper = preparedSearch.ExpandSettings;
                resultRow.Invalid          = true;
                resultRow.DataValid        = true;
                resultSection.AddResultRow(resultRow);
            }

            return(resultSection);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// The row from result row.
        /// </summary>
        /// <param name="crmRow">
        /// The crm row.
        /// </param>
        /// <returns>
        /// The <see cref="UPMResultRow"/>.
        /// </returns>
        public virtual UPMResultRow RowFromResultRow(UPCRMResultRow crmRow)
        {
            RecordIdentifier identifier = new RecordIdentifier(crmRow.RecordIdentificationAtIndex(0));
            UPMResultRow     resultRow  = new UPMResultRow(identifier)
            {
                Invalid = true, DataValid = true
            };

            this.TheDelegate?.ResultRowProviderDidCreateRowFromDataRow(this, resultRow, crmRow);
            return(resultRow);
        }
        private IIdentifier BuildStandartIdentifier()
        {
            IIdentifier identifier;

            if (!string.IsNullOrEmpty(this.RecordIdentification))
            {
                identifier = new RecordIdentifier(this.RecordIdentification);
            }
            else
            {
                identifier = StringIdentifier.IdentifierWithStringId("Web");
            }

            return(identifier);
        }
Ejemplo n.º 13
0
        /// <inheritdoc/>
        public override UPMResultSection ResultSectionForSearchResult(UPSearchPageModelControllerPreparedSearch preparedSearch, UPCRMResult result)
        {
            UPCoreMappingResultContext resultContext = new UPCoreMappingResultContext(result, preparedSearch.CombinedControl, preparedSearch.ListFieldControl.NumberOfFields);

            this.SectionContexts.SetObjectForKey(resultContext, preparedSearch.InfoAreaId);
            bool newSection = this.geoSection == null;

            if (newSection)
            {
                this.geoSection = new UPMResultSection(StringIdentifier.IdentifierWithStringId($"Search_{preparedSearch.InfoAreaId}"));
            }

            var count = result.RowCount;

            for (var j = 0; j < count; j++)
            {
                UPCRMResultRow dataRow    = result.ResultRowAtIndex(j) as UPCRMResultRow;
                var            identifier = new RecordIdentifier(preparedSearch.InfoAreaId, dataRow.RecordIdAtIndex(0));
                UPMResultRow   resultRow  = new UPMResultRow(identifier);
                resultRow.DataValid = true;
                resultContext.RowDictionary.SetObjectForKey(new UPCoreMappingResultRowContext(dataRow, resultContext), resultRow.Key);
                resultContext.ExpandMapper = preparedSearch.ExpandSettings;
                resultRow = (UPMResultRow)this.UpdatedElement(resultRow);

                this.AddDistanceFieldToRow(resultRow);
                this.geoSection.AddResultRow(resultRow);
                if (resultRow.RecordImageDocument != null)
                {
                    this.AnyResultWithImageField = true;
                }
            }

            List <GeoUPMResultRow> sortedArray = this.resultRowsToSort.OrderBy(a => a.Distance).ToList();

            this.geoSection.RemoveAllChildren();
            foreach (var row in sortedArray)
            {
                if (row.ResultRow != null)
                {
                    this.geoSection.AddResultRow(row.ResultRow);
                }
                else
                {
                }
            }

            return(newSection ? this.geoSection : null);
        }
        /// <summary>
        /// Synchronizes the manager did update records.
        /// </summary>
        /// <param name="notification">The notification.</param>
        public void SyncManagerDidUpdateRecords(SyncManagerMessage notification)
        {
            List <string> recordIdentifications = notification.State.ValueOrDefault(Core.Session.Constants.KUPSyncManagerModifiedRecordIdentifications) as List <string>;

            if (recordIdentifications != null)
            {
                List <IIdentifier> recordIdentifiers = new List <IIdentifier>();

                foreach (string identification in recordIdentifications)
                {
                    RecordIdentifier recordIdentifier = new RecordIdentifier(identification);
                    recordIdentifiers.Add(recordIdentifier);
                }

                this.RegisterChanges(recordIdentifiers);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Toggles the favorite.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        protected override void ToggleFavorite(ViewReference viewReference)
        {
            if (!string.IsNullOrEmpty(this.Organizer.FavoriteRecordIdentification))
            {
                this.FavoriteModelController.ChangeFavoriteValue(this.Organizer.FavoriteRecordIdentification, false);
            }
            else
            {
                this.FavoriteModelController.ChangeFavoriteValue(this.RecordIdentification, true);
            }

            RecordIdentifier identifier = new RecordIdentifier(this.RecordIdentification);

            UPChangeManager.CurrentChangeManager.RegisterChanges(new List <IIdentifier> {
                identifier
            });
        }
 /**
  * Create a reader that reads from the first key larger than minKey to any
  * keys equal to maxKey.
  * @param key the key to read into
  * @param reader the ORC file reader
  * @param bucket the bucket number for the file
  * @param minKey only return keys larger than minKey if it is non-null
  * @param maxKey only return keys less than or equal to maxKey if it is
  *               non-null
  * @param options options to provide to read the rows.
  * @param statementId id of SQL statement within a transaction
  * @
  */
 public ReaderPair(ReaderKey key, Reader reader, int bucket,
                   RecordIdentifier minKey, RecordIdentifier maxKey,
                   ReaderImpl.Options options, int statementId)
 {
     this.reader = reader;
     this.key    = key;
     this.maxKey = maxKey;
     this.bucket = bucket;
     // TODO use stripe statistics to jump over stripes
     recordReader     = reader.rowsOptions(options);
     this.statementId = statementId;
     // advance the reader until we reach the minimum key
     do
     {
         next(nextRecord);
     } while (nextRecord != null &&
              (minKey != null && key.compareRow(minKey) <= 0));
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Details the organizer for result row.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <returns></returns>
        public override UPOrganizerModelController DetailOrganizerForResultRow(UPMResultRow resultRow)
        {
            RecordIdentifier           identifier          = (RecordIdentifier)resultRow.Identifier;
            ViewReference              viewReference       = HistoryManager.DefaultHistoryManager.ViewReferenceForRecordIdentifier(identifier.RecordIdentification);
            UPOrganizerModelController organizerController = UPOrganizerModelController.OrganizerFromViewReference(viewReference);

            if (resultRow.OnlineData)
            {
                organizerController.OnlineData = resultRow.OnlineData;
            }

            resultRow.DataValid = true;
            resultRow.Invalid   = true;
            UPChangeManager.CurrentChangeManager.RegisterChanges(new List <IIdentifier> {
                resultRow.Identifier
            });
            return(organizerController);
        }
        /// <summary>
        /// Builds the cache starting from recordId
        /// </summary>
        /// <param name="record">record</param>
        public void BuildCache(RecordIdentifier record = null)
        {
            var currentRecordIndex = 0;

            var cachedCaptions = this.modelController.LoadTableCaptionsFromIndexToIndex(-this.cacheSize, this.cacheSize)
                                 .ToList();

            if (record != null && cachedCaptions.Any())
            {
                var recordId = $"{record.InfoAreaId}.{record.RecordId}";

                var currentRecord = cachedCaptions.FirstOrDefault(c => c.RecordIdentification == recordId);

                if (currentRecord != null)
                {
                    currentRecordIndex = cachedCaptions.IndexOf(currentRecord);
                }
            }

            this.tableCaptions.AddRange(cachedCaptions);
            this.CurrentIndex = currentRecordIndex;
        }
Ejemplo n.º 19
0
        private ActionResult _InboundSetupWithQpcIdNum(string carrierId, string recordingId, string qpcIdNum, Interview interview)
        {
            ActionResult result           = null;
            var          recordIdentifier = RecordIdentifier.FindByQpcIdNum(qpcIdNum, int.Parse(carrierId));

#if NET472
            if (recordIdentifier != null)
            {
                //Map carrier program for inbound calls for carriers having different programs with same parent carrier
                var carrierProgram = Customizable.GetCarrierProgram(carrierId.ToString());
                if (carrierProgram != null)
                {
                    recordIdentifier.CarrierId = carrierProgram.carrierId;
                }
                //Session["CarrierId"] = carrierProgram.carrierId;
                else
                {
                    recordIdentifier.CarrierId = int.Parse(carrierId);
                }
                //Session["CarrierId"] = int.Parse(carrierId);

                var remote = this.HttpContext.Connection.RemoteIpAddress;
                var local  = this.HttpContext.Connection.LocalIpAddress;
                interview.IPAddress   = remote.ToString();
                interview.RecordingId = recordingId;
                interview.BeginInterviewInbound(recordIdentifier);
                var objectNo = recordIdentifier.ObjectNumber; //with objNo updated in BeginInterviewInbound.  Gets reset in star

                LogicTree.StartModule(interview.RecordIdentifier, _GREETING_INBOUND_MODULE);
                var tree = LogicTree.StartNewTree("GreetingInboundTree", interview.InterviewId, interview.RecordIdentifier);
                interview.RecordIdentifier.ObjectNumber = objectNo;

                result = RedirectToAction("View", _QUESTIONS, new { sectionTreeGuid = tree.sectionTreeGuid, pageNodeTypeCd = interview.Policy.IsCCDone ? "GreetingCCDone" : "ChooseInsured", objectNumber = interview.RecordIdentifier.ObjectNumber });
            }
#endif
            return(result);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Refreshes the after document uploaded.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        public void RefreshAfterDocumentUploaded(string recordIdentification)
        {
            List <IIdentifier> changedIdentifiers = null;

            if (recordIdentification != null)
            {
                changedIdentifiers = new List <IIdentifier> {
                    new RecordIdentifier(recordIdentification)
                };
            }

            if (!string.IsNullOrEmpty(this.RecordIdentification))
            {
                RecordIdentifier ri = new RecordIdentifier(this.RecordIdentification);
                if (changedIdentifiers != null)
                {
                    changedIdentifiers.Add(ri);
                }
                else
                {
                    changedIdentifiers = new List <IIdentifier> {
                        ri
                    };
                }
            }

            foreach (UPPageModelController modelController in this.PageModelControllers)
            {
                if (modelController is DetailPageModelController || modelController is DocumentPageModelController)
                {
                    modelController.Page.Invalid = true;
                    modelController.ProcessChanges(changedIdentifiers);
                }
            }

            UPChangeManager.CurrentChangeManager.RegisterChanges(changedIdentifiers);
        }
Ejemplo n.º 21
0
        public override void DeleteAll(Stack <RecordIdentifier> recordIdentifiers)
        {
            if (recordIdentifiers.Any())
            {
                using (var transaction = _sqlConnection.BeginTransaction())
                {
                    while (recordIdentifiers.Count > 0)
                    {
                        RecordIdentifier recordIdentifier = recordIdentifiers.Pop();

                        string deleteStmt = string.Format("DELETE FROM {0} WHERE {1} = @Id", SanitizeTableName(recordIdentifier.TableName), recordIdentifier.ColumnName);

                        SqlCommand deleteCommand = new SqlCommand(deleteStmt, _sqlConnection, transaction);
                        deleteCommand.Parameters.Add(new SqlParameter {
                            ParameterName = "@Id", Value = recordIdentifier.IdentifierValue
                        });

                        deleteCommand.ExecuteNonQuery();
                    }

                    transaction.Commit();
                }
            }
        }
Ejemplo n.º 22
0
        private SmartCitizenCard getSmartCitizenCardForPerson(RecordIdentifier personIdentifier)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("Getting Smart Citizen Card for Person");
            }
            logParams(personIdentifier);
            SmartCitizenCard      cardForPerson     = new SmartCitizenCard();
            GetCardholderResponse cardHolderDetails = _cmClient.GetCardholder(new GetCardholderData()
            {
                CardholderIdentifier = personIdentifier
            });

            if (cardHolderDetails.Identifier.CardID != null)
            {
                CheckCardResponse cardCheckResponse =
                    _cmClient.CheckCard(new CheckCardData()
                {
                    CardIdentifier = cardHolderDetails.Identifier.CardID
                });
                EntityDetailsListResponse[] entityDetailsListResponse = _cmClient.GetEntityList(personIdentifier);
                cardForPerson.IsValid = cardCheckResponse.CardValid;

                cardForPerson.ISRN = cardHolderDetails.Identifier.CardID;
                DateTime expiryDate;
                DateTime.TryParse(
                    cardHolderDetails.CitizenData.XPathSelectElement("Services/Service/Item[@name='EXPIRY DATE']")
                    .Value, out expiryDate);
                cardForPerson.ExpiryDate = expiryDate;
            }
            if (log.IsDebugEnabled)
            {
                log.Debug("Got Card.");
            }
            return(cardForPerson);
        }
        /**
         * Find the key range for bucket files.
         * @param reader the reader
         * @param options the options for reading with
         * @
         */
        private void discoverKeyBounds(Reader reader,
                                       Reader.Options options)
        {
            RecordIdentifier[] keyIndex = OrcRecordUpdater.parseKeyIndex(reader);
            long offset      = options.getOffset();
            long maxOffset   = options.getMaxOffset();
            int  firstStripe = 0;
            int  stripeCount = 0;
            bool isTail      = true;
            List <StripeInformation> stripes = reader.getStripes();

            foreach (StripeInformation stripe in stripes)
            {
                if (offset > stripe.getOffset())
                {
                    firstStripe += 1;
                }
                else if (maxOffset > stripe.getOffset())
                {
                    stripeCount += 1;
                }
                else
                {
                    isTail = false;
                    break;
                }
            }
            if (firstStripe != 0)
            {
                minKey = keyIndex[firstStripe - 1];
            }
            if (!isTail)
            {
                maxKey = keyIndex[firstStripe + stripeCount - 1];
            }
        }
Ejemplo n.º 24
0
        public bool next(RecordIdentifier recordIdentifier,
                            OrcStruct prev)
        {
            bool keysSame = true;
            while (keysSame && primary != null)
            {

                // The primary's nextRecord is the next value to return
                OrcStruct current = primary.nextRecord;
                recordIdentifier.set(primary.key);

                // Advance the primary reader to the next record
                primary.next(extraValue);

                // Save the current record as the new extraValue for next time so that
                // we minimize allocations
                extraValue = current;

                // now that the primary reader has advanced, we need to see if we
                // continue to read it or move to the secondary.
                if (primary.nextRecord == null ||
                    primary.key.compareTo(secondaryKey) > 0)
                {

                    // if the primary isn't done, push it back into the readers
                    if (primary.nextRecord != null)
                    {
                        readers.put(primary.key, primary);
                    }

                    // update primary and secondaryKey
                    Map.Entry<ReaderKey, ReaderPair> entry = readers.pollFirstEntry();
                    if (entry != null)
                    {
                        primary = entry.getValue();
                        if (readers.isEmpty())
                        {
                            secondaryKey = null;
                        }
                        else
                        {
                            secondaryKey = readers.firstKey();
                        }
                    }
                    else
                    {
                        primary = null;
                    }
                }

                // if this transaction isn't ok, skip over it
                if (!validTxnList.isTxnValid(
                    ((ReaderKey)recordIdentifier).getCurrentTransactionId()))
                {
                    continue;
                }

                /*for multi-statement txns, you may have multiple events for the same
                * row in the same (current) transaction.  We want to collapse these to just the last one
                * regardless whether we are minor compacting.  Consider INSERT/UPDATE/UPDATE of the
                * same row in the same txn.  There is no benefit passing along anything except the last
                * event.  If we did want to pass it along, we'd have to include statementId in the row
                * returned so that compaction could write it out or make minor minor compaction understand
                * how to write out delta files in delta_xxx_yyy_stid format.  There doesn't seem to be any
                * value in this.*/
                bool isSameRow = prevKey.isSameRow((ReaderKey)recordIdentifier);
                // if we are collapsing, figure out if this is a new row
                if (collapse || isSameRow)
                {
                    keysSame = (collapse && prevKey.compareRow(recordIdentifier) == 0) || (isSameRow);
                    if (!keysSame)
                    {
                        prevKey.set(recordIdentifier);
                    }
                }
                else
                {
                    keysSame = false;
                }

                // set the output record by fiddling with the pointers so that we can
                // avoid a copy.
                prev.linkFields(current);
            }
            return !keysSame;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Use the current layout.DataSet to format data and populate the FormattedDataDataset (ds).
        /// As a single record can span multiple lines, the read approach is based on a memory
        /// stream (instead of simple readlines)
        /// </summary>
        public void FormatDatafile()
        {
            if (logger.TextBox != null)
            {
                logger.TextBox.Clear();
            }

            ValidateLayout();

            if ((data.Source != null) && (data.Source.Length > 0) &&
                (layout.DataSet.Record.Count > 0))
            {
                _isUpdating = true;

                RecordIdentifier[] recordTable = GetRecordIdentifiers();

                hasErrors = false;
                _error    = "";
                _leftover = "";
                ds.Clear();

                // 2. put entire data source into a memory stream
                this.buffer = data.Source.ToCharArray();
                this.idx    = 0;
                int recordIndex = 0;

                try
                {
                    while (this.idx < this.buffer.Length)
                    {
                        RecordIdentifier theRecId = GetCurrentRecord(recordTable);

                        if (theRecId != null)
                        {
                            FormatRecord(recordIndex, theRecId);
                            recordIndex++;
                        }
                        else
                        {
                            // no matching record identifier found, add to error message and
                            // jump to next line
                            string unparsedSection = "";
                            while (this.idx < this.buffer.Length)
                            {
                                unparsedSection += this.buffer[idx];
                                idx++;
                                if (unparsedSection.EndsWith(_eolDelimiter))
                                {
                                    break;
                                }
                            }

                            String errorMessage = "Parse error: failed to find a matching record around [";
                            if (unparsedSection.Length > 10)
                            {
                                errorMessage += unparsedSection.Substring(0, 10);
                                errorMessage += "...";
                            }
                            else
                            {
                                errorMessage += unparsedSection;
                            }

                            errorMessage += "], proceeding to next line ...";
                            _error       += Environment.NewLine + errorMessage;
                            hasErrors     = true;
                        }
                    }                     // while position is < StringReader buffer
                }
                catch (Exception ex)
                {
                    logger.Log(Logger.MessageType.DEBUG, ex);

                    _leftover = GetString(0, this.buffer.Length - idx);

                    _error += "\n" + ex.Message;
                    _error += "\nUnparsed: ";

                    if (_leftover.Length > 50)
                    {
                        _error += _leftover.Substring(0, 50);
                        _error += "...";
                    }
                    else
                    {
                        _error += _leftover;
                    }
                    hasErrors = true;
                    return;
                }
                finally
                {
                    _isUpdating = false;
                }
            }             // if data and layout present
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Return a list of all defined record identifiers
        /// </summary>
        /// <returns></returns>
        private RecordIdentifier[] GetRecordIdentifiers()
        {
            int recIdPos = 0;
            int index    = 0;

            RecordIdentifier[]       recordTable = new RecordIdentifier[layout.DataSet.Record.Count];
            LayoutDataset.FieldRow[] fields;

            foreach (LayoutDataset.RecordRow recRow in layout.DataSet.Record.Rows)
            {
                recIdPos = 0;

                // get fields for record name, sorted by 'Index'
                fields = (LayoutDataset.FieldRow[])layout.DataSet.Field.Select("RecordName = '" + recRow.Name + "'", "Index");

                ArrayList posList    = new ArrayList();
                ArrayList valueList  = new ArrayList();
                ArrayList lengthList = new ArrayList();

                foreach (LayoutDataset.FieldRow fieldRow in fields)
                {
                    if (fieldRow.IsRecordIdentifier == true)
                    {
                        if ((fieldRow.IsPredefinedValueNull()) || (fieldRow.IsLengthNull()))
                        {
                            throw new Exception("Parse error: Predefined value and length must be set for " + fieldRow.Name + " in " + recRow.Name);
                        }
                        else
                        {
                            string escPredefinedValue = layout.Escape(fieldRow.PredefinedValue);
                            posList.Add(recIdPos);
                            valueList.Add(escPredefinedValue);
                            lengthList.Add(fieldRow.Length);
                        }
                    }
                    recIdPos += fieldRow.Length;
                }

                if (posList.Count > 0)
                {
                    recordTable[index] = new RecordIdentifier(
                        (int[])posList.ToArray(typeof(int)),
                        (int[])lengthList.ToArray(typeof(int)),
                        recRow.Name,
                        (string[])valueList.ToArray(typeof(string)),
                        recRow.IsHideInFormatViewNull() ? false : recRow.HideInFormatView);
                    index++;
                    logger.Log(Logger.MessageType.DEBUG, "Loaded record identifier for " + recRow.Name);

                    posList.Clear();
                    valueList.Clear();
                    lengthList.Clear();
                }

                else
                {
                    logger.Log(Logger.MessageType.WARN, "Failed to locate an identifier field for record " + recRow.Name);
                }
            }

            return(recordTable);
        }
 MyRow(String val, long rowId, long origTxn, int bucket) {
   col1 = new Text(val);
   ROW__ID = new RecordIdentifier(origTxn, bucket, rowId);
 }
Ejemplo n.º 28
0
 /**
  * Create a reader that reads from the first key larger than minKey to any
  * keys equal to maxKey.
  * @param key the key to read into
  * @param reader the ORC file reader
  * @param bucket the bucket number for the file
  * @param minKey only return keys larger than minKey if it is non-null
  * @param maxKey only return keys less than or equal to maxKey if it is
  *               non-null
  * @param options options to provide to read the rows.
  * @param statementId id of SQL statement within a transaction
  * @
  */
 public ReaderPair(ReaderKey key, Reader reader, int bucket,
            RecordIdentifier minKey, RecordIdentifier maxKey,
            ReaderImpl.Options options, int statementId)
 {
     this.reader = reader;
     this.key = key;
     this.maxKey = maxKey;
     this.bucket = bucket;
     // TODO use stripe statistics to jump over stripes
     recordReader = reader.rowsOptions(options);
     this.statementId = statementId;
     // advance the reader until we reach the minimum key
     do
     {
         next(nextRecord);
     } while (nextRecord != null &&
         (minKey != null && key.compareRow(minKey) <= 0));
 }
Ejemplo n.º 29
0
 public int compareTo(RecordIdentifier other)
 {
     int sup = compareToInternal(other);
     if (sup == 0)
     {
         if (other.GetType() == typeof(ReaderKey))
         {
             ReaderKey oth = (ReaderKey)other;
             if (currentTransactionId != oth.currentTransactionId)
             {
                 return currentTransactionId < oth.currentTransactionId ? +1 : -1;
             }
             if (statementId != oth.statementId)
             {
                 return statementId < oth.statementId ? +1 : -1;
             }
         }
         else
         {
             return -1;
         }
     }
     return sup;
 }
Ejemplo n.º 30
0
 OriginalReaderPair(ReaderKey key, Reader reader, int bucket,
                    RecordIdentifier minKey, RecordIdentifier maxKey,
                    Reader.Options options)
     : base(key, reader, bucket, minKey, maxKey, options, 0)
 {
 }
 BigRow(long rowId, long origTxn, int bucket) {
   ROW__ID = new RecordIdentifier(origTxn, bucket, rowId);
 }
Ejemplo n.º 32
0
 static RecordIdentifier[] parseKeyIndex(Reader reader)
 {
     String[] stripes;
     try
     {
         ByteBuffer val =
             reader.getMetadataValue(OrcRecordUpdater.ACID_KEY_INDEX_NAME)
                 .duplicate();
         stripes = utf8Decoder.decode(val).toString().split(";");
     }
     catch (CharacterCodingException e)
     {
         throw new ArgumentException("Bad string encoding for " +
             OrcRecordUpdater.ACID_KEY_INDEX_NAME, e);
     }
     RecordIdentifier[] result = new RecordIdentifier[stripes.length];
     for (int i = 0; i < stripes.length; ++i)
     {
         if (stripes[i].length() != 0)
         {
             String[] parts = stripes[i].split(",");
             result[i] = new RecordIdentifier();
             result[i].setValues(Long.parseLong(parts[0]),
                 Integer.parseInt(parts[1]), Long.parseLong(parts[2]));
         }
     }
     return result;
 }
 BigRow(int myint, long mylong, String mytext, float myfloat, double mydouble,
                 long rowId, long origTxn, int bucket) {
   this.myint = myint;
   this.mylong = mylong;
   this.mytext = new Text(mytext);
   this.myfloat = myfloat;
   this.mydouble = mydouble;
   ROW__ID = new RecordIdentifier(origTxn, bucket, rowId);
 }
 BigRow(int myint, long mylong, String mytext, float myfloat, double mydouble) {
   this.myint = myint;
   this.mylong = mylong;
   this.mytext = new Text(mytext);
   this.myfloat = myfloat;
   this.mydouble = mydouble;
   ROW__ID = null;
 }
  public void testOrdering()  {
    ReaderKey left = new ReaderKey(100, 200, 1200, 300);
    ReaderKey right = new ReaderKey();
    right.setValues(100, 200, 1000, 200,1);
    assertTrue(right.compareTo(left) < 0);
    assertTrue(left.compareTo(right) > 0);
    Assert.Equal(false, left.equals(right));
    left.set(right);
    assertTrue(right.compareTo(left) == 0);
    Assert.Equal(true, right.equals(left));
    right.setRowId(2000);
    assertTrue(right.compareTo(left) > 0);
    left.setValues(1, 2, 3, 4,-1);
    right.setValues(100, 2, 3, 4,-1);
    assertTrue(left.compareTo(right) < 0);
    assertTrue(right.compareTo(left) > 0);
    left.setValues(1, 2, 3, 4,-1);
    right.setValues(1, 100, 3, 4,-1);
    assertTrue(left.compareTo(right) < 0);
    assertTrue(right.compareTo(left) > 0);
    left.setValues(1, 2, 3, 100,-1);
    right.setValues(1, 2, 3, 4,-1);
    assertTrue(left.compareTo(right) < 0);
    assertTrue(right.compareTo(left) > 0);

    // ensure that we are consistent when comparing to the base class
    RecordIdentifier ri = new RecordIdentifier(1, 2, 3);
    Assert.Equal(1, ri.compareTo(left));
    Assert.Equal(-1, left.compareTo(ri));
    Assert.Equal(false, ri.equals(left));
    Assert.Equal(false, left.equals(ri));
  }
Ejemplo n.º 36
0
 /**
  * Find the key range for bucket files.
  * @param reader the reader
  * @param options the options for reading with
  * @
  */
 private void discoverKeyBounds(Reader reader,
                                Reader.Options options)
 {
     RecordIdentifier[] keyIndex = OrcRecordUpdater.parseKeyIndex(reader);
     long offset = options.getOffset();
     long maxOffset = options.getMaxOffset();
     int firstStripe = 0;
     int stripeCount = 0;
     bool isTail = true;
     List<StripeInformation> stripes = reader.getStripes();
     foreach (StripeInformation stripe in stripes)
     {
         if (offset > stripe.getOffset())
         {
             firstStripe += 1;
         }
         else if (maxOffset > stripe.getOffset())
         {
             stripeCount += 1;
         }
         else
         {
             isTail = false;
             break;
         }
     }
     if (firstStripe != 0)
     {
         minKey = keyIndex[firstStripe - 1];
     }
     if (!isTail)
     {
         maxKey = keyIndex[firstStripe + stripeCount - 1];
     }
 }
 public void set(RecordIdentifier other)
 {
     base.set(other);
     currentTransactionId = ((ReaderKey)other).currentTransactionId;
     statementId          = ((ReaderKey)other).statementId;
 }
Ejemplo n.º 38
0
 /**
  * Find the key range for original bucket files.
  * @param reader the reader
  * @param bucket the bucket number we are reading
  * @param options the options for reading with
  * @
  */
 private void discoverOriginalKeyBounds(Reader reader, int bucket,
                                        Reader.Options options
                                        )
 {
     long rowLength = 0;
     long rowOffset = 0;
     long offset = options.getOffset();
     long maxOffset = options.getMaxOffset();
     bool isTail = true;
     foreach (StripeInformation stripe in reader.getStripes())
     {
         if (offset > stripe.getOffset())
         {
             rowOffset += stripe.getNumberOfRows();
         }
         else if (maxOffset > stripe.getOffset())
         {
             rowLength += stripe.getNumberOfRows();
         }
         else
         {
             isTail = false;
             break;
         }
     }
     if (rowOffset > 0)
     {
         minKey = new RecordIdentifier(0, bucket, rowOffset - 1);
     }
     if (!isTail)
     {
         maxKey = new RecordIdentifier(0, bucket, rowOffset + rowLength - 1);
     }
 }
Ejemplo n.º 39
0
        /// <summary>
        /// Updateds the element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns>
        /// The <see cref="UPMElement" />.
        /// </returns>
        public override UPMElement UpdatedElement(UPMElement element)
        {
            UPMSyncConflictsPage page = new UPMSyncConflictsPage(StringIdentifier.IdentifierWithStringId("SyncConflictsPage"));

            page.SyncConflictEmail = ConfigurationUnitStore.DefaultStore.ConfigValue("Sync.ConflictEmailAddress");
            IOfflineStorage offlineStorage  = UPOfflineStorage.DefaultStorage;
            var             offlineRequests = this.ShowAllOfflineRequests ? offlineStorage.OfflineRequests : offlineStorage.ConflictRequests;

            if (offlineRequests == null || offlineRequests.Count == 0)
            {
                this.AddNoConflictsFoundPage(page);
                return(page);
            }

            foreach (UPOfflineRequest request in offlineRequests)
            {
                IIdentifier identifier;
                if (!string.IsNullOrEmpty(request.IdentifyingRecordIdentification))
                {
                    identifier = new RecordIdentifier(request.IdentifyingRecordIdentification);
                }
                else
                {
                    identifier = StringIdentifier.IdentifierWithStringId($"request_{request.RequestNr}");
                }

                UPMSyncConflictWithContext syncConflict = new UPMSyncConflictWithContext(identifier);
                request.LoadFromOfflineStorage();
                syncConflict.OfflineRequest = request;
                syncConflict.CanBeFixed     = request.FixableByUser;
                syncConflict.CanBeReported  = !string.IsNullOrEmpty(page.SyncConflictEmail) && syncConflict.OfflineRequest.HasXml;
                if (!string.IsNullOrEmpty(request.ImageName))
                {
                    //SyncConflict.Icon = UIImage.ImageNamed(request.ImageName);    // CRM-5007
                }

                UPMStringField titleLineField = new UPMStringField(null);
                titleLineField.StringValue = request.TitleLine;
                syncConflict.MainField     = titleLineField;
                string detailsLine = request.DetailsLine;
                if (!string.IsNullOrEmpty(detailsLine))
                {
                    UPMStringField detailsLineField = new UPMStringField(null);
                    detailsLineField.StringValue = detailsLine;
                    syncConflict.DetailField     = detailsLineField;
                }

                if (!this.ShowAllOfflineRequests)
                {
                    UPMErrorStatus error = UPMErrorStatus.ErrorStatusWithMessageDetails(request.Error, request.Response);
                    syncConflict.AddStatus(error);
                }

                List <UPOfflineRequest> dependingRequests = request.DependentRequests;
                if (dependingRequests != null)
                {
                    foreach (UPOfflineRequest dependentRequest in dependingRequests)
                    {
                        string        description = $"{dependentRequest.TitleLine}-{dependentRequest.DetailsLine}";
                        UPMWarnStatus warning     = UPMWarnStatus.WarnStatusWithMessageDetails(description, null);
                        syncConflict.AddStatus(warning);
                    }
                }

                page.AddSyncConflict(syncConflict);
            }

            if (this.oldNumberOfConflicts >= 0 && this.oldNumberOfConflicts != offlineRequests.Count)
            {
                Messenger.Default.Send(SyncManagerMessage.Create(SyncManagerMessageKey.NumberOfConflictsChanged));
            }

            this.oldNumberOfConflicts = offlineRequests.Count;
            return(page);
        }
Ejemplo n.º 40
0
 /**
  * Compare rows without considering the currentTransactionId.
  * @param other the value to compare to
  * @return -1, 0, +1
  */
 public int compareRow(RecordIdentifier other)
 {
     return compareToInternal(other);
 }
Ejemplo n.º 41
0
        private void FormatRecord(int recordIndex, RecordIdentifier theRecId)
        {
            LayoutDataset.FieldRow[]       fields;
            FormattedDataDataset.RecordRow fmtRec = ds.Record.NewRecordRow();
            fmtRec.Name   = theRecId.RecordName;
            fmtRec.Index  = recordIndex;
            fmtRec.Hidden = theRecId.HideInFormattedView;
            ds.Record.AddRecordRow(fmtRec);

            // b. process this record and move position accordingly
            fields = (LayoutDataset.FieldRow[])layout.DataSet.Field.Select("RecordName = '" + theRecId.RecordName + "'", "Index");

            logger.Log(Logger.MessageType.DEBUG, "Parsing " + fields.Length + " fields ...");

            int fieldIndex = 0;

            for (; fieldIndex < fields.Length; fieldIndex++)
            {
                bool indexMoved = false;
                LayoutDataset.FieldRow fieldRow = fields[fieldIndex];
                LayoutDataset.FieldRow eor      = GetNextEorField(theRecId, fieldRow, recordIndex);

                string dataValue = null;

                if (fieldRow.Length < 0)
                {
                    dataValue  = GetVariableLengthValue(fields, fieldIndex, fieldRow);
                    indexMoved = true;
                }
                else
                {
                    dataValue = GetString(0, fieldRow.Length);
                }

                if (dataValue != null)
                {
                    bool processField = CheckValueForProcessing(recordIndex, theRecId, fmtRec, fieldRow, eor, dataValue);

                    if (processField)
                    {
                        FormattedDataDataset.FieldRow fmtField = ds.Field.NewFieldRow();
                        fmtField.Name        = fieldRow.Name;
                        fmtField.RecordName  = fmtRec.Name;
                        fmtField.RecordIndex = recordIndex;
                        fmtField.Description = fieldRow.IsDescriptionNull() ? "" : fieldRow.Description;
                        fmtField.Value       = dataValue;
                        fmtField.Index       = fieldRow.Index;
                        fmtField.Length      = fieldRow.Length;

                        ds.Field.AddFieldRow(fmtField);

                        if (!indexMoved)
                        {
                            this.idx += dataValue.Length;
                        }
                    }
                }
                else if (!indexMoved && !fieldRow.IsLengthNull())
                {
                    // if data field was not set, still move index
                    this.idx += fieldRow.Length;
                }
            }
        }
Ejemplo n.º 42
0
 public void set(RecordIdentifier other)
 {
     base.set(other);
     currentTransactionId = ((ReaderKey)other).currentTransactionId;
     statementId = ((ReaderKey)other).statementId;
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Check if current data value should be processed (mainly for conditional fields). For values
        /// which do not match a condition, the StringReader is set back to the previous position. If
        /// an optional fields does not define a condition or predefined value and the datavalue matches
        /// next EOR, that EOR is written.
        /// </summary>
        /// <param name="recordIndex"></param>
        /// <param name="theRecId"></param>
        /// <param name="fmtRec"></param>
        /// <param name="fieldRow"></param>
        /// <param name="eor"></param>
        /// <param name="dataValue"></param>
        /// <returns></returns>
        private bool CheckValueForProcessing(int recordIndex, RecordIdentifier theRecId, FormattedDataDataset.RecordRow fmtRec, LayoutDataset.FieldRow fieldRow, LayoutDataset.FieldRow eor, string dataValue)
        {
            if ((!fieldRow.IsIsOptionalNull()) && (fieldRow.IsOptional))
            {
                // optional values are identified either by predefined values
                // or by conditions


                if ((!fieldRow.IsConditionNull()) && (fieldRow.Condition.Length > 0))
                {
                    string condExpression = "((RecordName = '" + theRecId.RecordName + "') and (RecordIndex = '" + recordIndex + "'))";
                    condExpression = condExpression + " and (" + fieldRow.Condition + ")";

                    Condition cond = new Condition(condExpression, ds.Field);

                    if (!cond.IsConditionTrue())
                    {
                        // go back
                        return(false);
                    }
                    return(true);
                }

                if ((!fieldRow.IsPredefinedValueNull()) &&
                    (fieldRow.PredefinedValue.Length > 0))
                {
                    // field has predefined value, check and roll back if no match
                    if (!layout.Escape(fieldRow.PredefinedValue).Equals(dataValue))
                    {
                        return(false);
                    }

                    return(true);
                }

                if (eor != null)
                {
                    // optional field has no condition and no predefined value,
                    // compare current data against next EOR, maybe record is
                    // already finished
                    string seor = layout.Escape(eor.PredefinedValue);
                    if (dataValue.Substring(0, seor.Length).Equals(seor))
                    {
                        FormattedDataDataset.FieldRow fmtField = ds.Field.NewFieldRow();
                        fmtField.Name        = eor.Name;
                        fmtField.RecordName  = fmtRec.Name;
                        fmtField.RecordIndex = recordIndex;
                        fmtField.Description = eor.IsDescriptionNull() ? "" : fieldRow.Description;
                        fmtField.Value       = seor;
                        fmtField.Index       = eor.Index;
                        fmtField.Length      = eor.Length;

                        ds.Field.AddFieldRow(fmtField);

                        this.idx += seor.Length;
                        // datavalue already written, do not process again
                        return(false);
                    }
                    return(true);
                }

                throw new Exception("Parse error: optional field " + fieldRow.Name + " must have condition or predefined value.");
            }

            return(true);
        }
Ejemplo n.º 44
0
        private void GenerateValuesForColumns(IDictionary <string, object> generatedValuesDict)
        {
            // For each column
            foreach (TableColumnInfo column in _tableColumnInfoList)
            {
                // Skip the column if it was already been generated.
                if (generatedValuesDict.ContainsKey(column.Name))
                {
                    continue;
                }

                // If the column type is a supported column type, and it is not Nullable
                if (column.ColumnType != ColumnType.Unsuported && !column.IsNullable)
                {
                    if (column.IsForeignKey)
                    {
                        if (IsSelfReferencedForeignKey(column.ForeignKeyTable))
                        {
                            if (_depth == 0)
                            {
                                // creates a new table generator to generate data for this foreign key
                                TableGenerator foreignKeyTableGenerator = new TableGenerator(_dbDialect,
                                                                                             column.ForeignKeyTable,
                                                                                             _generatedRecords,
                                                                                             _depth + 1);

                                IDictionary <string, object> foreignKeyGeneratedData = foreignKeyTableGenerator.GenerateValues();

                                generatedValuesDict[column.ForeignKeyTable] = foreignKeyGeneratedData[column.ForeignKeyTable];

                                // TODO: Inner from database?
                            }
                        } // if (IsSelfReferencedForeignKey(column.ForeignKeyTable))
                        else
                        {
                            // Try to get an existing generated value for this foreign key column
                            RecordIdentifier existingRecord = GetGeneratedRecord(column.ForeignKeyTable, column.ForeignKeyColumn);

                            // record exists?
                            if (existingRecord != null)
                            {
                                // Use the existing value
                                generatedValuesDict[column.Name] = existingRecord.IdentifierValue;
                            }
                            else
                            {
                                if (column.IsNullable == false)
                                {
                                    // creates a new table generator to generate data for this foreign key
                                    TableGenerator foreignKeyTableGenerator = new TableGenerator(_dbDialect, column.ForeignKeyTable, _generatedRecords, _depth + 1);
                                    generatedValuesDict[column.Name] = foreignKeyTableGenerator.GenerateValues()[column.ForeignKeyColumn];
                                }
                            }
                        }
                    } // if (column.IsForeignKey)
                    else if (column.IsIdentity == false)
                    {
                        object random = RandomValues.ForColumn(column);

                        if (column.IsUnique)
                        {
                            // Keep generating random value while they are not unique
                            while (_dbDialect.RecordExists(_tableName, column.Name, random))
                            {
                                random = RandomValues.ForColumn(column);
                            }
                        }

                        generatedValuesDict[column.Name] = random;
                    }
                }
            }
        }
 MyRow(String val) {
   field = new Text(val);
   ROW__ID = null;
 }