Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,17 @@

package org.labkey.skylinetoolsstore;

import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager.ContainerListener;
import org.labkey.api.data.RuntimeSQLException;
import org.labkey.api.security.User;

import java.sql.SQLException;

import java.beans.PropertyChangeEvent;
import java.util.Collection;
import java.util.Collections;

public class SkylineToolsStoreContainerListener implements ContainerListener
{
@Override
public void containerCreated(Container c, User user)
{
}

@Override
public void containerDeleted(Container c, User user)
{
try
{
SkylineToolsStoreManager.get().deleteAllData(c);
}
catch (SQLException e)
{
throw new RuntimeSQLException(e);
}
}

@Override
public void propertyChange(PropertyChangeEvent evt)
{
}

@Override
public void containerMoved(Container c, Container oldParent, User user)
{
SkylineToolsStoreManager.get().deleteAllData(c);
}

@NotNull
@Override
public Collection<String> canMove(Container c, Container newParent, User user)
{
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.commons.lang3.math.NumberUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.action.FormHandlerAction;
import org.labkey.api.action.NavTrailAction;
import org.labkey.api.action.PermissionCheckable;
Expand Down Expand Up @@ -468,7 +469,7 @@ public InsertAction()
}

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final String sender = httpServletRequest.getParameter("sender");
final String updateTargetString = StringUtils.trimToNull(httpServletRequest.getParameter("updatetarget"));
Expand Down Expand Up @@ -703,7 +704,7 @@ public InsertSupplementAction()
}

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final String suppTargetString = httpServletRequest.getParameter("supptarget");
int suppTarget = NumberUtils.toInt(suppTargetString, -1);
Expand Down Expand Up @@ -765,7 +766,7 @@ public DeleteSupplementAction()
}

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final int suppTarget = Integer.parseInt(httpServletRequest.getParameter("supptarget"));

Expand Down Expand Up @@ -896,7 +897,7 @@ public class DeleteLatestAction extends AbstractController implements Permission
private final Class REQ_PERMS = DeletePermission.class;

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
int id;
try {
Expand Down Expand Up @@ -961,7 +962,7 @@ public class DownloadToolAction extends AbstractController implements Permission
public static final String DOWNLOADED_COOKIE_PREFIX = "downloadtool";

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final int id = NumberUtils.toInt(httpServletRequest.getParameter("id"), -1);
final String toolName = httpServletRequest.getParameter("name");
Expand Down Expand Up @@ -1239,7 +1240,7 @@ public SetOwnersAction()
}

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final String sender = httpServletRequest.getParameter("sender");
final String updateTargetString = httpServletRequest.getParameter("updatetarget");
Expand Down Expand Up @@ -1312,7 +1313,7 @@ public class UpdatePropertyAction extends AbstractController implements Permissi
private final Class REQ_PERMS = InsertPermission.class;

@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception
{
final int id = Integer.parseInt(httpServletRequest.getParameter("id"));

Expand Down Expand Up @@ -1420,7 +1421,7 @@ public void checkPermissions() throws UnauthorizedException
public class GetToolsApiAction extends AbstractController implements PermissionCheckable
{
@Override
public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException
public ModelAndView handleRequestInternal(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws IOException
{
StringBuilder sb = new StringBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.labkey.api.security.User;
import org.labkey.skylinetoolsstore.model.SkylineTool;

import java.sql.SQLException;

public class SkylineToolsStoreManager
{
private static final SkylineToolsStoreManager _instance = new SkylineToolsStoreManager();
Expand All @@ -42,7 +40,7 @@ public static SkylineToolsStoreManager get()
return _instance;
}

public void deleteAllData(Container c) throws SQLException
public void deleteAllData(Container c)
{
// delete all tools when the container is deleted
Filter containerFilter = SimpleFilter.createContainerFilter(c);
Expand Down Expand Up @@ -124,18 +122,18 @@ public SkylineTool getToolByNameAndVersion(String name, String version)
return (tools != null && tools.length > 0) ? tools[0] : null;
}

public void deleteTool(int rowId) throws SQLException
public void deleteTool(int rowId)
{
Table.delete(SkylineToolsStoreSchema.getInstance().getTableInfoSkylineTool(), rowId);
}

public SkylineTool insertTool(Container c, User user, SkylineTool tool) throws SQLException
public SkylineTool insertTool(Container c, User user, SkylineTool tool)
{
tool.setContainer(c.getId());
return Table.insert(user, SkylineToolsStoreSchema.getInstance().getTableInfoSkylineTool(), tool);
}

public SkylineTool updateTool(Container c, User user, SkylineTool tool) throws SQLException
public SkylineTool updateTool(Container c, User user, SkylineTool tool)
{
if (tool.getContainerId() == null)
tool.setContainerId(c.getId());
Expand All @@ -153,7 +151,7 @@ public SkylineTool updateTool(Container c, User user, SkylineTool tool) throws S
tool, tool.getRowId());
}

public SkylineTool recordToolDownload(SkylineTool tool) throws SQLException
public SkylineTool recordToolDownload(SkylineTool tool)
{
tool.setDownloads(tool.getDownloads() + 1);
return Table.update(null, SkylineToolsStoreSchema.getInstance().getTableInfoSkylineTool(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.labkey.api.view.BaseWebPartFactory;
import org.labkey.api.view.Portal;
import org.labkey.api.view.ViewContext;
import org.labkey.api.view.WebPartConfigurationException;
import org.labkey.api.view.WebPartFactory;
import org.labkey.api.view.WebPartView;
import org.labkey.skylinetoolsstore.model.SkylineTool;
Expand Down Expand Up @@ -74,7 +73,7 @@ protected Collection<WebPartFactory> createWebPartFactories()
}

@Override
public WebPartView<?> getWebPartView(@NotNull ViewContext portalCtx, Portal.@NotNull WebPart webPart) throws WebPartConfigurationException
public WebPartView<?> getWebPartView(@NotNull ViewContext portalCtx, Portal.@NotNull WebPart webPart)
{
return new SkylineToolsStoreWebPart();
}
Expand Down
6 changes: 3 additions & 3 deletions lincs/src/org/labkey/lincs/CustomGctBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Gct build(List<Path> files, List<LincsController.SelectedAnnotation> sele

for(Path file: files)
{
_log.info("LINCS custom GCT: reading file: " + file);
_log.info("LINCS custom GCT: reading file: {}", file);
Gct gct;
try
{
Expand Down Expand Up @@ -87,10 +87,10 @@ private void updateMultiValueProbeAnnotations(Gct gct, Gct customGct)
{
// All replicates in a single GCT file should have the same value for the "det_plate" replicate annotation.
// TODO: This is not true for GCP plate 16 file.
String detPlateAnnotationVal = gct.getReplicates().get(0).getAnnotationValue(LincsAnnotation.PLATE_ANNOTATION);
String detPlateAnnotationVal = gct.getReplicates().getFirst().getAnnotationValue(LincsAnnotation.PLATE_ANNOTATION);

// All replicates in a single GCT file should have the same value for the "provenance_code" replicate annotation
String expType = gct.getExperimentType(gct.getReplicates().get(0).getAnnotationValue(LincsAnnotation.PROVENANCE_CODE));
String expType = gct.getExperimentType(gct.getReplicates().getFirst().getAnnotationValue(LincsAnnotation.PROVENANCE_CODE));

// Append experiment type to plate annotation since we can have same plate (e.g. plate 18) analyzed by both DIA and PRM.
String expTypeAndPlate = expType + "_" + detPlateAnnotationVal;
Expand Down
10 changes: 5 additions & 5 deletions lincs/src/org/labkey/lincs/DocImportListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void beforeRunDelete(ExpProtocol protocol, ExpRun run, User user)
}
catch (IOException e)
{
_log.warn("LINCS: Error listing files in folder " + FileUtil.getAbsolutePath(gctDir), e);
_log.warn("LINCS: Error listing files in folder {}", FileUtil.getAbsolutePath(gctDir), e);
return;
}

Expand All @@ -81,7 +81,7 @@ public void beforeRunDelete(ExpProtocol protocol, ExpRun run, User user)
}
catch (IOException e)
{
_log.warn("LINCS: Error deleting file " + FileUtil.getAbsolutePath(path), e);
_log.warn("LINCS: Error deleting file {}", FileUtil.getAbsolutePath(path), e);
}
});
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public void onDocumentImport(Container container, User user, ITargetedMSRun skyl
PipeRoot root = PipelineService.get().findPipelineRoot(container);
if (root == null || !root.isValid())
{
_log.error("LINCS: No valid pipeline root found for " + container.getPath());
_log.error("LINCS: No valid pipeline root found for {}", container.getPath());
return;
}

Expand All @@ -129,7 +129,7 @@ public void onDocumentImport(Container container, User user, ITargetedMSRun skyl
}
catch (PipelineValidationException e)
{
_log.error("Error adding LINCS pipeline job to queue. Message: " + e.getMessage(), e);
_log.error("Error adding LINCS pipeline job to queue. Message: {}", e.getMessage(), e);
if(pspJob != null)
{
LincsManager.get().deleteLincsPspJob(pspJob);
Expand All @@ -138,7 +138,7 @@ public void onDocumentImport(Container container, User user, ITargetedMSRun skyl
}

long jobId = PipelineService.get().getJobId(user, container, job.getJobGUID());
_log.info("LINCS: Queued job Id " + jobId +" for creating GCT files for " + skylineRun.getFileName() + ". Container: " + container.getPath());
_log.info("LINCS: Queued job Id {} for creating GCT files for {}. Container: {}", jobId, skylineRun.getFileName(), container.getPath());

pspJob.setPipelineJobId(jobId);
LincsManager.get().updatePipelineJobId(pspJob);
Expand Down
7 changes: 1 addition & 6 deletions lincs/src/org/labkey/lincs/Gct.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,7 @@ public void addMultiValueProbeAnnotation(String annotationName, ProbeExpTypePlat
{
_multiValueProbeAnnotations = new HashMap<>();
}
GctTable<ProbeExpTypePlate> probePlateValues = _multiValueProbeAnnotations.get(annotationName);
if(probePlateValues == null)
{
probePlateValues = new GctTable<>();
_multiValueProbeAnnotations.put(annotationName, probePlateValues);
}
GctTable<ProbeExpTypePlate> probePlateValues = _multiValueProbeAnnotations.computeIfAbsent(annotationName, _ -> new GctTable<>());
probePlateValues.addValue(key, value);
}

Expand Down
55 changes: 0 additions & 55 deletions lincs/src/org/labkey/lincs/LincsContainerListener.java

This file was deleted.

2 changes: 0 additions & 2 deletions lincs/src/org/labkey/lincs/LincsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
import org.springframework.validation.Errors;
import org.springframework.web.servlet.ModelAndView;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
Expand Down
14 changes: 7 additions & 7 deletions lincs/src/org/labkey/lincs/LincsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public List<LincsAnnotation> getReplicateAnnotations(User user, Container contai
else
{
// Otherwise, read from the lincs_replicate_annotations.txt file in the module's resources directory
_log.info("Could not find table " + listName + " in schema 'lists'. Trying to read from file.");
_log.info("Could not find table {} in schema 'lists'. Trying to read from file.", listName);
return readFromFile("lincs_replicate_annotations.txt");
}
}
Expand All @@ -100,7 +100,7 @@ public List<LincsAnnotation> getPeptideAnnotations(User user, Container containe
else
{
// Otherwise, read from the lincs_peptide_annotations.txt file in the module's resources directory
_log.info("Could not find table " + listName + " in schema 'lists'. Trying to read from file.");
_log.info("Could not find table {} in schema 'lists'. Trying to read from file.", listName);
return readFromFile("lincs_peptide_annotations.txt");
}
}
Expand All @@ -120,10 +120,10 @@ private List<LincsAnnotation> readFromFile(String filename)
String[] headers = line.split("\\t");
for(int i = 0; i < headers.length; i++)
{
if(headers[i].toLowerCase().equals("name")) {nameCol = i;}
else if(headers[i].toLowerCase().equals("displayname")) {displayNameCol = i;}
else if(headers[i].toLowerCase().equals("advanced")) {advancedCol = i;}
else if(headers[i].toLowerCase().equals("ignored")) {ignoredCol = i;}
if(headers[i].equalsIgnoreCase("name")) {nameCol = i;}
else if(headers[i].equalsIgnoreCase("displayname")) {displayNameCol = i;}
else if(headers[i].equalsIgnoreCase("advanced")) {advancedCol = i;}
else if(headers[i].equalsIgnoreCase("ignored")) {ignoredCol = i;}
}

List<LincsAnnotation> annotations = new ArrayList<>();
Expand All @@ -142,7 +142,7 @@ private List<LincsAnnotation> readFromFile(String filename)
}
catch (IOException e)
{
_log.error("Could not read file " + txt.getPath(), e);
_log.error("Could not read file {}", txt.getPath(), e);
return Collections.emptyList();
}
}
Expand Down
Loading
Loading