public void deleteBranch(DbSession session, String uuid) { PurgeProfiler profiler = new PurgeProfiler(); PurgeMapper purgeMapper = mapper(session); PurgeCommands purgeCommands = new PurgeCommands(session, profiler); deleteRootComponent(uuid, purgeMapper, purgeCommands); }
private static void purgeAnalyses(PurgeCommands commands, String rootUuid) { List<IdUuidPair> analysisUuids = commands.selectSnapshotIdUuids( new PurgeSnapshotQuery() .setComponentUuid(rootUuid) .setIslast(false) .setNotPurged(true)); commands.purgeAnalyses(analysisUuids); }
private static IdUuidPair toIdUuidPair(PurgeableAnalysisDto snapshot) { return new IdUuidPair(snapshot.getAnalysisId(), snapshot.getAnalysisUuid()); }
public void purge(DbSession session, PurgeConfiguration conf, PurgeListener listener, PurgeProfiler profiler) { PurgeMapper mapper = session.getMapper(PurgeMapper.class); PurgeCommands commands = new PurgeCommands(session, mapper, profiler); String rootUuid = conf.rootProjectIdUuid().getUuid(); deleteAbortedAnalyses(rootUuid, commands); deleteDataOfComponentsWithoutHistoricalData(session, rootUuid, conf.getScopesWithoutHistoricalData(), commands); purgeAnalyses(commands, rootUuid); purgeDisabledComponents(session, conf, listener); deleteOldClosedIssues(conf, mapper, listener); purgeStaleBranches(commands, conf, mapper, rootUuid); }
public ProjectCleaner purge(DbSession session, IdUuidPair rootId, Configuration projectConfig, Collection<String> disabledComponentUuids) { long start = System.currentTimeMillis(); profiler.reset(); PurgeConfiguration configuration = newDefaultPurgeConfiguration(projectConfig, rootId, disabledComponentUuids); periodCleaner.clean(session, configuration.rootProjectIdUuid().getUuid(), projectConfig); purgeDao.purge(session, configuration, purgeListener, profiler); session.commit(); logProfiling(start, projectConfig); return this; }
private void purgeDisabledComponents(DbSession session, PurgeConfiguration conf, PurgeListener listener) { PurgeMapper mapper = mapper(session); executeLargeInputs(conf.getDisabledComponentUuids(), input -> { mapper.deleteFileSourcesByFileUuid(input); mapper.resolveComponentIssuesNotAlreadyResolved(input, system2.now()); mapper.deleteLiveMeasuresByComponentUuids(input); return emptyList(); }); listener.onComponentsDisabling(conf.rootProjectIdUuid().getUuid(), conf.getDisabledComponentUuids()); session.commit(); }
private static void deleteAbortedAnalyses(String rootUuid, PurgeCommands commands) { LOG.debug("<- Delete aborted builds"); PurgeSnapshotQuery query = new PurgeSnapshotQuery() .setIslast(false) .setStatus(UNPROCESSED_STATUS) .setComponentUuid(rootUuid); commands.deleteAnalyses(query); }
void deletePermissions(long rootId) { profiler.start("deletePermissions (group_roles)"); purgeMapper.deleteGroupRolesByComponentId(rootId); session.commit(); profiler.stop(); profiler.start("deletePermissions (user_roles)"); purgeMapper.deleteUserRolesByComponentId(rootId); session.commit(); profiler.stop(); }
void deleteIssues(String rootUuid) { profiler.start("deleteIssues (issue_changes)"); purgeMapper.deleteIssueChangesByProjectUuid(rootUuid); session.commit(); profiler.stop(); profiler.start("deleteIssues (issues)"); purgeMapper.deleteIssuesByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteFileSources(String rootUuid) { profiler.start("deleteFileSources (file_sources)"); purgeMapper.deleteFileSourcesByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteWebhookDeliveries(String rootUuid) { profiler.start("deleteWebhookDeliveries (webhook_deliveries)"); purgeMapper.deleteWebhookDeliveriesByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteProjectAlmBindings(String rootUuid) { profiler.start("deleteProjectAlmBindings (project_alm_bindings)"); purgeMapper.deleteProjectAlmBindingsByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteLinks(String rootUuid) { profiler.start("deleteLinks (project_links)"); purgeMapper.deleteProjectLinksByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteComponents(String rootUuid) { profiler.start("deleteComponents (projects)"); purgeMapper.deleteComponentsByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteProjectMappings(String rootUuid) { profiler.start("deleteProjectMappings (project_mappings)"); purgeMapper.deleteProjectMappingsByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteBranch(String rootUuid) { profiler.start("deleteBranch (project_branches)"); purgeMapper.deleteBranchByUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteWebhooks(String rootUuid) { profiler.start("deleteWebhooks (webhooks)"); purgeMapper.deleteWebhooksByProjectUuid(rootUuid); session.commit(); profiler.stop(); }
void deleteLiveMeasures(String rootUuid) { profiler.start("deleteLiveMeasures (live_measures)"); purgeMapper.deleteLiveMeasuresByProjectUuid(rootUuid); session.commit(); profiler.stop(); } }
private List<PurgeableAnalysisDto> selectAnalysesOfComponent(String componentUuid, DbSession session) { return purgeDao.selectPurgeableAnalyses(componentUuid, session); } }
void start(String table) { this.startTime = clock.now(); this.currentTable = table; }