refactor: apply MSA naming standard for DTOs and Scaffold template (Req->Request, Res->Response)
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 30s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 30s
This commit is contained in:
34
dto_refactor.ps1
Normal file
34
dto_refactor.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$extensions = @("*.java", "*.xml", "*.yml", "*.properties", "*.gradle", "*.md")
|
||||
$baseDir = "C:\eGovFrameDev-4.3.1-64bit\workspace-egov\axhub-backend-main"
|
||||
|
||||
Write-Host "Replacing text (Req -> Request, Res -> Response)..."
|
||||
Get-ChildItem -Path $baseDir -Include $extensions -Recurse -File | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
try {
|
||||
$content = Get-Content $_.FullName -Raw -Encoding UTF8
|
||||
$newContent = $content -creplace "Req\b", "Request"
|
||||
$newContent = $newContent -creplace "Res\b", "Response"
|
||||
if ($content -cne $newContent) {
|
||||
Write-Host "Updated text in: $($_.FullName)"
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding $False
|
||||
[System.IO.File]::WriteAllText($_.FullName, $newContent, $utf8NoBom)
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Skipped binary or locked file: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Renaming DTO files..."
|
||||
Get-ChildItem -Path $baseDir -Include *Req.java,*Res.java -Recurse -File | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
$newName = $_.Name -creplace "Req\.java$", "Request.java"
|
||||
$newName = $newName -creplace "Res\.java$", "Response.java"
|
||||
Write-Host "Renaming file: $($_.FullName) -> $newName"
|
||||
Rename-Item -Path $_.FullName -NewName $newName
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "DTO Refactoring completed!"
|
||||
Reference in New Issue
Block a user