Codota Logo
IssueFieldsSetter.assign
Code IndexAdd Codota to your IDE (free)

How to use
assign
method
in
org.sonar.server.issue.IssueFieldsSetter

Best Java code snippets using org.sonar.server.issue.IssueFieldsSetter.assign (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

@Override
public Function.Context setAssignee(@Nullable UserDto user) {
 updater.assign(issue, user, changeContext);
 return this;
}
origin: SonarSource/sonarqube

@Override
public boolean execute(Map<String, Object> properties, Context context) {
 checkArgument(properties.containsKey(VERIFIED_ASSIGNEE), "Assignee is missing from the execution parameters");
 UserDto assignee = (UserDto) properties.get(VERIFIED_ASSIGNEE);
 return isAssigneeMemberOfIssueOrganization(assignee, properties, context) && issueFieldsSetter.assign(context.issue(), assignee, context.issueChangeContext());
}
origin: SonarSource/sonarqube

private SearchResponseData assign(String issueKey, @Nullable String login) {
 try (DbSession dbSession = dbClient.openSession(false)) {
  IssueDto issueDto = issueFinder.getByKey(dbSession, issueKey);
  DefaultIssue issue = issueDto.toDefaultIssue();
  checkArgument(issue.type() != RuleType.SECURITY_HOTSPOT,"It is not allowed to assign a security hotspot");
  UserDto user = getUser(dbSession, login);
  if (user != null) {
   checkMembership(dbSession, issueDto, user);
  }
  IssueChangeContext context = IssueChangeContext.createUser(new Date(system2.now()), userSession.getUuid());
  if (issueFieldsSetter.assign(issue, user, context)) {
   return issueUpdater.saveIssueAndPreloadSearchResponseData(dbSession, issue, context, null, false);
  }
  return new SearchResponseData(issueDto);
 }
}
origin: SonarSource/sonarqube

@Test
public void unassign() {
 issue.setAssigneeUuid("user_uuid");
 boolean updated = underTest.assign(issue, null, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isNull();
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isNull();
}
origin: SonarSource/sonarqube

@Test
public void assign() {
 UserDto user = newUserDto().setLogin("emmerik").setName("Emmerik");
 boolean updated = underTest.assign(issue, user, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isEqualTo(user.getUuid());
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isEqualTo(user.getName());
}
origin: SonarSource/sonarqube

@Test
public void change_assignee() {
 UserDto user = newUserDto().setLogin("emmerik").setName("Emmerik");
 issue.setAssigneeUuid("user_uuid");
 boolean updated = underTest.assign(issue, user, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isEqualTo(user.getUuid());
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isEqualTo(user.getName());
}
origin: SonarSource/sonarqube

@Test
public void not_change_assignee() {
 UserDto user = newUserDto().setLogin("morgan").setName("Morgan");
 issue.setAssigneeUuid(user.getUuid());
 boolean updated = underTest.assign(issue, user, context);
 assertThat(updated).isFalse();
 assertThat(issue.currentChange()).isNull();
 assertThat(issue.mustSendNotifications()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void verify_notification_when_assignee_has_changed() {
 UserDto oldAssignee = db.users().insertUser();
 RuleDto rule = db.rules().insertRule();
 ComponentDto project = db.components().insertPrivateProject();
 ComponentDto file = db.components().insertComponent(newFileDto(project));
 RuleType randomTypeExceptHotspot = RuleType.values()[nextInt(RuleType.values().length - 1)];
 DefaultIssue issue = db.issues().insertIssue(IssueTesting.newIssue(rule.getDefinition(), project, file)
 .setType(randomTypeExceptHotspot))
  .setAssigneeUuid(oldAssignee.getUuid())
  .toDefaultIssue();
 UserDto changeAuthor = db.users().insertUser();
 IssueChangeContext context = IssueChangeContext.createUser(new Date(), changeAuthor.getUuid());
 UserDto newAssignee = db.users().insertUser();
 issueFieldsSetter.assign(issue, newAssignee, context);
 underTest.saveIssue(db.getSession(), issue, context, null);
 verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
 IssueChangeNotification issueChangeNotification = notificationArgumentCaptor.getValue();
 assertThat(issueChangeNotification.getFieldValue("key")).isEqualTo(issue.key());
 assertThat(issueChangeNotification.getFieldValue("new.assignee")).isEqualTo(newAssignee.getName());
 assertThat(issueChangeNotification.getFieldValue("old.assignee")).isNull();
 assertThat(issueChangeNotification.getFieldValue("assignee")).isEqualTo(newAssignee.getLogin());
}
origin: org.sonarsource.sonarqube/sonar-server

@Override
public Function.Context setAssignee(@Nullable UserDto user) {
 updater.assign(issue, user, changeContext);
 return this;
}
origin: org.sonarsource.sonarqube/sonar-server

@Override
public boolean execute(Map<String, Object> properties, Context context) {
 checkArgument(properties.containsKey(VERIFIED_ASSIGNEE), "Assignee is missing from the execution parameters");
 UserDto assignee = (UserDto) properties.get(VERIFIED_ASSIGNEE);
 return isAssigneeMemberOfIssueOrganization(assignee, properties, context) && issueFieldsSetter.assign(context.issue(), assignee, context.issueChangeContext());
}
origin: org.sonarsource.sonarqube/sonar-server

private SearchResponseData assign(String issueKey, @Nullable String login) {
 try (DbSession dbSession = dbClient.openSession(false)) {
  IssueDto issueDto = issueFinder.getByKey(dbSession, issueKey);
  DefaultIssue issue = issueDto.toDefaultIssue();
  UserDto user = getUser(dbSession, login);
  if (user != null) {
   checkMembership(dbSession, issueDto, user);
  }
  IssueChangeContext context = IssueChangeContext.createUser(new Date(system2.now()), userSession.getUuid());
  if (issueFieldsSetter.assign(issue, user, context)) {
   return issueUpdater.saveIssueAndPreloadSearchResponseData(dbSession, issue, context, null, false);
  }
  return new SearchResponseData(issueDto);
 }
}
org.sonar.server.issueIssueFieldsSetterassign

Popular methods of IssueFieldsSetter

  • setResolution
  • setStatus
  • setType
  • setMessage
  • setPastEffort
  • setPastLine
  • setPastMessage
  • setPastSeverity
  • setSeverity
  • addComment
  • setCreationDate
  • setGap
  • setCreationDate,
  • setGap,
  • setIssueMoved,
  • setLocations,
  • setManualSeverity,
  • setNewAssignee,
  • setNewAuthor,
  • setPastGap,
  • setPastLocations

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • notifyDataSetChanged (ArrayAdapter)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • Notification (javax.management)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now