Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-89396 || EPMRPP-89397 || EPMRPP-89395 || Change batch endpoint #1928

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.epam.ta.reportportal.model.DeleteBulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRS;
import com.epam.ta.reportportal.ws.reporting.OperationCompletionRS;
import java.util.List;

/**
* Delete Launch request handler
Expand All @@ -42,13 +43,13 @@ OperationCompletionRS deleteLaunch(Long launchId, ReportPortalUser.ProjectDetail
ReportPortalUser user);

/**
* Bul launches delete.
* Bulk launches delete.
*
* @param deleteBulkRQ {@link DeleteBulkRQ}
* @param ids list of launch ids
* @param projectDetails Project Details
* @param user User
* @return DeleteLaunchesRS
*/
DeleteBulkRS deleteLaunches(DeleteBulkRQ deleteBulkRQ,
DeleteBulkRS deleteLaunches(List<Long> ids,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface implementation class should be updated accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeleteBulkRS - response of api don't change

ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import com.epam.reportportal.events.ElementsDeletedEvent;
import com.epam.ta.reportportal.commons.ReportPortalUser;
import com.epam.ta.reportportal.commons.ReportPortalUser.ProjectDetails;
import com.epam.ta.reportportal.core.ElementsCounterService;
import com.epam.ta.reportportal.core.analyzer.auto.LogIndexer;
import com.epam.ta.reportportal.core.events.MessageBus;
Expand Down Expand Up @@ -123,14 +124,14 @@ public OperationCompletionRS deleteLaunch(Long launchId,
return new OperationCompletionRS("Launch with ID = '" + launchId + "' successfully deleted.");
}

public DeleteBulkRS deleteLaunches(DeleteBulkRQ deleteBulkRQ,
public DeleteBulkRS deleteLaunches(List<Long> ids,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user) {
List<Long> notFound = Lists.newArrayList();
List<ReportPortalException> exceptions = Lists.newArrayList();
Map<Launch, Long> toDelete = Maps.newHashMap();
List<Long> launchIds = Lists.newArrayList();

deleteBulkRQ.getIds().forEach(id -> {
ids.forEach(id -> {
Optional<Launch> optionalLaunch = launchRepository.findById(id);
if (optionalLaunch.isPresent()) {
Launch launch = optionalLaunch.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public OperationCompletionRS deleteUser(@PathVariable(value = "id") Long userId,
@Operation(summary = "Delete specified users by ids (DEPRECATED)")
public DeleteBulkRS deleteUsers(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
@AuthenticationPrincipal ReportPortalUser user) {
return super.deleteUsers(deleteBulkRQ, user);
return super.deleteUsers(deleteBulkRQ.getIds(), user);
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.epam.ta.reportportal.entity.widget.content.ChartStatisticsContent;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.model.BulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRS;
import com.epam.ta.reportportal.model.launch.AnalyzeLaunchRQ;
import com.epam.ta.reportportal.model.launch.FinishLaunchRS;
Expand Down Expand Up @@ -451,9 +450,9 @@ public void getLaunchReport(@PathVariable String projectName, @PathVariable Long
@ResponseStatus(OK)
@Operation(summary = "Delete specified launches by ids")
public DeleteBulkRS deleteLaunches(@PathVariable String projectName,
@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteLaunchMessageHandler.deleteLaunches(deleteBulkRQ,
return deleteLaunchMessageHandler.deleteLaunches(ids,
projectExtractor.extractProjectDetails(user, normalizeId(projectName)), user
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.epam.ta.reportportal.entity.project.ProjectInfo;
import com.epam.ta.reportportal.entity.user.User;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.model.DeleteBulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRS;
import com.epam.ta.reportportal.model.EntryCreatedRS;
import com.epam.ta.reportportal.model.preference.PreferenceResource;
Expand Down Expand Up @@ -74,7 +73,6 @@
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.jooq.Operator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down Expand Up @@ -172,9 +170,9 @@ public OperationCompletionRS updateProjectNotificationConfig(@PathVariable Strin
@ResponseStatus(OK)
@PreAuthorize(ADMIN_ONLY)
@Operation(summary = "Delete multiple projects", description = "Could be deleted only by users with administrator role")
public DeleteBulkRS deleteProject(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
public DeleteBulkRS deleteProject(@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteProjectHandler.bulkDeleteProjects(deleteBulkRQ.getIds(), user);
return deleteProjectHandler.bulkDeleteProjects(ids, user);
}

@DeleteMapping("/{projectId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.epam.ta.reportportal.model.ApiKeyRQ;
import com.epam.ta.reportportal.model.ApiKeyRS;
import com.epam.ta.reportportal.model.ApiKeysRS;
import com.epam.ta.reportportal.model.DeleteBulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRS;
import com.epam.ta.reportportal.model.ModelViews;
import com.epam.ta.reportportal.model.YesNoRS;
Expand All @@ -67,10 +66,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.jooq.Operator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down Expand Up @@ -167,9 +166,9 @@ public OperationCompletionRS deleteUser(@PathVariable(value = "id") Long userId,
@PreAuthorize(ADMIN_ONLY)
@ResponseStatus(OK)
@Operation(summary = "Delete specified users by ids")
public DeleteBulkRS deleteUsers(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
public DeleteBulkRS deleteUsers(@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteUserHandler.deleteUsers(deleteBulkRQ.getIds(), user);
return deleteUserHandler.deleteUsers(ids, user);
}

@Transactional
Expand Down
Loading