Skip to content

Commit c69facc

Browse files
Minor auto-refactor code cleanup on a massive scale
Original PR: LabKey/platform#6742 * Minor auto-refactor code cleanup on a massive scale * Fix DomainDesignerTest, reduce usage of deprecated methods * Fix merge
1 parent fa896fe commit c69facc

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

studydesign/src/org/labkey/studydesign/StudyDesignController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private Study getStudy(Container container)
120120

121121
@ActionNames("manageAssaySchedule, manageAssaySpecimen")
122122
@RequiresPermission(UpdatePermission.class)
123-
public class ManageAssayScheduleAction extends SimpleViewAction<AssayScheduleForm>
123+
public static class ManageAssayScheduleAction extends SimpleViewAction<AssayScheduleForm>
124124
{
125125
@Override
126126
public ModelAndView getView(AssayScheduleForm form, BindException errors)
@@ -154,7 +154,7 @@ public void setUseAlternateLookupFields(boolean useAlternateLookupFields)
154154
}
155155

156156
@RequiresPermission(UpdatePermission.class)
157-
public class ManageStudyProductsAction extends SimpleViewAction<ReturnUrlForm>
157+
public static class ManageStudyProductsAction extends SimpleViewAction<ReturnUrlForm>
158158
{
159159
@Override
160160
public ModelAndView getView(ReturnUrlForm form, BindException errors)
@@ -188,7 +188,7 @@ public void setSingleTable(boolean singleTable)
188188
}
189189

190190
@RequiresPermission(UpdatePermission.class)
191-
public class ManageTreatmentsAction extends SimpleViewAction<ManageTreatmentsBean>
191+
public static class ManageTreatmentsAction extends SimpleViewAction<ManageTreatmentsBean>
192192
{
193193
@Override
194194
public ModelAndView getView(ManageTreatmentsBean form, BindException errors)
@@ -633,10 +633,10 @@ private List<Integer> updateTreatments(List<TreatmentImpl> treatments) throws Ex
633633
@RequiresPermission(UpdatePermission.class)
634634
public class UpdateTreatmentScheduleAction extends MutatingApiAction<StudyTreatmentSchedule>
635635
{
636-
private Map<String, Integer> _tempTreatmentIdMap = new HashMap<>();
637-
private Set<Integer> usedTreatmentIds = new HashSet<>(); // treatmentIds referenced in single table Treatment Schedule UI
638-
private List<Integer> treatmentRowIds = new ArrayList<>(); // treatmentIds defined in 2 table UI's Treatment section
639-
private List<Integer> cohortRowIds = new ArrayList<>();
636+
private final Map<String, Integer> _tempTreatmentIdMap = new HashMap<>();
637+
private final Set<Integer> usedTreatmentIds = new HashSet<>(); // treatmentIds referenced in single table Treatment Schedule UI
638+
private final List<Integer> treatmentRowIds = new ArrayList<>(); // treatmentIds defined in 2 table UI's Treatment section
639+
private final List<Integer> cohortRowIds = new ArrayList<>();
640640

641641
@Override
642642
public void validateForm(StudyTreatmentSchedule form, Errors errors)

studydesign/src/org/labkey/studydesign/model/TreatmentManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,11 @@ private void populateTreatmentSchedule() throws ValidationException
805805
{
806806
_cohorts.add(CohortService.get().createCohort(_junitStudy, _user, "Cohort1", true, 10, null));
807807
_cohorts.add(CohortService.get().createCohort(_junitStudy, _user, "Cohort2", true, 20, null));
808-
assertEquals(_cohorts.size(), 2);
808+
assertEquals(2, _cohorts.size());
809809

810810
_visits.add(VisitService.get().createVisit(_junitStudy, _user, BigDecimal.valueOf(1.0), "Visit 1", Visit.Type.BASELINE));
811811
_visits.add(VisitService.get().createVisit(_junitStudy, _user, BigDecimal.valueOf(2.0), "Visit 2", Visit.Type.SCHEDULED_FOLLOWUP));
812-
assertEquals(_visits.size(), 2);
812+
assertEquals(2, _visits.size());
813813

814814
for (Cohort cohort : _cohorts)
815815
{
@@ -843,7 +843,7 @@ private void populateTreatments()
843843
_treatments.add(treatment2);
844844
}
845845

846-
assertEquals(_treatments.size(), 2);
846+
assertEquals(2, _treatments.size());
847847
}
848848

849849
private void addProductsForTreatment(int treatmentId)
@@ -887,7 +887,7 @@ private void populateStudyProducts()
887887
_products.add(Table.insert(_user, ti, product4));
888888
}
889889

890-
assertEquals(_products.size(), 4);
890+
assertEquals(4, _products.size());
891891

892892
for (ProductImpl product : _products)
893893
addAntigenToProduct(product.getRowId());
@@ -942,7 +942,7 @@ private void populateLookupTables()
942942
assertNull("Unexpected study design lookup label", _manager.getStudyDesignRouteLabelByName(_container, "UNK"));
943943
_lookups.put("Route", name);
944944

945-
assertEquals(_lookups.keySet().size(), 4);
945+
assertEquals(4, _lookups.keySet().size());
946946
}
947947

948948
private void verifyTreatmentVisitMapRecords(int expectedCount)
@@ -1079,7 +1079,7 @@ private void populateAssaySchedule()
10791079
{
10801080
_visits.add(VisitService.get().createVisit(_junitStudy, _user, BigDecimal.valueOf(1.0), "Visit 1", Visit.Type.BASELINE));
10811081
_visits.add(VisitService.get().createVisit(_junitStudy, _user, BigDecimal.valueOf(2.0), "Visit 2", Visit.Type.SCHEDULED_FOLLOWUP));
1082-
assertEquals(_visits.size(), 2);
1082+
assertEquals(2, _visits.size());
10831083

10841084
for (AssaySpecimenConfigImpl assay : _assays)
10851085
{
@@ -1123,7 +1123,7 @@ private void populateLookupTables()
11231123
_lookups.put("Lab", name);
11241124

11251125
data.put("Name", name = "Test Sample Type");
1126-
data.put("Label", label = "Test Sample Type Label");
1126+
data.put("Label", "Test Sample Type Label");
11271127
data.put("PrimaryType", "Test Primary Type");
11281128
data.put("ShortSampleCode", "TP");
11291129
Table.insert(_user, StudyDesignSchema.getInstance().getTableInfoStudyDesignSampleTypes(), data);

studydesign/src/org/labkey/studydesign/view/immunizationScheduleWebpart.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
%>
104104
</tr>
105105
<%
106-
if (cohorts.size() == 0)
106+
if (cohorts.isEmpty())
107107
{
108108
%><tr><td class="cell-display empty" colspan="2">No data to show.</td></tr><%
109109
}

0 commit comments

Comments
 (0)