Source:
<code>public ReturnValue addLane(Integer sequencerRunAccession, Integer studyTypeId, Integer libraryStrategyId, Integer librarySelectionId, Integer librarySourceId, String name, String description, String cycleDescriptor, boolean skip, Integer laneNumber) { ReturnValue ret = new ReturnValue(ReturnValue.SUCCESS); try { boolean studyTypeFound = isValidModelId(getStudyTypes(), studyTypeId); boolean libraryStrategyFound = isValidModelId(this.getLibraryStrategies(), libraryStrategyId); boolean librarySelectionFound = isValidModelId(this.getLibrarySelections(), librarySelectionId); boolean librarySourceFound = isValidModelId(this.getLibrarySource(), librarySourceId); <START> if (!studyTypeFound || !libraryStrategyFound || !librarySelectionFound || !librarySourceFound){ <END> ret.setExitStatus(ReturnValue.INVALIDPARAMETERS); return ret; } SequencerRun sr = ll.findSequencerRun("/" + sequencerRunAccession); StudyType st = new StudyType(); st.setStudyTypeId(studyTypeId); LibraryStrategy ls = new LibraryStrategy(); ls.setLibraryStrategyId(libraryStrategyId); LibrarySelection lsel = new LibrarySelection(); lsel.setLibrarySelectionId(librarySelectionId); LibrarySource lsource = new LibrarySource(); lsource.setLibrarySourceId(librarySourceId); Lane l = new Lane(); l.setStudyType(st); l.setLibraryStrategy(ls); l.setLibrarySelection(lsel); l.setLibrarySource(lsource); l.setSequencerRun(sr); l.setName(name); l.setDescription(description); l.setCycleDescriptor(cycleDescriptor); l.setSkip(skip); l.setLaneIndex(laneNumber-1); Log.info("Posting new lane"); l = ll.addLane(l); ret.setAttribute("sw_accession", l.getSwAccession().toString()); } catch(NotFoundException e){ Log.fatal("NotFoundException, e"); ret.setExitStatus(ReturnValue.INVALIDPARAMETERS); return ret; } catch (Exception e) { e.printStackTrace(); ret.setExitStatus(ReturnValue.FAILURE); return ret; } return (ret); }</code><technical_language>Move calls if conditional short-circuited instead of triggering a network call</technical_language>

Target:
public ReturnValue addLane(Integer sequencerRunAccession, Integer studyTypeId, Integer libraryStrategyId, Integer librarySelectionId, Integer librarySourceId, String name, String description, String cycleDescriptor, boolean skip, Integer laneNumber) { ReturnValue ret = new ReturnValue(ReturnValue.SUCCESS); try { if (!isValidModelId(getStudyTypes(), studyTypeId) || !isValidModelId(this.getLibraryStrategies(), libraryStrategyId) || !isValidModelId(this.getLibrarySelections(), librarySelectionId) || !isValidModelId(this.getLibrarySource(), librarySourceId)){ ret.setExitStatus(ReturnValue.INVALIDPARAMETERS); return ret; } SequencerRun sr = ll.findSequencerRun("/" + sequencerRunAccession); StudyType st = new StudyType(); st.setStudyTypeId(studyTypeId); LibraryStrategy ls = new LibraryStrategy(); ls.setLibraryStrategyId(libraryStrategyId); LibrarySelection lsel = new LibrarySelection(); lsel.setLibrarySelectionId(librarySelectionId); LibrarySource lsource = new LibrarySource(); lsource.setLibrarySourceId(librarySourceId); Lane l = new Lane(); l.setStudyType(st); l.setLibraryStrategy(ls); l.setLibrarySelection(lsel); l.setLibrarySource(lsource); l.setSequencerRun(sr); l.setName(name); l.setDescription(description); l.setCycleDescriptor(cycleDescriptor); l.setSkip(skip); l.setLaneIndex(laneNumber-1); Log.info("Posting new lane"); l = ll.addLane(l); ret.setAttribute("sw_accession", l.getSwAccession().toString()); } catch(NotFoundException e){ Log.fatal("NotFoundException, e"); ret.setExitStatus(ReturnValue.INVALIDPARAMETERS); return ret; } catch (Exception e) { e.printStackTrace(); ret.setExitStatus(ReturnValue.FAILURE); return ret; } return (ret); }