示例#1
0
  private List<Task> getTasksToDisplay() {
    final List<Task> tasksToDisplay = new LinkedList<Task>();

    final UserContext userContext = UserContext.getInstanceFromPageContext(pageContext);
    final boolean isAdmin = userContext.hasRequiredRole(IUserManager.ROLE_ADMIN);

    final ITaskManager taskManager = ManagementContainer.getInstance().getTaskManager();
    final Calendar whenCompleted = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    whenCompleted.setTime((Date) pageContext.getSession().getAttribute("ems.session.start.time"));
    whenCompleted.add(Calendar.DAY_OF_YEAR, -1);
    final Date searchDate = whenCompleted.getTime();
    final List<Task> tasks =
        taskManager.getDisplayedTasks(userContext.getCurrentCustomer().getCustID(), searchDate);

    final IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager();
    final Collection<ReviewerGroup> reviewerGroups =
        rgm.getReviewerGroups(
            userContext.getCurrentCustomer().getCustID(), userContext.getActualUser().getUserID());

    final List<Integer> reviewerGroupIdList =
        CollectionBuilder.buildList(reviewerGroups, ReviewerGroup.getReviewerGroupIdFunction());

    for (final Task task : tasks) {
      if (isAdmin
          || userContext.getActualUser().getUserID() == task.getUserID()
          || reviewerGroupIdList.contains(task.getInternalData())) {
        if (getType() == null || getType().equals(task.getType())) {
          tasksToDisplay.add(task);
        }
      }
    }

    return tasksToDisplay;
  }
示例#2
0
  @Test
  public void testDescribeReviewerGroupReviewerChanges() throws Exception {
    String changes = null;

    UserContext.newContext(getRequest(), m_user, m_customer);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(null, null, null);
    assertNull(
        "DiffUtils.describeReviewerGroupReviewerChanges(null, null, null) should return null",
        changes);

    List<SearchConstraint> constraints;
    constraints = new ArrayList<SearchConstraint>();
    constraints.add(
        new SearchConstraint(
            IUserManager.PROP_USERID,
            SearchConstraintOperator.CONSTRAINT_EQUALS,
            m_user.getUserID()));

    SavedUserSet reviewers = new SavedUserSet(m_customer.getCustID());
    reviewers.addUsers(constraints);

    ReviewerGroup oldRG =
        new ReviewerGroup(m_customer.getCustID(), 1, "name", reviewers, null, "extra");
    ReviewerGroup newRG =
        new ReviewerGroup(m_customer.getCustID(), 1, "name", reviewers, null, "extra");

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNull("Expected no diffs for 2 identical user sets", changes);

    reviewers = new SavedUserSet(m_customer.getCustID());
    newRG.setReviewers(reviewers);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNotNull("Expected diffs on 2 different reviewer groups", changes);

    SavedUserSet reviewers1 = new SavedUserSet(m_customer.getCustID());
    reviewers1.addConstraintSets(InternalUserSets.getAllUsersSet(m_customer.getCustID()));
    oldRG.setReviewers(reviewers1);

    SavedUserSet reviewers2 = new SavedUserSet(m_customer.getCustID());
    newRG.setReviewers(reviewers2);

    changes = DiffUtils.describeReviewerGroupReviewerChanges(getRequest(), oldRG, newRG);
    assertNotNull("Expected diffs on 2 different reviewer groups", changes);
  }
示例#3
0
  @Test
  public void verifyRetentionPolicyFilterForRetentionHolds() throws Exception {
    // Create a new Test User
    LOGGER.info("Creating a new Test user");
    String currentTime = Long.toString(System.currentTimeMillis());
    String userName = "******" + currentTime;
    String userAddress = userName + "@" + getJspTestUtils().getDomain();
    String password = getJspTestUtils().getPasswd();

    getJspTestUtils().createTestUser(userName, userAddress, password);

    int custId = getJspTestUtils().getCustId();
    LOGGER.info("Test user creation completed:" + userAddress);
    LOGGER.info("Customer Id is: " + Integer.toString(custId));

    // Get Retention policy manager, Reviewer group manager and User manager
    IRetentionPolicyManager mgr = ManagementContainer.getInstance().getRetentionPolicyManager();
    IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager();
    IUserManager um = ManagementContainer.getInstance().getUserManager();

    // Create Reviewer User set-1  for reviewers
    UserAccount reviewer1 = um.findUserForEmail(getJspTestUtils().m_userAddress);
    SavedUserSet sus1 = new SavedUserSet(custId);
    sus1.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer1.getUserID()))));
    // sus1.setInternal(true);
    sus1.setName("REVIEWERS-1");
    um.saveUserSet(sus1);
    // Create User set-1 for users whose mails will be reviewed by reviewer
    SavedUserSet scope1 = InternalUserSets.getAllUsersSet(custId);
    // scope1.setInternal(true);
    scope1.setName("SCOPE-1");
    um.saveUserSet(scope1);
    // Create Reviewer group-1
    LOGGER.info("Creating Reviewer group reviewerGrp1");
    ReviewerGroup rg1 = rgm.createReviewerGroup(custId, "reviewerGrp1", sus1, scope1, null);
    rgm.updateReviewerGroup(rg1);
    rg1 = rgm.getReviewerGroup(custId, "reviewerGrp1");
    LOGGER.info(
        "Reviewer group creation done. Reviewer group details-> GroupId:"
            + rg1.getGroupID()
            + ";GroupName:"
            + rg1.getGroupName());

    RetentionPolicy qblh1 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-1",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp1");
    LOGGER.info(
        "Query based legal hold QBLH-1 details-> Policy Id:"
            + qblh1.getId()
            + ";Policy Name:"
            + qblh1.getName());

    // Create Reviewer User set-2 for reviewers
    UserAccount reviewer2 = um.findUserForEmail(userAddress);
    SavedUserSet sus2 = new SavedUserSet(custId);
    sus2.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer2.getUserID()))));
    sus2.setName("REVIEWERS-2");
    um.saveUserSet(sus2);
    // Create User set-2 for users whose mails will be reviewed by reviewer
    SavedUserSet scope2 = InternalUserSets.getAllUsersSet(custId);
    scope2.setName("SCOPE-2");
    um.saveUserSet(scope2);
    // Create Reviewer group-2
    ReviewerGroup rg2 = rgm.createReviewerGroup(custId, "reviewerGrp2", sus2, scope2, null);
    rgm.updateReviewerGroup(rg2);
    rg2 = rgm.getReviewerGroup(custId, "reviewerGrp2");
    LOGGER.info("Reviewer group details:" + rg2.getGroupID() + ";" + rg2.getGroupName());
    RetentionPolicy qblh2 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-2",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp2");
    LOGGER.info(
        "Query based legal hold QBLH-2 details-> Policy Id:"
            + qblh2.getId()
            + ";Policy Name:"
            + qblh2.getName());

    // Login as reviewer-1  and verify QBLH-1 is visible to reviewer-1 and QBLH-2 is not visible
    LOGGER.info("Logging in as reviewer-1");
    getJspTestUtils()
        .login(getJspTestUtils().m_cappLoginUrl, getJspTestUtils().m_userAddress, password);
    getJspTestUtils().navigateToArchivePage();
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-1 is not present for REVIEWERS-1",
        getJspTestUtils().findElement(By.linkText("QBLH-1")));
    assertFalse(
        "Query Based legal hold QBLH-2 is present for REVIEWERS-1",
        getJspTestUtils().isElement(By.linkText("QBLH-2")));
    getJspTestUtils().logout();

    // Login as reviewer-2  and verify QBLH-2 is visible to reviewer-2 and QBLH-1 is not visible
    LOGGER.info("Logging in as reviewer-2");
    getJspTestUtils().login(getJspTestUtils().m_cappLoginUrl, userAddress, password);
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-2 is not present for REVIEWERS-2",
        getJspTestUtils().findElement(By.linkText("QBLH-2")));
    assertFalse(
        "Query Based legal hold QBLH-1 is present for REVIEWERS-2",
        getJspTestUtils().isElement(By.linkText("QBLH-1")));
    getJspTestUtils().logout();
  }