private ISet <FieldDescriptor> GetAllFieldDescriptors() { ISet <FieldDescriptor> fieldList = new HashSet <FieldDescriptor>(); FieldUtils.AddFieldDescriptors(FieldUtils.session.Loans.FieldDescriptors.StandardFields, fieldList); FieldUtils.AddFieldDescriptors(FieldUtils.session.Loans.FieldDescriptors.CustomFields, fieldList); FieldUtils.AddFieldDescriptors(FieldUtils.session.Loans.FieldDescriptors.VirtualFields, fieldList); return(fieldList); }
public static IList <IDictionary <string, object> > ExtractBorrowerPairs(Loan loan, ISet <string> fields) { IList <IDictionary <string, object> > borrowerPairs = new List <IDictionary <string, object> >(); try { int pairCount = loan.BorrowerPairs.Count; //using for loop instead of foreach in order to track the index //and ordering of the pairs for (int pairIndex = 0; pairIndex < pairCount; pairIndex++) { BorrowerPair pair = loan.BorrowerPairs[pairIndex]; IDictionary <string, object> fieldDictionary = new Dictionary <string, object>(); fieldDictionary["BorrowerPairId"] = pairIndex; borrowerPairs.Add(ExtractSimpleFields(loan, pair, fields, fieldDictionary)); if (pair.Borrower != null) { fieldDictionary["Borrower.ID"] = pair.Borrower.ID; } if (pair.CoBorrower != null) { fieldDictionary["CoBorrower.ID"] = pair.CoBorrower.ID; } if (pairIndex == 0) { fieldDictionary["PrimaryPair"] = true; } else { fieldDictionary["PrimaryPair"] = false; } //change the current borrower pair loan.BorrowerPairs.Current = pair; ExtractIntIndexFields(loan, FieldUtils.BorrowerEmployers(), loan.BorrowerEmployers.Count, fieldDictionary); ExtractIntIndexFields(loan, FieldUtils.CoBorrowerEmployers(), loan.CoBorrowerEmployers.Count, fieldDictionary); ExtractIntIndexFields(loan, FieldUtils.BorrowerResidences(), loan.BorrowerResidences.Count, fieldDictionary); ExtractIntIndexFields(loan, FieldUtils.CoBorrowerResidences(), loan.CoBorrowerResidences.Count, fieldDictionary); ExtractIntIndexFields(loan, FieldUtils.LiabilitiesMulti(), loan.Liabilities.Count, fieldDictionary); ExtractIntIndexFields(loan, FieldUtils.MortgagesMulti(), loan.Mortgages.Count, fieldDictionary); } } catch { //No-op - if there are no SSN this will throw an exception. //But this is a no-op because SSN is not required } return(borrowerPairs); }
/// <summary> /// Walks through the various types of fields in a loan. /// There are simple fields where it is a simple key = value map, /// complex fields, where the key name represents a dictonary and must be mutated /// as well as more traditional key = array and key = dictionary /// </summary> /// <param name="currentLoan"></param> /// <returns> /// IDictionary<string, object> of the data, object will either be a string, /// or further IDictionary<string, object> /// </returns> public static IDictionary <string, object> ExtractLoanFields(Loan currentLoan) { IDictionary <string, object> fieldValues = new Dictionary <string, object>(); ExtractSimpleFields(currentLoan, FieldUtils.SimpleFieldNames(), fieldValues); ExtractMiddleIndexFields(currentLoan, FieldUtils.MiddleIndexMulti(), fieldValues); ExtractEndIndexFields(currentLoan, FieldUtils.EndIndexMulti(), fieldValues); ExtractStringIndexFields(currentLoan, FieldUtils.DocumentMulti(), GetDocumentIndexes(currentLoan), fieldValues); ExtractStringIndexFields(currentLoan, FieldUtils.PostClosingMulti(), GetPostClosingIndexes(currentLoan), fieldValues); ExtractStringIndexFields(currentLoan, FieldUtils.UnderwritingMulti(), GetUnderwritingIndexes(currentLoan), fieldValues); ExtractStringIndexFields(currentLoan, FieldUtils.MilestoneTaskMulti(), GetMilestoneTaskIndexes(currentLoan), fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.BorrowerEmployers(), currentLoan.BorrowerEmployers.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.CoBorrowerEmployers(), currentLoan.CoBorrowerEmployers.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.BorrowerResidences(), currentLoan.BorrowerResidences.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.CoBorrowerResidences(), currentLoan.CoBorrowerResidences.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.LiabilitiesMulti(), currentLoan.Liabilities.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.DepostisMulti(), currentLoan.Deposits.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.MortgagesMulti(), currentLoan.Mortgages.Count, fieldValues); ExtractIntIndexFields(currentLoan, FieldUtils.VestingPartiesMulti(), currentLoan.AdditionalVestingParties.Count, fieldValues); //This is a subset of the borrower pair information, there does not seem to be an efficient method for //extracting all of this data programmatically. fieldValues["borrower-pairs"] = ExtractBorrowerPairs(currentLoan); fieldValues["Associates"] = ExtractAssociates(currentLoan); fieldValues["uw-conditions"] = ExtractUWConditions(currentLoan); ExtractEndIndexFields(currentLoan, FieldUtils.DisclosureMulti(), fieldValues, currentLoan.Log.Disclosures.Count); ExtractFundingFees(currentLoan, fieldValues); ExtractProperties(currentLoan, fieldValues); return(fieldValues); }