public boolean hasValue(Issue issue) { return issue.getAssignee() != null; }
@Override protected ChangeHistoryItem createInitialChangeItem(Issue issue) { final ApplicationUser assignee = issue.getAssignee(); final String assigneeName = (assignee == null) ? "" : assignee.getName(); final String assigneeValue = issue.getAssigneeId() == null ? EMPTY_VALUE : issue.getAssigneeId(); return changeItemBuilder(issue).to(assigneeName, assigneeValue).build(); } }
public ApplicationUser getAssignee() { return issue.getAssignee(); }
public boolean passesCondition(Map transientVars, Map args, PropertySet ps) throws WorkflowException { ApplicationUser caller = getCallerUser(transientVars, args); ApplicationUser assignee = null; try { assignee = getIssue(transientVars).getAssignee(); } catch (DataAccessException e) { log.warn("Could not retrieve assignee with id '" + getIssue(transientVars).getAssigneeId() + "' of issue '" + getIssue(transientVars).getKey() + "'"); } if (caller != null && assignee != null && caller.equals(assignee)) return true; else return false; }
public ApplicationUser getAssignee() { return issue.getAssignee(); }
this.assignee = issue.getAssignee() != null ? issue.getAssignee().getName() : null;
@Override public Set<ApplicationUser> getUsers(final PermissionContext ctx, final String ignored) { final Issue issue = ctx.getIssue(); if (issue != null && issue.getAssignee() != null && getPermissionManager().hasPermission(ASSIGNABLE_USER, issue.getAssignee())) { return newHashSet(issue.getAssignee()); } return newHashSet(); }
public Set<ApplicationUser> getUsers(PermissionContext ctx, String ignored) { if (ctx.getIssue() != null && ctx.getIssue().getAssignee() != null) { return Collections.singleton(ctx.getIssue().getAssignee()); } return Collections.emptySet(); } }
public void populateFromIssue(Map<String, Object> fieldValuesHolder, Issue issue) { ApplicationUser assignee = issue.getAssignee(); String assigneeName = (assignee != null) ? assignee.getName() : null; fieldValuesHolder.put(getId(), assigneeName); }
@Override public String toString() { final Issue issue = event.getIssue(); final String issueString = new ToStringBuilder(issue).append("id", issue.getId()).append("summary", issue.getSummary()).append("key", issue.getKey()).append("created", issue.getCreated()).append("updated", issue.getUpdated()).append("assignee", issue.getAssignee()).append( "reporter", issue.getReporter()).toString(); return new ToStringBuilder(this).append("issue", issueString).append("remoteUser", event.getUser()).append("notificationType", notificationType).append("eventTypeId", event.getEventTypeId().longValue()).append("templateId", templateId.longValue()).toString(); }
@Override public List<ApplicationUser> getSuggestedAssignees(Issue issue, @Nullable ApplicationUser loggedInUser, @Nullable ActionDescriptor actionDescriptor) { List<ApplicationUser> suggestedAssignees = new ArrayList<>(); Set<String> suggestedAssigneeKeys = getSuggestedAssigneeKeys(issue, loggedInUser); for (String suggestedAssigneeKey : suggestedAssigneeKeys) { //Look up user for this key ApplicationUser appUser = userManager.getUserByKey(suggestedAssigneeKey); if (appUser != null && isAssignable(issue, appUser, actionDescriptor)) { suggestedAssignees.add(appUser); } } //Current assignee can always stay assigned , even if they are now inactive or no longer in the right group if (issue != null && issue.getAssignee() != null) { ApplicationUser currentAssignee = issue.getAssignee(); if (!suggestedAssignees.contains(currentAssignee)) { suggestedAssignees.add(issue.getAssignee()); } } Collections.sort(suggestedAssignees, new UserCachingComparator(authenticationContext.getLocale())); return suggestedAssignees; }
public String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters) { Map velocityParams = getVelocityParams(fieldLayoutItem, action, issue, displayParameters); ApplicationUser assignee = issue.getAssignee(); if (assignee != null) { velocityParams.put("assignee", assignee.getName()); } else { velocityParams.put("assignee", null); } return getViewHtml(velocityParams); }
Set<ApplicationUser> findAllAsSet() { UserSet userSet = new UserSet(permissionSchemeManager.getUsers(ASSIGNABLE_USER, ctx)); // Current assignee can always stay assigned , even if they are now inactive or no longer in the right group if (issue != null && issue.getAssignee() != null) { userSet.add(issue.getAssignee()); } Set<ApplicationUser> assignableUsers = userSet.toSet(); // Optionally filter by the username query if (matchingUsername != null) { assignableUsers = findAssignableUsers(matchingUsername, assignableUsers); } return assignableUsers; }
@Override public void issueAssigned(final IssueEvent event) { ApplicationUser user = event.getUser(); ApplicationUser assignee = event.getIssue().getAssignee(); if (assignee != null && user != null) { UserHistoryManager userHistoryManager = ComponentAccessor.getComponent(UserHistoryManager.class); userHistoryManager.addUserToHistory(UserHistoryItem.ASSIGNEE, user, assignee); userHistoryManager.addUserToHistory(UserHistoryItem.USED_USER, user, assignee); } }
@Override public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequired, FieldLayoutItem fieldLayoutItem) { return new FieldJsonRepresentation(new JsonData(userBeanFactory.createBean(issue.getAssignee(), authenticationContext.getUser()))); }
AssigneeOptions optionsForFrotherControl(Issue issue, ActionDescriptor actionDescriptor, String currentAssigneeUsername) { ApplicationUser loggedInUser = authenticationContext.getUser(); List<ApplicationUser> suggestedAssignees = assigneeService.getSuggestedAssignees(issue, loggedInUser, actionDescriptor); ApplicationUser assignee = issue.getAssignee(); if(assignee == null && currentAssigneeUsername != null) { assignee = userManager.getUserObject(currentAssigneeUsername); if(assignee != null && isAssignable(assignee, singletonList(issue), actionDescriptor)) { suggestedAssignees.add(assignee); Collections.sort(suggestedAssignees, new UserCachingComparator(authenticationContext.getLocale())); } } AssigneeOptions assigneeOptions = makeAssigneeOptions(singletonList(issue), actionDescriptor, suggestedAssignees, assignee, isNew(issue)); if (assignee != null && !assignee.getName().equals(currentAssigneeUsername)) { assigneeOptions.setInvalidAssigneeSelected(true); } return assigneeOptions; }
private Iterable<NotificationRecipient> getRecipientsFromNotification(ApplicationUser remoteUser, Issue issue, NotificationBuilder notification) { final ImmutableList.Builder<NotificationRecipient> recipients = ImmutableList.<NotificationRecipient>builder() .addAll(getEmailRecipients(notification)) .addAll(getUserRecipients(notification)) .addAll(getGroupRecipients(notification)); if (notification.isToReporter()) { recipients.add(new NotificationRecipient(issue.getReporter())); } if (notification.isToAssignee()) { recipients.add(new NotificationRecipient(issue.getAssignee())); } if (notification.isToWatchers()) { recipients.addAll(getWatchersRecipients(remoteUser, issue)); } if (notification.isToVoters()) { recipients.addAll(getVotersRecipients(remoteUser, issue)); } return restrict(removeRemoteUserIfNecessary(recipients.build(), remoteUser), issue, (NotificationBuilderImpl) notification); }