Spaces:
Sleeping
Sleeping
Merged in release/dev (pull request #6)
Browse files- Dockerfile +27 -0
- README.md +5 -0
- bitbucket-pipelines.yml +15 -0
- entrypoint.sh +9 -0
- src/main/java/com/utility/utilitycommonservice/api/controller/beToBe/bitbucket/BitbucketController.java +0 -53
- src/main/java/com/utility/utilitycommonservice/api/model/request/CreateBranchRequest.java +0 -21
- src/main/java/com/utility/utilitycommonservice/api/model/request/CreatePullRequestRequest.java +0 -24
- src/main/java/com/utility/utilitycommonservice/api/model/request/ListRepositoryRequest.java +0 -18
- src/main/java/com/utility/utilitycommonservice/api/model/response/CrateBranchResponse.java +0 -13
- src/main/java/com/utility/utilitycommonservice/common/util/BitbucketBasicAuthGenerator.java +0 -21
- src/main/java/com/utility/utilitycommonservice/dao/entity/GitBranch.java +0 -34
- src/main/java/com/utility/utilitycommonservice/dao/repository/GitBranchRepository.java +0 -12
- src/main/java/com/utility/utilitycommonservice/domain/assembler/SaveLogAssembler.java +2 -2
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/AddGitBranchInput.java +0 -27
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/CreateBranchInput.java +0 -20
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/CreatePullRequestInput.java +0 -22
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/GetGitBranchFromNameInput.java +0 -10
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/ListRepositoryFilesInput.java +0 -19
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/UpdateGitBranchInput.java +0 -13
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/UploadFileInput.java +0 -24
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/output/CreateBranchOutput.java +0 -21
- src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/output/GetGitBranchOutput.java +0 -14
- src/main/java/com/utility/utilitycommonservice/domain/model/notification/Notification.java +2 -1
- src/main/java/com/utility/utilitycommonservice/domain/properties/BitbucketProperties.java +0 -25
- src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/BitbucketService.java +0 -19
- src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/GitBranchService.java +0 -17
- src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/impl/BitbucketServiceImpl.java +0 -46
- src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/impl/GitBranchServiceImpl.java +0 -49
- src/main/java/com/utility/utilitycommonservice/domain/service/clientbe/notification/notificationImpl/PushServiceImpl.java +4 -4
- src/main/java/com/utility/utilitycommonservice/integration/config/bitbucket/EmptyObjectProvider.java +0 -30
- src/main/java/com/utility/utilitycommonservice/integration/config/bitbucket/RestTemplateConfig.java +0 -22
- src/main/java/com/utility/utilitycommonservice/integration/interceptor/bitbucket/BitbucketAuthHttpClientInterceptor.java +0 -26
- src/main/java/com/utility/utilitycommonservice/integration/service/model/Author.java +0 -17
- src/main/java/com/utility/utilitycommonservice/integration/service/model/MultipartInputStreamFileResource.java +0 -27
- src/main/java/com/utility/utilitycommonservice/integration/service/model/Target.java +0 -20
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/CreateBranchClientRequest.java +0 -11
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/CreatePullRequestClientRequest.java +0 -12
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/DeleteFileClientRequest.java +0 -13
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/GetBranchHeadHashClientRequest.java +0 -10
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/ListRepositoryFilesClientRequest.java +0 -10
- src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/UploadFileClientRequest.java +0 -15
- src/main/java/com/utility/utilitycommonservice/integration/service/model/response/bitbucket/CreateBranchClientResponse.java +0 -28
- src/main/java/com/utility/utilitycommonservice/integration/service/service/bitbucket/BitbucketClientService.java +0 -21
- src/main/java/com/utility/utilitycommonservice/integration/service/service/bitbucket/impl/BitbucketClientServiceImpl.java +0 -160
- src/main/resources/application.yml +7 -38
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM eclipse-temurin:17-jdk-jammy AS build
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY mvnw .
|
| 6 |
+
COPY .mvn .mvn
|
| 7 |
+
COPY pom.xml .
|
| 8 |
+
COPY src src
|
| 9 |
+
|
| 10 |
+
RUN chmod +x mvnw && ./mvnw -q -DskipTests package
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
FROM eclipse-temurin:17-jre-jammy
|
| 14 |
+
|
| 15 |
+
WORKDIR /app
|
| 16 |
+
|
| 17 |
+
COPY --from=build /app/target/*.jar app.jar
|
| 18 |
+
|
| 19 |
+
COPY entrypoint.sh entrypoint.sh
|
| 20 |
+
|
| 21 |
+
RUN chmod +x entrypoint.sh
|
| 22 |
+
|
| 23 |
+
EXPOSE 9797
|
| 24 |
+
|
| 25 |
+
ENV JAVA_OPTS=""
|
| 26 |
+
|
| 27 |
+
ENTRYPOINT ["./entrypoint.sh"]
|
README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: utility-common-service
|
| 3 |
+
sdk: docker
|
| 4 |
+
app_port: 9797
|
| 5 |
+
---
|
bitbucket-pipelines.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
image: alpine/git:latest
|
| 2 |
+
|
| 3 |
+
pipelines:
|
| 4 |
+
custom:
|
| 5 |
+
deploy-test-to-huggingface:
|
| 6 |
+
- step:
|
| 7 |
+
name: Deploy release/test to Hugging Face Space
|
| 8 |
+
script:
|
| 9 |
+
- git config --global user.email "bitbucket-pipeline@artandscience.local"
|
| 10 |
+
- git config --global user.name "Bitbucket Pipeline"
|
| 11 |
+
|
| 12 |
+
- git remote remove hf || true
|
| 13 |
+
- git remote add hf https://sarvenyanik:${HF_TOKEN}@huggingface.co/spaces/sarvenyanik/artandscience-utility-common-test
|
| 14 |
+
|
| 15 |
+
- git push --force hf HEAD:main
|
entrypoint.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
mkdir -p /tmp/aiven-kafka
|
| 5 |
+
|
| 6 |
+
printf "%s" "$AIVEN_KAFKA_KEYSTORE_BASE64" | base64 -d > /tmp/aiven-kafka/client.keystore.p12
|
| 7 |
+
printf "%s" "$AIVEN_KAFKA_TRUSTSTORE_BASE64" | base64 -d > /tmp/aiven-kafka/client.truststore.jks
|
| 8 |
+
|
| 9 |
+
exec java $JAVA_OPTS -jar app.jar
|
src/main/java/com/utility/utilitycommonservice/api/controller/beToBe/bitbucket/BitbucketController.java
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.api.controller.beToBe.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.api.model.request.CreateBranchRequest;
|
| 4 |
-
import com.utility.utilitycommonservice.api.model.request.CreatePullRequestRequest;
|
| 5 |
-
import com.utility.utilitycommonservice.api.model.request.ListRepositoryRequest;
|
| 6 |
-
import com.utility.utilitycommonservice.common.base.controller.BaseController;
|
| 7 |
-
import com.utility.utilitycommonservice.common.base.response.MessageResponse;
|
| 8 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.UploadFileInput;
|
| 9 |
-
import com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.BitbucketService;
|
| 10 |
-
import com.utility.utilitycommonservice.integration.service.model.response.bitbucket.CreateBranchClientResponse;
|
| 11 |
-
import lombok.RequiredArgsConstructor;
|
| 12 |
-
import org.springframework.web.bind.annotation.*;
|
| 13 |
-
import org.springframework.web.multipart.MultipartFile;
|
| 14 |
-
|
| 15 |
-
@RestController
|
| 16 |
-
@RequiredArgsConstructor
|
| 17 |
-
@RequestMapping("/api/v1/cdn")
|
| 18 |
-
public class BitbucketController extends BaseController {
|
| 19 |
-
|
| 20 |
-
private final BitbucketService bitbucketService;
|
| 21 |
-
|
| 22 |
-
@PostMapping("/repository-list")
|
| 23 |
-
public String repositoryList(@RequestBody ListRepositoryRequest request) {
|
| 24 |
-
return bitbucketService.listRepositoryByBranch(request.toInput());
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
@PostMapping("create-branch")
|
| 28 |
-
public MessageResponse<CreateBranchClientResponse> createBranch(@RequestBody CreateBranchRequest request) {
|
| 29 |
-
CreateBranchClientResponse response = bitbucketService.createBranch(request.toInput()).toResponse();
|
| 30 |
-
return responseSuccess(response);
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
@PostMapping("pull-request")
|
| 34 |
-
public String createPullRequest(@RequestBody CreatePullRequestRequest request) {
|
| 35 |
-
return bitbucketService.createPullRequest(request.toInput());
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
@PostMapping("/upload")
|
| 39 |
-
public String uploadFile(@RequestParam("file") MultipartFile file,
|
| 40 |
-
@RequestParam("path") String path,
|
| 41 |
-
@RequestParam(required = false) String branch) {
|
| 42 |
-
return bitbucketService.uploadFile(prepareUploadFileInput(file,path,branch));
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
private UploadFileInput prepareUploadFileInput(MultipartFile file, String path, String branch) {
|
| 46 |
-
return UploadFileInput.builder()
|
| 47 |
-
.multipartFile(file)
|
| 48 |
-
.path(path)
|
| 49 |
-
.branch(branch)
|
| 50 |
-
.build();
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/api/model/request/CreateBranchRequest.java
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.api.model.request;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.CreateBranchInput;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class CreateBranchRequest {
|
| 10 |
-
|
| 11 |
-
private String newBranch;
|
| 12 |
-
private String fromBranch;
|
| 13 |
-
|
| 14 |
-
public CreateBranchInput toInput() {
|
| 15 |
-
return CreateBranchInput.builder()
|
| 16 |
-
.newBranch(newBranch)
|
| 17 |
-
.fromBranch(fromBranch)
|
| 18 |
-
.build();
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/api/model/request/CreatePullRequestRequest.java
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.api.model.request;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.CreatePullRequestInput;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class CreatePullRequestRequest {
|
| 10 |
-
|
| 11 |
-
private String sourceBranch;
|
| 12 |
-
private String destinationBranch;
|
| 13 |
-
private String title;
|
| 14 |
-
|
| 15 |
-
public CreatePullRequestInput toInput() {
|
| 16 |
-
return CreatePullRequestInput
|
| 17 |
-
.builder()
|
| 18 |
-
.sourceBranch(sourceBranch)
|
| 19 |
-
.destinationBranch(destinationBranch)
|
| 20 |
-
.title(title)
|
| 21 |
-
.build();
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/api/model/request/ListRepositoryRequest.java
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.api.model.request;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.ListRepositoryFilesInput;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class ListRepositoryRequest {
|
| 10 |
-
private String branch;
|
| 11 |
-
|
| 12 |
-
public ListRepositoryFilesInput toInput() {
|
| 13 |
-
return ListRepositoryFilesInput.builder()
|
| 14 |
-
.branch(branch)
|
| 15 |
-
.build();
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/api/model/response/CrateBranchResponse.java
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.api.model.response;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.Target;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class CrateBranchResponse {
|
| 10 |
-
private String name;
|
| 11 |
-
private Target target;
|
| 12 |
-
|
| 13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/common/util/BitbucketBasicAuthGenerator.java
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.common.util;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.properties.BitbucketProperties;
|
| 4 |
-
import lombok.RequiredArgsConstructor;
|
| 5 |
-
import org.springframework.stereotype.Component;
|
| 6 |
-
|
| 7 |
-
import java.nio.charset.StandardCharsets;
|
| 8 |
-
import java.util.Base64;
|
| 9 |
-
|
| 10 |
-
@Component
|
| 11 |
-
@RequiredArgsConstructor
|
| 12 |
-
public class BitbucketBasicAuthGenerator {
|
| 13 |
-
|
| 14 |
-
private final BitbucketProperties bitbucketProperties;
|
| 15 |
-
|
| 16 |
-
public String generate() {
|
| 17 |
-
String auth = bitbucketProperties.getUsername() + ":" + bitbucketProperties.getPassword();
|
| 18 |
-
return "Basic " + Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/dao/entity/GitBranch.java
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.dao.entity;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.GetGitBranchOutput;
|
| 4 |
-
import jakarta.persistence.Entity;
|
| 5 |
-
import jakarta.persistence.Id;
|
| 6 |
-
import lombok.AllArgsConstructor;
|
| 7 |
-
import lombok.Data;
|
| 8 |
-
import lombok.NoArgsConstructor;
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
@AllArgsConstructor
|
| 12 |
-
@NoArgsConstructor
|
| 13 |
-
@Data
|
| 14 |
-
@Entity
|
| 15 |
-
public class GitBranch {
|
| 16 |
-
|
| 17 |
-
@Id
|
| 18 |
-
private String uid;
|
| 19 |
-
private String name;
|
| 20 |
-
private String author;
|
| 21 |
-
private String isProd;
|
| 22 |
-
private String isTest;
|
| 23 |
-
|
| 24 |
-
public GetGitBranchOutput toOutput() {
|
| 25 |
-
return GetGitBranchOutput.builder()
|
| 26 |
-
.name(name)
|
| 27 |
-
.author(author)
|
| 28 |
-
.isTest(isTest)
|
| 29 |
-
.isProd(isProd)
|
| 30 |
-
.build();
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/dao/repository/GitBranchRepository.java
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.dao.repository;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.dao.entity.GitBranch;
|
| 4 |
-
import org.springframework.data.jpa.repository.JpaRepository;
|
| 5 |
-
import org.springframework.stereotype.Repository;
|
| 6 |
-
|
| 7 |
-
import java.util.Optional;
|
| 8 |
-
|
| 9 |
-
@Repository
|
| 10 |
-
public interface GitBranchRepository extends JpaRepository<GitBranch,String> {
|
| 11 |
-
Optional<GitBranch> findByNameEqualsIgnoreCase(String name);
|
| 12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/assembler/SaveLogAssembler.java
CHANGED
|
@@ -22,7 +22,7 @@ public class SaveLogAssembler {
|
|
| 22 |
private final PushNotificationLogRepository pushNotificationLogRepository;
|
| 23 |
private final ObjectMapper mapper = new ObjectMapper();
|
| 24 |
|
| 25 |
-
public void assemble(InfoModel infoModel, String domainCode, LogType logType, String messageId) {
|
| 26 |
|
| 27 |
try {
|
| 28 |
String jsonBody = mapper.writeValueAsString(infoModel);
|
|
@@ -34,7 +34,7 @@ public class SaveLogAssembler {
|
|
| 34 |
.domainCode(domainCode)
|
| 35 |
.isRead(false)
|
| 36 |
.isRemove(false)
|
| 37 |
-
.customerNumber(RequestScopeHelper.getCustomerNumber())
|
| 38 |
.createDate(LocalDate.now())
|
| 39 |
.build();
|
| 40 |
pushNotificationLogRepository.save(pushNotificationLog);
|
|
|
|
| 22 |
private final PushNotificationLogRepository pushNotificationLogRepository;
|
| 23 |
private final ObjectMapper mapper = new ObjectMapper();
|
| 24 |
|
| 25 |
+
public void assemble(InfoModel infoModel,String customerNo, String domainCode, LogType logType, String messageId) {
|
| 26 |
|
| 27 |
try {
|
| 28 |
String jsonBody = mapper.writeValueAsString(infoModel);
|
|
|
|
| 34 |
.domainCode(domainCode)
|
| 35 |
.isRead(false)
|
| 36 |
.isRemove(false)
|
| 37 |
+
.customerNumber(!customerNo.isEmpty() ? customerNo : RequestScopeHelper.getCustomerNumber())
|
| 38 |
.createDate(LocalDate.now())
|
| 39 |
.build();
|
| 40 |
pushNotificationLogRepository.save(pushNotificationLog);
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/AddGitBranchInput.java
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.dao.entity.GitBranch;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
import java.util.UUID;
|
| 8 |
-
|
| 9 |
-
@Data
|
| 10 |
-
@Builder
|
| 11 |
-
public class AddGitBranchInput {
|
| 12 |
-
|
| 13 |
-
private String name;
|
| 14 |
-
private String author;
|
| 15 |
-
private String isTest;
|
| 16 |
-
|
| 17 |
-
public GitBranch toEntity(){
|
| 18 |
-
GitBranch gitBranch = new GitBranch();
|
| 19 |
-
gitBranch.setUid(UUID.randomUUID().toString());
|
| 20 |
-
gitBranch.setName(name);
|
| 21 |
-
gitBranch.setAuthor(author);
|
| 22 |
-
gitBranch.setIsTest(isTest);
|
| 23 |
-
gitBranch.setIsProd("0");
|
| 24 |
-
return gitBranch;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/CreateBranchInput.java
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.CreateBranchClientRequest;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class CreateBranchInput {
|
| 10 |
-
private String newBranch;
|
| 11 |
-
private String fromBranch;
|
| 12 |
-
|
| 13 |
-
public CreateBranchClientRequest toRequest() {
|
| 14 |
-
return CreateBranchClientRequest.builder()
|
| 15 |
-
.newBranch(newBranch)
|
| 16 |
-
.fromBranch(fromBranch)
|
| 17 |
-
.build();
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/CreatePullRequestInput.java
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.CreatePullRequestClientRequest;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class CreatePullRequestInput {
|
| 10 |
-
private String sourceBranch;
|
| 11 |
-
private String destinationBranch;
|
| 12 |
-
private String title;
|
| 13 |
-
|
| 14 |
-
public CreatePullRequestClientRequest toRequest() {
|
| 15 |
-
return CreatePullRequestClientRequest.builder()
|
| 16 |
-
.sourceBranch(sourceBranch)
|
| 17 |
-
.destinationBranch(destinationBranch)
|
| 18 |
-
.title(title)
|
| 19 |
-
.build();
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/GetGitBranchFromNameInput.java
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class GetGitBranchFromNameInput {
|
| 9 |
-
private String name;
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/ListRepositoryFilesInput.java
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.ListRepositoryFilesClientRequest;
|
| 5 |
-
import lombok.Builder;
|
| 6 |
-
import lombok.Data;
|
| 7 |
-
|
| 8 |
-
@Data
|
| 9 |
-
@Builder
|
| 10 |
-
public class ListRepositoryFilesInput {
|
| 11 |
-
private String branch;
|
| 12 |
-
|
| 13 |
-
public ListRepositoryFilesClientRequest toRequest() {
|
| 14 |
-
return ListRepositoryFilesClientRequest.builder()
|
| 15 |
-
.branch(branch)
|
| 16 |
-
.build();
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/UpdateGitBranchInput.java
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class UpdateGitBranchInput {
|
| 9 |
-
|
| 10 |
-
private String name;
|
| 11 |
-
private String isProd;
|
| 12 |
-
|
| 13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/input/UploadFileInput.java
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.input;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.UploadFileClientRequest;
|
| 4 |
-
import lombok.Builder;
|
| 5 |
-
import lombok.Data;
|
| 6 |
-
import org.springframework.web.multipart.MultipartFile;
|
| 7 |
-
|
| 8 |
-
@Data
|
| 9 |
-
@Builder
|
| 10 |
-
public class UploadFileInput {
|
| 11 |
-
|
| 12 |
-
private MultipartFile multipartFile;
|
| 13 |
-
private String path;
|
| 14 |
-
String branch;
|
| 15 |
-
|
| 16 |
-
public UploadFileClientRequest toRequest() {
|
| 17 |
-
return UploadFileClientRequest.builder()
|
| 18 |
-
.multipartFile(multipartFile)
|
| 19 |
-
.path(path)
|
| 20 |
-
.branch(branch)
|
| 21 |
-
.build();
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/output/CreateBranchOutput.java
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.output;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.Target;
|
| 4 |
-
import com.utility.utilitycommonservice.integration.service.model.response.bitbucket.CreateBranchClientResponse;
|
| 5 |
-
import lombok.Builder;
|
| 6 |
-
import lombok.Data;
|
| 7 |
-
|
| 8 |
-
@Data
|
| 9 |
-
@Builder
|
| 10 |
-
public class CreateBranchOutput {
|
| 11 |
-
private String name;
|
| 12 |
-
private Target target;
|
| 13 |
-
|
| 14 |
-
public CreateBranchClientResponse toResponse() {
|
| 15 |
-
return CreateBranchClientResponse.builder()
|
| 16 |
-
.name(name)
|
| 17 |
-
.target(target)
|
| 18 |
-
.build();
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/bitbucket/output/GetGitBranchOutput.java
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.model.bitbucket.output;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class GetGitBranchOutput {
|
| 9 |
-
private String name;
|
| 10 |
-
private String author;
|
| 11 |
-
private String isTest;
|
| 12 |
-
private String isProd;
|
| 13 |
-
|
| 14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/model/notification/Notification.java
CHANGED
|
@@ -38,7 +38,8 @@ public class Notification {
|
|
| 38 |
.title(infoModel.getTitle())
|
| 39 |
.body(infoModel.getText())
|
| 40 |
.imageUrl(infoModel.getImageUrl())
|
| 41 |
-
.url(infoModel.getDeeplink()
|
|
|
|
| 42 |
.topic(pushNotificationLog.getDomainCode())
|
| 43 |
.isRead(pushNotificationLog.getIsRead())
|
| 44 |
.build();
|
|
|
|
| 38 |
.title(infoModel.getTitle())
|
| 39 |
.body(infoModel.getText())
|
| 40 |
.imageUrl(infoModel.getImageUrl())
|
| 41 |
+
.url(!Objects.isNull(infoModel.getDeeplink())
|
| 42 |
+
? infoModel.getDeeplink().getNavigationCode() : null)
|
| 43 |
.topic(pushNotificationLog.getDomainCode())
|
| 44 |
.isRead(pushNotificationLog.getIsRead())
|
| 45 |
.build();
|
src/main/java/com/utility/utilitycommonservice/domain/properties/BitbucketProperties.java
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.properties;
|
| 2 |
-
|
| 3 |
-
import lombok.Data;
|
| 4 |
-
import org.springframework.boot.context.properties.ConfigurationProperties;
|
| 5 |
-
import org.springframework.stereotype.Component;
|
| 6 |
-
|
| 7 |
-
@Component
|
| 8 |
-
@Data
|
| 9 |
-
@ConfigurationProperties(prefix = "bitbucket")
|
| 10 |
-
public class BitbucketProperties {
|
| 11 |
-
|
| 12 |
-
private String username;
|
| 13 |
-
private String password;
|
| 14 |
-
private String workspace;
|
| 15 |
-
private String repository;
|
| 16 |
-
private String defaultBranch;
|
| 17 |
-
private String url;
|
| 18 |
-
private String uploadFilePath;
|
| 19 |
-
private String deleteFilePath;
|
| 20 |
-
private String createBranchPath;
|
| 21 |
-
private String getBranchPath;
|
| 22 |
-
private String pullRequestPath;
|
| 23 |
-
private String listRepositoryFilesPath;
|
| 24 |
-
|
| 25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/BitbucketService.java
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.service.beToBe.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.CreateBranchInput;
|
| 4 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.CreatePullRequestInput;
|
| 5 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.ListRepositoryFilesInput;
|
| 6 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.UploadFileInput;
|
| 7 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.CreateBranchOutput;
|
| 8 |
-
|
| 9 |
-
public interface BitbucketService {
|
| 10 |
-
|
| 11 |
-
String listRepositoryByBranch(ListRepositoryFilesInput input);
|
| 12 |
-
|
| 13 |
-
CreateBranchOutput createBranch(CreateBranchInput input);
|
| 14 |
-
|
| 15 |
-
String createPullRequest(CreatePullRequestInput input);
|
| 16 |
-
|
| 17 |
-
String uploadFile(UploadFileInput input);
|
| 18 |
-
|
| 19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/GitBranchService.java
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.service.beToBe.bitbucket;
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.AddGitBranchInput;
|
| 5 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.GetGitBranchFromNameInput;
|
| 6 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.UpdateGitBranchInput;
|
| 7 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.GetGitBranchOutput;
|
| 8 |
-
|
| 9 |
-
public interface GitBranchService {
|
| 10 |
-
|
| 11 |
-
void addGitBranch(AddGitBranchInput input);
|
| 12 |
-
|
| 13 |
-
void updateGitBranch(UpdateGitBranchInput input);
|
| 14 |
-
|
| 15 |
-
GetGitBranchOutput getGitBranch(GetGitBranchFromNameInput input);
|
| 16 |
-
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/impl/BitbucketServiceImpl.java
DELETED
|
@@ -1,46 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.impl;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.*;
|
| 4 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.CreateBranchOutput;
|
| 5 |
-
import com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.BitbucketService;
|
| 6 |
-
import com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.GitBranchService;
|
| 7 |
-
import com.utility.utilitycommonservice.integration.service.service.bitbucket.BitbucketClientService;
|
| 8 |
-
import lombok.RequiredArgsConstructor;
|
| 9 |
-
import org.springframework.stereotype.Service;
|
| 10 |
-
|
| 11 |
-
@Service
|
| 12 |
-
@RequiredArgsConstructor
|
| 13 |
-
public class BitbucketServiceImpl implements BitbucketService {
|
| 14 |
-
|
| 15 |
-
private final BitbucketClientService clientService;
|
| 16 |
-
private final GitBranchService gitBranchService;
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
@Override
|
| 20 |
-
public String listRepositoryByBranch(ListRepositoryFilesInput input) {
|
| 21 |
-
return clientService.listRepositoryFiles(input.toRequest());
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
@Override
|
| 25 |
-
public CreateBranchOutput createBranch(CreateBranchInput input) {
|
| 26 |
-
var clientResponse = clientService.createBranch(input.toRequest());
|
| 27 |
-
gitBranchService.addGitBranch(AddGitBranchInput.builder()
|
| 28 |
-
.name(clientResponse.getName())
|
| 29 |
-
.author(clientResponse.getTarget().getAuthor().getRaw().split(" ")[0])
|
| 30 |
-
.isTest("1")
|
| 31 |
-
.build());
|
| 32 |
-
return clientResponse.toOutput();
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
@Override
|
| 36 |
-
public String createPullRequest(CreatePullRequestInput input) {
|
| 37 |
-
var clientResponse = clientService.createPullRequest(input.toRequest());
|
| 38 |
-
return clientResponse;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
@Override
|
| 42 |
-
public String uploadFile(UploadFileInput input) {
|
| 43 |
-
var clientResponse = clientService.uploadFile(input.toRequest());
|
| 44 |
-
return clientResponse;
|
| 45 |
-
}
|
| 46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/service/beToBe/bitbucket/impl/GitBranchServiceImpl.java
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.impl;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.dao.entity.GitBranch;
|
| 4 |
-
import com.utility.utilitycommonservice.dao.repository.GitBranchRepository;
|
| 5 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.AddGitBranchInput;
|
| 6 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.GetGitBranchFromNameInput;
|
| 7 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.input.UpdateGitBranchInput;
|
| 8 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.GetGitBranchOutput;
|
| 9 |
-
import com.utility.utilitycommonservice.domain.service.beToBe.bitbucket.GitBranchService;
|
| 10 |
-
import lombok.RequiredArgsConstructor;
|
| 11 |
-
import org.springframework.stereotype.Service;
|
| 12 |
-
|
| 13 |
-
import java.util.Optional;
|
| 14 |
-
|
| 15 |
-
@Service
|
| 16 |
-
@RequiredArgsConstructor
|
| 17 |
-
public class GitBranchServiceImpl implements GitBranchService {
|
| 18 |
-
|
| 19 |
-
private final GitBranchRepository gitBranchRepository;
|
| 20 |
-
|
| 21 |
-
@Override
|
| 22 |
-
public void addGitBranch(AddGitBranchInput input) {
|
| 23 |
-
gitBranchRepository.save(input.toEntity());
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
@Override
|
| 27 |
-
public void updateGitBranch(UpdateGitBranchInput input) {
|
| 28 |
-
GitBranch gitBranch = findByBranchList(GetGitBranchFromNameInput.builder()
|
| 29 |
-
.name(input.getName()).build());
|
| 30 |
-
gitBranch.setIsProd(input.getIsProd());
|
| 31 |
-
gitBranchRepository.save(gitBranch);
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
@Override
|
| 35 |
-
public GetGitBranchOutput getGitBranch(GetGitBranchFromNameInput input) {
|
| 36 |
-
return findByBranchList(input).toOutput();
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
private GitBranch findByBranchList(GetGitBranchFromNameInput input) {
|
| 40 |
-
Optional<GitBranch> optGitBranch = gitBranchRepository.findByNameEqualsIgnoreCase(input.getName());
|
| 41 |
-
GitBranch gitBranch = new GitBranch();
|
| 42 |
-
|
| 43 |
-
if (optGitBranch.isPresent()) {
|
| 44 |
-
gitBranch = optGitBranch.get();
|
| 45 |
-
}
|
| 46 |
-
return gitBranch;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/domain/service/clientbe/notification/notificationImpl/PushServiceImpl.java
CHANGED
|
@@ -39,11 +39,11 @@ public class PushServiceImpl implements PushService {
|
|
| 39 |
.build();
|
| 40 |
String jsonBody = mapper.writeValueAsString(pnBody);
|
| 41 |
var clientResponse = clientService.sendToTopic(input.toRequest(jsonBody));
|
| 42 |
-
saveLogAssembler.assemble(input.getInfoModel(),input.getDomainCode(), LogType.INFO, clientResponse.getMessageId());
|
| 43 |
|
| 44 |
} catch (Exception e) {
|
| 45 |
log.error("An error occurrence: {}", e.getMessage());
|
| 46 |
-
saveLogAssembler.assemble(input.getInfoModel(),input.getDomainCode(), LogType.ERROR, null);
|
| 47 |
}
|
| 48 |
|
| 49 |
}
|
|
@@ -64,7 +64,7 @@ public class PushServiceImpl implements PushService {
|
|
| 64 |
.build();
|
| 65 |
String jsonBody = mapper.writeValueAsString(pnBody);
|
| 66 |
var clientResponse = clientService.sendToToken(input.toRequest(jsonBody,fcmToken));
|
| 67 |
-
saveLogAssembler.assemble(input.getInfoModel(),null, LogType.INFO, clientResponse.getMessageId());
|
| 68 |
|
| 69 |
}
|
| 70 |
|
|
@@ -72,7 +72,7 @@ public class PushServiceImpl implements PushService {
|
|
| 72 |
|
| 73 |
} catch (Exception e) {
|
| 74 |
log.error("An error occurrence: {}", e.getMessage());
|
| 75 |
-
saveLogAssembler.assemble(input.getInfoModel(),null, LogType.ERROR, null);
|
| 76 |
}
|
| 77 |
}
|
| 78 |
|
|
|
|
| 39 |
.build();
|
| 40 |
String jsonBody = mapper.writeValueAsString(pnBody);
|
| 41 |
var clientResponse = clientService.sendToTopic(input.toRequest(jsonBody));
|
| 42 |
+
saveLogAssembler.assemble(input.getInfoModel(),"",input.getDomainCode(), LogType.INFO, clientResponse.getMessageId());
|
| 43 |
|
| 44 |
} catch (Exception e) {
|
| 45 |
log.error("An error occurrence: {}", e.getMessage());
|
| 46 |
+
saveLogAssembler.assemble(input.getInfoModel(),"",input.getDomainCode(), LogType.ERROR, null);
|
| 47 |
}
|
| 48 |
|
| 49 |
}
|
|
|
|
| 64 |
.build();
|
| 65 |
String jsonBody = mapper.writeValueAsString(pnBody);
|
| 66 |
var clientResponse = clientService.sendToToken(input.toRequest(jsonBody,fcmToken));
|
| 67 |
+
saveLogAssembler.assemble(input.getInfoModel(),input.getCustomerNumber(),null, LogType.INFO, clientResponse.getMessageId());
|
| 68 |
|
| 69 |
}
|
| 70 |
|
|
|
|
| 72 |
|
| 73 |
} catch (Exception e) {
|
| 74 |
log.error("An error occurrence: {}", e.getMessage());
|
| 75 |
+
saveLogAssembler.assemble(input.getInfoModel(),input.getCustomerNumber(),null, LogType.ERROR, null);
|
| 76 |
}
|
| 77 |
}
|
| 78 |
|
src/main/java/com/utility/utilitycommonservice/integration/config/bitbucket/EmptyObjectProvider.java
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.config.bitbucket;
|
| 2 |
-
|
| 3 |
-
import org.springframework.beans.BeansException;
|
| 4 |
-
import org.springframework.beans.factory.ObjectProvider;
|
| 5 |
-
|
| 6 |
-
import java.util.function.Consumer;
|
| 7 |
-
|
| 8 |
-
public class EmptyObjectProvider<T> implements ObjectProvider<T> {
|
| 9 |
-
|
| 10 |
-
public T getObject(Object... args) throws BeansException {
|
| 11 |
-
return null;
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
public T getObject() throws BeansException {
|
| 15 |
-
return null;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
public T getIfAvailable() throws BeansException {
|
| 19 |
-
return null;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
public T getIfUnique() throws BeansException {
|
| 23 |
-
return null;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
public void forEach(Consumer action) {
|
| 27 |
-
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/config/bitbucket/RestTemplateConfig.java
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.config.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.interceptor.bitbucket.BitbucketAuthHttpClientInterceptor;
|
| 4 |
-
import lombok.RequiredArgsConstructor;
|
| 5 |
-
import org.springframework.context.annotation.Bean;
|
| 6 |
-
import org.springframework.context.annotation.Configuration;
|
| 7 |
-
import org.springframework.web.client.RestTemplate;
|
| 8 |
-
|
| 9 |
-
@Configuration
|
| 10 |
-
@RequiredArgsConstructor
|
| 11 |
-
public class RestTemplateConfig {
|
| 12 |
-
|
| 13 |
-
private final BitbucketAuthHttpClientInterceptor authHttpClientInterceptor;
|
| 14 |
-
|
| 15 |
-
@Bean
|
| 16 |
-
public RestTemplate restTemplate() {
|
| 17 |
-
RestTemplate restTemplate = new RestTemplate();
|
| 18 |
-
restTemplate.getInterceptors().add(authHttpClientInterceptor);
|
| 19 |
-
return restTemplate;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/interceptor/bitbucket/BitbucketAuthHttpClientInterceptor.java
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.interceptor.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.common.util.BitbucketBasicAuthGenerator;
|
| 4 |
-
import lombok.RequiredArgsConstructor;
|
| 5 |
-
import org.springframework.http.HttpRequest;
|
| 6 |
-
import org.springframework.http.client.ClientHttpRequestExecution;
|
| 7 |
-
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
| 8 |
-
import org.springframework.http.client.ClientHttpResponse;
|
| 9 |
-
import org.springframework.stereotype.Component;
|
| 10 |
-
|
| 11 |
-
import java.io.IOException;
|
| 12 |
-
|
| 13 |
-
@Component
|
| 14 |
-
@RequiredArgsConstructor
|
| 15 |
-
public class BitbucketAuthHttpClientInterceptor implements ClientHttpRequestInterceptor {
|
| 16 |
-
|
| 17 |
-
private final BitbucketBasicAuthGenerator generator;
|
| 18 |
-
public static final String AUTHORIZATION = "Authorization";
|
| 19 |
-
|
| 20 |
-
@Override
|
| 21 |
-
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
|
| 22 |
-
throws IOException {
|
| 23 |
-
request.getHeaders().add(AUTHORIZATION, generator.generate());
|
| 24 |
-
return execution.execute(request,body);
|
| 25 |
-
}
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/Author.java
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model;
|
| 2 |
-
|
| 3 |
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
| 4 |
-
import lombok.AllArgsConstructor;
|
| 5 |
-
import lombok.Builder;
|
| 6 |
-
import lombok.Data;
|
| 7 |
-
import lombok.NoArgsConstructor;
|
| 8 |
-
|
| 9 |
-
@Data
|
| 10 |
-
@Builder
|
| 11 |
-
@AllArgsConstructor
|
| 12 |
-
@NoArgsConstructor
|
| 13 |
-
@JsonIgnoreProperties(ignoreUnknown = true)
|
| 14 |
-
public class Author {
|
| 15 |
-
private String type;
|
| 16 |
-
private String raw;
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/MultipartInputStreamFileResource.java
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model;
|
| 2 |
-
|
| 3 |
-
import org.springframework.core.io.InputStreamResource;
|
| 4 |
-
|
| 5 |
-
import java.io.InputStream;
|
| 6 |
-
|
| 7 |
-
public class MultipartInputStreamFileResource extends InputStreamResource {
|
| 8 |
-
|
| 9 |
-
private final String filename;
|
| 10 |
-
private final long contentLength;
|
| 11 |
-
|
| 12 |
-
public MultipartInputStreamFileResource(InputStream inputStream, String filename, long contentLength) {
|
| 13 |
-
super(inputStream);
|
| 14 |
-
this.filename = filename;
|
| 15 |
-
this.contentLength = contentLength;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
@Override
|
| 19 |
-
public String getFilename() {
|
| 20 |
-
return filename;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
@Override
|
| 24 |
-
public long contentLength() {
|
| 25 |
-
return contentLength;
|
| 26 |
-
}
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/Target.java
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model;
|
| 2 |
-
|
| 3 |
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
| 4 |
-
import lombok.AllArgsConstructor;
|
| 5 |
-
import lombok.Builder;
|
| 6 |
-
import lombok.Data;
|
| 7 |
-
import lombok.NoArgsConstructor;
|
| 8 |
-
|
| 9 |
-
@Data
|
| 10 |
-
@Builder
|
| 11 |
-
@AllArgsConstructor
|
| 12 |
-
@NoArgsConstructor
|
| 13 |
-
@JsonIgnoreProperties(ignoreUnknown = true)
|
| 14 |
-
public class Target {
|
| 15 |
-
|
| 16 |
-
private String type;
|
| 17 |
-
private String hash;
|
| 18 |
-
private Author author;
|
| 19 |
-
|
| 20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/CreateBranchClientRequest.java
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class CreateBranchClientRequest {
|
| 9 |
-
private String newBranch;
|
| 10 |
-
private String fromBranch;
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/CreatePullRequestClientRequest.java
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class CreatePullRequestClientRequest {
|
| 9 |
-
private String sourceBranch;
|
| 10 |
-
private String destinationBranch;
|
| 11 |
-
private String title;
|
| 12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/DeleteFileClientRequest.java
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class DeleteFileClientRequest {
|
| 9 |
-
|
| 10 |
-
private String path;
|
| 11 |
-
private String branch;
|
| 12 |
-
|
| 13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/GetBranchHeadHashClientRequest.java
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class GetBranchHeadHashClientRequest {
|
| 9 |
-
private String branch;
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/ListRepositoryFilesClientRequest.java
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
|
| 6 |
-
@Data
|
| 7 |
-
@Builder
|
| 8 |
-
public class ListRepositoryFilesClientRequest {
|
| 9 |
-
private String branch;
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/request/bitbucket/UploadFileClientRequest.java
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.request.bitbucket;
|
| 2 |
-
|
| 3 |
-
import lombok.Builder;
|
| 4 |
-
import lombok.Data;
|
| 5 |
-
import org.springframework.web.multipart.MultipartFile;
|
| 6 |
-
|
| 7 |
-
@Data
|
| 8 |
-
@Builder
|
| 9 |
-
public class UploadFileClientRequest {
|
| 10 |
-
|
| 11 |
-
private MultipartFile multipartFile;
|
| 12 |
-
private String path;
|
| 13 |
-
String branch;
|
| 14 |
-
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/model/response/bitbucket/CreateBranchClientResponse.java
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.model.response.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
| 4 |
-
import com.utility.utilitycommonservice.domain.model.bitbucket.output.CreateBranchOutput;
|
| 5 |
-
import com.utility.utilitycommonservice.integration.service.model.Target;
|
| 6 |
-
import lombok.AllArgsConstructor;
|
| 7 |
-
import lombok.Builder;
|
| 8 |
-
import lombok.Data;
|
| 9 |
-
import lombok.NoArgsConstructor;
|
| 10 |
-
|
| 11 |
-
@Data
|
| 12 |
-
@Builder
|
| 13 |
-
@AllArgsConstructor
|
| 14 |
-
@NoArgsConstructor
|
| 15 |
-
@JsonIgnoreProperties(ignoreUnknown = true)
|
| 16 |
-
public class CreateBranchClientResponse {
|
| 17 |
-
|
| 18 |
-
private String name;
|
| 19 |
-
private Target target;
|
| 20 |
-
|
| 21 |
-
public CreateBranchOutput toOutput() {
|
| 22 |
-
return CreateBranchOutput.builder()
|
| 23 |
-
.name(name)
|
| 24 |
-
.target(target)
|
| 25 |
-
.build();
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/service/bitbucket/BitbucketClientService.java
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.service.bitbucket;
|
| 2 |
-
|
| 3 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.*;
|
| 4 |
-
import com.utility.utilitycommonservice.integration.service.model.response.bitbucket.CreateBranchClientResponse;
|
| 5 |
-
|
| 6 |
-
public interface BitbucketClientService {
|
| 7 |
-
|
| 8 |
-
String uploadFile(UploadFileClientRequest request);
|
| 9 |
-
|
| 10 |
-
String deleteFile(DeleteFileClientRequest request);
|
| 11 |
-
|
| 12 |
-
CreateBranchClientResponse createBranch(CreateBranchClientRequest request);
|
| 13 |
-
|
| 14 |
-
String createPullRequest(CreatePullRequestClientRequest request);
|
| 15 |
-
|
| 16 |
-
String getBranchHeadHash(GetBranchHeadHashClientRequest request);
|
| 17 |
-
|
| 18 |
-
String listRepositoryFiles(ListRepositoryFilesClientRequest request);
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/java/com/utility/utilitycommonservice/integration/service/service/bitbucket/impl/BitbucketClientServiceImpl.java
DELETED
|
@@ -1,160 +0,0 @@
|
|
| 1 |
-
package com.utility.utilitycommonservice.integration.service.service.bitbucket.impl;
|
| 2 |
-
|
| 3 |
-
import com.fasterxml.jackson.core.JsonProcessingException;
|
| 4 |
-
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 5 |
-
import com.utility.utilitycommonservice.domain.properties.BitbucketProperties;
|
| 6 |
-
import com.utility.utilitycommonservice.integration.service.model.MultipartInputStreamFileResource;
|
| 7 |
-
import com.utility.utilitycommonservice.integration.service.model.request.bitbucket.*;
|
| 8 |
-
import com.utility.utilitycommonservice.integration.service.model.response.bitbucket.CreateBranchClientResponse;
|
| 9 |
-
import com.utility.utilitycommonservice.integration.service.service.bitbucket.BitbucketClientService;
|
| 10 |
-
import lombok.RequiredArgsConstructor;
|
| 11 |
-
import org.springframework.http.HttpEntity;
|
| 12 |
-
import org.springframework.http.HttpHeaders;
|
| 13 |
-
import org.springframework.http.MediaType;
|
| 14 |
-
import org.springframework.http.ResponseEntity;
|
| 15 |
-
import org.springframework.stereotype.Service;
|
| 16 |
-
import org.springframework.util.LinkedMultiValueMap;
|
| 17 |
-
import org.springframework.util.MultiValueMap;
|
| 18 |
-
import org.springframework.web.client.RestTemplate;
|
| 19 |
-
|
| 20 |
-
import java.io.IOException;
|
| 21 |
-
import java.util.Map;
|
| 22 |
-
|
| 23 |
-
@Service
|
| 24 |
-
@RequiredArgsConstructor
|
| 25 |
-
public class BitbucketClientServiceImpl implements BitbucketClientService {
|
| 26 |
-
|
| 27 |
-
private final RestTemplate restTemplate;
|
| 28 |
-
|
| 29 |
-
private final BitbucketProperties properties;
|
| 30 |
-
private final ObjectMapper objectMapper = new ObjectMapper();
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
@Override
|
| 34 |
-
public String uploadFile(UploadFileClientRequest request) {
|
| 35 |
-
try {
|
| 36 |
-
String url = String.format(
|
| 37 |
-
properties.getUrl() + properties.getUploadFilePath(),
|
| 38 |
-
properties.getWorkspace(), properties.getRepository()
|
| 39 |
-
);
|
| 40 |
-
|
| 41 |
-
HttpHeaders headers = new HttpHeaders();
|
| 42 |
-
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
| 43 |
-
|
| 44 |
-
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
|
| 45 |
-
body.add("message", "upload: " + request.getPath());
|
| 46 |
-
body.add("branch", request.getBranch() != null ? request.getBranch() : properties.getDefaultBranch());
|
| 47 |
-
|
| 48 |
-
body.add(request.getPath(), new MultipartInputStreamFileResource(
|
| 49 |
-
request.getMultipartFile().getInputStream(), request.getMultipartFile().getOriginalFilename(), request.getMultipartFile().getSize()
|
| 50 |
-
));
|
| 51 |
-
|
| 52 |
-
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
| 53 |
-
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
|
| 54 |
-
|
| 55 |
-
return response.getBody();
|
| 56 |
-
|
| 57 |
-
} catch (IOException e) {
|
| 58 |
-
throw new RuntimeException("File upload failed", e);
|
| 59 |
-
}
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
@Override
|
| 63 |
-
public String deleteFile(DeleteFileClientRequest request) {
|
| 64 |
-
String url = String.format(
|
| 65 |
-
properties.getUrl() + properties.getDeleteFilePath(),
|
| 66 |
-
properties.getWorkspace(), properties.getRepository()
|
| 67 |
-
);
|
| 68 |
-
|
| 69 |
-
HttpHeaders headers = new HttpHeaders();
|
| 70 |
-
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
| 71 |
-
|
| 72 |
-
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
|
| 73 |
-
body.add("files", request.getPath());
|
| 74 |
-
body.add("message", "delete: " + request.getPath());
|
| 75 |
-
body.add("branch", request.getBranch() != null ? request.getBranch() : properties.getDefaultBranch());
|
| 76 |
-
|
| 77 |
-
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
| 78 |
-
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
|
| 79 |
-
|
| 80 |
-
return response.getBody();
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
@Override
|
| 84 |
-
public CreateBranchClientResponse createBranch(CreateBranchClientRequest request) {
|
| 85 |
-
String url = String.format(
|
| 86 |
-
properties.getUrl() + properties.getCreateBranchPath(),
|
| 87 |
-
properties.getWorkspace(), properties.getRepository()
|
| 88 |
-
);
|
| 89 |
-
|
| 90 |
-
String hash = getBranchHeadHash(GetBranchHeadHashClientRequest.builder()
|
| 91 |
-
.branch(request.getFromBranch()).build());
|
| 92 |
-
|
| 93 |
-
HttpHeaders headers = new HttpHeaders();
|
| 94 |
-
headers.setContentType(MediaType.APPLICATION_JSON);
|
| 95 |
-
|
| 96 |
-
Map<String, Object> body = Map.of(
|
| 97 |
-
"name", request.getNewBranch(),
|
| 98 |
-
"target", Map.of("hash", hash)
|
| 99 |
-
);
|
| 100 |
-
|
| 101 |
-
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
| 102 |
-
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
|
| 103 |
-
String responseBody = response.getBody();
|
| 104 |
-
|
| 105 |
-
CreateBranchClientResponse clientResponse = null;
|
| 106 |
-
|
| 107 |
-
try {
|
| 108 |
-
clientResponse = objectMapper.readValue(responseBody,CreateBranchClientResponse.class);
|
| 109 |
-
} catch (JsonProcessingException e) {
|
| 110 |
-
throw new RuntimeException();
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
return clientResponse;
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
@Override
|
| 117 |
-
public String createPullRequest(CreatePullRequestClientRequest request) {
|
| 118 |
-
String url = String.format(
|
| 119 |
-
properties.getUrl() + properties.getPullRequestPath(),
|
| 120 |
-
properties.getWorkspace(), properties.getRepository()
|
| 121 |
-
);
|
| 122 |
-
|
| 123 |
-
HttpHeaders headers = new HttpHeaders();
|
| 124 |
-
headers.setContentType(MediaType.APPLICATION_JSON);
|
| 125 |
-
|
| 126 |
-
Map<String, Object> body = Map.of(
|
| 127 |
-
"title", request.getTitle(),
|
| 128 |
-
"source", Map.of("branch", Map.of("name", request.getSourceBranch())),
|
| 129 |
-
"destination", Map.of("branch", Map.of("name", request.getDestinationBranch()))
|
| 130 |
-
);
|
| 131 |
-
|
| 132 |
-
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
| 133 |
-
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
|
| 134 |
-
return response.getBody();
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
@Override
|
| 138 |
-
public String getBranchHeadHash(GetBranchHeadHashClientRequest request) {
|
| 139 |
-
String url = String.format(
|
| 140 |
-
properties.getUrl() + properties.getGetBranchPath(),
|
| 141 |
-
properties.getWorkspace(), properties.getRepository(), request.getBranch()
|
| 142 |
-
);
|
| 143 |
-
|
| 144 |
-
ResponseEntity<Map> response = restTemplate.getForEntity(url, Map.class);
|
| 145 |
-
Map<String, Object> body = response.getBody();
|
| 146 |
-
Map<String, String> target = (Map<String, String>) body.get("target");
|
| 147 |
-
return target.get("hash");
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
@Override
|
| 151 |
-
public String listRepositoryFiles(ListRepositoryFilesClientRequest request) {
|
| 152 |
-
String url = String.format(
|
| 153 |
-
properties.getUrl() + properties.getListRepositoryFilesPath(),
|
| 154 |
-
properties.getWorkspace(), properties.getRepository(), request.getBranch() != null ? request.getBranch() : properties.getDefaultBranch()
|
| 155 |
-
);
|
| 156 |
-
|
| 157 |
-
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
|
| 158 |
-
return response.getBody();
|
| 159 |
-
}
|
| 160 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/main/resources/application.yml
CHANGED
|
@@ -26,38 +26,20 @@ spring:
|
|
| 26 |
active: local
|
| 27 |
application:
|
| 28 |
name: utility-common-service
|
| 29 |
-
|
| 30 |
-
multipart:
|
| 31 |
-
enabled: true
|
| 32 |
-
max-file-size: 4000MB
|
| 33 |
-
max-request-size: 4000MB
|
| 34 |
server:
|
| 35 |
port: 9797
|
| 36 |
servlet:
|
| 37 |
-
context-path: /
|
| 38 |
|
| 39 |
localize:
|
| 40 |
resource:
|
| 41 |
path: src/main/resources/languages/
|
| 42 |
|
| 43 |
-
bitbucket:
|
| 44 |
-
username: dummy-services-admin
|
| 45 |
-
password: ATBBjtHe7KshREMPgKWQPrQWtrVx357E59FE
|
| 46 |
-
workspace: dummy-services
|
| 47 |
-
repository: cdn-resource
|
| 48 |
-
defaultBranch: dev
|
| 49 |
-
url: https://api.bitbucket.org/2.0
|
| 50 |
-
uploadFilePath: /repositories/%s/%s/src
|
| 51 |
-
deleteFilePath: /repositories/%s/%s/src
|
| 52 |
-
createBranchPath: /repositories/%s/%s/refs/branches
|
| 53 |
-
getBranchPath: /repositories/%s/%s/refs/branches/%s
|
| 54 |
-
pullRequestPath: /repositories/%s/%s/pullrequests
|
| 55 |
-
listRepositoryFilesPath: /repositories/%s/%s/src/%s/
|
| 56 |
-
|
| 57 |
integration:
|
| 58 |
security:
|
| 59 |
fcm-service:
|
| 60 |
-
base-url:
|
| 61 |
connect-timeout-ms: 3000
|
| 62 |
read-timeout-ms: 5000
|
| 63 |
get-token: /get-token
|
|
@@ -74,15 +56,15 @@ utility-common:
|
|
| 74 |
kafka:
|
| 75 |
consumer:
|
| 76 |
group-id: artandscience-core-group
|
| 77 |
-
brokers:
|
| 78 |
security:
|
| 79 |
protocol: SSL
|
| 80 |
ssl:
|
| 81 |
truststore:
|
| 82 |
-
location:
|
| 83 |
password: changeit
|
| 84 |
keystore:
|
| 85 |
-
location:
|
| 86 |
password: changeit
|
| 87 |
key:
|
| 88 |
password: changeit
|
|
@@ -93,17 +75,4 @@ consumer:
|
|
| 93 |
notification-batch: NOTIFICATION-BATCH
|
| 94 |
group-ids:
|
| 95 |
name:
|
| 96 |
-
notification-consumer-group: notification-consumer-group
|
| 97 |
-
|
| 98 |
-
logging:
|
| 99 |
-
level:
|
| 100 |
-
org:
|
| 101 |
-
hibernate:
|
| 102 |
-
SQL: DEBUG
|
| 103 |
-
orm:
|
| 104 |
-
jdbc:
|
| 105 |
-
bind: TRACE # Parametre değerlerini logla
|
| 106 |
-
extract: TRACE # (Opsiyonel) Sonuç okuma logları
|
| 107 |
-
# JdbcTemplate kullanıyorsanız aşağıdakiler de işinize yarar:
|
| 108 |
-
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
| 109 |
-
org.springframework.jdbc.core.StatementCreatorUtils: TRACE
|
|
|
|
| 26 |
active: local
|
| 27 |
application:
|
| 28 |
name: utility-common-service
|
| 29 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
server:
|
| 31 |
port: 9797
|
| 32 |
servlet:
|
| 33 |
+
context-path: /utility-service
|
| 34 |
|
| 35 |
localize:
|
| 36 |
resource:
|
| 37 |
path: src/main/resources/languages/
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
integration:
|
| 40 |
security:
|
| 41 |
fcm-service:
|
| 42 |
+
base-url: ${FCM_SERVICE_BASE_URL}/security-service/api/v1/fcm
|
| 43 |
connect-timeout-ms: 3000
|
| 44 |
read-timeout-ms: 5000
|
| 45 |
get-token: /get-token
|
|
|
|
| 56 |
kafka:
|
| 57 |
consumer:
|
| 58 |
group-id: artandscience-core-group
|
| 59 |
+
brokers: ${AIVEN_KAFKA_BOOTSTRAP}
|
| 60 |
security:
|
| 61 |
protocol: SSL
|
| 62 |
ssl:
|
| 63 |
truststore:
|
| 64 |
+
location: ${AIVEN_KAFKA_TRUSTSTORE_LOCATION}
|
| 65 |
password: changeit
|
| 66 |
keystore:
|
| 67 |
+
location: ${AIVEN_KAFKA_KEYSTORE_LOCATION}
|
| 68 |
password: changeit
|
| 69 |
key:
|
| 70 |
password: changeit
|
|
|
|
| 75 |
notification-batch: NOTIFICATION-BATCH
|
| 76 |
group-ids:
|
| 77 |
name:
|
| 78 |
+
notification-consumer-group: notification-consumer-group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|