4242import de .symeda .sormas .api .caze .CaseClassification ;
4343import de .symeda .sormas .api .caze .CaseDataDto ;
4444import de .symeda .sormas .api .caze .CaseReferenceDto ;
45- import de .symeda .sormas .api .common .DeletionReason ;
4645import de .symeda .sormas .api .contact .ContactDto ;
4746import de .symeda .sormas .api .contact .ContactReferenceDto ;
4847import de .symeda .sormas .api .contact .ContactStatus ;
@@ -137,10 +136,10 @@ public CommitDiscardWrapperComponent<PathogenTestForm> getPathogenTestCreateComp
137136 ContactDto contact = FacadeProvider .getContactFacade ().getByUuid (sampleDto .getAssociatedContact ().getUuid ());
138137 associatedEventOrCaseOrContactDisease = contact .getDisease ();
139138 }
140- PathogenTestForm createForm = new PathogenTestForm (sampleDto , true , caseSampleCount , false , true , associatedEventOrCaseOrContactDisease ); // Valid because jurisdiction doesn't matter for entities that are about to be created
141- // Defaulting the case disease as tested disease
139+ PathogenTestForm createForm = new PathogenTestForm (sampleDto , true , caseSampleCount , false , true , associatedEventOrCaseOrContactDisease );
142140 pathogenTest .setTestedDisease (associatedEventOrCaseOrContactDisease );
143141 createForm .setValue (pathogenTest );
142+
144143 final CommitDiscardWrapperComponent <PathogenTestForm > editView =
145144 new CommitDiscardWrapperComponent <>(createForm , UiUtil .permitted (UserRight .PATHOGEN_TEST_CREATE ), createForm .getFieldGroup ());
146145
@@ -254,10 +253,7 @@ public CommitDiscardWrapperComponent<PathogenTestForm> getPathogenTestEditCompon
254253 });
255254
256255 if (pathogenTest .isDeleted ()) {
257- editView .getWrappedComponent ().getField (PathogenTestDto .DELETION_REASON ).setVisible (true );
258- if (editView .getWrappedComponent ().getField (PathogenTestDto .DELETION_REASON ).getValue () == DeletionReason .OTHER_REASON ) {
259- editView .getWrappedComponent ().getField (PathogenTestDto .OTHER_DELETION_REASON ).setVisible (true );
260- }
256+ editView .getWrappedComponent ().showDeletionInfo (pathogenTest .getDeletionReason ());
261257 }
262258 editView .restrictEditableComponentsOnEditView (
263259 forHumanSample ? UserRight .SAMPLE_EDIT : UserRight .ENVIRONMENT_SAMPLE_EDIT ,
@@ -354,14 +350,17 @@ public void savePathogenTests(List<PathogenTestDto> pathogenTests, SampleReferen
354350 /**
355351 * Handles the association of a pathogen test with a case.
356352 * Based on pathogen test results the following logic is applied:
357- *
358- * <p>Negative test result AND test result verified
353+ *
354+ * <p>
355+ * Negative test result AND test result verified
359356 * <ol>
360- * <li>Tested disease == case disease AND test result != sample pathogen test result: Ask user whether to update the sample pathogen test result</li>
357+ * <li>Tested disease == case disease AND test result != sample pathogen test result: Ask user whether to update the sample pathogen
358+ * test result</li>
361359 * <li>Tested disease != case disease: Do nothing</li>
362360 * </ol>
363361 * </p>
364- * <p>Positive test result AND test result verified
362+ * <p>
363+ * Positive test result AND test result verified
365364 * <ol>
366365 * <li>Tested disease == case disease: Ask user whether to update the sample pathogen test result
367366 * <ol>
@@ -372,12 +371,15 @@ public void savePathogenTests(List<PathogenTestDto> pathogenTests, SampleReferen
372371 * <li>Tested disease != case disease: Ask user to create a new case for the tested disease</li>
373372 * </ol>
374373 * </p>
375- *
376- * @param pathogenTests the pathogen tests
377- * @param associatedCase the associated case
378- * @param suppressNavigateToCase whether to suppress navigation to the case
379- *
380- */
374+ *
375+ * @param pathogenTests
376+ * the pathogen tests
377+ * @param associatedCase
378+ * the associated case
379+ * @param suppressNavigateToCase
380+ * whether to suppress navigation to the case
381+ *
382+ */
381383 private void handleAssociatedCase (List <PathogenTestDto > pathogenTests , CaseReferenceDto associatedCase , boolean suppressNavigateToCase ) {
382384
383385 if (!UiUtil .permitted (UserRight .CASE_EDIT )) {
@@ -413,7 +415,6 @@ private void handleAssociatedCase(List<PathogenTestDto> pathogenTests, CaseRefer
413415
414416 final boolean hasVerifiedTests = hasVerifiedPositiveTest || hasVerifiedNegativeTest ;
415417
416-
417418 // 1. Ask user to update sample overall result if latest test result is different
418419 // 2. Ask user to update disease variant if case variant is different
419420 // 3. Ask user if they want to confirm the case only if any of the tests are verified either positive or negative (not pending or other)
@@ -436,7 +437,7 @@ private void handleAssociatedCase(List<PathogenTestDto> pathogenTests, CaseRefer
436437 // We decided this based on the intented text in the dialog but based on the test results instead of the sample overall result
437438 if (hasVerifiedPositiveTest ) {
438439 // The final laboratory result of the sample the saved pathogen test belongs to is positive. <-- sample overall result
439- // However, the case cannot be automatically classified as a confirmed case because it is missing some information.
440+ // However, the case cannot be automatically classified as a confirmed case because it is missing some information.
440441 // Do you want to set the case classification to confirmed anyway?
441442 this .showConfirmCaseDialog (c ); // Case classification
442443 }
0 commit comments