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
1 change: 0 additions & 1 deletion hdrl/src/org/labkey/hdrl/HDRLContainerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.labkey.api.security.User;
import org.labkey.api.util.ContainerUtil;
import org.labkey.hdrl.query.LabWareQuerySchema;
import org.labkey.remoteapi.assay.Data;

import java.util.Collections;
import java.util.Collection;
Expand Down
20 changes: 10 additions & 10 deletions hdrl/src/org/labkey/hdrl/HDRLController.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void addNavTrail(NavTree root)


@RequiresPermission(ReadPermission.class)
public class RequestDetailsAction extends SimpleViewAction
public static class RequestDetailsAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object o, BindException errors)
Expand All @@ -141,7 +141,7 @@ public ModelAndView getView(Object o, BindException errors)
if (requestId != null)
{
InboundRequestBean bean = HDRLManager.get().getInboundRequest(getUser(), getContainer(), Integer.parseInt(requestId));
JspView jsp = new JspView("/org/labkey/hdrl/view/requestDetails.jsp", bean);
JspView jsp = new JspView<>("/org/labkey/hdrl/view/requestDetails.jsp", bean);
jsp.setTitle("Test Request");

UserSchema schema = QueryService.get().getUserSchema(getUser(), getContainer(), HDRLQuerySchema.NAME);
Expand All @@ -166,7 +166,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(InsertPermission.class)
public class EditRequestAction extends SimpleViewAction<RequestForm>
public static class EditRequestAction extends SimpleViewAction<RequestForm>
{
private String _navLabel = "Create a new Test Request";

Expand Down Expand Up @@ -259,7 +259,7 @@ public void setTestTypeId(Integer testTypeId)
}

@RequiresPermission(ReadPermission.class)
public class VerifySpecimenAction extends ReadOnlyApiAction<VerifyForm>
public static class VerifySpecimenAction extends ReadOnlyApiAction<VerifyForm>
{
@Override
public Object execute(VerifyForm form, BindException errors)
Expand Down Expand Up @@ -310,7 +310,7 @@ public static class VerifyForm extends SimpleApiJsonForm


@RequiresPermission(ReadPermission.class)
public class DownloadClinicalReportAction extends ExportAction<SpecimenForm>
public static class DownloadClinicalReportAction extends ExportAction<SpecimenForm>
{
@Override
public void export(SpecimenForm form, HttpServletResponse response, BindException errors) throws Exception
Expand Down Expand Up @@ -361,7 +361,7 @@ public void setSpecimenId(Integer specimenId)
}

@RequiresPermission(ReadPermission.class)
public class DownloadSpecimenTemplateAction extends ExportAction
public static class DownloadSpecimenTemplateAction extends ExportAction<Object>
{
@Override
public void export(Object o, HttpServletResponse response, BindException errors)
Expand All @@ -385,7 +385,7 @@ public void export(Object o, HttpServletResponse response, BindException errors)
}

@RequiresPermission(ReadPermission.class)
public class PrintPackingListAction extends SimpleViewAction<PackingListBean>
public static class PrintPackingListAction extends SimpleViewAction<PackingListBean>
{
@Override
public ModelAndView getView(PackingListBean packingListBean, BindException errors)
Expand Down Expand Up @@ -483,7 +483,7 @@ public void setShippingNumber(String shippingNumber)

@AdminConsoleAction
@RequiresPermission(AdminPermission.class)
public class HDRLSensitiveDataAdminAction extends FormViewAction<SensitiveDataForm>
public static class HDRLSensitiveDataAdminAction extends FormViewAction<SensitiveDataForm>
{
@Override
public void validateCommand(SensitiveDataForm target, Errors errors)
Expand Down Expand Up @@ -537,7 +537,7 @@ public void setTimeWindowInDays(int timeWindowInDays)

@RequiresPermission(AdminPermission.class)
@Marshal(Marshaller.Jackson)
public class AddLabWareOutboundRequestAction extends MutatingApiAction<LabWareOutboundRequestForm>
public static class AddLabWareOutboundRequestAction extends MutatingApiAction<LabWareOutboundRequestForm>
{
@Override
public Object execute(LabWareOutboundRequestForm form, BindException errors)
Expand Down Expand Up @@ -633,7 +633,7 @@ public void setDateModified(Date dateModified)

@RequiresPermission(AdminPermission.class)
@Marshal(Marshaller.Jackson)
public class AddLabWareOutboundSpecimenAction extends MutatingApiAction<LabWareOutboundSpecimenForm>
public static class AddLabWareOutboundSpecimenAction extends MutatingApiAction<LabWareOutboundSpecimenForm>
{
@Override
public Object execute(LabWareOutboundSpecimenForm form, BindException errors) throws Exception
Expand Down
1 change: 0 additions & 1 deletion hdrl/src/org/labkey/hdrl/HDRLFolderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.labkey.hdrl;

import org.labkey.api.module.Module;
import org.labkey.api.module.MultiPortalFolderType;
import org.labkey.api.view.Portal;

Expand Down
1 change: 0 additions & 1 deletion hdrl/src/org/labkey/hdrl/HDRLMaintenanceTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.labkey.hdrl;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.SQLFragment;
Expand Down
2 changes: 1 addition & 1 deletion hdrl/src/org/labkey/hdrl/query/HDRLQuerySchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class HDRLQuerySchema extends SimpleUserSchema
public static final String TABLE_LABWARE_OUTBOUND_RESULTS = "LabwareOutboundRequests";
public static final String TABLE_LABWARE_OUTBOUND_SPECIMENS = "LabwareOutboundSpecimens";

public static final String COL_REQUEST_STATUS_ID = "RequestStatusId";;
public static final String COL_REQUEST_STATUS_ID = "RequestStatusId";
public static final String COL_INBOUND_REQUEST_ID = "InboundRequestId";
public static final String COL_ARCHIVED_REQUEST_COUNT = "ArchivedRequestCount";

Expand Down
1 change: 0 additions & 1 deletion hdrl/src/org/labkey/hdrl/query/InboundRequestTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.ColumnInfo;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.ContainerForeignKey;
import org.labkey.api.data.DatabaseTableType;
Expand Down
12 changes: 6 additions & 6 deletions hdrl/src/org/labkey/hdrl/query/InboundRequestUpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,33 @@ public static void validateUniqueness(Integer requestId) throws QueryUpdateServi
// check that there are no duplicate barcodes
List<String> duplicates = findDuplicates(requestId, "CustomerBarcode");
StringBuilder message = new StringBuilder();
if (duplicates.size() > 0)
if (!duplicates.isEmpty())
{
message.append("Request has specimens with duplicate fields: Customer Barcode - ").append(StringUtils.join(duplicates, ", "));
}

// check that all existing DODId in the specimens in this request are unique
duplicates = findDuplicates(requestId, "DoDId");
if (duplicates.size() > 0)
if (!duplicates.isEmpty())
{
if (message.length() == 0)
if (message.isEmpty())
message.append("Request has specimens with duplicate fields: ");
else
message.append("; ");
message.append("DoDID - ").append(StringUtils.join(duplicates, ", "));
}
// check that all the existing SSN + FMP pairs in this request are unique
duplicates = findDuplicates(requestId, "SSN, FMPId");
if (duplicates.size() > 0)
if (!duplicates.isEmpty())
{
if (message.length() == 0)
if (message.isEmpty())
message.append("Request has specimens with duplicate fields: ");
else
message.append("; ");
message.append("SSN + FMP - ").append(StringUtils.join(duplicates, ", "));
}

if (message.length() > 0)
if (!message.isEmpty())
throw new QueryUpdateServiceException(message.toString());

}
Expand Down
30 changes: 17 additions & 13 deletions hdrl/src/org/labkey/hdrl/query/InboundSpecimenUpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public static void validate(Map<String, Object> row) throws ValidationException
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date today = calendar.getTime();
List<String> errors = new ArrayList<String>();
List<String> missingFields = new ArrayList<String>();
List<String> errors = new ArrayList<>();
List<String> missingFields = new ArrayList<>();
if (row.get("FMPId") == null)
missingFields.add("FMP");
if (row.get("DrawDate") == null)
Expand All @@ -151,30 +151,34 @@ public static void validate(Map<String, Object> row) throws ValidationException
}
}
}
if (row.get("BirthDate") != null)
Object birthDateObj = row.get("BirthDate");
if (birthDateObj != null)
{
Date birthDate = null;
if (row.get("BirthDate") instanceof Date)
birthDate = (Date) row.get("BirthDate");
if (birthDateObj instanceof Date d)
birthDate = d;
else
{
try
{
birthDate = dateFormat.parse((String) row.get("BirthDate"));
if (birthDate.after(today))
{
errors.add("Birth date cannot be in the future");
}
else if ((drawDate != null) && (drawDate.before(birthDate)))
{
errors.add("Draw date cannot be before birth date");
}
}
catch (ParseException e)
{
errors.add("Invalid birth date format");
}
}
if (birthDate != null)
{
if (birthDate.after(today))
{
errors.add("Birth date cannot be in the future");
}
else if ((drawDate != null) && (drawDate.before(birthDate)))
{
errors.add("Draw date cannot be before birth date");
}
}
}
if (row.get("SSN") == null || StringUtils.isEmpty(String.valueOf(row.get("SSN"))))
missingFields.add("SSN");
Expand Down
1 change: 0 additions & 1 deletion hdrl/src/org/labkey/hdrl/query/ResultTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.labkey.api.security.UserPrincipal;
import org.labkey.api.security.permissions.Permission;

import java.sql.SQLException;
import java.util.Map;

/**
Expand Down
26 changes: 13 additions & 13 deletions hdrl/test/src/org/labkey/test/tests/HDRLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public class HDRLTest extends BaseWebDriverTest implements PostgresOnlyTest
public static final Locator.XPathLocator enabledSave = Locator.xpath("//a[not(contains(normalize-space(@class), 'x4-btn-disable'))]//span[text()='" + SAVE_BUTTON_TEXT + "']");
public static final Locator.XPathLocator enabledPrintPackingList = Locator.xpath("//a[not(contains(normalize-space(@class), 'x4-btn-disable'))]//span[text()='" + PRINT_PACKING_LIST_TEXT + "']");

private static int CARRIER_COLUMN_INDEX = 2;
private static int STATUS_COLUMN_INDEX = 13;
private static final int CARRIER_COLUMN_INDEX = 2;
private static final int STATUS_COLUMN_INDEX = 13;

@Override
protected String getProjectName()
Expand All @@ -78,7 +78,7 @@ protected String getProjectName()
@BeforeClass
public static void initProject()
{
HDRLTest init = (HDRLTest)getCurrentTest();
HDRLTest init = getCurrentTest();
init.setupFolder();
}

Expand Down Expand Up @@ -150,7 +150,7 @@ public void testRetrievalOfResultsAndArchiving() throws Exception
clickButton(SUBMIT_BUTTON_TEXT);
DataRegionTable drt = new DataRegionTable("query", this);
int idx = drt.getRowIndex("ShippingNumber", "testRetrievalOfResults");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
String requestId = drt.getDataAsText(idx, "RequestId");

Map<String, Object> result = new HashMap<>();
Expand Down Expand Up @@ -236,7 +236,7 @@ public void testRetrievalOfResultsAndArchiving() throws Exception
click(Locator.linkContainingText("View test requests"));
drt = new DataRegionTable("query", this);
idx = drt.getRowIndex("RequestId", requestId);
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
log("view test results");
assertEquals("VIEW", drt.getDataAsText(idx, 0));
clickAndWait(drt.link(idx, 0));
Expand Down Expand Up @@ -395,7 +395,7 @@ public void testFileUploadAndSubmit()

DataRegionTable drt = new DataRegionTable("query", this);
int idx = drt.getRowIndex("ShippingCarrier", "FedEx");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
clickAndWait(drt.link(idx, 0));
log("submitting an existing request");
waitForElement(Locator.tagContainingText("div", "222-33-4444"));
Expand All @@ -404,7 +404,7 @@ public void testFileUploadAndSubmit()

drt = new DataRegionTable("query", this);
idx = drt.getRowIndex("ShippingCarrier", "FedEx");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
Assert.assertFalse(drt.getDataAsText(idx, "Submitted By").trim().isEmpty()); // "submitted by" field should be filled in
Assert.assertFalse(drt.getDataAsText(idx, "Submitted").trim().isEmpty()); // submitted date should be filled in

Expand All @@ -423,7 +423,7 @@ public void testFileUploadAndSubmit()
clickAndWait(Locator.linkContainingText("View test requests"));
drt = new DataRegionTable("query", this);
idx = drt.getRowIndex("ShippingCarrier", "FedEx");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
log("ensure submitted requests are still editable by admins");
assertEquals("VIEW", drt.getDataAsText(idx, 0));
clickAndWait(drt.link(idx, 0));
Expand Down Expand Up @@ -454,7 +454,7 @@ public void testEditSubmittedRequest()
log("Edit the submitted request as admin");
DataRegionTable drt = new DataRegionTable("query", this);
int idx = drt.getRowIndex("ShippingNumber", "testEditSubmittedRequest");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
assertEquals("Submitted", drt.getDataAsText(idx, STATUS_COLUMN_INDEX));
String submittedDate = drt.getDataAsText(idx, 6).trim();

Expand All @@ -476,7 +476,7 @@ public void testEditSubmittedRequest()
log("Test that not saving request does not change anything");
clickButton("Cancel", 0); // takes you back to the view test requests page
idx = drt.getRowIndex("ShippingNumber", "testEditSubmittedRequest");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
assertEquals("Submitted", drt.getDataAsText(idx, STATUS_COLUMN_INDEX));
assertNotEquals("DHL", drt.getDataAsText(idx, CARRIER_COLUMN_INDEX));
assertEquals("EDIT", drt.getDataAsText(idx, 0));
Expand All @@ -491,7 +491,7 @@ public void testEditSubmittedRequest()

log("Test that saving request does not change the request status");
idx = drt.getRowIndex("ShippingNumber", "testEditSubmittedRequest");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
assertEquals("Submitted", drt.getDataAsText(idx, STATUS_COLUMN_INDEX));
assertEquals("DHL", drt.getDataAsText(idx, CARRIER_COLUMN_INDEX));
// submitted date should still be the same
Expand Down Expand Up @@ -528,7 +528,7 @@ public void testDataDeletion()
click(Locator.linkWithText("View test requests"));
DataRegionTable drt = new DataRegionTable("query", this);
int idx = drt.getRowIndex("ShippingNumber", "testRetrievalOfResults");
assertNotEquals(idx, -1);
assertNotEquals(-1, idx);
String requestId = drt.getDataAsText(idx, "RequestId");
Assert.assertEquals("Archived", drt.getDataAsText(idx, "Status"));
List<String> specimenIds = getSpecimenIds(requestId, "hdrl", "InboundSpecimen", "RowId");
Expand Down Expand Up @@ -600,7 +600,7 @@ private void verifyDataRegionRows(String tableName, List<Map<String, String>> ex
for (Map<String, String> expectedRow : expectedRows)
{
int idx = drt.getRowIndex(key, expectedRow.get(key));
assertNotEquals(String.format("Didn't find row with %s = %s", key, expectedRow.get(key)), idx, -1);
assertNotEquals(String.format("Didn't find row with %s = %s", key, expectedRow.get(key)), -1, idx);

Map<String, String> actualRow = new HashMap<>();
for (Map.Entry<String, String> field : expectedRow.entrySet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static String getPreference(ViewContext viewContext, String preferenceNa
}

@RequiresPermission(AdminOperationsPermission.class)
public class UpdatePeptideCountsAction extends SimpleViewAction<Object>
public static class UpdatePeptideCountsAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object o, BindException errors)
Expand All @@ -105,7 +105,7 @@ public ModelAndView getView(Object o, BindException errors)
{
List<DOM.Renderable> warnings = new ArrayList<>();
updatePeptideCounts(warnings, getContainer());
if (warnings.size() == 0)
if (warnings.isEmpty())
{
return new HtmlView(DOM.DIV("Success!"));
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(ReadPermission.class)
public class SetPreferencesAction extends MutatingApiAction<SimpleApiJsonForm>
public static class SetPreferencesAction extends MutatingApiAction<SimpleApiJsonForm>
{
@Override
public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.labkey.ms2extensions;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.Container;
import org.labkey.api.exp.ExperimentDataHandler;
Expand Down
4 changes: 2 additions & 2 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBBaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ && validateInteger(getAAStart().trim()) > validateInteger(getAAEnd().trim()))
{
if (StringUtils.trimToNull(qValue) == null)
errors.reject(null, "The Peptide Id range must be entered.");
if (qValue != null && qValue.length() > 0)
if (qValue != null && !qValue.isEmpty())
{
if (!(qValue.matches("\\d+-\\d+")))
{
Expand Down Expand Up @@ -423,7 +423,7 @@ public boolean validate(Errors errors, AttachmentFile file) throws Exception
errors.reject(null, "File name must end with in .txt.\nFile should be tab delimited text file and the number of field vary depending on file type.");
}
}
if (getActionType() == null || getActionType().length() == 0)
if (getActionType() == null || getActionType().isEmpty())
errors.reject(null, "File Type is required");
if(errors.getErrorCount() > 0)
return false;
Expand Down
Loading