public static bool applyFilter(AnalysisFilters.filter fFilterToApply, List<AssessmentAssessmentFileFinding> lfTargetList, AssessmentAssessmentFileFinding fFinding, AssessmentRun arAssessmentRunToAnalyze) { List<AssessmentAssessmentFile> lafFilteredAssessmentFiles = null; // we are not using this here so make it null (all findings to analyze are provided one by one) // invoke filter return fFilterToApply.applyFilterAndPopulateList(arAssessmentRunToAnalyze, fFinding, lfTargetList, lafFilteredAssessmentFiles); }
public static AssessmentRun createFilteredAssessmentRunObjectBasedOnCriteria(AnalysisFilters.filter fFilter, O2AssessmentData_OunceV6 fadO2AssessmentDataOunceV6) { AssessmentRun arFilteredAssessmentRun = OzasmtUtils_OunceV6.getDefaultAssessmentRunObject(); // create list to contain the filtered AssessmentFiles var lafFilteredAssessmentFiles = new List<AssessmentAssessmentFile>(); if (StringsAndLists.notNull(fadO2AssessmentDataOunceV6.arAssessmentRun, typeof (AssessmentRun).Name)) if (null != fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) foreach (Assessment aAssessment in fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) { foreach (AssessmentAssessmentFile afAssessmentFile in aAssessment.AssessmentFile) { // create filtered AssesmentFile object var afFilteredAssessmentFile = new AssessmentAssessmentFile(); // and copy the important values from the original into it afFilteredAssessmentFile.filename = afAssessmentFile.filename; afFilteredAssessmentFile.error_status = afAssessmentFile.error_status; afFilteredAssessmentFile.last_modified_time = afAssessmentFile.last_modified_time; // create list to contain Findings that match filter var lfFindingsThatMatchCriteria = new List<AssessmentAssessmentFileFinding>(); // if there are findings if (null != afAssessmentFile.Finding) { foreach (AssessmentAssessmentFileFinding fFinding in afAssessmentFile.Finding) fFilter.applyFilterAndPopulateList(fadO2AssessmentDataOunceV6.arAssessmentRun, fFinding, lfFindingsThatMatchCriteria, lafFilteredAssessmentFiles); // invoke the respective filter if (lfFindingsThatMatchCriteria.Count > 0) // if there were findings in this AssessmentFile { afFilteredAssessmentFile.Finding = lfFindingsThatMatchCriteria.ToArray(); // map them to the Finding array lafFilteredAssessmentFiles.Add(afFilteredAssessmentFile); // add add the filtered AssessmentFile to its list } } } } // (if there are some)add the filtered AssessentFiles into the Filtered AssessmentRun object if (lafFilteredAssessmentFiles.Count > 0) arFilteredAssessmentRun.Assessment.Assessment[0].AssessmentFile = lafFilteredAssessmentFiles.ToArray(); // for now all consolidate all projects into one return arFilteredAssessmentRun; }