예제 #1
0
 @Override
 protected void initializeEntity(Screen screen) {
   super.initializeEntity(screen);
   getDao().needReadOnly(screen, Screen.labHead.to(LabHead.labAffiliation));
   getDao().needReadOnly(screen, Screen.labHead.to(LabHead.labMembers));
   getDao().needReadOnly(screen, Screen.leadScreener);
   getDao().needReadOnly(screen, Screen.collaborators.to(ScreeningRoomUser.LabHead));
   getDao().needReadOnly(screen, Screen.billingItems);
   getDao().needReadOnly(screen, Screen.labActivities.to(Activity.performedBy));
   //    Note: explicit load of serviceActivity screen; however this doesn't solve the need
   // to reload the screeen when displaying the activity in the ActivitySearchResults - sde4
   getDao().needReadOnly(screen, Screen.serviceActivities.to(Activity.performedBy));
   getDao().needReadOnly(screen, Screen.serviceActivities.to(ServiceActivity.servicedUser));
   getDao().needReadOnly(screen, Screen.serviceActivities.to(ServiceActivity.servicedScreen));
   getDao().needReadOnly(screen, Screen.attachedFiles.to(AttachedFile.fileType));
   getDao().needReadOnly(screen, Screen.fundingSupports);
   getDao().needReadOnly(screen, Screen.publications);
   getDao().needReadOnly(screen, Screen.keywords);
   getDao().needReadOnly(screen, Screen.statusItems);
   getDao().needReadOnly(screen, Screen.cherryPickRequests.to(CherryPickRequest.requestedBy));
   // getDao().needReadOnly(screen, Screen.annotationTypes.to(AnnotationType.annotationValues));
   getDao()
       .needReadOnly(
           screen.getScreenResult(), ScreenResult.dataColumns.to(DataColumn.derivedTypes));
   getDao()
       .needReadOnly(
           screen.getScreenResult(), ScreenResult.dataColumns.to(DataColumn.typesDerivedFrom));
   // for screen result last data import date
   getDao().needReadOnly(screen, AuditedAbstractEntity.updateActivities);
   getDao().needReadOnly(screen, Screen.pinTransferApprovalActivity.to(Activity.createdBy));
   getDao().needReadOnly(screen, Screen.pinTransferApprovalActivity.to(Activity.performedBy));
 }
 private Screen createScreen(String title, ScreenType type) {
   log.info("leads" + leadScreener);
   Screen screen =
       new Screen(
           null,
           Integer.toString(screen_number_counter++),
           leadScreener,
           labHead,
           type,
           StudyType.IN_VITRO,
           ProjectPhase.PRIMARY_SCREEN,
           title);
   screen.addCollaborator(collaborator);
   screen.createStatusItem(new LocalDate(), ScreenStatus.ACCEPTED);
   genericEntityDao.persistEntity(screen);
   return screen;
 }
  /**
   * Test the updates of single screens to various levels TODO: should check the audit log too
   *
   * @throws Exception
   */
  public void testScreenDataSharingLevelUpdater() throws Exception {
    initializeData();
    Screen screen = createScreen("SDSL TEST");

    flushAndClear();

    screen = genericEntityDao.reloadEntity(screen);
    assertEquals(ScreenDataSharingLevel.PRIVATE, screen.getDataSharingLevel());
    screenDataSharingLevelUpdater.updateScreen(
        screen, ScreenDataSharingLevel.MUTUAL_SCREENS, admin);

    flushAndClear();

    screen = genericEntityDao.reloadEntity(screen);
    assertEquals(ScreenDataSharingLevel.MUTUAL_SCREENS, screen.getDataSharingLevel());
    screenDataSharingLevelUpdater.updateScreen(
        screen, ScreenDataSharingLevel.MUTUAL_POSITIVES, admin);

    flushAndClear();

    screen = genericEntityDao.reloadEntity(screen);
    assertEquals(ScreenDataSharingLevel.MUTUAL_POSITIVES, screen.getDataSharingLevel());
    screenDataSharingLevelUpdater.updateScreen(screen, ScreenDataSharingLevel.SHARED, admin);

    flushAndClear();

    screen = genericEntityDao.reloadEntity(screen);
    assertEquals(ScreenDataSharingLevel.SHARED, screen.getDataSharingLevel());
    screenDataSharingLevelUpdater.updateScreen(screen, ScreenDataSharingLevel.PRIVATE, admin);

    flushAndClear();

    screen = genericEntityDao.reloadEntity(screen);
    assertEquals(ScreenDataSharingLevel.PRIVATE, screen.getDataSharingLevel());
  }
예제 #4
0
  public void initializeViewer(Screen screen) {
    super.initializeViewer(screen);

    _screenDetailViewer.setEntity(screen);
    ScreenResult screenResult = screen.getScreenResult();
    if (screenResult != null && screenResult.isRestricted()) {
      screenResult = null;
    }
    _screenResultViewer.setEntity(screenResult);
    _heatMapViewer.setScreenResult(screenResult);
    _cellHTS2Runner.setScreenResult(screenResult);

    warnAdminOnMismatchedDataSharingLevel(screen);
  }
예제 #5
0
 private void warnAdminOnMismatchedDataSharingLevel(Screen screen) {
   if (isReadAdmin()) {
     if (screen.getLabHead() != null) {
       ScreenDataSharingLevel screenDslForLabHead =
           DataSharingLevelMapper.getScreenDataSharingLevelForUser(
               screen.getScreenType(), screen.getLabHead());
       if (screen.getDataSharingLevel().compareTo(screenDslForLabHead) > 0) {
         showMessage(
             "screens.dataSharingLevelTooRestrictive",
             screen.getDataSharingLevel().toString(),
             DataSharingLevelMapper.getPrimaryDataSharingLevelRoleForUser(
                 screen.getScreenType(), screen.getLabHead()));
       }
     }
   }
 }
  /** Test the bulk expire method */
  public void testExpire() throws Exception {
    initializeData();

    LocalDate date = new LocalDate(new Date());

    testFindExpired();

    flushAndClear();

    screen1NotExpired = genericEntityDao.reloadEntity(screen1NotExpired);
    screen2Expired = genericEntityDao.reloadEntity(screen2Expired);
    screen3Expired = genericEntityDao.reloadEntity(screen3Expired);
    screen4Default = genericEntityDao.reloadEntity(screen4Default);
    screen5RnaiExpired = genericEntityDao.reloadEntity(screen5RnaiExpired);
    screen6ExpiredNoResults = genericEntityDao.reloadEntity(screen6ExpiredNoResults);
    screen7ExpiredDropped = genericEntityDao.reloadEntity(screen7ExpiredDropped);
    screen8ExpiredTransferred = genericEntityDao.reloadEntity(screen8ExpiredTransferred);
    screen9ExpiredMaxDatePassed = genericEntityDao.reloadEntity(screen9ExpiredMaxDatePassed);

    List<Pair<Screen, AdministrativeActivity>> results =
        screenDataSharingLevelUpdater.expireScreenDataSharingLevels(
            date, admin, ScreenType.SMALL_MOLECULE);
    // TODO: Do some checking of the activities as well.
    Set<Screen> screens = Sets.newLinkedHashSet();
    for (Pair<Screen, AdministrativeActivity> result : results) {
      screens.add(result.getFirst());
    }
    log.info("screens: " + screens);
    screen1NotExpired = genericEntityDao.reloadEntity(screen1NotExpired);
    screen2Expired = genericEntityDao.reloadEntity(screen2Expired);
    screen3Expired = genericEntityDao.reloadEntity(screen3Expired);
    screen4Default = genericEntityDao.reloadEntity(screen4Default);
    screen5RnaiExpired = genericEntityDao.reloadEntity(screen5RnaiExpired);

    assertTrue("screen2Expired should be expired", screens.contains(screen2Expired));
    assertTrue(
        "screen2Expired should be shared",
        screen2Expired.getDataSharingLevel() == ScreenDataSharingLevel.MUTUAL_SCREENS);

    assertTrue("screen3Expired should be expired", screens.contains(screen3Expired));
    assertTrue(
        "screen3Expired should be shared",
        screen3Expired.getDataSharingLevel() == ScreenDataSharingLevel.MUTUAL_SCREENS);

    assertFalse("screen4Default should not be expired", screens.contains(screen4Default));
    assertTrue(
        "screen4Default should not be shared",
        screen4Default.getDataSharingLevel() != ScreenDataSharingLevel.MUTUAL_SCREENS);

    assertFalse("screen1NotExpired should be expired", screens.contains(screen1NotExpired));
    assertTrue(
        "screen1NotExpired should not be shared",
        screen1NotExpired.getDataSharingLevel() != ScreenDataSharingLevel.MUTUAL_SCREENS);

    assertFalse(
        "screen5RnaiExpired should NOT be expired (unless setting the screenType=RNAi)",
        screens.contains(screen5RnaiExpired));
    assertTrue(
        "screen5RnaiExpired NOT should be shared",
        screen5RnaiExpired.getDataSharingLevel() != ScreenDataSharingLevel.MUTUAL_SCREENS);

    assertTrue(
        "screen9ExpiredMaxDatePassed should be expired",
        screens.contains(screen9ExpiredMaxDatePassed));
    assertTrue(
        "screen9ExpiredMaxDatePassed should be shared",
        screen9ExpiredMaxDatePassed.getDataSharingLevel() == ScreenDataSharingLevel.MUTUAL_SCREENS);

    // TODO: Do some checking of the activities as well.

    // RNAi
    results =
        screenDataSharingLevelUpdater.expireScreenDataSharingLevels(date, admin, ScreenType.RNAI);
    screen5RnaiExpired = genericEntityDao.reloadEntity(screen5RnaiExpired);
    assertFalse(results.isEmpty());
    assertTrue("should only return the 1 RNAI screen: " + results, results.size() == 1);
    assertTrue(
        "screen5RnaiExpired should be expired (setting the screenType=RNAi)",
        results.get(0).getFirst().equals((screen5RnaiExpired)));
    assertTrue(
        "screen5RnaiExpired should be shared",
        screen5RnaiExpired.getDataSharingLevel() == ScreenDataSharingLevel.MUTUAL_SCREENS);
  }
  public void testFindExpired() throws Exception {
    initializeData();

    LocalDate date = new LocalDate(new Date());

    screen1NotExpired = createScreen("SDSL TEST1");
    screen1NotExpired.setDataPrivacyExpirationDate(date.plusYears(2));
    genericEntityDao.persistEntity(screen1NotExpired);

    screen2Expired = createScreen("SDSL TEST2");
    screen2Expired.createScreenResult();
    screen2Expired.setDataPrivacyExpirationDate(date);
    genericEntityDao.persistEntity(screen2Expired);

    screen3Expired = createScreen("SDSL TEST3");
    screen3Expired.createScreenResult();
    screen3Expired.setDataPrivacyExpirationDate(date.minusYears(1));
    genericEntityDao.persistEntity(screen3Expired);

    screen9ExpiredMaxDatePassed = createScreen("screen9ExpiredMaxDatePassed");
    screen9ExpiredMaxDatePassed.createScreenResult();
    screen9ExpiredMaxDatePassed.setMinAllowedDataPrivacyExpirationDate(date.minusYears(2));
    screen9ExpiredMaxDatePassed.setMaxAllowedDataPrivacyExpirationDate(date.minusYears(2));
    screen9ExpiredMaxDatePassed.setDataPrivacyExpirationDate(date.minusYears(2));
    genericEntityDao.persistEntity(screen9ExpiredMaxDatePassed);

    screen4Default = createScreen("SDSL TEST4");
    genericEntityDao.persistEntity(screen4Default);

    screen5RnaiExpired = createScreen("Test RNAI expired", ScreenType.RNAI);
    screen5RnaiExpired.setDataPrivacyExpirationDate(date.minusYears(1));
    screen5RnaiExpired.createScreenResult();
    genericEntityDao.persistEntity(screen5RnaiExpired);

    screen6ExpiredNoResults = createScreen("test expired no results", ScreenType.RNAI);
    screen6ExpiredNoResults.setDataPrivacyExpirationDate(date.minusYears(1));
    genericEntityDao.persistEntity(screen6ExpiredNoResults);

    screen7ExpiredDropped = createScreen("test expired dropped technical");
    screen7ExpiredDropped.setDataPrivacyExpirationDate(date.minusYears(1));
    screen7ExpiredDropped.createScreenResult();
    screen7ExpiredDropped.createStatusItem(new LocalDate(), ScreenStatus.DROPPED_TECHNICAL);
    genericEntityDao.persistEntity(screen7ExpiredDropped);

    screen8ExpiredTransferred = createScreen("test expired transferred");
    screen8ExpiredTransferred.setDataPrivacyExpirationDate(date.minusYears(1));
    screen8ExpiredTransferred.createScreenResult();
    screen8ExpiredTransferred.createStatusItem(
        new LocalDate(), ScreenStatus.TRANSFERRED_TO_BROAD_INSTITUTE);
    genericEntityDao.persistEntity(screen8ExpiredTransferred);

    flushAndClear();

    //    startNewTransaction();

    List<Screen> allScreens = genericEntityDao.findAllEntitiesOfType(Screen.class);
    for (Screen screen : allScreens) {
      log.info(
          "allScreens: "
              + screen.getTitle()
              + " , expires: "
              + screen.getDataPrivacyExpirationDate());
    }

    List<Screen> screens =
        screenDataSharingLevelUpdater.findNewExpiredNotNotified(date, ScreenType.SMALL_MOLECULE);
    for (Screen screen : screens) {
      log.info(
          "expiredScreens: "
              + screen.getTitle()
              + " , expires: "
              + screen.getDataPrivacyExpirationDate());
    }
    assertFalse("no expired screens", screens.isEmpty());

    screen1NotExpired = genericEntityDao.reloadEntity(screen1NotExpired);
    screen2Expired = genericEntityDao.reloadEntity(screen2Expired);
    screen3Expired = genericEntityDao.reloadEntity(screen3Expired);
    screen4Default = genericEntityDao.reloadEntity(screen4Default);
    screen5RnaiExpired = genericEntityDao.reloadEntity(screen5RnaiExpired);
    screen6ExpiredNoResults = genericEntityDao.reloadEntity(screen6ExpiredNoResults);
    screen7ExpiredDropped = genericEntityDao.reloadEntity(screen7ExpiredDropped);
    screen8ExpiredTransferred = genericEntityDao.reloadEntity(screen8ExpiredTransferred);
    screen9ExpiredMaxDatePassed = genericEntityDao.reloadEntity(screen9ExpiredMaxDatePassed);

    assertTrue("screen2Expired should be expired: ", screens.contains(screen2Expired));
    assertTrue("screen3Expired should be expired: ", screens.contains(screen3Expired));
    assertTrue(
        "screen9ExpiredMaxDatePassed should be expired: ",
        screens.contains(screen9ExpiredMaxDatePassed));

    assertFalse("screen4Default should not be expired", screens.contains(screen4Default));
    assertFalse("screen1NotExpired should not be expired", screens.contains(screen1NotExpired));
    assertFalse(
        "screen5RnaiExpired should NOT be expired (unless setting screenType=RNAi)",
        screens.contains(screen5RnaiExpired));
    assertFalse(
        "screen6ExpiredNoResults should not be expired", screens.contains(screen6ExpiredNoResults));
    assertFalse(
        "screen7ExpiredDropped should not be expired", screens.contains(screen7ExpiredDropped));
    assertFalse(
        "screen8ExpiredTransferred should not be expired",
        screens.contains(screen8ExpiredTransferred));

    // just a little test here to see if we get a null or an empty list, find none
    screens =
        screenDataSharingLevelUpdater.findNewExpiredNotNotified(
            date.minusYears(20), ScreenType.SMALL_MOLECULE);
    log.info("empty result: " + screens);
    assertNotNull(screens);
    assertTrue(screens.isEmpty());

    screens = screenDataSharingLevelUpdater.findNewExpiredNotNotified(date, ScreenType.RNAI);
    assertFalse("no expired screens", screens.isEmpty());
    assertTrue(
        "only the RNAi screen should be returned (no Small Molecule): " + screens,
        screens.size() == 1);
    assertTrue(
        "screen5RnaiExpired should NOT be expired (unless setting screenType=RNAi)",
        screens.contains(screen5RnaiExpired));
  }
  /**
   * If this test is run by itself, it leaves the database in a state that is convenient for testing
   * from the command line.
   */
  @Rollback(value = false)
  public void testThatSetsUpForCommandLineTest() throws Exception {
    initializeData();

    int daysToNofify = 60;
    int daysToExpire =
        790; // 2 years, 2months  (technically, a month is variable, using 30 days for all
    // calculations)
    LocalDate today = new LocalDate();
    LocalDate activityDateToExpireToday = today.minusDays(daysToExpire);
    LocalDate activityDateToNotifyToday = today.minusDays(daysToExpire).plusDays(daysToNofify);

    Screen screen1ToExpireTodayAfterAdjust =
        createScreen("is testing for expiration (760 days after lab activity) today");
    screen1ToExpireTodayAfterAdjust.createScreenResult();
    screen1ToExpireTodayAfterAdjust.createLibraryScreening(
        admin, leadScreener, activityDateToExpireToday);

    Screen screen2ToNotifyTodayAfterAdjust =
        createScreen("is testing for notification (60 days before expiration) today");
    screen2ToNotifyTodayAfterAdjust.createScreenResult();
    screen2ToNotifyTodayAfterAdjust.createLibraryScreening(
        admin, leadScreener, activityDateToNotifyToday);

    Screen screen3AjustementOverridden =
        createScreen("is testing for max/min DPED override - Adjustment to the allowed value");
    screen3AjustementOverridden.createScreenResult();
    screen3AjustementOverridden.createLibraryScreening(
        admin, leadScreener, activityDateToExpireToday);
    screen3AjustementOverridden.setDataPrivacyExpirationDate(today.plusDays(2));
    screen3AjustementOverridden.setMinAllowedDataPrivacyExpirationDate(today.plusDays(1));

    Screen screen3aAjustementOverridden =
        createScreen("is testing for max/min DPED override - adjustment not allowed - overridden");
    screen3aAjustementOverridden.createScreenResult();
    screen3aAjustementOverridden.createLibraryScreening(
        admin, leadScreener, activityDateToExpireToday);
    screen3aAjustementOverridden.setMinAllowedDataPrivacyExpirationDate(today.plusDays(1));
    screen3aAjustementOverridden.setDataPrivacyExpirationDate(today.plusDays(1));

    Screen screen4Published = createScreen("is testing a published Screen");
    screen4Published.createScreenResult();
    screen4Published.createLibraryScreening(admin, leadScreener, activityDateToNotifyToday);
    screen4Published.addPublication(new Publication());

    genericEntityDao.persistEntity(screen1ToExpireTodayAfterAdjust);
    genericEntityDao.persistEntity(screen2ToNotifyTodayAfterAdjust);
    genericEntityDao.persistEntity(screen3AjustementOverridden);
    genericEntityDao.persistEntity(screen3aAjustementOverridden);
    genericEntityDao.persistEntity(screen4Published);
    genericEntityDao.flush();
  }
  public void testFindNewPublishedPrivate() throws Exception {
    initializeData();

    Screen screen1NotPublished = createScreen("SDSL TEST1 Not Published");
    genericEntityDao.persistEntity(screen1NotPublished);

    Screen screen2Published = createScreen("SDSL TEST2 Published");
    screen2Published.createScreenResult();
    Publication publication = new Publication();
    publication.setAuthors("Test Authors");
    publication.setJournal("Test Journal");
    publication.setTitle("Test Publication Title");
    screen2Published.addPublication(publication);
    genericEntityDao.persistEntity(screen2Published);

    Screen screen3Mutual = createScreen("SDSL screen3Mutual");
    screen3Mutual.createScreenResult();
    screen3Mutual.setDataSharingLevel(ScreenDataSharingLevel.MUTUAL_SCREENS);
    publication = new Publication();
    publication.setAuthors("Test Authors x");
    publication.setJournal("Test Journal x");
    publication.setTitle("Test Publication Title x");
    screen3Mutual.addPublication(publication);
    genericEntityDao.persistEntity(screen3Mutual);

    Screen screen4Private = createScreen("SDSL private");
    screen4Private.createScreenResult();
    screen4Private.setDataSharingLevel(ScreenDataSharingLevel.PRIVATE);
    publication = new Publication();
    publication.setAuthors("Test Authors x");
    publication.setJournal("Test Journal x");
    publication.setTitle("Test Publication Title x");
    screen4Private.addPublication(publication);
    genericEntityDao.persistEntity(screen4Private);

    Screen screenPrivatePublishedTransferred =
        createScreen("SDSL screenPrivatePublishedTransferred");
    screenPrivatePublishedTransferred.createScreenResult();
    screenPrivatePublishedTransferred.setDataSharingLevel(ScreenDataSharingLevel.PRIVATE);
    publication = new Publication();
    publication.setAuthors("Test Authors x");
    publication.setJournal("Test Journal x");
    publication.setTitle("Test Publication Title x");
    screenPrivatePublishedTransferred.createStatusItem(
        new LocalDate(), ScreenStatus.TRANSFERRED_TO_BROAD_INSTITUTE);
    screenPrivatePublishedTransferred.addPublication(publication);
    genericEntityDao.persistEntity(screenPrivatePublishedTransferred);

    Screen screen4Public = createScreen("SDSL screen4Public");
    screen4Public.createScreenResult();
    screen4Public.setDataSharingLevel(ScreenDataSharingLevel.SHARED);
    publication = new Publication();
    publication.setAuthors("Test Authors xx");
    publication.setJournal("Test Journal xx");
    publication.setTitle("Test Publication Title xx");
    screen4Public.addPublication(publication);
    genericEntityDao.persistEntity(screen4Public);

    flushAndClear();

    screen2Published = genericEntityDao.reloadEntity(screen2Published);
    screen3Mutual = genericEntityDao.reloadEntity(screen3Mutual);
    screen4Private = genericEntityDao.reloadEntity(screen4Private);

    Set<Screen> publishedScreens =
        Sets.newHashSet(
            screenDataSharingLevelUpdater.findNewPublishedPrivate(
                ScreenType.SMALL_MOLECULE)); // TODO: Test RNAi as well
    assertNotNull(publishedScreens);
    assertEquals(
        Sets.newHashSet(screen2Published, screen3Mutual, screen4Private), publishedScreens);
  }
  public void testAdjustDataPrivacyExpirationByActivities() throws Exception {
    initializeData();

    // as of [#2175] expiration services to become notification services only
    // the DPED will be set separately from the ScreenResultImport (the old way).
    // It will now be set by batch process, SCREEN_ACTIVITY_DATA_PRIVACY_EXPIRATION_AGE_DAYS from
    // the last ScreeningActivity date for a screen:
    // Meaning:
    // DPED will be set in one step (this test)
    // DPED will be used in separate step to find and expire screens (next test)

    // 1. create some screens
    Screen screen1NoActivities = createScreen("SDSL TEST1");
    Screen screen2HasActivity = createScreen("SDSL TEST2");
    Screen screen5TransferredHasActivity = createScreen("SDSL TEST5");
    screen5TransferredHasActivity.createStatusItem(
        new LocalDate(), ScreenStatus.TRANSFERRED_TO_BROAD_INSTITUTE);
    Screen screen3RnaiHasActivity = createScreen("SDSL TEST RNAI", ScreenType.RNAI);
    Screen screen4HasNoLibraryScreeningActivity =
        createScreen("screen4HasNoLibraryScreeningActivity");
    Screen screen6MinMaxSet = createScreen("screen6MinMaxSet");

    // 2. add some activities
    LocalDate newActivityDate = new LocalDate();
    screen2HasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen2HasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen2HasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen2HasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    // create a screening for user provided plates
    LibraryScreening ls =
        screen2HasActivity.createLibraryScreening(
            admin, leadScreener, newActivityDate.plusDays(100));
    ls.setForExternalLibraryPlates(true);
    // create a non-library-screening activity too
    screen2HasActivity.createCherryPickRequest(admin, leadScreener, newActivityDate.plusDays(100));

    screen4HasNoLibraryScreeningActivity.createCherryPickRequest(
        admin, leadScreener, newActivityDate.plusDays(100));

    screen3RnaiHasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);

    screen5TransferredHasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen5TransferredHasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen5TransferredHasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen5TransferredHasActivity.createLibraryScreening(admin, leadScreener, newActivityDate);
    // create a screening for user provided plates
    ls =
        screen5TransferredHasActivity.createLibraryScreening(
            admin, leadScreener, newActivityDate.plusDays(100));
    ls.setForExternalLibraryPlates(true);
    // 3. add some results
    screen2HasActivity.createScreenResult();
    screen5TransferredHasActivity.createScreenResult();
    screen4HasNoLibraryScreeningActivity.createScreenResult();

    LocalDate maxAllowedDataPrivacyExpirationDate = newActivityDate.minusDays(10);
    LocalDate minAllowedDataPrivacyExpirationDate = newActivityDate.minusDays(20);
    screen6MinMaxSet.setMinAllowedDataPrivacyExpirationDate(minAllowedDataPrivacyExpirationDate);
    screen6MinMaxSet.setMaxAllowedDataPrivacyExpirationDate(maxAllowedDataPrivacyExpirationDate);
    screen6MinMaxSet.createLibraryScreening(admin, leadScreener, newActivityDate);
    screen6MinMaxSet.createScreenResult();

    genericEntityDao.persistEntity(screen1NoActivities);
    genericEntityDao.persistEntity(screen2HasActivity);
    genericEntityDao.persistEntity(screen3RnaiHasActivity);
    genericEntityDao.persistEntity(screen4HasNoLibraryScreeningActivity);
    genericEntityDao.persistEntity(screen5TransferredHasActivity);
    genericEntityDao.persistEntity(screen6MinMaxSet);
    flushAndClear();

    // 4. find the ones with "old" activities (activity age >
    // SCREEN_ACTIVITY_DATA_PRIVACY_EXPIRATION_AGE_DAYS)
    int ageToExpireFromActivityDateInDays = 760;

    ScreenDataSharingLevelUpdater.DataPrivacyAdjustment adjustment =
        screenDataSharingLevelUpdater.adjustDataPrivacyExpirationByActivities(
            ageToExpireFromActivityDateInDays, admin, ScreenType.SMALL_MOLECULE);

    flushAndClear();

    screen1NoActivities = genericEntityDao.reloadEntity(screen1NoActivities);
    screen2HasActivity = genericEntityDao.reloadEntity(screen2HasActivity);
    screen3RnaiHasActivity = genericEntityDao.reloadEntity(screen3RnaiHasActivity);
    screen4HasNoLibraryScreeningActivity =
        genericEntityDao.reloadEntity(screen4HasNoLibraryScreeningActivity);
    screen5TransferredHasActivity = genericEntityDao.reloadEntity(screen5TransferredHasActivity);
    screen6MinMaxSet = genericEntityDao.reloadEntity(screen6MinMaxSet);

    boolean containsFirst = false,
        containsSecond = false,
        containsThird = false,
        containsFourth = false,
        containsFifth = false,
        containsSixth = false;
    for (Pair<Screen, AdministrativeActivity> result : adjustment.screensAdjusted) {
      log.info("entry: " + result.getSecond());
      if (result.getFirst().equals(screen1NoActivities)) containsFirst = true;
      if (result.getFirst().equals(screen2HasActivity)) containsSecond = true;
      if (result.getFirst().equals(screen3RnaiHasActivity)) containsThird = true;
      if (result.getFirst().equals(screen4HasNoLibraryScreeningActivity)) containsFourth = true;
      if (result.getFirst().equals(screen5TransferredHasActivity)) containsFifth = true;
      if (result.getFirst().equals(screen6MinMaxSet)) containsSixth = true;
    }

    // TODO: update test for this
    assertTrue(
        "no screens should not be allowed", adjustment.screenPrivacyAdjustmentNotAllowed.isEmpty());
    assertFalse(
        "the sixth screen should adjusted to allowed",
        adjustment.screensAdjustedToAllowed.isEmpty());

    assertFalse("screen1NoActivities should not have been adjusted", containsFirst);
    assertTrue("screen2HasActivity should have been adjusted", containsSecond);
    assertFalse("screen3RnaiHasActivity should not have been adjusted", containsThird);
    assertFalse(
        "screen4HasNoLibraryScreeningActivity should not have been adjusted", containsFourth);
    assertFalse("screen5TransferredHasActivity should not have been adjusted", containsFifth);
    assertFalse("screen6MinMaxSet should not have been adjusted", containsSixth);
    assertEquals(
        "new screen2HasActivity dataPrivacyExpirationDate() wrong: ",
        newActivityDate.plusDays(ageToExpireFromActivityDateInDays),
        screen2HasActivity.getDataPrivacyExpirationDate());
  }