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 @@ -17,7 +17,6 @@
package org.labkey.oconnorexperiments;

import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.labkey.api.action.ApiResponse;
import org.labkey.api.action.ApiSimpleResponse;
Expand Down Expand Up @@ -93,7 +92,7 @@ public OConnorExperimentsController()
}

@RequiresPermission(ReadPermission.class)
public class BeginAction extends SimpleViewAction
public static class BeginAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object o, BindException errors)
Expand All @@ -108,7 +107,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(AdminPermission.class)
public class MigrateDataAction extends FormViewAction<UserForm>
public static class MigrateDataAction extends FormViewAction<UserForm>
{
@Override
public void validateCommand(UserForm target, Errors errors)
Expand Down Expand Up @@ -234,7 +233,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
// Move files
File sourceFile = new File(fileContentService.getFileRoot(sourceContainer).getPath() + File.separator + "@files", databaseMap.get("expnumber").toString());
File targetDir = new File(fileContentService.getFileRoot(targetContainer).getPath() + File.separator + databaseMap.get("expnumber").toString() + File.separator + "@files");
LogManager.getLogger(OConnorExperimentsController.class).info("Copy from file '" + sourceFile.toString() + "' to directory '" + targetDir.toString() +"'" );
LogManager.getLogger(OConnorExperimentsController.class).info("Copy from file '" + sourceFile + "' to directory '" + targetDir +"'" );
if (sourceFile.exists())
{
FileUtils.copyDirectory(sourceFile, targetDir);
Expand All @@ -258,7 +257,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
Map<String, Object> map = new CaseInsensitiveHashMap<>();
map.put("container", databaseMap.get("ContainerStr"));

String[] parents = new String[0];
String[] parents;
ArrayList<String> parentsEntityId = new ArrayList<>();
if (databaseMap.get("expParent") != null)
{
Expand All @@ -280,9 +279,9 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
}
}
}
if (parentsEntityId.size() > 0)
if (!parentsEntityId.isEmpty())
{
map.put("ParentExperiments", parentsEntityId.toArray(new String[parentsEntityId.size()]));
map.put("ParentExperiments", parentsEntityId.toArray(new String[0]));

// workaround, pass user, container - databaseMap.get("Container"), singleton list
LogManager.getLogger(OConnorExperimentsController.class).info("Update rows on experiment " + databaseMap.get("expnumber"));
Expand Down Expand Up @@ -423,7 +422,7 @@ public void setFinalMigration(boolean finalMigration)
*/
@RequiresLogin
@RequiresPermission(InsertPermission.class)
public class InsertExperimentAction extends FormHandlerAction
public static class InsertExperimentAction extends FormHandlerAction<Object>
{
private Container newExperiment;

Expand Down Expand Up @@ -465,7 +464,7 @@ public boolean handlePost(Object o, BindException errors) throws Exception

@RequiresLogin
@RequiresPermission(ReadPermission.class)
public class GetExperimentAction extends ReadOnlyApiAction
public static class GetExperimentAction extends ReadOnlyApiAction<Object>
{
@Override
public ApiResponse execute(Object o, BindException errors) throws Exception
Expand All @@ -474,7 +473,7 @@ public ApiResponse execute(Object o, BindException errors) throws Exception
TableInfo table = schema.getTable(OConnorExperimentsUserSchema.Table.Experiments.name());
QueryUpdateService qus = table.getUpdateService();

List<Map<String, Object>> pks = Collections.singletonList(Collections.singletonMap("Container", (Object)getContainer().getId()));
List<Map<String, Object>> pks = Collections.singletonList(Collections.singletonMap("Container", getContainer().getId()));
List<Map<String, Object>> result = qus.getRows(getUser(), getContainer(), pks);

ApiSimpleResponse resp = new ApiSimpleResponse();
Expand All @@ -495,14 +494,14 @@ public ApiResponse execute(Object o, BindException errors) throws Exception
}

@RequiresPermission(UpdatePermission.class)
public class HistoryAction extends SimpleViewAction
public static class HistoryAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object o, BindException errors)
{
getPageConfig().setNoIndex();
getPageConfig().setNoFollow();
return new JspView("/org/labkey/oconnorexperiments/view/history.jsp", null, errors);
return new JspView<>("/org/labkey/oconnorexperiments/view/history.jsp", null, errors);
}

@Override
Expand All @@ -528,7 +527,7 @@ public void setId(String id)
}

@RequiresPermission(ReadPermission.class)
public class LookupWorkbookAction extends SimpleViewAction<LookupWorkbookForm>
public static class LookupWorkbookAction extends SimpleViewAction<LookupWorkbookForm>
{
@Override
public ModelAndView getView(LookupWorkbookForm form, BindException errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Set<String> getSchemaNames()
}

// Listener that just updates the experiment changed date when a wiki is modified.
private class OConnorWikiChangeListener implements WikiChangeListener
private static class OConnorWikiChangeListener implements WikiChangeListener
{
@Override
public void wikiCreated(User user, Container c, String name)
Expand All @@ -150,7 +150,7 @@ public void wikiDeleted(User user, Container c, String name)
}

// Listener that just updates the experiment changed date when a file is uploaded/renamed.
private class OConnorFileChangeListener implements FileListener
private static class OConnorFileChangeListener implements FileListener
{
@Override
public void fileCreated(@NotNull File created, @Nullable User user, @Nullable Container container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public boolean next() throws BatchValidationException
}

Collection<String> parentExperiments = (Collection<String>)o;
if (parentExperiments.size() == 0)
if (parentExperiments.isEmpty())
return true;

// Validate each ParentExperiment is a workbook and create list of maps for insertion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class OConnorExperimentTest extends BaseWebDriverTest implements Postgres
private static final String TABLE_NAME = "Experiments";
private static final String EXPERIMENT_TYPE_TABLE_NAME = "ExperimentType";
private static final String EXPERIMENT_SAVE_SIGNAL = "experimentDataSave"; // See experimentField.html
private ArrayList<String> pkeys = new ArrayList<>();
private final ArrayList<String> pkeys = new ArrayList<>();

@Nullable
@Override
Expand Down Expand Up @@ -327,7 +327,7 @@ protected void deleteViaJavaApi()
DeleteRowsCommand cmd = new DeleteRowsCommand(SCHEMA_NAME, TABLE_NAME);
Connection cn = WebTestHelper.getRemoteApiConnection();
for (String pk : pkeys)
cmd.addRow(Collections.singletonMap("container", (Object) pk));
cmd.addRow(Collections.singletonMap("container", pk));

SaveRowsResponse resp = cmd.execute(cn, getProjectName());
assertEquals("Expected to delete " + pkeys.size() + " rows", pkeys.size(), resp.getRowsAffected().intValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public List<String> getAssociatedModules()
@LogMethod
public static void setup()
{
OConnorListTest initTest = (OConnorListTest)getCurrentTest();
OConnorListTest initTest = getCurrentTest();
initTest.setupOConnorProject();
}

Expand Down
44 changes: 22 additions & 22 deletions genotyping/src/org/labkey/genotyping/GenotypingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public GenotypingController()
}

@RequiresPermission(ReadPermission.class)
public class BeginAction extends SimpleRedirectAction
public static class BeginAction extends SimpleRedirectAction<Object>
{
@Override
public ActionURL getRedirectURL(Object o)
Expand Down Expand Up @@ -222,7 +222,7 @@ public void setError(String error)


@RequiresPermission(ReadPermission.class)
public class AnalysisAction extends QueryViewAction<AnalysisForm, QueryView>
public static class AnalysisAction extends QueryViewAction<AnalysisForm, QueryView>
{
private GenotypingAnalysis _analysis = null;

Expand Down Expand Up @@ -316,7 +316,7 @@ private ActionURL getDeleteMatchesURL(int analysisId)

// TODO: Delete this action? No longer used?
@RequiresPermission(DeletePermission.class)
public class DeleteMatchesAction extends FormHandlerAction<MatchesForm>
public static class DeleteMatchesAction extends FormHandlerAction<MatchesForm>
{
private int _count = 0;
private String _error = null;
Expand Down Expand Up @@ -363,7 +363,7 @@ public boolean handlePost(MatchesForm form, BindException errors)


@RequiresPermission(AdminPermission.class)
public class LoadSequencesAction extends FormHandlerAction<ReturnUrlForm>
public static class LoadSequencesAction extends FormHandlerAction<ReturnUrlForm>
{
@Override
public void validateCommand(ReturnUrlForm target, Errors errors)
Expand Down Expand Up @@ -581,7 +581,7 @@ public void addNavTrail(NavTree root)

@RequiresPermission(ReadPermission.class)
@IgnoresTermsOfUse
public class MergeFastqFilesAction extends ExportAction<MergeFastqFilesForm>
public static class MergeFastqFilesAction extends ExportAction<MergeFastqFilesForm>
{
@Override
public void export(MergeFastqFilesForm form, HttpServletResponse response, BindException errors) throws Exception
Expand Down Expand Up @@ -698,7 +698,7 @@ public static ActionURL getMySettingsURL(Container c, ActionURL returnUrl)


@RequiresPermission(ReadPermission.class)
public class MySettingsAction extends FormViewAction<MySettingsForm>
public static class MySettingsAction extends FormViewAction<MySettingsForm>
{
@Override
public void validateCommand(MySettingsForm form, Errors errors)
Expand Down Expand Up @@ -890,10 +890,10 @@ public void setPrefix(String prefix)

public static class ImportReadsBean
{
private List<Integer> _runs;
private SEQUENCE_PLATFORMS _platform;
private String _readsPath;
private String _path;
private final List<Integer> _runs;
private final SEQUENCE_PLATFORMS _platform;
private final String _readsPath;
private final String _path;
private String _prefix;

private ImportReadsBean(List<Integer> runs, String readsPath, String path, @Nullable String platform, @Nullable String prefix)
Expand Down Expand Up @@ -1124,7 +1124,7 @@ private ActionURL getAnalyzeURL(int runId, ActionURL cancelURL)


@RequiresPermission(InsertPermission.class)
public class AnalyzeAction extends FormViewAction<AnalyzeForm>
public static class AnalyzeAction extends FormViewAction<AnalyzeForm>
{
@Override
public void validateCommand(AnalyzeForm target, Errors errors)
Expand Down Expand Up @@ -1501,7 +1501,7 @@ public static ActionURL getSequencesURL(Container c, @Nullable Integer dictionar


@RequiresPermission(ReadPermission.class)
public class SequencesAction extends QueryViewAction<SequencesForm, QueryView>
public static class SequencesAction extends QueryViewAction<SequencesForm, QueryView>
{
public SequencesAction()
{
Expand Down Expand Up @@ -1563,7 +1563,7 @@ public void setAnalysis(Integer analysis)

@SuppressWarnings({"UnusedDeclaration"}) // URL defined on sequences.rowId column in genotyping.xml
@RequiresPermission(ReadPermission.class)
public class SequenceAction extends SimpleViewAction<SequenceForm>
public static class SequenceAction extends SimpleViewAction<SequenceForm>
{
@Override
public ModelAndView getView(SequenceForm form, BindException errors)
Expand Down Expand Up @@ -1607,7 +1607,7 @@ public static ActionURL getRunsURL(Container c)


@RequiresPermission(ReadPermission.class)
public class RunsAction extends QueryViewAction<QueryExportForm, QueryView>
public static class RunsAction extends QueryViewAction<QueryExportForm, QueryView>
{
public RunsAction()
{
Expand Down Expand Up @@ -1636,7 +1636,7 @@ public static ActionURL getAnalysesURL(Container c)


@RequiresPermission(ReadPermission.class)
public class AnalysesAction extends QueryViewAction<QueryExportForm, QueryView>
public static class AnalysesAction extends QueryViewAction<QueryExportForm, QueryView>
{
public AnalysesAction()
{
Expand Down Expand Up @@ -1727,7 +1727,7 @@ public static ActionURL getRunURL(Container c, GenotypingRun run)
public static final String FASTQ_FILE_FORMAT = "FASTQ_FILE";
public static final String FASTQ_FORMAT = "FASTQ";

private abstract class ReadsAction<FORM extends RunForm> extends QueryViewAction<FORM, QueryView>
private abstract static class ReadsAction<FORM extends RunForm> extends QueryViewAction<FORM, QueryView>
{
private static final String DATA_REGION_NAME = "Reads";

Expand Down Expand Up @@ -1905,7 +1905,7 @@ protected void handleSettings(QuerySettings settings)


@RequiresPermission(AdminPermission.class)
public class DeleteRunsAction extends FormHandlerAction
public static class DeleteRunsAction extends FormHandlerAction<Object>
{
@Override
public void validateCommand(Object target, Errors errors)
Expand Down Expand Up @@ -1936,7 +1936,7 @@ public ActionURL getSuccessURL(Object o)


@RequiresPermission(DeletePermission.class)
public class DeleteAnalysesAction extends FormHandlerAction
public static class DeleteAnalysesAction extends FormHandlerAction<Object>
{
@Override
public void validateCommand(Object target, Errors errors)
Expand Down Expand Up @@ -2036,7 +2036,7 @@ protected void handleSettings(QuerySettings settings)
}
}

public class AssignmentReportBean
public static class AssignmentReportBean
{
private final Collection<Integer> _ids;
private final String _assayName;
Expand Down Expand Up @@ -2101,7 +2101,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(ReadPermission.class)
public class DuplicateAssignmentReportAction extends BaseAssayAction<ProtocolIdForm>
public static class DuplicateAssignmentReportAction extends BaseAssayAction<ProtocolIdForm>
{
private ExpProtocol _protocol;

Expand All @@ -2128,7 +2128,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(ReadPermission.class)
public class STRDiscrepanciesAssignmentReportAction extends SimpleViewAction<STRDiscrepancies>
public static class STRDiscrepanciesAssignmentReportAction extends SimpleViewAction<STRDiscrepancies>
{
private ExpProtocol _protocol;
private static final String DELIM = "[;,/]";
Expand Down Expand Up @@ -2355,7 +2355,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(UpdatePermission.class)
public class EditHaplotypeAssignmentAction extends SimpleViewAction<AssignmentForm>
public static class EditHaplotypeAssignmentAction extends SimpleViewAction<AssignmentForm>
{
@Override
public ModelAndView getView(AssignmentForm form, BindException errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public int deleteMatches(Container c, User user, int analysisId, List<Integer> m
GenotypingAnalysis analysis = GenotypingManager.get().getAnalysis(c, analysisId);

// Verify that matches were posted
if (matchIds.size() < 1)
if (matchIds.isEmpty())
throw new IllegalStateException("No matches were selected");

// Count the corresponding matches in the database, making sure they belong to this analysis
Expand Down
Loading