private boolean validateRequestedTests() { if (form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getRows().size() == 0) return true; SpecimenCollectionTypeCollection collTypes = new SpecimenCollectionTypeCollection(); for (int i = 0; i < form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getAllRows().length; i++) { GenForm.lyrDetailsLayer.tabPathDetailsContainer.lyrPathologyLayer.tabRequestedTestsContainer.grdTestRow specimenOrSiteRow = form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getAllRows()[i]; if (specimenOrSiteRow.getValue() instanceof OrderInvestigationVo) { if (specimenOrSiteRow.getColSpecimen() instanceof SpecimenVo) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getColType().getValue()); if (!specimenOrSiteRow.isReadOnly() && specimenOrSiteRow.getColType().getValue() == null) return false; } else if (specimenOrSiteRow.getColSpecimen() == null && specimenOrSiteRow.getValue() != null && Boolean.TRUE.equals(specimenOrSiteRow.getValue().getInvestigation().getInvestigationIndex().getRequiresSiteSpecifier())) // This could be a site specifier investigation and collection type { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getColType().getValue()); if (!specimenOrSiteRow.isReadOnly() && specimenOrSiteRow.getColType().getValue() == null) return false; } else if (specimenOrSiteRow.getParentRow() != null) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getParentRow().getColType().getValue()); if (specimenOrSiteRow.getParentRow().getColType().getValue() == null) return false; } } else if (specimenOrSiteRow.getValue() == null && specimenOrSiteRow.getParentRow() != null) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getParentRow().getColType().getValue()); if (specimenOrSiteRow.getParentRow().getColType().getValue() == null) return false; } } if (collTypes.size() == 0) return false; else return true; }