congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
IssueFieldsSetter.assign
Code IndexAdd Tabnine 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)

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

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JComboBox (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now