use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class CloseIssuesOnRemovedComponentsVisitor method closeIssuesForDeletedComponentUuids.
private void closeIssuesForDeletedComponentUuids(Set<String> deletedComponentUuids) {
DiskCache<DefaultIssue>.DiskAppender<DefaultIssue> cacheAppender = issueCache.newAppender();
try {
for (String deletedComponentUuid : deletedComponentUuids) {
List<DefaultIssue> issues = baseIssuesLoader.loadForComponentUuid(deletedComponentUuid);
for (DefaultIssue issue : issues) {
issue.setBeingClosed(true);
// TODO should be renamed
issue.setOnDisabledRule(false);
issueLifecycle.doAutomaticTransition(issue);
cacheAppender.append(issue);
}
}
} finally {
cacheAppender.close();
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IntegrateIssuesVisitor method fillExistingOpenIssues.
private void fillExistingOpenIssues(Component component, Tracking<DefaultIssue, DefaultIssue> tracking, DiskCache<DefaultIssue>.DiskAppender<DefaultIssue> cacheAppender) {
for (Map.Entry<DefaultIssue, DefaultIssue> entry : tracking.getMatchedRaws().entrySet()) {
DefaultIssue raw = entry.getKey();
DefaultIssue base = entry.getValue();
issueLifecycle.mergeExistingOpenIssue(raw, base);
process(component, raw, cacheAppender);
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IntegrateIssuesVisitor method closeUnmatchedBaseIssues.
private void closeUnmatchedBaseIssues(Component component, Tracking<DefaultIssue, DefaultIssue> tracking, DiskCache<DefaultIssue>.DiskAppender<DefaultIssue> cacheAppender) {
for (DefaultIssue issue : tracking.getUnmatchedBases()) {
// TODO should replace flag "beingClosed" by express call to transition "automaticClose"
issue.setBeingClosed(true);
// TODO manual issues -> was updater.setResolution(newIssue, Issue.RESOLUTION_REMOVED, changeContext);. Is it a problem ?
process(component, issue, cacheAppender);
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueStorage method insert.
/**
* @return the keys of the inserted issues
*/
private Collection<String> insert(DbSession session, Iterable<DefaultIssue> issuesToInsert, long now) {
List<String> inserted = newArrayList();
int count = 0;
IssueChangeMapper issueChangeMapper = session.getMapper(IssueChangeMapper.class);
for (DefaultIssue issue : issuesToInsert) {
String key = doInsert(session, now, issue);
inserted.add(key);
insertChanges(issueChangeMapper, issue);
if (count > BatchSession.MAX_BATCH_SIZE) {
session.commit();
}
count++;
}
session.commit();
return inserted;
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class TransitionAction method execute.
@Override
public boolean execute(Map<String, Object> properties, Context context) {
DefaultIssue issue = context.issue();
String transition = transition(properties);
return canExecuteTransition(issue, transition) && transitionService.doTransition(context.issue(), context.issueChangeContext(), transition(properties));
}
Aggregations