Skip to content

Commit 29e36ca

Browse files
committed
Add 'withId' function to Service class
1 parent e58ad4c commit 29e36ca

File tree

1 file changed

+15
-0
lines changed
  • src/main/kotlin/spp/protocol/platform/general

1 file changed

+15
-0
lines changed

src/main/kotlin/spp/protocol/platform/general/Service.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ data class Service(
9999
return copy(name = name)
100100
}
101101

102+
fun withId(id: String?): Service {
103+
if (id == null) return this
104+
val definition = IDManager.ServiceID.analysisId(id)
105+
if (name.contains("|")) {
106+
val parts = name.split("|")
107+
return copy(
108+
name = parts[0],
109+
environment = parts[1],
110+
commitId = parts[2],
111+
normal = definition.isReal
112+
)
113+
}
114+
return copy(name = definition.name, normal = definition.isReal)
115+
}
116+
102117
companion object {
103118

104119
@JvmStatic

0 commit comments

Comments
 (0)