From 55543c85c9e7cf0f03ef4e06b1d1078cf3a5d457 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sat, 12 Oct 2024 11:19:34 +0200 Subject: [PATCH 01/44] add dependency --- server/application-server/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/application-server/pom.xml b/server/application-server/pom.xml index 13d54409..9f53a554 100644 --- a/server/application-server/pom.xml +++ b/server/application-server/pom.xml @@ -127,6 +127,11 @@ hypersistence-utils-hibernate-63 3.8.2 + + io.nats + jnats + 2.20.2 + From e3ef05e174c2f5d15fe459e317e448de6d3ee7d4 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sat, 12 Oct 2024 17:02:53 +0200 Subject: [PATCH 02/44] add WIP --- .../hephaestus/nats/NatsConsumerService.java | 167 ++++++++++++++++++ .../src/main/resources/application-prod.yml | 4 + .../src/main/resources/application.yml | 4 + 3 files changed, 175 insertions(+) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java new file mode 100644 index 00000000..fa366c2e --- /dev/null +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java @@ -0,0 +1,167 @@ +package de.tum.in.www1.hephaestus.nats; + +import io.nats.client.*; +import io.nats.client.api.ConsumerConfiguration; +import io.nats.client.api.DeliverPolicy; + +import java.io.IOException; +import java.util.Arrays; +import java.time.ZonedDateTime; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; + +import org.springframework.stereotype.Service; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.event.EventListener; +import org.kohsuke.github.GHEventPayload; +import org.kohsuke.github.GitHub; +import org.kohsuke.github.GitHubBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; + +@Service +public class NatsConsumerService { + + private static final Logger logger = LoggerFactory.getLogger(NatsConsumerService.class); + + @Value("${nats.server}") + private String natsServer; + + @Value("${monitoring.repositories}") + private String[] repositoriesToMonitor; + + private Connection natsConnection; + + @EventListener(ApplicationReadyEvent.class) + public void init() throws IOException, InterruptedException, JetStreamApiException { + Options options = Options.builder().server(natsServer).build(); + natsConnection = Nats.connect(options); + + // String consumerName = "github-consumer"; + ConsumerConfiguration consumerConfig = ConsumerConfiguration.builder() + // .durable(consumerName) + .filterSubjects(getSubjects()) + .deliverPolicy(DeliverPolicy.ByStartTime) + .startTime(ZonedDateTime.now().minusDays(1)) + .build(); + + // JetStreamManagement jsm = natsConnection.jetStreamManagement(); + // logger.info("Consumer names:" + jsm.getConsumerNames("github")); + // logger.info("Consumers:" + jsm.getConsumers("github")); + // jsm.deleteConsumer("github", "github-consumer"); + + // try { + StreamContext streamContext = natsConnection.getStreamContext("github"); + ConsumerContext consumerContext = streamContext.createOrUpdateConsumer(consumerConfig); + // consumerContext = streamContext.getConsumerContext(natsServer) + // } catch (JetStreamApiException | IOException e) { + // // JetStreamApiException: + // // the stream or consumer did not exist + // // IOException: + // // likely a connection problem + // return; + // } + + GitHub github = new GitHubBuilder().build(); + + MessageHandler handler = msg -> { + msg.ack(); + logger.info("Received message: " + msg.getSubject() + " metaData: " + msg.metaData()); + byte[] data = msg.getData(); + String payload = new String(data, StandardCharsets.UTF_8); + StringReader reader = new StringReader(payload); + + String subject = msg.getSubject(); + if (subject.endsWith(".pull_request")) { + try { + GHEventPayload.PullRequest pullRequestEvent = github.parseEventPayload(reader, GHEventPayload.PullRequest.class); + logger.info("Received pull request: " + pullRequestEvent.getPullRequest().getTitle()); + } catch (IOException e) { + logger.error("Failed to parse pull request payload.", e); + } + } else if (subject.endsWith(".pull_request_review_comment")) { + try { + GHEventPayload.PullRequestReviewComment pullRequestReviewCommentEvent = github.parseEventPayload(reader, GHEventPayload.PullRequestReviewComment.class); + logger.info("Received pull request review comment: " + pullRequestReviewCommentEvent.getComment().getBody()); + } catch (IOException e) { + logger.error("Failed to parse pull request review comment payload.", e); + } + } else if (subject.endsWith(".pull_request_review")) { + try { + GHEventPayload.PullRequestReview pullRequestReviewEvent = github.parseEventPayload(reader, GHEventPayload.PullRequestReview.class); + logger.info("Received pull request review: " + pullRequestReviewEvent.getReview().getBody()); + } catch (IOException e) { + logger.error("Failed to parse pull request review payload.", e); + } + } + // else if (subject.endsWith(".pull_request_review_thread")) { + // try { + // GHEventPayload.PullRequestReviewThread pullRequestReviewThreadEvent = github.parseEventPayload(reader, GHEventPayload.PullRequestReviewThread.class); + // logger.info("Received pull request review thread: " + pullRequestReviewThreadEvent.getThread().getTitle()); + // } catch (IOException e) { + // logger.error("Failed to parse pull request review thread payload.", e); + // } + // } + }; + + consumerContext.consume(handler); + + // try (MessageConsumer consumer = ) { + // } catch (JetStreamApiException | IOException e) { + // // JetStreamApiException: + // // 1. the stream or consumer did not exist + // // 2. api calls under the covers theoretically this could fail, but practically + // // it won't. + // // IOException: + // // likely a connection problem + // } catch (Exception e) { + // // this is from the FetchConsumer being AutoCloseable, but should never be + // // called + // // as work inside the close is already guarded by try/catch + // } + } + + /** + * Subjects to monitor. + * + * @return The subjects to monitor. + */ + private String[] getSubjects() { + String[] events = new String[] { + "pull_request", + "pull_request_review_comment", + "pull_request_review", + // "pull_request_review_thread" + }; + + return Arrays.stream(repositoriesToMonitor) + .map(this::getSubjectPrefix) + .flatMap(prefix -> Arrays.stream(events).map(event -> prefix + "." + event)) + .toArray(String[]::new); + } + + /** + * Get subject prefix from ownerWithName for the given repository. + * + * @param ownerWithName The owner and name of the repository. + * @return The subject prefix, i.e. "github.owner.name" sanitized. + * @throws IllegalArgumentException if the repository string is improperly + * formatted. + */ + private String getSubjectPrefix(String ownerWithName) { + if (ownerWithName == null || ownerWithName.trim().isEmpty()) { + throw new IllegalArgumentException("Repository identifier cannot be null or empty."); + } + + String sanitized = ownerWithName.replace(".", "~"); + String[] parts = sanitized.split("/"); + + if (parts.length != 2) { + throw new IllegalArgumentException( + String.format("Invalid repository format: '%s'. Expected format 'owner/repository'.", ownerWithName)); + } + + return "github." + parts[0] + "." + parts[1]; + } +} \ No newline at end of file diff --git a/server/application-server/src/main/resources/application-prod.yml b/server/application-server/src/main/resources/application-prod.yml index df356106..51fc0445 100644 --- a/server/application-server/src/main/resources/application-prod.yml +++ b/server/application-server/src/main/resources/application-prod.yml @@ -14,6 +14,10 @@ spring: jwt: issuer-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM} +nats: + enabled: ${NATS_ENABLED:false} + server: ${NATS_SERVER} + monitoring: runOnStartup: ${MONITORING_RUN_ON_STARTUP:true} # Fetching timeframe in days diff --git a/server/application-server/src/main/resources/application.yml b/server/application-server/src/main/resources/application.yml index 6cfd5185..ec6f0e24 100644 --- a/server/application-server/src/main/resources/application.yml +++ b/server/application-server/src/main/resources/application.yml @@ -31,6 +31,10 @@ spring: springdoc: default-produces-media-type: application/json +nats: + enabled: false + server: "" + monitoring: runOnStartup: true # Fetching timeframe in days From 493f006a1a194b5600a98507129d07ed3e9f6822 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sat, 12 Oct 2024 18:11:38 +0200 Subject: [PATCH 03/44] rename codereview to gitprovider --- ...assImportIntegratorIntegratorProvider.java | 8 ++--- .../de/tum/in/www1/hephaestus/WebConfig.java | 12 +++---- .../codereview/pullrequest/IssueState.java | 5 --- .../hephaestus/codereview/user/UserType.java | 5 --- .../base/BaseGitServiceEntity.java | 2 +- .../base/BaseGitServiceEntityConverter.java | 2 +- .../base/Comment.java | 4 +-- .../comment/IssueComment.java | 6 ++-- .../comment/IssueCommentConverter.java | 4 +-- .../comment/IssueCommentDTO.java | 6 ++-- .../comment/IssueCommentRepository.java | 2 +- .../review/PullRequestReviewComment.java | 6 ++-- .../PullRequestReviewCommentConverter.java | 4 +-- .../PullRequestReviewCommentRepository.java | 2 +- .../gitprovider/pullrequest/IssueState.java | 5 +++ .../pullrequest/PullRequest.java | 12 +++---- .../pullrequest/PullRequestController.java | 2 +- .../pullrequest/PullRequestConverter.java | 4 +-- .../pullrequest/PullRequestDTO.java | 8 ++--- .../pullrequest/PullRequestLabel.java | 2 +- .../pullrequest/PullRequestRepository.java | 2 +- .../pullrequest/PullRequestService.java | 2 +- .../pullrequest/review/PullRequestReview.java | 10 +++--- .../review/PullRequestReviewConverter.java | 4 +-- .../review/PullRequestReviewDTO.java | 2 +- .../review/PullRequestReviewRepository.java | 2 +- .../review/PullRequestReviewState.java | 2 +- .../repository/Repository.java | 6 ++-- .../repository/RepositoryConverter.java | 4 +-- .../repository/RepositoryDTO.java | 4 +-- .../repository/RepositoryRepository.java | 2 +- .../repository/RepositoryVisibility.java | 2 +- .../user/User.java | 12 +++---- .../user/UserController.java | 2 +- .../user/UserConverter.java | 4 +-- .../user/UserDTO.java | 6 ++-- .../user/UserRepository.java | 2 +- .../user/UserService.java | 2 +- .../hephaestus/gitprovider/user/UserType.java | 5 +++ .../leaderboard/LeaderboardEntry.java | 4 +-- .../leaderboard/LeaderboardService.java | 10 +++--- .../hephaestus/nats/NatsConsumerService.java | 21 ++++------- .../scheduler/GitHubDataSyncService.java | 36 +++++++++---------- 43 files changed, 119 insertions(+), 128 deletions(-) delete mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/IssueState.java delete mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserType.java rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/base/BaseGitServiceEntity.java (90%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/base/BaseGitServiceEntityConverter.java (97%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/base/Comment.java (86%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/IssueComment.java (74%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/IssueCommentConverter.java (85%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/IssueCommentDTO.java (67%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/IssueCommentRepository.java (73%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/review/PullRequestReviewComment.java (77%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/review/PullRequestReviewCommentConverter.java (87%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/comment/review/PullRequestReviewCommentRepository.java (73%) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/IssueState.java rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequest.java (80%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestController.java (94%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestConverter.java (95%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestDTO.java (70%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestLabel.java (83%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestRepository.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/PullRequestService.java (93%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/review/PullRequestReview.java (78%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/review/PullRequestReviewConverter.java (92%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/review/PullRequestReviewDTO.java (81%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/review/PullRequestReviewRepository.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/pullrequest/review/PullRequestReviewState.java (58%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/repository/Repository.java (84%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/repository/RepositoryConverter.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/repository/RepositoryDTO.java (71%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/repository/RepositoryRepository.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/repository/RepositoryVisibility.java (50%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/User.java (83%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/UserController.java (95%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/UserConverter.java (93%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/UserDTO.java (68%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/UserRepository.java (96%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/{codereview => gitprovider}/user/UserService.java (95%) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserType.java diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java index ec7ca8bb..45fafd4e 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java @@ -6,10 +6,10 @@ import org.hibernate.integrator.spi.Integrator; import org.hibernate.jpa.boot.spi.IntegratorProvider; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentDTO; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestDTO; -import de.tum.in.www1.hephaestus.codereview.repository.RepositoryDTO; -import de.tum.in.www1.hephaestus.codereview.user.UserDTO; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; +import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryDTO; +import de.tum.in.www1.hephaestus.gitprovider.user.UserDTO; import io.hypersistence.utils.hibernate.type.util.ClassImportIntegrator; public class ClassImportIntegratorIntegratorProvider implements IntegratorProvider { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java index 6afaac48..b042b68e 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java @@ -5,12 +5,12 @@ import org.springframework.lang.NonNull; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentConverter; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewCommentConverter; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestConverter; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReviewConverter; -import de.tum.in.www1.hephaestus.codereview.repository.RepositoryConverter; -import de.tum.in.www1.hephaestus.codereview.user.UserConverter; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewConverter; +import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryConverter; +import de.tum.in.www1.hephaestus.gitprovider.user.UserConverter; @Configuration public class WebConfig implements WebMvcConfigurer { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/IssueState.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/IssueState.java deleted file mode 100644 index 07ae6da8..00000000 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/IssueState.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; - -public enum IssueState { - CLOSED, OPEN -} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserType.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserType.java deleted file mode 100644 index 26705808..00000000 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserType.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.tum.in.www1.hephaestus.codereview.user; - -public enum UserType { - USER, BOT -} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntity.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntity.java similarity index 90% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntity.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntity.java index d66dc62f..4dc242ed 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntity.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntity.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.base; +package de.tum.in.www1.hephaestus.gitprovider.base; import java.time.OffsetDateTime; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntityConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntityConverter.java similarity index 97% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntityConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntityConverter.java index 5ba3e8b8..f5d808e1 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/BaseGitServiceEntityConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/BaseGitServiceEntityConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.base; +package de.tum.in.www1.hephaestus.gitprovider.base; import org.kohsuke.github.GHObject; import org.springframework.core.convert.converter.Converter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/Comment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java similarity index 86% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/Comment.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java index abeae890..eeca31c4 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/Comment.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java @@ -1,6 +1,6 @@ -package de.tum.in.www1.hephaestus.codereview.base; +package de.tum.in.www1.hephaestus.gitprovider.base; -import de.tum.in.www1.hephaestus.codereview.user.User; +import de.tum.in.www1.hephaestus.gitprovider.user.User; import jakarta.persistence.Column; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueComment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java similarity index 74% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueComment.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java index 103f68c7..98d0895b 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueComment.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java @@ -1,8 +1,8 @@ -package de.tum.in.www1.hephaestus.codereview.comment; +package de.tum.in.www1.hephaestus.gitprovider.comment; import jakarta.persistence.Table; -import de.tum.in.www1.hephaestus.codereview.base.Comment; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.base.Comment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; import jakarta.persistence.Entity; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java similarity index 85% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java index 502eb33a..04a02c4b 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.comment; +package de.tum.in.www1.hephaestus.gitprovider.comment; import org.kohsuke.github.GHIssueComment; import org.slf4j.Logger; @@ -6,7 +6,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class IssueCommentConverter extends BaseGitServiceEntityConverter { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java similarity index 67% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java index 6e2b537f..9782f4a2 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java @@ -1,9 +1,9 @@ -package de.tum.in.www1.hephaestus.codereview.comment; +package de.tum.in.www1.hephaestus.gitprovider.comment; import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestDTO; -import de.tum.in.www1.hephaestus.codereview.user.UserDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; +import de.tum.in.www1.hephaestus.gitprovider.user.UserDTO; @JsonInclude(JsonInclude.Include.NON_EMPTY) public record IssueCommentDTO(Long id, String body, String createdAt, String updatedAt, UserDTO author, diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java similarity index 73% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java index adacc0d7..0059c3e2 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.comment; +package de.tum.in.www1.hephaestus.gitprovider.comment; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewComment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java similarity index 77% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewComment.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java index bdf18610..14fc91db 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewComment.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java @@ -1,9 +1,9 @@ -package de.tum.in.www1.hephaestus.codereview.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.comment.review; import org.springframework.lang.NonNull; -import de.tum.in.www1.hephaestus.codereview.base.Comment; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.base.Comment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java similarity index 87% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java index 03982fae..32e79509 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.comment.review; import org.kohsuke.github.GHPullRequestReviewComment; import org.slf4j.Logger; @@ -6,7 +6,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class PullRequestReviewCommentConverter diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java similarity index 73% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java index 49e9160a..f9b8ed45 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/PullRequestReviewCommentRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.comment.review; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/IssueState.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/IssueState.java new file mode 100644 index 00000000..850373f6 --- /dev/null +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/IssueState.java @@ -0,0 +1,5 @@ +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; + +public enum IssueState { + CLOSED, OPEN +} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequest.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java similarity index 80% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequest.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java index 9ad5c321..5b82becb 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequest.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.time.OffsetDateTime; import java.util.HashSet; @@ -7,11 +7,11 @@ import jakarta.persistence.*; import org.springframework.lang.NonNull; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.codereview.comment.IssueComment; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReview; -import de.tum.in.www1.hephaestus.codereview.repository.Repository; -import de.tum.in.www1.hephaestus.codereview.user.User; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; +import de.tum.in.www1.hephaestus.gitprovider.user.User; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestController.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestController.java similarity index 94% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestController.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestController.java index 8af92a91..8894e46e 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestController.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestController.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.util.Optional; import java.util.Set; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestConverter.java similarity index 95% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestConverter.java index f065f597..140098e3 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.io.IOException; import java.util.Collection; @@ -12,7 +12,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class PullRequestConverter extends BaseGitServiceEntityConverter { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java similarity index 70% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java index 9e85f02c..f0961bfe 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java @@ -1,12 +1,12 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.util.Set; import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentDTO; -import de.tum.in.www1.hephaestus.codereview.repository.RepositoryDTO; -import de.tum.in.www1.hephaestus.codereview.user.UserDTO; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryDTO; +import de.tum.in.www1.hephaestus.gitprovider.user.UserDTO; @JsonInclude(JsonInclude.Include.NON_EMPTY) public record PullRequestDTO(Long id, String title, String url, IssueState state, String createdAt, String updatedAt, diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestLabel.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestLabel.java similarity index 83% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestLabel.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestLabel.java index 28c666e2..e894ade7 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestLabel.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestLabel.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import jakarta.persistence.Embeddable; import lombok.Getter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestRepository.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestRepository.java index abcab783..70aeb22f 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.util.Optional; import java.util.Set; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestService.java similarity index 93% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestService.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestService.java index 4c3fdbf3..c1f2524d 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestService.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest; import java.util.Optional; import java.util.Set; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReview.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java similarity index 78% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReview.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java index 74bc73da..7e166563 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReview.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; import java.time.OffsetDateTime; import java.util.HashSet; @@ -6,10 +6,10 @@ import org.springframework.lang.NonNull; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewComment; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.codereview.user.User; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.user.User; import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java similarity index 92% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java index 4f382f45..31501fc2 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; import java.io.IOException; @@ -8,7 +8,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class PullRequestReviewConverter extends BaseGitServiceEntityConverter { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java similarity index 81% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java index 92e2564b..e5bf7433 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; import java.time.OffsetDateTime; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java index ad2d2ccd..b5e4fb4e 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; import java.util.Optional; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewState.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java similarity index 58% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewState.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java index 5d05cb81..2a4b993d 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/review/PullRequestReviewState.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; public enum PullRequestReviewState { COMMENTED, APPROVED, CHANGES_REQUESTED, DISMISSED diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/Repository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/Repository.java similarity index 84% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/Repository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/Repository.java index f5137cfc..44bcc6d9 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/Repository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/Repository.java @@ -1,12 +1,12 @@ -package de.tum.in.www1.hephaestus.codereview.repository; +package de.tum.in.www1.hephaestus.gitprovider.repository; import java.util.HashSet; import java.util.Set; import org.springframework.lang.NonNull; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; import io.micrometer.common.lang.Nullable; import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryConverter.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryConverter.java index 7cb69e9d..126f7756 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.repository; +package de.tum.in.www1.hephaestus.gitprovider.repository; import org.kohsuke.github.GHRepository; import org.kohsuke.github.GHRepository.Visibility; @@ -7,7 +7,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class RepositoryConverter extends BaseGitServiceEntityConverter { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryDTO.java similarity index 71% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryDTO.java index 5defadbe..60903cd7 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryDTO.java @@ -1,8 +1,8 @@ -package de.tum.in.www1.hephaestus.codereview.repository; +package de.tum.in.www1.hephaestus.gitprovider.repository; import java.util.Set; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; public record RepositoryDTO(String name, String nameWithOwner, String description, String url, Set pullRequests) { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryRepository.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryRepository.java index dc25104e..e1d4bf3a 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.repository; +package de.tum.in.www1.hephaestus.gitprovider.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryVisibility.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryVisibility.java similarity index 50% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryVisibility.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryVisibility.java index 83143a1b..8e5f077e 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryVisibility.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/repository/RepositoryVisibility.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.repository; +package de.tum.in.www1.hephaestus.gitprovider.repository; public enum RepositoryVisibility { PUBLIC, PRIVATE diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/User.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java similarity index 83% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/User.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java index 8c84ec51..79e5385b 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/User.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import jakarta.persistence.Table; @@ -7,11 +7,11 @@ import org.springframework.lang.NonNull; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.codereview.comment.IssueComment; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewComment; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserController.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserController.java similarity index 95% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserController.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserController.java index 3e264422..54e9f8c9 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserController.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserController.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import java.util.Optional; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserConverter.java similarity index 93% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserConverter.java index 3f2dadbb..9b86e74a 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import java.io.IOException; @@ -8,7 +8,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntityConverter; @Component public class UserConverter extends BaseGitServiceEntityConverter { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java similarity index 68% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java index 64d8051b..8b9a935b 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java @@ -1,11 +1,11 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import java.util.Set; import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentDTO; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestDTO; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; @JsonInclude(JsonInclude.Include.NON_EMPTY) public record UserDTO(Long id, String login, String email, String name, String url, Set pullRequests, diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserRepository.java similarity index 96% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserRepository.java index ba998f9d..84cd0b61 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import java.time.OffsetDateTime; import java.util.List; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserService.java similarity index 95% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserService.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserService.java index 1a5f3e9b..6cf49509 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserService.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.codereview.user; +package de.tum.in.www1.hephaestus.gitprovider.user; import java.time.OffsetDateTime; import java.util.List; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserType.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserType.java new file mode 100644 index 00000000..8de2fcab --- /dev/null +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserType.java @@ -0,0 +1,5 @@ +package de.tum.in.www1.hephaestus.gitprovider.user; + +public enum UserType { + USER, BOT +} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java index a0dafb54..f32250e0 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReviewDTO; -import de.tum.in.www1.hephaestus.codereview.user.UserType; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewDTO; +import de.tum.in.www1.hephaestus.gitprovider.user.UserType; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java index a031c407..eeae461f 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java @@ -19,11 +19,11 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReviewDTO; -import de.tum.in.www1.hephaestus.codereview.user.User; -import de.tum.in.www1.hephaestus.codereview.user.UserService; -import de.tum.in.www1.hephaestus.codereview.user.UserType; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewDTO; +import de.tum.in.www1.hephaestus.gitprovider.user.User; +import de.tum.in.www1.hephaestus.gitprovider.user.UserService; +import de.tum.in.www1.hephaestus.gitprovider.user.UserType; @Service public class LeaderboardService { diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java index fa366c2e..1987122f 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/nats/NatsConsumerService.java @@ -57,9 +57,9 @@ public void init() throws IOException, InterruptedException, JetStreamApiExcepti // consumerContext = streamContext.getConsumerContext(natsServer) // } catch (JetStreamApiException | IOException e) { // // JetStreamApiException: - // // the stream or consumer did not exist + // // the stream or consumer did not exist // // IOException: - // // likely a connection problem + // // likely a connection problem // return; // } @@ -95,14 +95,6 @@ public void init() throws IOException, InterruptedException, JetStreamApiExcepti logger.error("Failed to parse pull request review payload.", e); } } - // else if (subject.endsWith(".pull_request_review_thread")) { - // try { - // GHEventPayload.PullRequestReviewThread pullRequestReviewThreadEvent = github.parseEventPayload(reader, GHEventPayload.PullRequestReviewThread.class); - // logger.info("Received pull request review thread: " + pullRequestReviewThreadEvent.getThread().getTitle()); - // } catch (IOException e) { - // logger.error("Failed to parse pull request review thread payload.", e); - // } - // } }; consumerContext.consume(handler); @@ -110,11 +102,11 @@ public void init() throws IOException, InterruptedException, JetStreamApiExcepti // try (MessageConsumer consumer = ) { // } catch (JetStreamApiException | IOException e) { // // JetStreamApiException: - // // 1. the stream or consumer did not exist - // // 2. api calls under the covers theoretically this could fail, but practically - // // it won't. + // // 1. the stream or consumer did not exist + // // 2. api calls under the covers theoretically this could fail, but practically + // // it won't. // // IOException: - // // likely a connection problem + // // likely a connection problem // } catch (Exception e) { // // this is from the FetchConsumer being AutoCloseable, but should never be // // called @@ -132,7 +124,6 @@ private String[] getSubjects() { "pull_request", "pull_request_review_comment", "pull_request_review", - // "pull_request_review_thread" }; return Arrays.stream(repositoriesToMonitor) diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java index 432a113a..7691df49 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java @@ -31,24 +31,24 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import de.tum.in.www1.hephaestus.codereview.comment.IssueComment; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentConverter; -import de.tum.in.www1.hephaestus.codereview.comment.IssueCommentRepository; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewComment; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewCommentConverter; -import de.tum.in.www1.hephaestus.codereview.comment.review.PullRequestReviewCommentRepository; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestConverter; -import de.tum.in.www1.hephaestus.codereview.pullrequest.PullRequestRepository; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReview; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReviewConverter; -import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReviewRepository; -import de.tum.in.www1.hephaestus.codereview.repository.Repository; -import de.tum.in.www1.hephaestus.codereview.repository.RepositoryConverter; -import de.tum.in.www1.hephaestus.codereview.repository.RepositoryRepository; -import de.tum.in.www1.hephaestus.codereview.user.User; -import de.tum.in.www1.hephaestus.codereview.user.UserConverter; -import de.tum.in.www1.hephaestus.codereview.user.UserRepository; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentRepository; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentRepository; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestRepository; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewRepository; +import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; +import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryConverter; +import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryRepository; +import de.tum.in.www1.hephaestus.gitprovider.user.User; +import de.tum.in.www1.hephaestus.gitprovider.user.UserConverter; +import de.tum.in.www1.hephaestus.gitprovider.user.UserRepository; @Service public class GitHubDataSyncService { From 7d44216ae24001689af0320cb6c6074694dcfb03 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sat, 12 Oct 2024 18:14:18 +0200 Subject: [PATCH 04/44] restructure gitprovider --- ...lassImportIntegratorIntegratorProvider.java | 2 +- .../de/tum/in/www1/hephaestus/WebConfig.java | 6 +++--- .../IssueComment.java | 2 +- .../IssueCommentConverter.java | 2 +- .../IssueCommentDTO.java | 2 +- .../IssueCommentRepository.java | 2 +- .../gitprovider/pullrequest/PullRequest.java | 4 ++-- .../pullrequest/PullRequestDTO.java | 2 +- .../PullRequestReview.java | 4 ++-- .../PullRequestReviewConverter.java | 2 +- .../PullRequestReviewDTO.java | 2 +- .../PullRequestReviewRepository.java | 2 +- .../PullRequestReviewState.java | 2 +- .../PullRequestReviewComment.java | 4 ++-- .../PullRequestReviewCommentConverter.java | 2 +- .../PullRequestReviewCommentRepository.java | 2 +- .../www1/hephaestus/gitprovider/user/User.java | 6 +++--- .../hephaestus/gitprovider/user/UserDTO.java | 2 +- .../leaderboard/LeaderboardEntry.java | 2 +- .../leaderboard/LeaderboardService.java | 2 +- .../scheduler/GitHubDataSyncService.java | 18 +++++++++--------- 21 files changed, 36 insertions(+), 36 deletions(-) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment => issuecomment}/IssueComment.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment => issuecomment}/IssueCommentConverter.java (93%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment => issuecomment}/IssueCommentDTO.java (89%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment => issuecomment}/IssueCommentRepository.java (71%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{pullrequest/review => pullrequestreview}/PullRequestReview.java (90%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{pullrequest/review => pullrequestreview}/PullRequestReviewConverter.java (96%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{pullrequest/review => pullrequestreview}/PullRequestReviewDTO.java (81%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{pullrequest/review => pullrequestreview}/PullRequestReviewRepository.java (91%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{pullrequest/review => pullrequestreview}/PullRequestReviewState.java (58%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment/review => pullrequestreviewcomment}/PullRequestReviewComment.java (83%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment/review => pullrequestreviewcomment}/PullRequestReviewCommentConverter.java (93%) rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/{comment/review => pullrequestreviewcomment}/PullRequestReviewCommentRepository.java (70%) diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java index 45fafd4e..3a138166 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/ClassImportIntegratorIntegratorProvider.java @@ -6,7 +6,7 @@ import org.hibernate.integrator.spi.Integrator; import org.hibernate.jpa.boot.spi.IntegratorProvider; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentDTO; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryDTO; import de.tum.in.www1.hephaestus.gitprovider.user.UserDTO; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java index b042b68e..295dbb46 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java @@ -5,10 +5,10 @@ import org.springframework.lang.NonNull; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentConverter; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentConverter; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestConverter; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewCommentConverter; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryConverter; import de.tum.in.www1.hephaestus.gitprovider.user.UserConverter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueComment.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueComment.java index 98d0895b..2983a0f3 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueComment.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueComment.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment; +package de.tum.in.www1.hephaestus.gitprovider.issuecomment; import jakarta.persistence.Table; import de.tum.in.www1.hephaestus.gitprovider.base.Comment; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentConverter.java similarity index 93% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentConverter.java index 04a02c4b..2b2b1fec 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment; +package de.tum.in.www1.hephaestus.gitprovider.issuecomment; import org.kohsuke.github.GHIssueComment; import org.slf4j.Logger; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentDTO.java similarity index 89% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentDTO.java index 9782f4a2..99aee704 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentDTO.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment; +package de.tum.in.www1.hephaestus.gitprovider.issuecomment; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentRepository.java similarity index 71% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentRepository.java index 0059c3e2..aa1604fd 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/IssueCommentRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment; +package de.tum.in.www1.hephaestus.gitprovider.issuecomment; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java index 5b82becb..2935e171 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequest.java @@ -8,8 +8,8 @@ import org.springframework.lang.NonNull; import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReview; import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; import de.tum.in.www1.hephaestus.gitprovider.user.User; import lombok.Getter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java index f0961bfe..161e6a04 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentDTO; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryDTO; import de.tum.in.www1.hephaestus.gitprovider.user.UserDTO; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReview.java similarity index 90% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReview.java index 7e166563..4e21e95a 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReview.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReview.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreview; import java.time.OffsetDateTime; import java.util.HashSet; @@ -7,8 +7,8 @@ import org.springframework.lang.NonNull; import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewComment; import de.tum.in.www1.hephaestus.gitprovider.user.User; import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewConverter.java similarity index 96% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewConverter.java index 31501fc2..ca643db1 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreview; import java.io.IOException; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewDTO.java similarity index 81% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewDTO.java index e5bf7433..8c3dff47 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewDTO.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreview; import java.time.OffsetDateTime; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewRepository.java similarity index 91% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewRepository.java index b5e4fb4e..6893fffd 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreview; import java.util.Optional; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewState.java similarity index 58% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewState.java index 2a4b993d..3b84b8bc 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/review/PullRequestReviewState.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreview/PullRequestReviewState.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.pullrequest.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreview; public enum PullRequestReviewState { COMMENTED, APPROVED, CHANGES_REQUESTED, DISMISSED diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewComment.java similarity index 83% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewComment.java index 14fc91db..d7e6d4b5 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewComment.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewComment.java @@ -1,9 +1,9 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment; import org.springframework.lang.NonNull; import de.tum.in.www1.hephaestus.gitprovider.base.Comment; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReview; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentConverter.java similarity index 93% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentConverter.java index 32e79509..23b9f776 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentConverter.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentConverter.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment; import org.kohsuke.github.GHPullRequestReviewComment; import org.slf4j.Logger; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentRepository.java similarity index 70% rename from server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java rename to server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentRepository.java index f9b8ed45..67913b57 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/comment/review/PullRequestReviewCommentRepository.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentRepository.java @@ -1,4 +1,4 @@ -package de.tum.in.www1.hephaestus.gitprovider.comment.review; +package de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java index 79e5385b..2f426477 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/User.java @@ -8,10 +8,10 @@ import org.springframework.lang.NonNull; import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueComment; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewComment; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java index 8b9a935b..33c83f2a 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/user/UserDTO.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentDTO; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentDTO; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestDTO; @JsonInclude(JsonInclude.Include.NON_EMPTY) diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java index f32250e0..900559b5 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewDTO; import de.tum.in.www1.hephaestus.gitprovider.user.UserType; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java index eeae461f..cb563e56 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java @@ -20,7 +20,7 @@ import org.springframework.stereotype.Service; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewDTO; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewDTO; import de.tum.in.www1.hephaestus.gitprovider.user.User; import de.tum.in.www1.hephaestus.gitprovider.user.UserService; import de.tum.in.www1.hephaestus.gitprovider.user.UserType; diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java index 7691df49..17074bd2 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/scheduler/GitHubDataSyncService.java @@ -31,18 +31,18 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueComment; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentConverter; -import de.tum.in.www1.hephaestus.gitprovider.comment.IssueCommentRepository; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewComment; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentConverter; -import de.tum.in.www1.hephaestus.gitprovider.comment.review.PullRequestReviewCommentRepository; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentRepository; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequest; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestConverter; import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestRepository; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReview; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewConverter; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.review.PullRequestReviewRepository; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReview; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewRepository; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewComment; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewCommentRepository; import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryConverter; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryRepository; From deb3448ee6af74d35ec187f2716faa4687d7837e Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 13 Oct 2024 10:22:43 +0200 Subject: [PATCH 05/44] update gitprovider entities --- .../de/tum/in/www1/hephaestus/WebConfig.java | 8 +- .../gitprovider/base/AuthorAssociation.java | 13 ++ .../hephaestus/gitprovider/base/Comment.java | 30 ----- .../hephaestus/gitprovider/issue/Issue.java | 109 +++++++++++++++ .../gitprovider/issue/IssueState.java | 5 + .../issuecomment/IssueComment.java | 36 ++++- .../GitHubIssueCommentConverter.java} | 7 +- .../hephaestus/gitprovider/label/Label.java | 45 +++++++ .../gitprovider/milestone/Milestone.java | 63 +++++++++ .../gitprovider/pullrequest/IssueState.java | 5 - .../gitprovider/pullrequest/PullRequest.java | 86 ++++++------ .../pullrequest/PullRequestDTO.java | 1 + .../pullrequest/PullRequestLabel.java | 19 --- .../GitHubPullRequestConverter.java} | 15 ++- .../GitHubPullRequestMessageHandler.java | 5 + .../github/GitHubPullRequestSyncService.java | 5 + .../pullrequestreview/PullRequestReview.java | 55 +++++--- .../PullRequestReviewComment.java | 86 ++++++++++-- .../PullRequestReviewCommentSide.java | 5 + .../PullRequestReviewCommentSubjectType.java | 5 + .../gitprovider/repository/Repository.java | 79 +++++++++-- .../repository/RepositoryVisibility.java | 2 +- .../hephaestus/gitprovider/user/User.java | 127 +++++++++++------- .../hephaestus/gitprovider/user/UserType.java | 2 +- .../scheduler/GitHubDataSyncService.java | 8 +- 25 files changed, 609 insertions(+), 212 deletions(-) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/AuthorAssociation.java delete mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/Issue.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/IssueState.java rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/{IssueCommentConverter.java => github/GitHubIssueCommentConverter.java} (71%) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/label/Label.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/milestone/Milestone.java delete mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/IssueState.java delete mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestLabel.java rename server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/{PullRequestConverter.java => github/GitHubPullRequestConverter.java} (83%) create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/github/GitHubPullRequestMessageHandler.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/github/GitHubPullRequestSyncService.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentSide.java create mode 100644 server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequestreviewcomment/PullRequestReviewCommentSubjectType.java diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java index 295dbb46..f1483ba7 100644 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/WebConfig.java @@ -5,8 +5,8 @@ import org.springframework.lang.NonNull; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueCommentConverter; -import de.tum.in.www1.hephaestus.gitprovider.pullrequest.PullRequestConverter; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.github.GitHubIssueCommentConverter; +import de.tum.in.www1.hephaestus.gitprovider.pullrequest.github.GitHubPullRequestConverter; import de.tum.in.www1.hephaestus.gitprovider.pullrequestreview.PullRequestReviewConverter; import de.tum.in.www1.hephaestus.gitprovider.pullrequestreviewcomment.PullRequestReviewCommentConverter; import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryConverter; @@ -19,9 +19,9 @@ public class WebConfig implements WebMvcConfigurer { public void addFormatters(@NonNull FormatterRegistry registry) { registry.addConverter(new UserConverter()); registry.addConverter(new RepositoryConverter()); - registry.addConverter(new PullRequestConverter()); + registry.addConverter(new GitHubPullRequestConverter()); registry.addConverter(new PullRequestReviewConverter()); - registry.addConverter(new IssueCommentConverter()); + registry.addConverter(new GitHubIssueCommentConverter()); registry.addConverter(new PullRequestReviewCommentConverter()); } } \ No newline at end of file diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/AuthorAssociation.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/AuthorAssociation.java new file mode 100644 index 00000000..fab97955 --- /dev/null +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/AuthorAssociation.java @@ -0,0 +1,13 @@ +package de.tum.in.www1.hephaestus.gitprovider.base; + +// How the author is associated with the repository. +public enum AuthorAssociation { + COLLABORATOR, + CONTRIBUTOR, + FIRST_TIMER, + FIRST_TIME_CONTRIBUTOR, + MANNEQUIN, + MEMBER, + NONE, + OWNER +} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java deleted file mode 100644 index eeca31c4..00000000 --- a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/base/Comment.java +++ /dev/null @@ -1,30 +0,0 @@ -package de.tum.in.www1.hephaestus.gitprovider.base; - -import de.tum.in.www1.hephaestus.gitprovider.user.User; -import jakarta.persistence.Column; -import jakarta.persistence.FetchType; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.MappedSuperclass; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@MappedSuperclass -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString(callSuper = true) -public abstract class Comment extends BaseGitServiceEntity { - @Column(columnDefinition = "TEXT") - @ToString.Exclude - protected String body; - - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "author_id") - @ToString.Exclude - protected User author; -} diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/Issue.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/Issue.java new file mode 100644 index 00000000..d433060a --- /dev/null +++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/Issue.java @@ -0,0 +1,109 @@ +package de.tum.in.www1.hephaestus.gitprovider.issue; + +import java.util.HashSet; +import java.util.Set; +import java.time.OffsetDateTime; + +import org.springframework.lang.NonNull; + +import jakarta.persistence.Table; +import jakarta.persistence.DiscriminatorColumn; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.DiscriminatorType; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import de.tum.in.www1.hephaestus.gitprovider.base.AuthorAssociation; +import de.tum.in.www1.hephaestus.gitprovider.base.BaseGitServiceEntity; +import de.tum.in.www1.hephaestus.gitprovider.issuecomment.IssueComment; +import de.tum.in.www1.hephaestus.gitprovider.label.Label; +import de.tum.in.www1.hephaestus.gitprovider.milestone.Milestone; +import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; +import de.tum.in.www1.hephaestus.gitprovider.user.User; + +@Entity +@Table(name = "issue") +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "issue_type", discriminatorType = DiscriminatorType.STRING) +@DiscriminatorValue(value = "ISSUE") +@Getter +@Setter +@NoArgsConstructor +@ToString(callSuper = true) +public class Issue extends BaseGitServiceEntity { + + private int number; + + @NonNull + @Enumerated(EnumType.STRING) + private IssueState state; + + @NonNull + private String title; + + private String body; + + @NonNull + private String htmlUrl; + + private boolean locked; + + private OffsetDateTime closedAt; + + @NonNull + @Enumerated(EnumType.STRING) + private AuthorAssociation authorAssociation; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "author_id") + @ToString.Exclude + private User author; + + @ManyToMany + @JoinTable(name = "issue_label", joinColumns = @JoinColumn(name = "issue_id"), inverseJoinColumns = @JoinColumn(name = "label_id")) + @ToString.Exclude + private Set