import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
import static org.sonar.core.util.stream.MoreCollectors.toList;
import static org.sonar.db.Pagination.forPage;
-import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
-import static org.sonar.server.ws.WsUtils.checkRequest;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_ONLY_CURRENTS;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE;
+import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
+import static org.sonar.server.ws.WsUtils.checkRequest;
+import static org.sonar.server.ws.WsUtils.writeProtobuf;
public class ActivityAction implements CeWsAction {
private static final int MAX_PAGE_SIZE = 1000;
new Change("5.5", "it's no more possible to specify the page parameter."),
new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
new Change("6.6", "fields \"branch\" and \"branchType\" added"),
- new Change("7.1", "fields \"pullRequest\" and \"pullRequestTitle\" added"))
+ new Change("7.1", "field \"pullRequest\" added"))
.setSince("5.2");
action.createParam(PARAM_COMPONENT_ID)
if (component != null) {
query.setComponentUuid(component.uuid());
} else if (componentQuery != null) {
- query.setComponentUuids(loadComponents(dbSession, componentQuery).stream().map(ComponentDto::uuid).collect(toList()));
+ query.setComponentUuids(loadComponents(dbSession, componentQuery).stream()
+ .map(ComponentDto::uuid)
+ .collect(toList()));
}
return query;
}
private Ce.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) {
Ce.Task.Builder builder = Ce.Task.newBuilder();
String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
- // FIXME organization field should be set from the CeQueueDto rather than from the ComponentDto
setNullable(organizationKey, builder::setOrganization);
if (dto.getComponentUuid() != null) {
builder.setComponentId(dto.getComponentUuid());
private static Ce.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) {
Ce.Task.Builder builder = Ce.Task.newBuilder();
String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
- // FIXME organization field should be set from the CeActivityDto rather than from the ComponentDto
setNullable(organizationKey, builder::setOrganization);
builder.setId(dto.getUuid());
builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name()));
}
static DtoCache forQueueDtos(DbClient dbClient, DbSession dbSession, Collection<CeQueueDto> ceQueueDtos) {
- Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(dbSession, uuidOfCeQueueDtos(ceQueueDtos))
+ Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(dbSession, componentUuidsOfCeQueues(ceQueueDtos))
.stream()
.collect(MoreCollectors.uniqueIndex(ComponentDto::uuid));
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
}
- private static Set<String> uuidOfCeQueueDtos(Collection<CeQueueDto> ceQueueDtos) {
+ private static Set<String> componentUuidsOfCeQueues(Collection<CeQueueDto> ceQueueDtos) {
return ceQueueDtos.stream()
.filter(Objects::nonNull)
.map(CeQueueDto::getComponentUuid)
static DtoCache forActivityDtos(DbClient dbClient, DbSession dbSession, Collection<CeActivityDto> ceActivityDtos) {
Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(
dbSession,
- uuidOfCeActivityDtos(ceActivityDtos))
+ getComponentUuidsOfCeActivities(ceActivityDtos))
.stream()
.collect(MoreCollectors.uniqueIndex(ComponentDto::uuid));
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
}
- private static Set<String> uuidOfCeActivityDtos(Collection<CeActivityDto> ceActivityDtos) {
+ private static Set<String> getComponentUuidsOfCeActivities(Collection<CeActivityDto> ceActivityDtos) {
return ceActivityDtos.stream()
.filter(Objects::nonNull)
.map(CeActivityDto::getComponentUuid)