Source:
<code><START> private void validateLibraryDesignValues(Library library) throws IOException { <END> if (!isDetailedLibrary(library)) { throw new IOException("A library design can only be applied to a detailed sample."); } LibraryDesign design = libraryDesignDao.getLibraryDesign(((DetailedLibrary) library).getLibraryDesign().getId()); if (((DetailedSample) library.getSample()).getSampleClass().getId() != design.getSampleClass().getId()) { throw new IOException( "This library design is not valid for sample " + library.getSample().getName() + " because the class is not compatible."); } ((DetailedLibrary) library).setLibraryDesign(design); LibrarySelectionType selection = libraryDao.getLibrarySelectionTypeById(design.getLibrarySelectionType().getId()); LibraryStrategyType strategy = libraryDao.getLibraryStrategyTypeById(design.getLibraryStrategyType().getId()); if (library.getLibrarySelectionType() != null && library.getLibrarySelectionType().getId() != selection.getId()) { throw new IOException("Library selection doesn't match library design."); } if (library.getLibraryStrategyType() != null && library.getLibraryStrategyType().getId() != strategy.getId()) { throw new IOException("Library strategy doesn't match library design."); } if (((DetailedLibrary) library).getLibraryDesignCode().getId() != null && ((DetailedLibrary) library).getLibraryDesign().getId() != null && ((DetailedLibrary) library).getLibraryDesignCode().getId() != null && ((DetailedLibrary) library).getLibraryDesign().getLibraryDesignCode().getId() != null) { throw new IOException("Selected library design code does not match library design code for selected library design."); } library.setLibrarySelectionType(selection); library.setLibraryStrategyType(strategy); }</code><technical_language>This is called end of loadChildEntities. need re-fetch DAOs</technical_language>

Target:
private void validateLibraryDesignValues(Library library) throws IOException { if (!isDetailedLibrary(library)) { throw new IOException("A library design can only be applied to a detailed sample."); } LibraryDesign design = ((DetailedLibrary) library).getLibraryDesign(); if (((DetailedSample) library.getSample()).getSampleClass().getId() != design.getSampleClass().getId()) { throw new IOException( "This library design is not valid for sample " + library.getSample().getName() + " because the class is not compatible."); } LibrarySelectionType selection = design.getLibrarySelectionType(); LibraryStrategyType strategy = design.getLibraryStrategyType(); if (library.getLibrarySelectionType() != null && library.getLibrarySelectionType().getId() != selection.getId()) { throw new IOException("Library selection doesn't match library design."); } if (library.getLibraryStrategyType() != null && library.getLibraryStrategyType().getId() != strategy.getId()) { throw new IOException("Library strategy doesn't match library design."); } if (((DetailedLibrary) library).getLibraryDesignCode().getId() != null && ((DetailedLibrary) library).getLibraryDesign().getId() != null && ((DetailedLibrary) library).getLibraryDesignCode().getId() != null && ((DetailedLibrary) library).getLibraryDesign().getLibraryDesignCode().getId() != null) { throw new IOException("Selected library design code does not match library design code for selected library design."); } }