diff --git a/src/org/labkey/panoramapremium/PanoramaPremiumController.java b/src/org/labkey/panoramapremium/PanoramaPremiumController.java index c435ed067..1dcc2c2b8 100644 --- a/src/org/labkey/panoramapremium/PanoramaPremiumController.java +++ b/src/org/labkey/panoramapremium/PanoramaPremiumController.java @@ -118,7 +118,7 @@ else if(isMolecule) //skip selected precursors that are already excluded selectedRowsKeys.forEach(id -> { List prec = precursorsList.stream().filter(p -> p.getId() == id).toList(); - ExcludedPrecursor precursor = prec.get(0); + ExcludedPrecursor precursor = prec.getFirst(); precursor.setIsPeptide(isPeptide); if (isExcluding) diff --git a/src/org/labkey/targetedms/SkylineAuditLogManager.java b/src/org/labkey/targetedms/SkylineAuditLogManager.java index 646ef18ad..b3a0de4ce 100644 --- a/src/org/labkey/targetedms/SkylineAuditLogManager.java +++ b/src/org/labkey/targetedms/SkylineAuditLogManager.java @@ -198,7 +198,7 @@ private int persistAuditLog(User user, AuditLogImportContext pContext, SkylineAu ent.setDocumentGUID(pContext._documentGUID); pContext._rootHash.update(ent.getEntryHash().getBytes(StandardCharsets.UTF_8)); // Insert at the beginning of the list so we can quickly iterate in reverse order for validation - entries.add(0, ent); + entries.addFirst(ent); } catch (XMLStreamException e) { @@ -247,7 +247,7 @@ private int persistAuditLog(User user, AuditLogImportContext pContext, SkylineAu } if (pContext._runId != null) //set the document version id on the chronologically last log entry. - entries.get(entries.size() - 1).setVersionId(pContext._runId); + entries.getLast().setVersionId(pContext._runId); AuditLogTree treePointer = pContext._logTree; int persistedEntriesCount = 0; @@ -280,7 +280,7 @@ private int persistAuditLog(User user, AuditLogImportContext pContext, SkylineAu } } if (persistedEntriesCount == 0) //if no entries were actually saved into the database we are uploading an earlier document version - entries.get(entries.size() - 1).insertRunAuditLogEntry(user, pContext._runId); //and still need to update the terminal entry with the versionId. + entries.getLast().insertRunAuditLogEntry(user, pContext._runId); //and still need to update the terminal entry with the versionId. return entries.size(); } @@ -304,7 +304,8 @@ private void verifyPostRequisites(AuditLogImportContext pContext, SkylineAuditLo * Builds a tree of audit log entry tokens representing the document versioning tree * @return the root node of the tree */ - private AuditLogTree buildLogTree(@NotNull GUID pDocumentGUID) throws AuditLogException { + private AuditLogTree buildLogTree(@NotNull GUID pDocumentGUID) + { TableInfo entryTbl = TargetedMSManager.getTableInfoSkylineAuditLogEntry(); @@ -440,7 +441,7 @@ private TargetedMSRun getNewRun(GUID pDocumentGUID, Container container) run.setContainer(container); run.setDocumentGUID(pDocumentGUID); Table.insert(_user, TargetedMSManager.getTableInfoRuns(), run); - _logger.info(String.format("new run is inserted with id %d", run.getId())); + _logger.info("new run is inserted with id {}", run.getId()); return run; } @@ -564,7 +565,7 @@ public void addAVersionTest() throws IOException, AuditLogException for(String fileName : testFileNames) { - _logger.info("AuditLogFiles/" + fileName); + _logger.info("AuditLogFiles/{}", fileName); runs.push(getNewRun(_docGUID)); tree = persistALogFile("AuditLogFiles/" + fileName, runs.peek()); } diff --git a/src/org/labkey/targetedms/SkylineBinaryDataHandler.java b/src/org/labkey/targetedms/SkylineBinaryDataHandler.java index e75d35792..99ff247b3 100644 --- a/src/org/labkey/targetedms/SkylineBinaryDataHandler.java +++ b/src/org/labkey/targetedms/SkylineBinaryDataHandler.java @@ -50,7 +50,7 @@ public DataType getDataType() } @Override - public void importFile(@NotNull ExpData data, @NotNull FileLike dataFile, @NotNull ViewBackgroundInfo info, @NotNull Logger log, @NotNull XarContext context) throws ExperimentException + public void importFile(@NotNull ExpData data, @NotNull FileLike dataFile, @NotNull ViewBackgroundInfo info, @NotNull Logger log, @NotNull XarContext context) { } diff --git a/src/org/labkey/targetedms/SkylineDocImporter.java b/src/org/labkey/targetedms/SkylineDocImporter.java index 8a1e1afd5..d0b4e4297 100644 --- a/src/org/labkey/targetedms/SkylineDocImporter.java +++ b/src/org/labkey/targetedms/SkylineDocImporter.java @@ -214,7 +214,7 @@ public TargetedMSRun importRun(RunInfo runInfo, PipelineJob job) throws IOExcept // Skip if run was already fully imported if (run.getStatusId() == SkylineDocImporter.STATUS_SUCCESS) { - _log.info(_expData.getName() + " has already been imported so it does not need to be imported again"); + _log.info("{} has already been imported so it does not need to be imported again", _expData.getName()); return run; } @@ -249,9 +249,9 @@ public TargetedMSRun importRun(RunInfo runInfo, PipelineJob job) throws IOExcept saveRunDocumentSize(run); updateRunStatus(IMPORT_STARTED); - _log.info("Starting to import Skyline document from " + run.getFileName()); + _log.info("Starting to import Skyline document from {}", run.getFileName()); importSkylineDoc(run, inputFile.toNioPathForRead().toFile()); - _log.info("Completed import of Skyline document from " + run.getFileName()); + _log.info("Completed import of Skyline document from {}", run.getFileName()); updateRunStatus(IMPORT_SUCCEEDED, STATUS_SUCCESS); @@ -401,17 +401,14 @@ private void importSkylineDoc(TargetedMSRun run, File f) throws XMLStreamExcepti modInfo, libraryNameIdMap, pepGroup, parser, peptides, smallMolecules, parser.getTransitionSettings()); if (++peptideGroupCount % 100 == 0) { - _log.info("Imported " + peptideGroupCount + " peptide groups."); + _log.info("Imported {} peptide groups.", peptideGroupCount); } } if (!_shouldSaveTransitionChromInfos) { TargetedMSModule targetedMSModule = ModuleLoader.getInstance().getModule(TargetedMSModule.class); - _log.info("None of the " + parser.getTransitionChromInfoCount() + " TransitionChromInfos in the file " + - "were imported because they exceed the limit of " + - targetedMSModule.MAX_TRANSITION_CHROM_INFOS_PROPERTY.getEffectiveValue(_container) + " and there are more than " + - targetedMSModule.MAX_PRECURSORS_PROPERTY.getEffectiveValue(_container) + " precursors"); + _log.info("None of the {} TransitionChromInfos in the file were imported because they exceed the limit of {} and there are more than {} precursors", parser.getTransitionChromInfoCount(), targetedMSModule.MAX_TRANSITION_CHROM_INFOS_PROPERTY.getEffectiveValue(_container), targetedMSModule.MAX_PRECURSORS_PROPERTY.getEffectiveValue(_container)); } // Done parsing document @@ -546,7 +543,7 @@ private void calculateSampleFileIRTStats(TargetedMSRun run, ReplicateInfo replic return; } - _log.info("Calculating iRT correlations for " + replicateInfo.skylineIdSampleFileIdMap.size() + " sample(s)"); + _log.info("Calculating iRT correlations for {} sample(s)", replicateInfo.skylineIdSampleFileIdMap.size()); // Get the iRT scale to which we are comparing each sample SimpleFilter iRTFilter = new SimpleFilter(FieldKey.fromParts("iRTScaleId"), run.getiRTscaleId()); @@ -600,7 +597,7 @@ private void calculateSampleFileIRTStats(TargetedMSRun run, ReplicateInfo replic updatedCount++; } } - _log.info("Finished calculating iRT correlations for all samples. " + updatedCount + " had a regression line calculated."); + _log.info("Finished calculating iRT correlations for all samples. {} had a regression line calculated.", updatedCount); } @@ -691,9 +688,9 @@ private void deleteOldSampleFiles(ReplicateInfo replicateInfo) return; } - _log.info(String.format("Updating previously imported data for %d old sample files.", total)); + _log.info("Updating previously imported data for {} old sample files.", total); _log.debug("Found data for the following old sample files in the QC folder:"); - replicateInfo.oldSamplesToDelete.keySet().forEach(key -> _log.debug(String.format(" %s", key))); + replicateInfo.oldSamplesToDelete.keySet().forEach(key -> _log.debug(" {}", key)); List existingSamples = new LongArrayList(total); replicateInfo.oldSamplesToDelete.forEach((key, value) -> value.forEach(existingSample -> existingSamples.add(existingSample.getId()))); @@ -709,7 +706,7 @@ private void deleteOldSampleFiles(ReplicateInfo replicateInfo) } catch (URISyntaxException e) { - _log.error("Unable to delete file " + srcFile + ". May be an invalid path. This file is no longer needed on the server."); + _log.error("Unable to delete file {}. May be an invalid path. This file is no longer needed on the server.", srcFile); } } } @@ -819,7 +816,7 @@ private void insertDigestSettings(PeptideSettings pepSettings) } else { - enzyme = existingEnzymes.get(0); + enzyme = existingEnzymes.getFirst(); } PeptideSettings.EnzymeDigestionSettings digestSettings = pepSettings.getEnzymeDigestionSettings(); @@ -988,9 +985,9 @@ private void handleReplicateExclusions(Replicate replicate, ReplicateAnnotation // If there is an ignore_in_QC annotation and we already have existing exclusions, don't insert but compare and // give a warning if there is a mismatch. if (!shouldExcludeFromAnnot) - _log.warn("Replicate " + replicate.getName() + " has an ignore_in_QC=false annotation but there are existing exclusions that were added within Panorama or from a previous import."); + _log.warn("Replicate {} has an ignore_in_QC=false annotation but there are existing exclusions that were added within Panorama or from a previous import.", replicate.getName()); else if (!hasExistingExcludeAllMetrics) - _log.warn("Replicate " + replicate.getName() + " has an ignore_in_QC=true annotation but there are existing metric specific exclusions that were added within Panorama."); + _log.warn("Replicate {} has an ignore_in_QC=true annotation but there are existing metric specific exclusions that were added within Panorama.", replicate.getName()); } } } @@ -1074,7 +1071,7 @@ else if (SkylineFileUtils.EXT_SKY_LOG.equalsIgnoreCase(ext)) newScale = true; else { - iRTScaleId = scaleIds.get(0); + iRTScaleId = scaleIds.getFirst(); SimpleFilter iRTFilter = new SimpleFilter(FieldKey.fromParts("iRTScaleId"), iRTScaleId); List existingScale = new TableSelector(TargetedMSManager.getTableInfoiRTPeptide(), iRTFilter, null).getArrayList(IrtPeptide.class); @@ -1123,7 +1120,7 @@ private ArrayList normalizeIrtImportAndReweighValues(List(existingStandards.values()), new ArrayList<>(existingLibrary.values()), _log); if (regressionLine == null) - throw new PipelineJobException(makeIrtStandardsErrorMsg(existingScale.get(0).getiRTScaleId(), new ArrayList<>(existingStandards.values()), importScale)); + throw new PipelineJobException(makeIrtStandardsErrorMsg(existingScale.getFirst().getiRTScaleId(), new ArrayList<>(existingStandards.values()), importScale)); applyIrtRegressionLine(regressionLine, importScale); @@ -1284,7 +1281,7 @@ else if(!pepGroup.isDecoy()) } // CONSIDER: If there is already an identical entry in the PeptideGroup table re-use it. - _log.info("Inserting " + pepGroup.getLabel()); + _log.info("Inserting {}", pepGroup.getLabel()); pepGroup = Table.insert(_user, TargetedMSManager.getTableInfoPeptideGroup(), pepGroup); for (Protein protein : pepGroup.getProteins()) @@ -1332,7 +1329,7 @@ else if(!pepGroup.isDecoy()) peptideCount++; if (peptideCount % 50 == 0) { - _log.debug(String.format("Inserted %d peptides", peptideCount)); + _log.debug("Inserted {} peptides", peptideCount); } } case MOLECULE -> { @@ -1346,7 +1343,7 @@ else if(!pepGroup.isDecoy()) moleculeCount++; if (moleculeCount % 50 == 0) { - _log.debug(String.format("Inserted %d molecules", moleculeCount)); + _log.debug("Inserted {} molecules", moleculeCount); } } } @@ -1356,11 +1353,11 @@ else if(!pepGroup.isDecoy()) } if(peptideCount > 0) { - _log.debug(String.format("Total peptides inserted: %d", peptideCount)); + _log.debug("Total peptides inserted: {}", peptideCount); } if(moleculeCount > 0) { - _log.debug(String.format("Total molecules inserted: %d", moleculeCount)); + _log.debug("Total molecules inserted: {}", moleculeCount); } } @@ -1726,7 +1723,7 @@ private void insertLibInfo(Precursor.LibraryInfo libraryInfo, Precursor precurso if (_missingLibraries.add(libraryInfo.getLibraryName())) { // Only log the first time - _log.warn("'" + libraryInfo.getLibraryName() + "' library was not found in settings."); + _log.warn("'{}' library was not found in settings.", libraryInfo.getLibraryName()); } } else @@ -2304,7 +2301,7 @@ private void insertSampleFiles(ReplicateInfo replicateInfo, Map= MIN_IRT_TO_TIME_CORRELATION) { - pipelineLog.info("Calculated iRT regression line by ignoring import value for standard: " + standardPeptideList.get(i).getModifiedSequence()); + pipelineLog.info("Calculated iRT regression line by ignoring import value for standard: {}", standardPeptideList.get(i).getModifiedSequence()); break; } } @@ -121,7 +121,7 @@ public static RegressionLine calcRegressionLine(IRetentionTimeProvider retention } Statistics statTimes = new Statistics(regressionTimes); Statistics statIrts = new Statistics(regressionScores); - pipelineLog.info("Successfully calculated iRT regression line from " + Integer.toString(regression.getPeptideTimes().size()) + " shared peptides."); + pipelineLog.info("Successfully calculated iRT regression line from {} shared peptides.", Integer.toString(regression.getPeptideTimes().size())); return new RegressionLine(statIrts.Slope(statTimes), statIrts.Intercept(statTimes)); } } diff --git a/src/org/labkey/targetedms/SkylinePort/Irt/RetentionTimeRegression.java b/src/org/labkey/targetedms/SkylinePort/Irt/RetentionTimeRegression.java index 01d410bf8..d08b367fa 100644 --- a/src/org/labkey/targetedms/SkylinePort/Irt/RetentionTimeRegression.java +++ b/src/org/labkey/targetedms/SkylinePort/Irt/RetentionTimeRegression.java @@ -525,7 +525,7 @@ public static RetentionTimeRegression CalcRegression(String name, ArrayList getReplicatesFilterList() } catch (NumberFormatException e) { - LOG.debug("Error parsing replicate Id: "+rep,e); + LOG.debug("Error parsing replicate Id: {}", rep, e); } } @@ -3284,7 +3284,7 @@ private void addSpectrumViews(TargetedMSRun run, VBox vbox, List materials = ExperimentService.get().getExpMaterialsByName(sampleName, null, getUser()); if (materials.size() == 1) { - ExpMaterial material = materials.get(0); + ExpMaterial material = materials.getFirst(); materialURL = material.detailsURL(material.getContainer(), true); } @@ -5590,7 +5590,7 @@ private static Protein selectProtein(List proteins, @Nullable Long prot { if (proteinId == null && !proteins.isEmpty()) { - return proteins.get(0); + return proteins.getFirst(); } if (proteinId != null) { @@ -7342,8 +7342,7 @@ public static ChromLibAnalyteCounts getChromLibAnalyteCounts(User user, Containe } catch (IOException | SQLException e) { - LOG.error("Error reading from chromatogram library file " + ChromatogramLibraryUtils.getDownloadFileName(container, libRevision) - + " in container " + container.getPath(), e); + LOG.error("Error reading from chromatogram library file {} in container {}", ChromatogramLibraryUtils.getDownloadFileName(container, libRevision), container.getPath(), e); } return counts == null ? ChromLibAnalyteCounts.NOT_EXISTS : counts; } @@ -7724,7 +7723,7 @@ else if (!run.getReplacesRuns().isEmpty() && run.getReplacesRuns().size() > 1) public Object execute(RowIdForm form, BindException errors) throws BatchValidationException { ExpRun run = ExperimentService.get().getExpRun(form.getRowId()); - ExpRun replaces = run.getReplacesRuns().isEmpty() ? null : run.getReplacesRuns().get(0); + ExpRun replaces = run.getReplacesRuns().isEmpty() ? null : run.getReplacesRuns().getFirst(); ExpRun replacedBy = run.getReplacedByRun(); DbScope scope = ExperimentService.get().getSchema().getScope(); diff --git a/src/org/labkey/targetedms/TargetedMSDataHandler.java b/src/org/labkey/targetedms/TargetedMSDataHandler.java index 5580b2942..ffcc5d66d 100644 --- a/src/org/labkey/targetedms/TargetedMSDataHandler.java +++ b/src/org/labkey/targetedms/TargetedMSDataHandler.java @@ -30,7 +30,6 @@ import org.labkey.api.exp.api.ExpRun; import org.labkey.api.exp.api.ExperimentService; import org.labkey.api.pipeline.PipeRoot; -import org.labkey.api.pipeline.PipelineJob; import org.labkey.api.pipeline.PipelineJobException; import org.labkey.api.pipeline.PipelineService; import org.labkey.api.security.User; @@ -377,7 +376,7 @@ private boolean zipContainsSkyFile(Path f) catch (IOException | IllegalArgumentException e) { //ignore - see issue 29485 for IllegalArgumentException case - _log.warn("Failed to open zip file " + f + " to check if it contains .sky files" + e.getMessage()); + _log.warn("Failed to open zip file {} to check if it contains .sky files{}", f, e.getMessage()); } return false; diff --git a/src/org/labkey/targetedms/TargetedMSManager.java b/src/org/labkey/targetedms/TargetedMSManager.java index 8e9fda0fd..02e41b83c 100644 --- a/src/org/labkey/targetedms/TargetedMSManager.java +++ b/src/org/labkey/targetedms/TargetedMSManager.java @@ -2788,7 +2788,7 @@ public static void populatePTMPercentsGroupedPrepivotCache(@NotNull TargetedMSRu return; } - _log.info("Populating PTMPercentsGroupedPrepivotCache for run " + run.getId()); + _log.info("Populating PTMPercentsGroupedPrepivotCache for run {}", run.getId()); String labkeySql = "SELECT\n" + " Modification,\n" + @@ -2826,7 +2826,7 @@ public static void populatePTMPercentsGroupedPrepivotCache(@NotNull TargetedMSRu insertSql.add(run.getId()); new SqlExecutor(getSchema()).execute(insertSql); - _log.info("Finished populating PTMPercentsGroupedPrepivotCache for run " + run.getId()); + _log.info("Finished populating PTMPercentsGroupedPrepivotCache for run {}", run.getId()); } /** diff --git a/src/org/labkey/targetedms/TargetedMSUpgradeCode.java b/src/org/labkey/targetedms/TargetedMSUpgradeCode.java index 3c95c2dbe..e781278ea 100644 --- a/src/org/labkey/targetedms/TargetedMSUpgradeCode.java +++ b/src/org/labkey/targetedms/TargetedMSUpgradeCode.java @@ -101,7 +101,7 @@ public void populatePTMPercentsGroupedPrepivotCache(final ModuleContext moduleCo } catch (Exception e) { - LOG.error("Error populating PTMPercentsGroupedPrepivotCache for run " + run.getId() + " in " + container.getPath(), e); + LOG.error("Error populating PTMPercentsGroupedPrepivotCache for run {} in {}", run.getId(), container.getPath(), e); } } } @@ -129,7 +129,7 @@ public void reparentOrphanedTargetedMSData(final ModuleContext moduleContext) int deletedCount = executor.execute(deleteSql); if (deletedCount > 0) { - LOG.info("Deleted " + deletedCount + " orphaned rows from targetedms." + tableName); + LOG.info("Deleted {} orphaned rows from targetedms.{}", deletedCount, tableName); } } @@ -142,7 +142,7 @@ public void reparentOrphanedTargetedMSData(final ModuleContext moduleContext) int updatedCount = executor.execute(updateSql); if (updatedCount > 0) { - LOG.info("Reparented " + updatedCount + " orphaned rows from targetedms." + tableName + " to /Shared"); + LOG.info("Reparented {} orphaned rows from targetedms.{} to /Shared", updatedCount, tableName); } } } diff --git a/src/org/labkey/targetedms/calculations/GeneralMoleculeResultDataSet.java b/src/org/labkey/targetedms/calculations/GeneralMoleculeResultDataSet.java index b047d3a1e..ec92c923a 100644 --- a/src/org/labkey/targetedms/calculations/GeneralMoleculeResultDataSet.java +++ b/src/org/labkey/targetedms/calculations/GeneralMoleculeResultDataSet.java @@ -39,7 +39,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; diff --git a/src/org/labkey/targetedms/calculations/RunQuantifier.java b/src/org/labkey/targetedms/calculations/RunQuantifier.java index e8e089ada..7734052a2 100644 --- a/src/org/labkey/targetedms/calculations/RunQuantifier.java +++ b/src/org/labkey/targetedms/calculations/RunQuantifier.java @@ -52,7 +52,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; diff --git a/src/org/labkey/targetedms/calculations/quantification/GroupComparisonDataSet.java b/src/org/labkey/targetedms/calculations/quantification/GroupComparisonDataSet.java index a262d04a2..1771d8715 100644 --- a/src/org/labkey/targetedms/calculations/quantification/GroupComparisonDataSet.java +++ b/src/org/labkey/targetedms/calculations/quantification/GroupComparisonDataSet.java @@ -86,7 +86,7 @@ public LinearFitResult calculateFoldChange(String label) { DesignMatrix designMatrix = DesignMatrix.getDesignMatrix(foldChangeDataSet, false); try { - LinearFitResult linearFitResult = designMatrix.performLinearFit().get(0); + LinearFitResult linearFitResult = designMatrix.performLinearFit().getFirst(); return linearFitResult; } catch (Exception x) diff --git a/src/org/labkey/targetedms/calculations/quantification/TransitionKeys.java b/src/org/labkey/targetedms/calculations/quantification/TransitionKeys.java index 72d0bbf41..c87a5edcb 100644 --- a/src/org/labkey/targetedms/calculations/quantification/TransitionKeys.java +++ b/src/org/labkey/targetedms/calculations/quantification/TransitionKeys.java @@ -14,6 +14,8 @@ */ package org.labkey.targetedms.calculations.quantification; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -76,7 +78,7 @@ public List asList() { } @Override - public Iterator iterator() { + public @NotNull Iterator iterator() { return Arrays.asList(_keys).iterator(); } diff --git a/src/org/labkey/targetedms/chart/ChromatogramDataset.java b/src/org/labkey/targetedms/chart/ChromatogramDataset.java index afeba8579..25bcbef23 100644 --- a/src/org/labkey/targetedms/chart/ChromatogramDataset.java +++ b/src/org/labkey/targetedms/chart/ChromatogramDataset.java @@ -67,7 +67,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -912,7 +911,7 @@ protected List getPeptideIdRetention } else { - LOG.warn("Could not find pipeline root for container " + _container.getPath()); + LOG.warn("Could not find pipeline root for container {}", _container.getPath()); return Collections.emptyList(); } diff --git a/src/org/labkey/targetedms/chart/ComparisonCategory.java b/src/org/labkey/targetedms/chart/ComparisonCategory.java index 6c65b27e8..db77c7de1 100644 --- a/src/org/labkey/targetedms/chart/ComparisonCategory.java +++ b/src/org/labkey/targetedms/chart/ComparisonCategory.java @@ -281,7 +281,7 @@ private static void makeUniquePrefixes(List peptideCategories, if(peptideCategories.size() == 1) { - ComparisonCategory.PeptideCategory category = peptideCategories.get(0); + ComparisonCategory.PeptideCategory category = peptideCategories.getFirst(); String sequence = category.getSequence(); prefixLen = Math.max(3, prefixLen - 1); category.setSeqPrefix(sequence.substring(0, Math.min(prefixLen, sequence.length()))); @@ -296,7 +296,7 @@ private static void makeUniquePrefixes(List peptideCategories, if(uniqSequences.size() == 1) { prefixLen = Math.max(3, prefixLen - 1); - prefixLen = Math.min(prefixLen, peptideCategories.get(0).getSequence().length()); + prefixLen = Math.min(prefixLen, peptideCategories.getFirst().getSequence().length()); // If all the given categories have the same sequence, set the for(ComparisonCategory.PeptideCategory category: peptideCategories) diff --git a/src/org/labkey/targetedms/chart/ComparisonDataset.java b/src/org/labkey/targetedms/chart/ComparisonDataset.java index abcbc9a08..e9166a09b 100644 --- a/src/org/labkey/targetedms/chart/ComparisonDataset.java +++ b/src/org/labkey/targetedms/chart/ComparisonDataset.java @@ -634,7 +634,7 @@ public BarChartSeriesItemData make(List pciPlusList, if(pciPlusList.size() == 1) { - Double pciVal = getValue(pciPlusList.get(0)); + Double pciVal = getValue(pciPlusList.getFirst()); if(pciVal != null && !cvValues) { value = pciVal; @@ -683,7 +683,7 @@ public BoxAndWhiskerSeriesItemData make(List pciPlus { if(pciPlusList.size() == 1) { - PrecursorChromInfoLitePlus pciPlus = pciPlusList.get(0); + PrecursorChromInfoLitePlus pciPlus = pciPlusList.getFirst(); if(pciPlus.getBestRetentionTime() == null || pciPlus.getMinStartTime() == null || pciPlus.getMaxEndTime() == null) { return null; diff --git a/src/org/labkey/targetedms/chart/ReplicateLabelMinimizer.java b/src/org/labkey/targetedms/chart/ReplicateLabelMinimizer.java index fa3bcc2a7..fb3482653 100644 --- a/src/org/labkey/targetedms/chart/ReplicateLabelMinimizer.java +++ b/src/org/labkey/targetedms/chart/ReplicateLabelMinimizer.java @@ -48,7 +48,7 @@ public static Map minimize(List labels) List normalizedLabels = normalizeLabels(labels); - String[] labelParts = normalizedLabels.get(0).split(String.valueOf(LABEL_SEP_CHAR)); + String[] labelParts = normalizedLabels.getFirst().split(String.valueOf(LABEL_SEP_CHAR)); if(labelParts.length == 1) { return originalLabels(labels); diff --git a/src/org/labkey/targetedms/chromlib/BaseDaoImpl.java b/src/org/labkey/targetedms/chromlib/BaseDaoImpl.java index 2de74c513..64549a92b 100644 --- a/src/org/labkey/targetedms/chromlib/BaseDaoImpl.java +++ b/src/org/labkey/targetedms/chromlib/BaseDaoImpl.java @@ -61,7 +61,7 @@ public void save(T t, Connection connection) throws SQLException @Override public void saveAll(Collection list, Connection connection) throws SQLException { - _log.debug("Batch insert of " + list.size() + " objects"); + _log.debug("Batch insert of {} objects", list.size()); if (!list.isEmpty()) { String sql = getInsertSql(); @@ -172,7 +172,7 @@ public T queryForId(int id, Connection connection) throws SQLException { throw new SQLException("More than one entries found in "+getTableName()+" for Id "+id); } - return results.get(0); + return results.getFirst(); } @Override diff --git a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java index 5a39d9823..498855095 100644 --- a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java +++ b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java @@ -36,7 +36,6 @@ import org.labkey.vfs.FileLike; import org.sqlite.SQLiteConfig; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; diff --git a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryWriter.java b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryWriter.java index ecbbfc8c3..a5a787d1b 100644 --- a/src/org/labkey/targetedms/chromlib/ChromatogramLibraryWriter.java +++ b/src/org/labkey/targetedms/chromlib/ChromatogramLibraryWriter.java @@ -63,7 +63,7 @@ public class ChromatogramLibraryWriter public void openLibrary(Path libFile) throws SQLException { - _log.info("Writing chromatogram library " + FileUtil.getFileName(libFile)); + _log.info("Writing chromatogram library {}", FileUtil.getFileName(libFile)); if(Files.exists(libFile)) { throw new IllegalStateException("Chromatogram library file "+ FileUtil.pathToString(libFile) +" already exists."); @@ -113,7 +113,7 @@ public void closeLibrary() throws SQLException { _connectionSource.close(); } - _log.info("Done writing chromatogram library " + FileUtil.pathToString(_libFile)); + _log.info("Done writing chromatogram library {}", FileUtil.pathToString(_libFile)); } private void flushCache() throws SQLException @@ -196,7 +196,7 @@ private void saveEntry(Dao dao, T object) throws SQLException } catch(SQLException e) { - _log.error("Error saving to " + dao.getTableName(), e); + _log.error("Error saving to {}", dao.getTableName(), e); throw e; } } @@ -209,7 +209,7 @@ private void flush(Dao dao, Collection list) throws SQLException } catch(SQLException e) { - _log.error("Error saving list to " + dao.getTableName(), e); + _log.error("Error saving list to {}", dao.getTableName(), e); throw e; } } diff --git a/src/org/labkey/targetedms/chromlib/LibProtein.java b/src/org/labkey/targetedms/chromlib/LibProtein.java index dd74870a4..023985c6a 100644 --- a/src/org/labkey/targetedms/chromlib/LibProtein.java +++ b/src/org/labkey/targetedms/chromlib/LibProtein.java @@ -44,7 +44,7 @@ public LibProtein(PeptideGroup pepGroup) List proteins = PeptideGroupManager.getProteinsForPeptideGroup(pepGroup.getId(), false); if (!proteins.isEmpty()) { - setSequence(proteins.get(0).getSequence()); + setSequence(proteins.getFirst().getSequence()); } } diff --git a/src/org/labkey/targetedms/datasource/MsDataSourceUtil.java b/src/org/labkey/targetedms/datasource/MsDataSourceUtil.java index dddf2fac6..ff9ab4641 100644 --- a/src/org/labkey/targetedms/datasource/MsDataSourceUtil.java +++ b/src/org/labkey/targetedms/datasource/MsDataSourceUtil.java @@ -207,7 +207,7 @@ private MsDataSource getMsDataSource(ISampleFile sampleFile) List sourceTypes = MsDataSourceTypes.getSourceForName(sampleFile.getFileName()); if(sourceTypes.size() == 1) { - return sourceTypes.get(0); + return sourceTypes.getFirst(); } else if(sourceTypes.size() > 1) { @@ -685,9 +685,9 @@ public void testGetMsDataSource() assertTrue(sourceType instanceof MsMultiDataSource); MsMultiDataSource multiSourceType = (MsMultiDataSource) sourceType; assertEquals("Expected one directory source", 1, multiSourceType.getDirSources().size()); - assertEquals("Expected Waters source", MsDataSourceTypes.WATERS, multiSourceType.getDirSources().get(0)); + assertEquals("Expected Waters source", MsDataSourceTypes.WATERS, multiSourceType.getDirSources().getFirst()); assertEquals("Expected one file source", 1, multiSourceType.getFileSources().size()); - assertEquals("Expected Thermo source", MsDataSourceTypes.THERMO, multiSourceType.getFileSources().get(0)); + assertEquals("Expected Thermo source", MsDataSourceTypes.THERMO, multiSourceType.getFileSources().getFirst()); // .d sampleFile.setFilePath("C:\\RawData\\file.d"); diff --git a/src/org/labkey/targetedms/datasource/PsiInstruments.java b/src/org/labkey/targetedms/datasource/PsiInstruments.java index 6c87570e6..003029fee 100644 --- a/src/org/labkey/targetedms/datasource/PsiInstruments.java +++ b/src/org/labkey/targetedms/datasource/PsiInstruments.java @@ -84,7 +84,7 @@ public static List getInstruments() } catch (ParserConfigurationException | SAXException | IOException e) { - LOG.error("Error parsing psi-ms-PARSED.xml. " + e.getMessage(), e); + LOG.error("Error parsing psi-ms-PARSED.xml. {}", e.getMessage(), e); return Collections.emptyList(); } diff --git a/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java b/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java index c5b101c6c..2ad839683 100644 --- a/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java +++ b/src/org/labkey/targetedms/folderImport/PanoramaQCSettings.java @@ -389,7 +389,7 @@ protected void getReplicateDataWithoutDuplicates(FolderImportContext ctx, TableI Integer replicateId = getNullableRowIdFromName(TargetedMSSchema.TABLE_REPLICATE, Collections.singleton("Id"), filter, ctx.getUser(), ctx.getContainer(), null); if (replicateId == null) { - ctx.getLogger().info("No replicate '" + replicateName + "' found for exclusion. Skipping."); + ctx.getLogger().info("No replicate '{}' found for exclusion. Skipping.", replicateName); } else { diff --git a/src/org/labkey/targetedms/folderImport/QCFolderImporter.java b/src/org/labkey/targetedms/folderImport/QCFolderImporter.java index a2620b90d..d52bf5900 100644 --- a/src/org/labkey/targetedms/folderImport/QCFolderImporter.java +++ b/src/org/labkey/targetedms/folderImport/QCFolderImporter.java @@ -62,7 +62,7 @@ public void process(@Nullable PipelineJob job, FolderImportContext ctx, VirtualF { ctx.getLogger().info("Starting QC Plot settings import"); numRows = qcSetting.importSettingsFromFile(ctx, panoramaQCDir, null, null, null, null); - ctx.getLogger().info("Finished importing " + numRows + " QC Plot settings from " + qcSetting.getSettingsFileName() + " as properties."); + ctx.getLogger().info("Finished importing {} QC Plot settings from {} as properties.", numRows, qcSetting.getSettingsFileName()); } else { @@ -70,9 +70,9 @@ public void process(@Nullable PipelineJob job, FolderImportContext ctx, VirtualF QueryUpdateService qus = ti.getUpdateService(); BatchValidationException errors = new BatchValidationException(); - ctx.getLogger().info("Starting data import from " + qcSetting.getSettingsFileName() + " into targetedms." + qcSetting.getTableName()); + ctx.getLogger().info("Starting data import from {} into targetedms.{}", qcSetting.getSettingsFileName(), qcSetting.getTableName()); numRows = qcSetting.importSettingsFromFile(ctx, panoramaQCDir, schema, ti, qus, errors); - ctx.getLogger().info("Finished importing " + numRows + " rows from " + qcSetting.getSettingsFileName() + " into targetedms." + qcSetting.getTableName()); + ctx.getLogger().info("Finished importing {} rows from {} into targetedms.{}", numRows, qcSetting.getSettingsFileName(), qcSetting.getTableName()); } } catch (IOException e) diff --git a/src/org/labkey/targetedms/model/QCPlotFragment.java b/src/org/labkey/targetedms/model/QCPlotFragment.java index f03f47b8c..d8dfcc1e4 100644 --- a/src/org/labkey/targetedms/model/QCPlotFragment.java +++ b/src/org/labkey/targetedms/model/QCPlotFragment.java @@ -195,7 +195,7 @@ public JSONObject toJSON(boolean includeLJ, boolean includeMR, boolean includeMe return jsonObject; } - public void setSeriesColor(Color seriesColor) + public void setSeriesColor(@Nullable Color seriesColor) { _seriesColor = seriesColor; } diff --git a/src/org/labkey/targetedms/model/passport/IProtein.java b/src/org/labkey/targetedms/model/passport/IProtein.java index 25ead6f7a..d1ce744bf 100644 --- a/src/org/labkey/targetedms/model/passport/IProtein.java +++ b/src/org/labkey/targetedms/model/passport/IProtein.java @@ -236,7 +236,7 @@ public List getProtSeqHTML() htmlStrings[i] = HtmlString.of(str[i]); } List groups = new ArrayList<>(); - if (features != null && !features.isEmpty() && features.get(features.size() - 1).getEndIndex() < str.length) + if (features != null && !features.isEmpty() && features.getLast().getEndIndex() < str.length) { for (int i = 0; i < features.size(); i++) { diff --git a/src/org/labkey/targetedms/outliers/OutlierGenerator.java b/src/org/labkey/targetedms/outliers/OutlierGenerator.java index e133136ea..80f8cdadf 100644 --- a/src/org/labkey/targetedms/outliers/OutlierGenerator.java +++ b/src/org/labkey/targetedms/outliers/OutlierGenerator.java @@ -529,7 +529,7 @@ public List getQCPlotFragment(List rawMetricDa { QCPlotFragment qcPlotFragment = new QCPlotFragment(); - RawMetricDataSet firstValue = entry.getValue().get(0); + RawMetricDataSet firstValue = entry.getValue().getFirst(); /* Common values for the whole peptide */ qcPlotFragment.setDataType(firstValue.getDataType()); @@ -620,7 +620,7 @@ public List getPeptideOutliers(List rawMetric outlierCountsPerMetric.put(rawMetricDataSet.getMetric().getName(), outlierCountsPerMetric.get(rawMetricDataSet.getMetric().getName()) + 1); } } - peptideOutlier.setPrecursorId(entry.getValue().get(0).getPrecursorChromInfoId()); + peptideOutlier.setPrecursorId(entry.getValue().getFirst().getPrecursorChromInfoId()); peptideOutlier.setOutlierCountsPerMetric(outlierCountsPerMetric); peptideOutlier.setTotalOutliers(totalOutliers); peptideOutliers.add(peptideOutlier); diff --git a/src/org/labkey/targetedms/parser/AbstractChromInfo.java b/src/org/labkey/targetedms/parser/AbstractChromInfo.java index cec984e0f..4b38e0ac4 100644 --- a/src/org/labkey/targetedms/parser/AbstractChromInfo.java +++ b/src/org/labkey/targetedms/parser/AbstractChromInfo.java @@ -62,7 +62,7 @@ public abstract class AbstractChromInfo extends ChromInfo(skydPath, _chromatogramOffset, _chromatogramLength)); if (diskBytes == null) { @@ -249,7 +249,7 @@ private CompressedBytesAndStatus getCompressedBytesAndStatus(TargetedMSRun run) } else if (databaseBytes != null && !Arrays.equals(databaseBytes, diskBytes._bytes)) { - LOG.error("Chromatogram bytes for " + this + " do not match between .skyd and DB. Using database copy. Lengths: " + diskBytes._bytes.length + " vs " + databaseBytes.length); + LOG.error("Chromatogram bytes for {} do not match between .skyd and DB. Using database copy. Lengths: {} vs {}", this, diskBytes._bytes.length, databaseBytes.length); status = Chromatogram.SourceStatus.mismatch; } else @@ -266,7 +266,7 @@ else if (databaseBytes != null && !Arrays.equals(databaseBytes, diskBytes._bytes } else { - LOG.debug("No length, offset, and/or SKYD DataId for " + this); + LOG.debug("No length, offset, and/or SKYD DataId for {}", this); status = Chromatogram.SourceStatus.dbOnly; } diff --git a/src/org/labkey/targetedms/parser/Chromatogram.java b/src/org/labkey/targetedms/parser/Chromatogram.java index 6187bf589..d33c483cf 100644 --- a/src/org/labkey/targetedms/parser/Chromatogram.java +++ b/src/org/labkey/targetedms/parser/Chromatogram.java @@ -78,7 +78,7 @@ public float[] getTimes() { if (_mergedTimes == null) { if (allSameTimes()) { - _mergedTimes = getTransitionTimeIntensities().get(0).getTimes(); + _mergedTimes = getTransitionTimeIntensities().getFirst().getTimes(); } else { _mergedTimes = getAllTimesMerged(); } diff --git a/src/org/labkey/targetedms/parser/PeakAreaRatioCalculator.java b/src/org/labkey/targetedms/parser/PeakAreaRatioCalculator.java index 5fabd3e4e..30d6d0399 100644 --- a/src/org/labkey/targetedms/parser/PeakAreaRatioCalculator.java +++ b/src/org/labkey/targetedms/parser/PeakAreaRatioCalculator.java @@ -276,13 +276,7 @@ PrecursorChromInfo getChromInfo(long isotopeLabelId) TransitionAreaRatioCalculator getTransitionAreaRatioCalculator(TransitionType transition, PrecursorType precursor) { String transitionKey = getTransitionKey(transition, precursor); - TransitionAreaRatioCalculator calculator = _calculatorMap.get(transitionKey); - if(calculator == null) - { - calculator = new TransitionAreaRatioCalculator(); - _calculatorMap.put(transitionKey, calculator); - } - return calculator; + return _calculatorMap.computeIfAbsent(transitionKey, _ -> new TransitionAreaRatioCalculator()); } } diff --git a/src/org/labkey/targetedms/parser/PeptideSettingsParser.java b/src/org/labkey/targetedms/parser/PeptideSettingsParser.java index 4e37d9522..665659d94 100644 --- a/src/org/labkey/targetedms/parser/PeptideSettingsParser.java +++ b/src/org/labkey/targetedms/parser/PeptideSettingsParser.java @@ -226,7 +226,7 @@ else if(XmlUtil.isStartElement(reader, evtType, HEAVY_MODIFICATIONS)) } // Mark the label types that were used as an internal standard - isotopeLabelNames.add(0, PeptideSettings.IsotopeLabel.LIGHT); + isotopeLabelNames.addFirst(PeptideSettings.IsotopeLabel.LIGHT); // If we did not find either the "internal_standard" attribute or elements, check if we have // a "heavy" isotope label. If we do, set "heavy" as the internal standard diff --git a/src/org/labkey/targetedms/parser/PrecursorChromInfo.java b/src/org/labkey/targetedms/parser/PrecursorChromInfo.java index 472fe1b6f..45a6cb375 100644 --- a/src/org/labkey/targetedms/parser/PrecursorChromInfo.java +++ b/src/org/labkey/targetedms/parser/PrecursorChromInfo.java @@ -461,7 +461,7 @@ public void setTransitionChromatogramIndices(byte[] bytes) } catch (IOException e) { - LOG.error("Unable to read " + bytes.length + " of transition chromatogram indices"); + LOG.error("Unable to read {} of transition chromatogram indices", bytes.length); } } diff --git a/src/org/labkey/targetedms/parser/Protein.java b/src/org/labkey/targetedms/parser/Protein.java index c514758c0..20fb8653b 100644 --- a/src/org/labkey/targetedms/parser/Protein.java +++ b/src/org/labkey/targetedms/parser/Protein.java @@ -179,7 +179,7 @@ public void setCdrRanges(String cdrRangesString) } catch (NumberFormatException e) { - LOG.debug("Invalid protein CDR value: " + cdrRangesString); + LOG.debug("Invalid protein CDR value: {}", cdrRangesString); } } } diff --git a/src/org/labkey/targetedms/parser/SampleFile.java b/src/org/labkey/targetedms/parser/SampleFile.java index b3c24c25b..82649f70d 100644 --- a/src/org/labkey/targetedms/parser/SampleFile.java +++ b/src/org/labkey/targetedms/parser/SampleFile.java @@ -281,8 +281,8 @@ public void testGetFileName() String path = "C:\\Users\\lab\\Data\\2017-Geoduck-SRM-raw\\" + fileName; String pathWithParams = path + "?centroid_ms1=true¢roid_ms2=true"; - assertTrue(fileName.equals(getFileName(path))); - assertTrue(fileName.equals(getFileName(pathWithParams))); + assertEquals(fileName, getFileName(path)); + assertEquals(fileName, getFileName(pathWithParams)); // Skyline stores multi-injection wiff file paths as: || // Example: C:\Analyst Data\Projects\CPTAC\Site54_STUDY9S_PHASE1_6ProtMix_090919\Site54_190909_Study9S_PHASE-1.wiff|Site54_STUDY9S_PHASE1_6ProtMix_QC_03|2 @@ -290,14 +290,14 @@ public void testGetFileName() path = "C:\\Analyst Data\\Projects\\CPTAC\\Site54_STUDY9S_PHASE1_6ProtMix_090919\\" + fileName; String pathWithSampleInfo = path + "|Site54_STUDY9S_PHASE1_6ProtMix_QC_03|2"; - assertTrue(fileName.equals(getFileName(path))); - assertTrue(fileName.equals(getFileName(pathWithSampleInfo))); + assertEquals(fileName, getFileName(path)); + assertEquals(fileName, getFileName(pathWithSampleInfo)); // Add a bogus param with a '|' character String pathWithSampleInfoAndParams = pathWithSampleInfo + "?centroid_ms1=true¢roid_ms2=true&madeup_param=a|b"; - assertTrue(fileName.equals(getFileName(path))); - assertTrue(fileName.equals(getFileName(pathWithSampleInfoAndParams))); + assertEquals(fileName, getFileName(path)); + assertEquals(fileName, getFileName(pathWithSampleInfoAndParams)); } } } diff --git a/src/org/labkey/targetedms/parser/SkylineBinaryParser.java b/src/org/labkey/targetedms/parser/SkylineBinaryParser.java index 6e14a143c..c472405f2 100644 --- a/src/org/labkey/targetedms/parser/SkylineBinaryParser.java +++ b/src/org/labkey/targetedms/parser/SkylineBinaryParser.java @@ -116,7 +116,7 @@ public void close() { if (!_file.delete()) { - _log.warn("Failed to delete temp copy of SKYD file: " + _file.getAbsolutePath()); + _log.warn("Failed to delete temp copy of SKYD file: {}", _file.getAbsolutePath()); } else { @@ -133,11 +133,11 @@ public void parse() throws IOException _cacheFormat = new CacheFormat(_cacheHeaderStruct); if (_cacheFormat.getFormatVersion().compareTo(CacheFormatVersion.Two) < 0) { - _log.warn("Version " + _cacheFormat.getFormatVersion() + " is not supported for .skyd files. The earliest supported version is " + CacheFormatVersion.Two + ". Skipping chromatogram import."); + _log.warn("Version {} is not supported for .skyd files. The earliest supported version is {}. Skipping chromatogram import.", _cacheFormat.getFormatVersion(), CacheFormatVersion.Two); return; } if (_cacheFormat.getVersionRequired().compareTo(FORMAT_VERSION_CACHE) > 0) { - _log.warn("Version " + _cacheFormat.getVersionRequired() + " is not supported for .skyd files. The newest supported version is " + FORMAT_VERSION_CACHE + ". Skipping chromatogram import."); + _log.warn("Version {} is not supported for .skyd files. The newest supported version is {}. Skipping chromatogram import.", _cacheFormat.getVersionRequired(), FORMAT_VERSION_CACHE); return; } diff --git a/src/org/labkey/targetedms/parser/SkylineDocumentParser.java b/src/org/labkey/targetedms/parser/SkylineDocumentParser.java index 104c4f589..810fdb8e6 100644 --- a/src/org/labkey/targetedms/parser/SkylineDocumentParser.java +++ b/src/org/labkey/targetedms/parser/SkylineDocumentParser.java @@ -45,7 +45,6 @@ import org.labkey.targetedms.parser.proto.SkylineDocument; import org.labkey.targetedms.parser.skyd.ChromGroupHeaderInfo; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.File; @@ -286,7 +285,7 @@ private void parseOptDbFiles() String optDbFileName = FilenameUtils.getName(optDbPath); File optDbFile = new File(_file.getParent(), optDbFileName); if (! optDbFile.exists() ) { - _log.warn("Input OPTDB database does not exist " + optDbFileName); + _log.warn("Input OPTDB database does not exist {}", optDbFileName); } else { @@ -303,7 +302,7 @@ private void parseOptDbFiles() schemaVersion = rs.getInt("SchemaVersion"); if (schemaVersion > 3) { - _log.warn("Unsupported OPTDB version: " + schemaVersion + " in OPTDB file " + optDbFile + ", attempting to continue"); + _log.warn("Unsupported OPTDB version: {} in OPTDB file {}, attempting to continue", schemaVersion, optDbFile); } } else @@ -358,7 +357,7 @@ private void parseiRTFile() String iRTFileName = FilenameUtils.getName(irtDatabasePath); File iRTFile = new File(_file.getParent(), iRTFileName); if (! iRTFile.exists() ) { - _log.warn("Input iRT database does not exist " + iRTFileName); + _log.warn("Input iRT database does not exist {}", iRTFileName); } else { @@ -412,7 +411,7 @@ private ExpData parseChromatograms(@NotNull Container container, @NotNull User u } else { - _log.warn("Unable to find file " + skydFile + ", unable to import chromatograms"); + _log.warn("Unable to find file {}, unable to import chromatograms", skydFile); } return null; } @@ -460,8 +459,7 @@ private void readDocumentVersion(XMLStreamReader reader) throws XMLStreamExcepti else if(version > MAX_SUPPORTED_VERSION) { // We will log a warning but continue with the import. - _log.warn("The version of this Skyline document is " + version + - ". This is newer than the highest supported version " + MAX_SUPPORTED_VERSION); + _log.warn("The version of this Skyline document is {}. This is newer than the highest supported version " + MAX_SUPPORTED_VERSION, version); } _formatVersion = String.valueOf(version); @@ -1054,7 +1052,7 @@ else if(XmlUtil.isStartElement(reader, evtType, ANNOTATION)) if(sampleFileList.size() == 1) { // Only for replicates with single sample files, store the id given by Skyline to the sample file. - _replicateSampleFileIdMap.put(replicate.getName(), sampleFileList.get(0).getSkylineId()); + _replicateSampleFileIdMap.put(replicate.getName(), sampleFileList.getFirst().getSkylineId()); } } @@ -1391,7 +1389,7 @@ public void logMissingChromatogramCounts() { for (Map.Entry entry : _missingChromatograms.entrySet()) { - _log.warn("Missed importing " + entry.getValue().intValue() + " chromatograms from sample file " + entry.getKey()); + _log.warn("Missed importing {} chromatograms from sample file {}", entry.getValue().intValue(), entry.getKey()); } } diff --git a/src/org/labkey/targetedms/parser/Target.java b/src/org/labkey/targetedms/parser/Target.java index bae200fd4..d7f7685e2 100644 --- a/src/org/labkey/targetedms/parser/Target.java +++ b/src/org/labkey/targetedms/parser/Target.java @@ -131,7 +131,7 @@ public static Target fromChromatogramTextId(String textId) if (!parts.isEmpty()) { - target.name = parts.get(0); + target.name = parts.getFirst(); } if (parts.size() > 1) { diff --git a/src/org/labkey/targetedms/parser/TransitionSettings.java b/src/org/labkey/targetedms/parser/TransitionSettings.java index e1d3e4902..d7ace095e 100644 --- a/src/org/labkey/targetedms/parser/TransitionSettings.java +++ b/src/org/labkey/targetedms/parser/TransitionSettings.java @@ -667,7 +667,7 @@ public int hashCode() } @Override - public int compareTo(PredictorSettings o) + public int compareTo(@NotNull PredictorSettings o) { return o == null ? -1 : this.toString().compareTo(o.toString()); } diff --git a/src/org/labkey/targetedms/parser/list/ListData.java b/src/org/labkey/targetedms/parser/list/ListData.java index 600ed89dc..4c62aed5c 100644 --- a/src/org/labkey/targetedms/parser/list/ListData.java +++ b/src/org/labkey/targetedms/parser/list/ListData.java @@ -37,7 +37,7 @@ public int getItemCount() if (_columnDatas.isEmpty()) { return 0; } - return _columnDatas.get(0).size(); + return _columnDatas.getFirst().size(); } public int getColumnCount() { diff --git a/src/org/labkey/targetedms/parser/proto/ChromatogramGroupDataOuterClass.java b/src/org/labkey/targetedms/parser/proto/ChromatogramGroupDataOuterClass.java index e609ce1d2..24b437afc 100644 --- a/src/org/labkey/targetedms/parser/proto/ChromatogramGroupDataOuterClass.java +++ b/src/org/labkey/targetedms/parser/proto/ChromatogramGroupDataOuterClass.java @@ -9315,7 +9315,7 @@ public FilterOperation findValueByNumber(int number) } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return org.labkey.targetedms.parser.proto.ChromatogramGroupDataOuterClass.ChromatogramGroupIdsProto.getDescriptor().getEnumTypes().get(0); + return org.labkey.targetedms.parser.proto.ChromatogramGroupDataOuterClass.ChromatogramGroupIdsProto.getDescriptor().getEnumTypes().getFirst(); } private static final FilterOperation[] VALUES = values(); @@ -15982,7 +15982,7 @@ public org.labkey.targetedms.parser.proto.ChromatogramGroupDataOuterClass.Chroma new com.google.protobuf.Descriptors.FileDescriptor[] { }); internal_static_ChromatogramGroupData_descriptor = - getDescriptor().getMessageTypes().get(0); + getDescriptor().getMessageTypes().getFirst(); internal_static_ChromatogramGroupData_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_ChromatogramGroupData_descriptor, @@ -16060,7 +16060,7 @@ public org.labkey.targetedms.parser.proto.ChromatogramGroupDataOuterClass.Chroma internal_static_ChromatogramGroupIdsProto_SpectrumFilter_descriptor, new java.lang.String[] { "Predicates", }); internal_static_ChromatogramGroupIdsProto_SpectrumFilter_Predicate_descriptor = - internal_static_ChromatogramGroupIdsProto_SpectrumFilter_descriptor.getNestedTypes().get(0); + internal_static_ChromatogramGroupIdsProto_SpectrumFilter_descriptor.getNestedTypes().getFirst(); internal_static_ChromatogramGroupIdsProto_SpectrumFilter_Predicate_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_ChromatogramGroupIdsProto_SpectrumFilter_Predicate_descriptor, diff --git a/src/org/labkey/targetedms/parser/proto/SkylineDocument.java b/src/org/labkey/targetedms/parser/proto/SkylineDocument.java index 92a6f382b..fa23c53d8 100644 --- a/src/org/labkey/targetedms/parser/proto/SkylineDocument.java +++ b/src/org/labkey/targetedms/parser/proto/SkylineDocument.java @@ -169,7 +169,7 @@ public UserSet findValueByNumber(int number) } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return org.labkey.targetedms.parser.proto.SkylineDocument.SkylineDocumentProto.getDescriptor().getEnumTypes().get(0); + return org.labkey.targetedms.parser.proto.SkylineDocument.SkylineDocumentProto.getDescriptor().getEnumTypes().getFirst(); } private static final UserSet[] VALUES = values(); @@ -18724,7 +18724,7 @@ public KeyType findValueByNumber(int number) } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return org.labkey.targetedms.parser.proto.SkylineDocument.LibraryKeyProto.getDescriptor().getEnumTypes().get(0); + return org.labkey.targetedms.parser.proto.SkylineDocument.LibraryKeyProto.getDescriptor().getEnumTypes().getFirst(); } private static final KeyType[] VALUES = values(); @@ -22554,7 +22554,7 @@ public org.labkey.targetedms.parser.proto.SkylineDocument.LibraryKeyProto getDef com.google.protobuf.WrappersProto.getDescriptor(), }); internal_static_SkylineDocumentProto_descriptor = - getDescriptor().getMessageTypes().get(0); + getDescriptor().getMessageTypes().getFirst(); internal_static_SkylineDocumentProto_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_SkylineDocumentProto_descriptor, @@ -22578,7 +22578,7 @@ public org.labkey.targetedms.parser.proto.SkylineDocument.LibraryKeyProto getDef internal_static_SkylineDocumentProto_TransitionPeak_descriptor, new java.lang.String[] { "ReplicateIndex", "FileIndexInReplicate", "MassError", "RetentionTime", "StartRetentionTime", "EndRetentionTime", "IonMobility", "IonMobilityWindow", "Area", "BackgroundArea", "Height", "Fwhm", "IsFwhmDegenerate", "Truncated", "Identified", "Rank", "RankByLevel", "PointsAcrossPeak", "UserSet", "OptimizationStep", "Annotations", "ForcedIntegration", "PeakShapeValues", "IonMobilityCollisionCrossSection", }); internal_static_SkylineDocumentProto_TransitionPeak_PeakShapeValues_descriptor = - internal_static_SkylineDocumentProto_TransitionPeak_descriptor.getNestedTypes().get(0); + internal_static_SkylineDocumentProto_TransitionPeak_descriptor.getNestedTypes().getFirst(); internal_static_SkylineDocumentProto_TransitionPeak_PeakShapeValues_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_SkylineDocumentProto_TransitionPeak_PeakShapeValues_descriptor, diff --git a/src/org/labkey/targetedms/parser/skyaudit/AuditLogEntry.java b/src/org/labkey/targetedms/parser/skyaudit/AuditLogEntry.java index 2d0e35445..d42f04e9a 100644 --- a/src/org/labkey/targetedms/parser/skyaudit/AuditLogEntry.java +++ b/src/org/labkey/targetedms/parser/skyaudit/AuditLogEntry.java @@ -76,7 +76,7 @@ public static AuditLogEntry retrieve(int pEntryId) List results = sel.getArrayList(AuditLogEntry.class); // Possible to get more than one match if two documents share an audit history. In this case, we don't care // which we use - return results.isEmpty() ? null : results.get(0); + return results.isEmpty() ? null : results.getFirst(); } public AuditLogTree getTreeEntry(){ diff --git a/src/org/labkey/targetedms/parser/skyaudit/AuditLogTree.java b/src/org/labkey/targetedms/parser/skyaudit/AuditLogTree.java index 2ac567cf1..c0f2cae7a 100644 --- a/src/org/labkey/targetedms/parser/skyaudit/AuditLogTree.java +++ b/src/org/labkey/targetedms/parser/skyaudit/AuditLogTree.java @@ -119,7 +119,7 @@ public int getTreeSize() while (!stack.isEmpty()) { - AuditLogTree current = stack.remove(0); + AuditLogTree current = stack.removeFirst(); result += current._children.size(); stack.addAll(current._children.values()); } @@ -176,7 +176,7 @@ public Set deleteList(long versionId) { if (currentEntry._entryId != 0) //No need to check for the root node. { - LOG.warn(String.format("Audit log entry with ID %d is a leaf but has no version ID. This might be a data corruption.", this._entryId)); + LOG.warn("Audit log entry with ID {} is a leaf but has no version ID. This might be a data corruption.", this._entryId); } } else if (versionId == currentEntry._versionId) //check if it is the right version id @@ -232,7 +232,7 @@ public AuditLogTree findVersionEntry(long pVersionId) while (!stack.isEmpty()) { - AuditLogTree currentEntry = stack.remove(0); + AuditLogTree currentEntry = stack.removeFirst(); // check if it is the right version id if (currentEntry._versionId != null && currentEntry._versionId == pVersionId) { diff --git a/src/org/labkey/targetedms/parser/skyaudit/UnitTestUtil.java b/src/org/labkey/targetedms/parser/skyaudit/UnitTestUtil.java index ab050b3aa..725b8bd21 100644 --- a/src/org/labkey/targetedms/parser/skyaudit/UnitTestUtil.java +++ b/src/org/labkey/targetedms/parser/skyaudit/UnitTestUtil.java @@ -38,7 +38,6 @@ import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; diff --git a/src/org/labkey/targetedms/parser/speclib/BlibSpectrumReader.java b/src/org/labkey/targetedms/parser/speclib/BlibSpectrumReader.java index db436891a..d178bb297 100644 --- a/src/org/labkey/targetedms/parser/speclib/BlibSpectrumReader.java +++ b/src/org/labkey/targetedms/parser/speclib/BlibSpectrumReader.java @@ -127,7 +127,7 @@ private static boolean malformedBlibFileError(String blibFilePath, SQLException { if(e.getMessage().contains("no such table") || e.getMessage().contains("no such column") || e.getMessage().contains("File opened that is not a database file")) { - LOG.error("Malformed .blib file " + blibFilePath + ". Error was: " + e.getMessage()); + LOG.error("Malformed .blib file {}. Error was: {}", blibFilePath, e.getMessage()); return true; } return false; @@ -415,7 +415,7 @@ private static void addRedundantSpectrumInfo(Connection conn, BlibSpectrum spect if (rSpec.isBestSpectrum()) { // If this is the reference spectrum keep it in front of the list. - redundantSpectra.add(0, rSpec); + redundantSpectra.addFirst(rSpec); } else { diff --git a/src/org/labkey/targetedms/parser/speclib/ElibSpectrumReader.java b/src/org/labkey/targetedms/parser/speclib/ElibSpectrumReader.java index 182839d81..dcb350074 100644 --- a/src/org/labkey/targetedms/parser/speclib/ElibSpectrumReader.java +++ b/src/org/labkey/targetedms/parser/speclib/ElibSpectrumReader.java @@ -106,7 +106,7 @@ private ElibSpectrum readElibSpectrum(Connection conn, SpectrumKey spectrumKey, if(!spectra.isEmpty()) { sortElibSpectra(spectra); - ElibSpectrum bestSpectrum = spectra.get(0); + ElibSpectrum bestSpectrum = spectra.getFirst(); readPeaks(conn, bestSpectrum); if(getRedundant) diff --git a/src/org/labkey/targetedms/parser/speclib/LibSpectrumReader.java b/src/org/labkey/targetedms/parser/speclib/LibSpectrumReader.java index fcf7f2e7b..f58728715 100644 --- a/src/org/labkey/targetedms/parser/speclib/LibSpectrumReader.java +++ b/src/org/labkey/targetedms/parser/speclib/LibSpectrumReader.java @@ -218,7 +218,7 @@ static String getNonEmptyLocalLibPath(Container container, Path libPath) } else { - LOG.debug("Unable to copy " + libPath + " to local file, referenced from " + container.getPath()); + LOG.debug("Unable to copy {} to local file, referenced from {}", libPath, container.getPath()); return null; } } @@ -229,12 +229,12 @@ static String getNonEmptyLocalLibPath(Container container, Path libPath) File f = new File(libPathString); if(!f.exists()) { - LOG.debug("Library file not found: " + libPathString + ", referenced from container " + container.getPath()); + LOG.debug("Library file not found: {}, referenced from container {}", libPathString, container.getPath()); return null; } if(f.length() == 0) { - LOG.debug("Found 0 byte library file: " + libPathString + ", referenced from container " + container.getPath()); + LOG.debug("Found 0 byte library file: {}, referenced from container {}", libPathString, container.getPath()); return null; } return libPathString; diff --git a/src/org/labkey/targetedms/passport/PassportController.java b/src/org/labkey/targetedms/passport/PassportController.java index 0e8afed5c..7cb653b50 100644 --- a/src/org/labkey/targetedms/passport/PassportController.java +++ b/src/org/labkey/targetedms/passport/PassportController.java @@ -61,7 +61,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; diff --git a/src/org/labkey/targetedms/pipeline/ChromatogramCrawlerJob.java b/src/org/labkey/targetedms/pipeline/ChromatogramCrawlerJob.java index 950139b66..5c32636a0 100644 --- a/src/org/labkey/targetedms/pipeline/ChromatogramCrawlerJob.java +++ b/src/org/labkey/targetedms/pipeline/ChromatogramCrawlerJob.java @@ -47,7 +47,7 @@ public ChromatogramCrawlerJob(ViewBackgroundInfo info, @NotNull PipeRoot root) getLogger().info("Description of key statuses:"); for (Chromatogram.SourceStatus value : Chromatogram.SourceStatus.values()) { - getLogger().info("\t" + value.toString() + ": " + value.getDescription()); + getLogger().info("\t{}: {}", value.toString(), value.getDescription()); } getLogger().info("\n"); } @@ -81,7 +81,7 @@ public void run() setStatus(TaskStatus.running); var containers = ContainerManager.getAllChildren(getContainer(), getUser()); - getLogger().info("Starting to process chromatogram rows over " + containers.size() + " containers"); + getLogger().info("Starting to process chromatogram rows over {} containers", containers.size()); CrawlSummary crawlSummary = new CrawlSummary(); @@ -99,11 +99,11 @@ public void run() if (containerPCICount == 0) { - getLogger().info("Skipping container " + container.getPath() + " - no chromatogram rows to process"); + getLogger().info("Skipping container {} - no chromatogram rows to process", container.getPath()); } else { - getLogger().info("Starting processing of container " + container.getPath() + " (" + containerCount + " of " + containers.size() + ") with " + containerPCICount + " chromatogram rows to process"); + getLogger().info("Starting processing of container {} ({} of {}) with {} chromatogram rows to process", container.getPath(), containerCount, containers.size(), containerPCICount); var handler = new PrecursorChromInfoHandler(container); try diff --git a/src/org/labkey/targetedms/query/AnnotatedTargetedMSTable.java b/src/org/labkey/targetedms/query/AnnotatedTargetedMSTable.java index f462dc497..f1a718f0e 100644 --- a/src/org/labkey/targetedms/query/AnnotatedTargetedMSTable.java +++ b/src/org/labkey/targetedms/query/AnnotatedTargetedMSTable.java @@ -140,7 +140,7 @@ protected void addAnnotationsColumns(TableInfo annotationTableInfo, String annot listDefs = listDefs.stream().filter((l) -> lookup.equals(l.getName())).toList(); if (!listDefs.isEmpty()) { - ListDefinition listDef = listDefs.get(0); + ListDefinition listDef = listDefs.getFirst(); // Use the first one (the most recent import) as our FK to a UNION version of the table LookupForeignKey fk = new LookupForeignKey() { diff --git a/src/org/labkey/targetedms/query/CDRConditionalFormattingDisplayColumnFactory.java b/src/org/labkey/targetedms/query/CDRConditionalFormattingDisplayColumnFactory.java index c4fd26833..865414af0 100644 --- a/src/org/labkey/targetedms/query/CDRConditionalFormattingDisplayColumnFactory.java +++ b/src/org/labkey/targetedms/query/CDRConditionalFormattingDisplayColumnFactory.java @@ -1,6 +1,5 @@ package org.labkey.targetedms.query; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.CompareType; diff --git a/src/org/labkey/targetedms/query/CrossLinkedPeptideDisplayColumn.java b/src/org/labkey/targetedms/query/CrossLinkedPeptideDisplayColumn.java index 24f02c55c..886fe3247 100644 --- a/src/org/labkey/targetedms/query/CrossLinkedPeptideDisplayColumn.java +++ b/src/org/labkey/targetedms/query/CrossLinkedPeptideDisplayColumn.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; diff --git a/src/org/labkey/targetedms/query/JoinedTargetedMSTable.java b/src/org/labkey/targetedms/query/JoinedTargetedMSTable.java index cd606dab4..29d3c463d 100644 --- a/src/org/labkey/targetedms/query/JoinedTargetedMSTable.java +++ b/src/org/labkey/targetedms/query/JoinedTargetedMSTable.java @@ -118,9 +118,9 @@ public SQLFragment getFromSQL(String alias) // Join based on the PKs on both tables result.append(" ON G."); - result.append(getRealTable().getPkColumnNames().get(0)); + result.append(getRealTable().getPkColumnNames().getFirst()); result.append(" = S."); - result.append(_specializedTable.getPkColumnNames().get(0)); + result.append(_specializedTable.getPkColumnNames().getFirst()); result.append(") i "); // Re-add the clauses, but only the ones associated with a FieldKey because the others wouldn't have been removed above diff --git a/src/org/labkey/targetedms/query/LibraryManager.java b/src/org/labkey/targetedms/query/LibraryManager.java index 53bba6f86..561f66c36 100644 --- a/src/org/labkey/targetedms/query/LibraryManager.java +++ b/src/org/labkey/targetedms/query/LibraryManager.java @@ -167,13 +167,13 @@ private static String getDocumentLibFileName(Path skyFilesDir) } catch (IOException e) { - LOG.info("Failed to determine the document library file name for " + skyFilesDir + ", continuing without a library file name.", e); + LOG.info("Failed to determine the document library file name for {}, continuing without a library file name.", skyFilesDir, e); } if(!skyFiles.isEmpty()) { // Documents libraries have the same name as the .sky file, with a .blib extension. - return skyFiles.get(0).substring(0, skyFiles.get(0).lastIndexOf('.')) + SkylineFileUtils.EXT_BLIB_W_DOT; + return skyFiles.getFirst().substring(0, skyFiles.getFirst().lastIndexOf('.')) + SkylineFileUtils.EXT_BLIB_W_DOT; } return null; diff --git a/src/org/labkey/targetedms/query/ModifiedSequenceDisplayColumn.java b/src/org/labkey/targetedms/query/ModifiedSequenceDisplayColumn.java index abe3d3ffc..fa7194faa 100644 --- a/src/org/labkey/targetedms/query/ModifiedSequenceDisplayColumn.java +++ b/src/org/labkey/targetedms/query/ModifiedSequenceDisplayColumn.java @@ -42,7 +42,6 @@ import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -320,13 +319,13 @@ public void initialize(RenderContext ctx) } else { - LOG.debug("Modified residue didn't match for " + modificationSite + " at calculated index " + aaIndex + " on peptide " + sequence + " in document " + runId); + LOG.debug("Modified residue didn't match for {} at calculated index {} on peptide {} in document {}", modificationSite, aaIndex, sequence, runId); } } } catch (NumberFormatException ignored) { - LOG.debug("Bad modificationSite value: " + modificationSite + " in document " + runId); + LOG.debug("Bad modificationSite value: {} in document {}", modificationSite, runId); } } } diff --git a/src/org/labkey/targetedms/query/PeptideGroupManager.java b/src/org/labkey/targetedms/query/PeptideGroupManager.java index b57cd0f0a..abb5effdb 100644 --- a/src/org/labkey/targetedms/query/PeptideGroupManager.java +++ b/src/org/labkey/targetedms/query/PeptideGroupManager.java @@ -95,7 +95,7 @@ public static List getProteinsForRun(long runId) public static Protein getProteinForPeptideGroupId(long id) { List result = getProteins(new SQLFragment("pg.Id = ?", id)); - return result.isEmpty() ? null : result.get(0); + return result.isEmpty() ? null : result.getFirst(); } public static List getProteins(SQLFragment whereSql) diff --git a/src/org/labkey/targetedms/query/PrecursorManager.java b/src/org/labkey/targetedms/query/PrecursorManager.java index 3009b6f75..a5afe7651 100644 --- a/src/org/labkey/targetedms/query/PrecursorManager.java +++ b/src/org/labkey/targetedms/query/PrecursorManager.java @@ -176,7 +176,7 @@ public static PrecursorChromInfo getBestPrecursorChromInfo(@NotNull List getDefaultVisibleColumns() List result = aggValues.get(aggregate.getFieldKey().toString()); if(result != null) { - Aggregate.Result aggResult = result.get(0); + Aggregate.Result aggResult = result.getFirst(); if (aggResult.getValue() != null) { defaultCols.add(aggResult.getAggregate().getFieldKey()); diff --git a/src/org/labkey/targetedms/query/SkylineListSchema.java b/src/org/labkey/targetedms/query/SkylineListSchema.java index b7dcce9d9..90ce5042d 100644 --- a/src/org/labkey/targetedms/query/SkylineListSchema.java +++ b/src/org/labkey/targetedms/query/SkylineListSchema.java @@ -61,7 +61,7 @@ private List getListDefinitions(@Nullable ContainerFilter contai if (!listDefs.isEmpty()) { // Use the first one as the base, as it is the most recently imported version - ListDefinition firstListDef = listDefs.get(0); + ListDefinition firstListDef = listDefs.getFirst(); SkylineListTable firstTable = new SkylineListTable(this, firstListDef); SkylineListUnionTable result = new SkylineListUnionTable(this, firstTable); diff --git a/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java b/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java index c8774a0c4..242867f5e 100644 --- a/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java +++ b/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java @@ -218,8 +218,8 @@ public void testSingleCrossLink() Assert.assertEquals("Linker count", 1, i._linkers.size()); Assert.assertEquals("Extra sequences", 1, i.getExtraSequences().size()); Assert.assertEquals("Link location", Set.of(1), i.getBaseSequence().getLinkIndices()); - Assert.assertEquals("Link location", Set.of(2), i.getExtraSequences().get(0).getLinkIndices()); - Assert.assertEquals("Linker mass", -2.01565, i._linkers.get(0).getMass(), 0.00001); + Assert.assertEquals("Link location", Set.of(2), i.getExtraSequences().getFirst().getLinkIndices()); + Assert.assertEquals("Linker mass", -2.01565, i._linkers.getFirst().getMass(), 0.00001); } @Test @@ -230,7 +230,7 @@ public void testModifiedAndMultiLinked() Assert.assertEquals("Modified peptides", Arrays.asList("SC[+57.0]DK", "GE[-4.5]C"), i._modifiedPeptides); Assert.assertEquals("Linker count", 1, i._linkers.size()); Assert.assertEquals("Link location", Set.of(1, 2), i.getBaseSequence().getLinkIndices()); - Assert.assertEquals("Link location", Set.of(0, 1), i.getExtraSequences().get(0).getLinkIndices()); + Assert.assertEquals("Link location", Set.of(0, 1), i.getExtraSequences().getFirst().getLinkIndices()); } @Test diff --git a/src/org/labkey/targetedms/view/DocumentTransitionsView.java b/src/org/labkey/targetedms/view/DocumentTransitionsView.java index e7f6d391c..888e785f1 100644 --- a/src/org/labkey/targetedms/view/DocumentTransitionsView.java +++ b/src/org/labkey/targetedms/view/DocumentTransitionsView.java @@ -15,7 +15,6 @@ package org.labkey.targetedms.view; -import org.labkey.api.data.Sort; import org.labkey.api.query.QueryNestingOption; import org.labkey.api.view.ViewContext; import org.labkey.targetedms.TargetedMSSchema; @@ -38,10 +37,4 @@ public DocumentTransitionsView(ViewContext ctx, TargetedMSSchema schema, String _context = ctx; setTitle(title); } - - @Override - protected Sort getBaseSort() - { - return new Sort("Id"); - } } diff --git a/src/org/labkey/targetedms/view/IconFactory.java b/src/org/labkey/targetedms/view/IconFactory.java index 9c0b2231b..f418a5052 100644 --- a/src/org/labkey/targetedms/view/IconFactory.java +++ b/src/org/labkey/targetedms/view/IconFactory.java @@ -44,19 +44,12 @@ public static String getPeptideIconPath(long peptideId, Long runId, boolean isDe } else { - switch (standardTypeEnum) + iconFile = switch (standardTypeEnum) { - case Normalization: - case SurrogateStandard: - iconFile = "/TargetedMS/images/PeptideStandardLib.png"; - break; - case QC: - iconFile = "/TargetedMS/images/PeptideQcLib.png"; - break; - case iRT: - iconFile = "/TargetedMS/images/PeptideIrtLib.png"; - break; - } + case Normalization, SurrogateStandard -> "/TargetedMS/images/PeptideStandardLib.png"; + case QC -> "/TargetedMS/images/PeptideQcLib.png"; + case iRT -> "/TargetedMS/images/PeptideIrtLib.png"; + }; } } else @@ -67,19 +60,12 @@ public static String getPeptideIconPath(long peptideId, Long runId, boolean isDe } else { - switch (standardTypeEnum) + iconFile = switch (standardTypeEnum) { - case Normalization: - case SurrogateStandard: - iconFile = "/TargetedMS/images/PeptideStandard.png"; - break; - case QC: - iconFile = "/TargetedMS/images/PeptideQc.png"; - break; - case iRT: - iconFile = "/TargetedMS/images/PeptideIrt.png"; - break; - } + case Normalization, SurrogateStandard -> "/TargetedMS/images/PeptideStandard.png"; + case QC -> "/TargetedMS/images/PeptideQc.png"; + case iRT -> "/TargetedMS/images/PeptideIrt.png"; + }; } } diff --git a/src/org/labkey/targetedms/view/moleculeListView.jsp b/src/org/labkey/targetedms/view/moleculeListView.jsp index fadb231b0..42199bd94 100644 --- a/src/org/labkey/targetedms/view/moleculeListView.jsp +++ b/src/org/labkey/targetedms/view/moleculeListView.jsp @@ -52,7 +52,7 @@ List accessions = proteins.stream().map(Protein::getAccession).filter(Objects::nonNull).toList(); %> <% if (accessions.size() == 1) { - String accession = accessions.get(0); %> + String accession = accessions.getFirst(); %> Accession diff --git a/src/org/labkey/targetedms/view/spectrum/LibrarySpectrumMatchGetter.java b/src/org/labkey/targetedms/view/spectrum/LibrarySpectrumMatchGetter.java index 531e9f161..6ad7cfe9c 100644 --- a/src/org/labkey/targetedms/view/spectrum/LibrarySpectrumMatchGetter.java +++ b/src/org/labkey/targetedms/view/spectrum/LibrarySpectrumMatchGetter.java @@ -46,7 +46,6 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; diff --git a/test/src/org/labkey/test/components/targetedms/GuideSetWebPart.java b/test/src/org/labkey/test/components/targetedms/GuideSetWebPart.java index 4db77e1b7..c5a256dd1 100644 --- a/test/src/org/labkey/test/components/targetedms/GuideSetWebPart.java +++ b/test/src/org/labkey/test/components/targetedms/GuideSetWebPart.java @@ -78,7 +78,7 @@ public Integer getRowId(GuideSet guideSet) if (!selResp.getRows().isEmpty()) { - String rowIdStr = selResp.getRows().get(0).get("RowId").toString(); + String rowIdStr = selResp.getRows().getFirst().get("RowId").toString(); return Integer.parseInt(rowIdStr); } } diff --git a/test/src/org/labkey/test/components/targetedms/QCPlot.java b/test/src/org/labkey/test/components/targetedms/QCPlot.java index c4c485af1..43da7429e 100644 --- a/test/src/org/labkey/test/components/targetedms/QCPlot.java +++ b/test/src/org/labkey/test/components/targetedms/QCPlot.java @@ -16,7 +16,6 @@ package org.labkey.test.components.targetedms; import org.junit.Assert; -import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; import org.labkey.test.util.targetedms.QCHelper; import org.openqa.selenium.WebElement; @@ -29,7 +28,6 @@ import java.util.regex.Pattern; import static org.labkey.test.BaseWebDriverTest.getCurrentTest; -import static org.labkey.test.util.TestLogger.log; public class QCPlot { diff --git a/test/src/org/labkey/test/components/targetedms/QCPlotsWebPart.java b/test/src/org/labkey/test/components/targetedms/QCPlotsWebPart.java index b4c4bcaed..bc6911cd8 100644 --- a/test/src/org/labkey/test/components/targetedms/QCPlotsWebPart.java +++ b/test/src/org/labkey/test/components/targetedms/QCPlotsWebPart.java @@ -33,14 +33,11 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; -import java.util.Optional; import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -78,7 +75,7 @@ private WebElement waitForPlotPanel() els.addAll(elementCache().findNoRecordsMessage()) || els.addAll(elementCache().findNoDataMessage()), "QC Plots Webpart load", 10_000); - return els.get(0); + return els.getFirst(); } private void doAndWaitForUpdate(Runnable action) @@ -556,7 +553,7 @@ public void createGuideSet(@LoggedParam GuideSet guideSet, String expectErrorMsg } else { - startPoint = elementCache().svgBackgrounds.findElements(this).get(0); + startPoint = elementCache().svgBackgrounds.findElements(this).getFirst(); xStartOffset = -1 * (Integer.parseInt(startPoint.getAttribute("width")) / 2); } @@ -568,7 +565,7 @@ public void createGuideSet(@LoggedParam GuideSet guideSet, String expectErrorMsg } else { - endPoint = elementCache().svgBackgrounds.findElements(this).get(0); + endPoint = elementCache().svgBackgrounds.findElements(this).getFirst(); xEndOffset = (Integer.parseInt(endPoint.getAttribute("width")) / 2) - 1; } @@ -579,7 +576,7 @@ public void createGuideSet(@LoggedParam GuideSet guideSet, String expectErrorMsg builder.moveToElement(startPoint, xStartOffset, yStartOffset).clickAndHold().moveToElement(endPoint, xEndOffset, yEndOffset).release().perform(); List gsButtons = elementCache().guideSetSvgButton.findElements(this); - getWrapper().shortWait().until(ExpectedConditions.elementToBeClickable(gsButtons.get(0))); + getWrapper().shortWait().until(ExpectedConditions.elementToBeClickable(gsButtons.getFirst())); Integer brushPointCount = getPointElements("fill", "rgba(20, 204, 201, 1)", false).size(); assertEquals("Unexpected number of points selected via brushing", guideSet.getBrushSelectedPoints(), brushPointCount); @@ -587,7 +584,7 @@ public void createGuideSet(@LoggedParam GuideSet guideSet, String expectErrorMsg boolean expectPageReload = expectErrorMsg == null; if (guideSet.getBrushSelectedPoints() != null && guideSet.getBrushSelectedPoints() < 5) { - gsButtons.get(0).click(); // Create button : index 0 + gsButtons.getFirst().click(); // Create button : index 0 Window warning = Window(getDriver()).withTitle("Create Guide Set Warning").waitFor(); if (expectPageReload) warning.clickButton("Yes"); @@ -596,12 +593,12 @@ public void createGuideSet(@LoggedParam GuideSet guideSet, String expectErrorMsg } else if (expectPageReload) { - getWrapper().clickAndWait(gsButtons.get(0)); // Create button : index 0 + getWrapper().clickAndWait(gsButtons.getFirst()); // Create button : index 0 waitForReady(); } else { - gsButtons.get(0).click(); // Create button : index 0 + gsButtons.getFirst().click(); // Create button : index 0 } if (expectErrorMsg != null) diff --git a/test/src/org/labkey/test/components/targetedms/TargetedMSRunsTable.java b/test/src/org/labkey/test/components/targetedms/TargetedMSRunsTable.java index d258d3fb1..26d989837 100644 --- a/test/src/org/labkey/test/components/targetedms/TargetedMSRunsTable.java +++ b/test/src/org/labkey/test/components/targetedms/TargetedMSRunsTable.java @@ -23,6 +23,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -126,7 +127,7 @@ public void verifyDocumentChain(List latestVersions, int[] verCounts) assertTrue(idx != -1); ListverCount = getRowDataAsText(idx, "Versions"); assertEquals(1, verCount.size()); - assertEquals("Expected version count for " + latestVersions, String.valueOf(verCounts[i]), verCount.get(0)); + assertEquals("Expected version count for " + latestVersions, String.valueOf(verCounts[i]), verCount.getFirst()); i++; } } @@ -134,10 +135,10 @@ public void verifyDocumentChain(List latestVersions, int[] verCounts) public void verifyNoChain(int rowCount) { List buttons = getHeaderButtons(); - assertTrue(!getWrapper().getTexts(buttons).contains(ALL_VERSIONS)); - assertTrue(!getWrapper().getTexts(buttons).contains(LATEST_VERSIONS)); + assertFalse(getWrapper().getTexts(buttons).contains(ALL_VERSIONS)); + assertFalse(getWrapper().getTexts(buttons).contains(LATEST_VERSIONS)); assertEquals(rowCount, getDataRowCount()); - assertTrue(!getColumnLabels().contains("Versions")); - assertTrue(!getColumnLabels().contains("Replaced By")); + assertFalse(getColumnLabels().contains("Versions")); + assertFalse(getColumnLabels().contains("Replaced By")); } } diff --git a/test/src/org/labkey/test/tests/panoramapremium/TargetedMSIsotopologueTest.java b/test/src/org/labkey/test/tests/panoramapremium/TargetedMSIsotopologueTest.java index 6dfbdff7d..d6c7a0bc1 100644 --- a/test/src/org/labkey/test/tests/panoramapremium/TargetedMSIsotopologueTest.java +++ b/test/src/org/labkey/test/tests/panoramapremium/TargetedMSIsotopologueTest.java @@ -5,10 +5,7 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.components.ext4.Window; import org.labkey.test.components.targetedms.QCPlotsWebPart; -import org.labkey.test.pages.panoramapremium.ConfigureMetricsUIPage; import org.labkey.test.pages.targetedms.PanoramaDashboard; import static org.junit.Assert.assertTrue; diff --git a/test/src/org/labkey/test/tests/panoramapremium/TargetedMSiRTMetricsTest.java b/test/src/org/labkey/test/tests/panoramapremium/TargetedMSiRTMetricsTest.java index ab8e51d5c..13827b15d 100644 --- a/test/src/org/labkey/test/tests/panoramapremium/TargetedMSiRTMetricsTest.java +++ b/test/src/org/labkey/test/tests/panoramapremium/TargetedMSiRTMetricsTest.java @@ -115,8 +115,8 @@ public void testFileWithIRTMetricValue() log("Verifying the tooltip area of QC summary web part"); QCSummaryWebPart qcSummaryWebPart = qcDashboard.getQcSummaryWebPart(); - QCSummaryWebPart.QcSummaryTile qcSummaryTile = qcSummaryWebPart.getQcSummaryTiles().get(0); - mouseOver(qcSummaryTile.getRecentSampleFiles().get(0)); + QCSummaryWebPart.QcSummaryTile qcSummaryTile = qcSummaryWebPart.getQcSummaryTiles().getFirst(); + mouseOver(qcSummaryTile.getRecentSampleFiles().getFirst()); final WebElement bubble = waitForElement(qcSummaryWebPart.getBubble().withDescendant(Locator.linkWithText("sample8_R03"))); checker().verifyTrue("iRT Correlation missing in tooltip", Locator.linkWithText("iRT Correlation").existsIn(bubble)); checker().verifyTrue("iRT Intercept missing in tooltip", Locator.linkWithText("iRT Intercept").existsIn(bubble)); diff --git a/test/src/org/labkey/test/tests/targetedms/InstrumentSchedulingTest.java b/test/src/org/labkey/test/tests/targetedms/InstrumentSchedulingTest.java index 50fdd277a..a9b137617 100644 --- a/test/src/org/labkey/test/tests/targetedms/InstrumentSchedulingTest.java +++ b/test/src/org/labkey/test/tests/targetedms/InstrumentSchedulingTest.java @@ -211,9 +211,9 @@ public void testSchedule() throws IOException, CommandException assertEquals("Wrong number of payment method dropdowns", 2, methodInputs.size()); // Duplicate payment methods - selectOptionByText(methodInputs.get(0), PAYMENT_METHOD_2); + selectOptionByText(methodInputs.getFirst(), PAYMENT_METHOD_2); assertTextPresent("The same payment method cannot be selected more than once."); - selectOptionByText(methodInputs.get(0), PAYMENT_METHOD_1); + selectOptionByText(methodInputs.getFirst(), PAYMENT_METHOD_1); // Bogus payment percentages setFormElement(percentInputs.get(1), "0"); @@ -245,18 +245,18 @@ public void testSchedule() throws IOException, CommandException impersonate(EXTERNAL_COLLABORATOR_USER); List> projects = new SelectRowsCommand("targetedms", "msProject").execute(createDefaultConnection(), getProjectName()).getRows(); assertEquals("Wrong number of projects for " + EXTERNAL_COLLABORATOR_USER, 1, projects.size()); - int project2Id = (Integer) projects.get(0).get("Id"); + int project2Id = (Integer) projects.getFirst().get("Id"); SelectRowsCommand instrumentSelect = new SelectRowsCommand("targetedms", "msInstrument"); instrumentSelect.setFilters(Arrays.asList(new Filter("Name", INSTRUMENT_1))); List> instruments = instrumentSelect.execute(createDefaultConnection(), getProjectName()).getRows(); assertEquals("Wrong number of instruments", 1, instruments.size()); - int instrument1Id = (Integer) instruments.get(0).get("Id"); + int instrument1Id = (Integer) instruments.getFirst().get("Id"); SelectRowsCommand paymentMethodSelect = new SelectRowsCommand("targetedms", "paymentMethod"); paymentMethodSelect.setFilters(Arrays.asList(new Filter("Name", PAYMENT_METHOD_1))); List> paymentMethods = paymentMethodSelect.execute(createDefaultConnection(), getProjectName()).getRows(); assertEquals("Wrong number of paymentMethods", 1, paymentMethods.size()); - int paymentMethod1Id = (Integer) paymentMethods.get(0).get("Id"); + int paymentMethod1Id = (Integer) paymentMethods.getFirst().get("Id"); int project1Id = project2Id - 1; // Assume sequential auto-incrementing ids int inactiveInstrumentId = instrument1Id + 2; @@ -343,7 +343,7 @@ public void testSetupInsertPermissions() throws IOException, CommandException // Insert as a lab member stopImpersonating(); impersonate(LAB_MEMBER_USER); - Map project = projectInsert.execute(createDefaultConnection(), getProjectName()).getRows().get(0); + Map project = projectInsert.execute(createDefaultConnection(), getProjectName()).getRows().getFirst(); int projectId = (Integer) project.get("Id"); // Collaborator isn't part of the project, so they shouldn't be able to add a researcher diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSEarlyStagePTMReportTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSEarlyStagePTMReportTest.java index c0b5907b1..78bf30f1f 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSEarlyStagePTMReportTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSEarlyStagePTMReportTest.java @@ -1,6 +1,5 @@ package org.labkey.test.tests.targetedms; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSIrtTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSIrtTest.java index 11aa5cd8f..50f075169 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSIrtTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSIrtTest.java @@ -80,7 +80,7 @@ protected List> getRowsForPeptide(String peptide) protected Map getIrtPeptide(String peptide) { - return getRowsForPeptide(peptide).get(0); + return getRowsForPeptide(peptide).getFirst(); } protected double getIrtValue(String peptide) diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSLibraryTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSLibraryTest.java index 9f6b3dacf..479640ee4 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSLibraryTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSLibraryTest.java @@ -133,7 +133,7 @@ private void verifyLibraryProteins(List proteins, List files, in assertTrue("Expected protein " + protein + " not found in table", idx != -1); ListfileName = proteinsTable.getRowDataAsText(idx, "RunId/File"); assertEquals(1, fileName.size()); - assertEquals("Unexpected file name for " + protein, files.get(i), fileName.get(0)); + assertEquals("Unexpected file name for " + protein, files.get(i), fileName.getFirst()); i++; } diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java index c7f393179..8ec16dc28 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.labkey.test.Locator; -import org.labkey.test.util.DataRegion; import org.labkey.test.util.DataRegionTable; import static org.junit.Assert.assertTrue; diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSQCSummaryTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSQCSummaryTest.java index f3f87ee71..a44542d1e 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSQCSummaryTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSQCSummaryTest.java @@ -30,7 +30,6 @@ import org.labkey.test.Locator; import org.labkey.test.ModulePropertyValue; import org.labkey.test.components.targetedms.GuideSet; -import org.labkey.test.components.targetedms.ParetoPlotsWebPart; import org.labkey.test.components.targetedms.QCPlotsWebPart; import org.labkey.test.components.targetedms.QCSummaryWebPart; import org.labkey.test.pages.targetedms.PanoramaDashboard; diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSQCTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSQCTest.java index e17395586..9916f8998 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSQCTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSQCTest.java @@ -26,7 +26,6 @@ import org.labkey.test.SortDirection; import org.labkey.test.TestFileUtils; import org.labkey.test.TestTimeoutException; -import org.labkey.test.components.ext4.RadioButton; import org.labkey.test.components.ext4.Window; import org.labkey.test.components.html.SiteNavBar; import org.labkey.test.components.targetedms.GuideSet; @@ -302,7 +301,7 @@ public void testQCPlotInputs() // test option to "Group X-Axis values by Date" String initialSVGText = qcPlotsWebPart.getSVGPlotText("precursorPlot0"); qcPlotsWebPart.setGroupXAxisValuesByDate(true); - assertFalse(initialSVGText.equals(qcPlotsWebPart.getSVGPlotText("precursorPlot0"))); + assertNotEquals(initialSVGText, qcPlotsWebPart.getSVGPlotText("precursorPlot0")); qcPlotsWebPart.setGroupXAxisValuesByDate(false); // test that plot0 changes based on scale @@ -314,7 +313,7 @@ public void testQCPlotInputs() qcPlotsWebPart.setScale(scale); String svgPlotText = qcPlotsWebPart.getSVGPlotText("precursorPlot0"); assertFalse(svgPlotText.isEmpty()); - assertFalse(initialSVGText.equals(svgPlotText)); + assertNotEquals(initialSVGText, svgPlotText); } } qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.LINEAR); @@ -324,13 +323,13 @@ public void testQCPlotInputs() qcPlotsWebPart.checkPlotType(CUSUMm); initialSVGText = qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1"); qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.LOG); - assertTrue(initialSVGText.equals(qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1"))); + assertEquals(initialSVGText, qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1")); qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.PERCENT_OF_MEAN); - assertTrue(initialSVGText.equals(qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1"))); + assertEquals(initialSVGText, qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1")); qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.STANDARD_DEVIATIONS); - assertTrue(initialSVGText.equals(qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1"))); + assertEquals(initialSVGText, qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1")); qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.DELTA_FROM_MEAN); - assertTrue(initialSVGText.equals(qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1"))); + assertEquals(initialSVGText, qcPlotsWebPart.getSVGPlotText("precursorPlot0_plotType_1")); qcPlotsWebPart.setScale(QCPlotsWebPart.Scale.LINEAR); @@ -845,9 +844,9 @@ public void testQCPlotExclusions() //confirm 3 exclusions DataRegionTable drt = getSchemaBrowserDataView("targetedms", "QCMetricExclusion"); assertEquals("Wrong count", 3, drt.getDataRowCount()); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(0, "MetricId").get(0)); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(1, "MetricId").get(0)); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(2, "MetricId").get(0)); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(0, "MetricId").getFirst()); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(1, "MetricId").getFirst()); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(2, "MetricId").getFirst()); importData(QC_1b_FILE, 2); clickFolder(subFolderName); @@ -855,9 +854,9 @@ public void testQCPlotExclusions() drt = getSchemaBrowserDataView("targetedms", "QCMetricExclusion"); assertEquals("Wrong count", 3, drt.getDataRowCount()); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(0, "MetricId").get(0)); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(1, "MetricId").get(0)); - assertEquals("Wrong metric", " ", drt.getRowDataAsText(2, "MetricId").get(0)); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(0, "MetricId").getFirst()); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(1, "MetricId").getFirst()); + assertEquals("Wrong metric", " ", drt.getRowDataAsText(2, "MetricId").getFirst()); verifyUploadReport("Replicate 25fmol_Pepmix_spike_SRM_1601_03 has an ignore_in_QC=false annotation " + "but there are existing exclusions that were added within Panorama or from a previous import."); @@ -1071,7 +1070,7 @@ private void verifyQCSummarySampleFileOutliers(String acquiredDate, String outli { PanoramaDashboard qcDashboard = new PanoramaDashboard(this); qcDashboard.getQcSummaryWebPart().waitForRecentSampleFiles(3); - QCSummaryWebPart.QcSummaryTile qcSummaryTile = qcDashboard.getQcSummaryWebPart().getQcSummaryTiles().get(0); + QCSummaryWebPart.QcSummaryTile qcSummaryTile = qcDashboard.getQcSummaryWebPart().getQcSummaryTiles().getFirst(); assertEquals("Unexpected outlier information for QC summary sample file for " + acquiredDate, outlierInfo, qcSummaryTile.getRecentSampleFileWithOutliers(acquiredDate)); } diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSSkydTextIdTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSSkydTextIdTest.java index 96db4eaed..7b9cbb0db 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSSkydTextIdTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSSkydTextIdTest.java @@ -126,8 +126,8 @@ private void verifyChromatogramReplicates(List detailHrefs, String...exp for (String href : detailHrefs) { goToURL(new URL(href), 10000); - waitForElement(locators.get(0)); - List firstReplicateChromatograms = locators.get(0).findElements(getDriver()); + waitForElement(locators.getFirst()); + List firstReplicateChromatograms = locators.getFirst().findElements(getDriver()); Assert.assertNotEquals(0, firstReplicateChromatograms.size()); for (int iReplicate = 1; iReplicate < locators.size(); iReplicate++) { diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSSmallMoleculeLightHeavyRatioTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSSmallMoleculeLightHeavyRatioTest.java index 1d266316e..8347a7f63 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSSmallMoleculeLightHeavyRatioTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSSmallMoleculeLightHeavyRatioTest.java @@ -55,11 +55,11 @@ public void testLightHeavyRatio() throws IOException, CommandException SelectRowsCommand transitionCommand = new SelectRowsCommand("targetedms", "transitionarearatio"); SelectRowsResponse transitionResponse = transitionCommand.execute(connection, getProjectName()); assertEquals("Wrong number of rows", 48, transitionResponse.getRows().size()); - assertEquals("Wrong ratio for first row", 11.234128, (Double)transitionResponse.getRows().get(0).get("arearatio"), 0.0001); + assertEquals("Wrong ratio for first row", 11.234128, (Double)transitionResponse.getRows().getFirst().get("arearatio"), 0.0001); SelectRowsCommand precursorCommand = new SelectRowsCommand("targetedms", "precursorarearatio"); SelectRowsResponse precursorResponse = precursorCommand.execute(connection, getProjectName()); assertEquals("Wrong number of rows", 24, precursorResponse.getRows().size()); - assertEquals("Wrong ratio for first row", 12.301311, (Double)precursorResponse.getRows().get(0).get("arearatio"), 0.0001); + assertEquals("Wrong ratio for first row", 12.301311, (Double)precursorResponse.getRows().getFirst().get("arearatio"), 0.0001); } } diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSTest.java index 2b1bf0650..985b32a14 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSTest.java @@ -346,7 +346,7 @@ protected void verifyQcSummary(int sampleFileCount, int precursorCount) .waitForElementToDisappear(getDriver(), 15_000); QCSummaryWebPart qcSummaryWebPart = new PanoramaDashboard(this).getQcSummaryWebPart(); - verifyQcSummary(qcSummaryWebPart.getQcSummaryTiles().get(0), null, sampleFileCount, precursorCount); + verifyQcSummary(qcSummaryWebPart.getQcSummaryTiles().getFirst(), null, sampleFileCount, precursorCount); } @LogMethod diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSTrailingMeanAndCVTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSTrailingMeanAndCVTest.java index b92e0348d..f612ecc2f 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSTrailingMeanAndCVTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSTrailingMeanAndCVTest.java @@ -6,12 +6,10 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locators; import org.labkey.test.components.targetedms.GuideSet; import org.labkey.test.components.targetedms.QCPlotsWebPart; import org.labkey.test.pages.targetedms.PanoramaDashboard; import org.labkey.test.util.PortalHelper; -import org.openqa.selenium.support.ui.ExpectedConditions; @Category({}) @BaseWebDriverTest.ClassTimeout(minutes = 5) diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSUtilizationCalendarTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSUtilizationCalendarTest.java index 05ed29770..8792e2c5e 100644 --- a/test/src/org/labkey/test/tests/targetedms/TargetedMSUtilizationCalendarTest.java +++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSUtilizationCalendarTest.java @@ -11,7 +11,6 @@ import org.labkey.test.util.DataRegionTable; import org.openqa.selenium.NoSuchElementException; -import java.sql.Timestamp; import java.util.Arrays; import static org.labkey.test.util.PermissionsHelper.READER_ROLE;