Exemplo n.º 1
0
 private Collection getRoleLevels(Issue issue) {
   Collection roles;
   if (commentService.isProjectRoleVisibilityEnabled()) {
     ApplicationUser user = authenticationContext.getUser();
     roles = projectRoleManager.getProjectRoles(user, issue.getProjectObject());
   } else {
     roles = Collections.EMPTY_LIST;
   }
   return roles;
 }
Exemplo n.º 2
0
 private Collection getRoleLevels(GenericValue project) {
   if (project == null) {
     throw new NullPointerException("project GenericValue was null");
   }
   Collection roles;
   if (commentService.isProjectRoleVisibilityEnabled()) {
     ApplicationUser user = authenticationContext.getUser();
     roles = projectRoleManager.getProjectRoles(user, projectFactory.getProject(project));
   } else {
     roles = Collections.EMPTY_LIST;
   }
   return roles;
 }
Exemplo n.º 3
0
  @Override
  public String getViewHtml(
      FieldLayoutItem fieldLayoutItem,
      Action action,
      Issue issue,
      Object value,
      Map displayParameters) {
    Map<String, Object> velocityParams =
        getVelocityParams(fieldLayoutItem, action, issue, displayParameters);

    // get the rendered value without specifying an issue for context
    IssueRenderContext context;
    if (issue != null) {
      context = issue.getIssueRenderContext();
    } else {
      context = new IssueRenderContext(null);
    }
    String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null;

    Map<String, Object> valueMap = (Map<String, Object>) value;

    velocityParams.put(
        "value",
        rendererManager.getRenderedContent(rendererType, (String) valueMap.get(getId()), context));
    if (valueMap.containsKey(PARAM_GROUP_LEVEL)) {
      velocityParams.put(PARAM_GROUP_LEVEL, valueMap.get(PARAM_GROUP_LEVEL));
    }
    if (valueMap.containsKey(PARAM_ROLE_LEVEL)) {
      String roleId = (String) valueMap.get(PARAM_ROLE_LEVEL);
      // We need the display name of the role
      if (roleId != null) {
        ProjectRole projectRole = projectRoleManager.getProjectRole(new Long(roleId));
        if (projectRole != null) {
          velocityParams.put("selectedRoleName", projectRole.getName());
        }
      }
      velocityParams.put(PARAM_ROLE_LEVEL, roleId);
    }
    if (valueMap.containsKey(PARAM_COMMENT_PROPERTY)) {
      velocityParams.put(PARAM_COMMENT_PROPERTY, valueMap.get(PARAM_COMMENT_PROPERTY));
    }
    return commentFieldRenderer.getFieldViewHtml(
        velocityParams, CommentHelper.builder().issue(issue).build());
  }
Exemplo n.º 4
0
 @Override
 public ProjectRole getProjectRole(Long projectRoleId) {
   return projectRoleManager.getProjectRole(projectRoleId);
 }