private Collection<? extends DefaultIssue> migrateIssuesToTheRoot(List<DefaultIssue> issuesOnModule, String modulePath) { for (DefaultIssue i : issuesOnModule) { // changes the issue's component uuid, add a change and set issue as changed to enforce it is persisted to DB IssueChangeContext context = IssueChangeContext.createUser(new Date(analysisMetadataHolder.getAnalysisDate()), null); if (StringUtils.isNotBlank(modulePath)) { issueUpdater.setMessage(i, "[" + modulePath + "] " + i.getMessage(), context); } issueUpdater.setIssueMoved(i, component.getUuid(), context); // other fields (such as module, modulePath, componentKey) are read-only and set/reset for consistency only i.setComponentKey(component.getKey()); i.setModuleUuid(null); i.setModuleUuidPath(null); } return issuesOnModule; } }
updater.setPastMessage(raw, base.getMessage(), changeContext); updater.setPastGap(raw, base.gap(), changeContext); updater.setPastEffort(raw, base.effort(), changeContext);
public void mergeExistingOpenIssue(DefaultIssue raw, DefaultIssue base) { raw.setKey(base.key()); raw.setNew(false); copyFields(raw, base); if (base.manualSeverity()) { raw.setManualSeverity(true); raw.setSeverity(base.severity()); } else { updater.setPastSeverity(raw, base.severity(), changeContext); } // set component/module related fields from base in case current component has been moved // (in which case base issue belongs to original file and raw issue to component) raw.setComponentUuid(base.componentUuid()); raw.setComponentKey(base.componentKey()); raw.setModuleUuid(base.moduleUuid()); raw.setModuleUuidPath(base.moduleUuidPath()); // fields coming from raw updater.setPastLine(raw, base.getLine()); updater.setPastLocations(raw, base.getLocations()); updater.setPastMessage(raw, base.getMessage(), changeContext); updater.setPastGap(raw, base.gap(), changeContext); updater.setPastEffort(raw, base.effort(), changeContext); }