generate separate PlantUML diagrams for meta-groups

This commit is contained in:
Michael Hoennig 2024-07-08 06:36:04 +02:00
parent af466dde2e
commit 672d4ce0f1
3 changed files with 151 additions and 48 deletions

View File

@ -1,8 +1,9 @@
### HostingAsset Type Structure
## HostingAsset Type Structure
### packages Webspace, Domain, Server
```plantuml
@startuml
left to right direction
package Booking #99bcdb {
@ -15,22 +16,10 @@ package Booking #99bcdb {
}
package Hosting #white {
package Server #99bcdb {
entity HA_CLOUD_SERVER
entity HA_MANAGED_SERVER
entity HA_IP_NUMBER
}
package PostgreSQL #99bcdb {
entity HA_PGSQL_INSTANCE
entity HA_PGSQL_USER
entity HA_PGSQL_DATABASE
}
package MariaDB #99bcdb {
entity HA_MARIADB_INSTANCE
entity HA_MARIADB_USER
entity HA_MARIADB_DATABASE
package Webspace #99bcdb {
entity HA_MANAGED_WEBSPACE
entity HA_UNIX_USER
entity HA_EMAIL_ALIAS
}
package Domain #99bcdb {
@ -41,10 +30,10 @@ package Hosting #white {
entity HA_EMAIL_ADDRESS
}
package Webspace #99bcdb {
entity HA_MANAGED_WEBSPACE
entity HA_UNIX_USER
entity HA_EMAIL_ALIAS
package Server #99bcdb {
entity HA_CLOUD_SERVER
entity HA_MANAGED_SERVER
entity HA_IP_NUMBER
}
}
@ -66,11 +55,56 @@ HA_DOMAIN_EMAIL_SUBMISSION_SETUP o..> HA_MANAGED_WEBSPACE
HA_DOMAIN_EMAIL_MAILBOX_SETUP *==> HA_MANAGED_WEBSPACE
HA_EMAIL_ALIAS *==> HA_MANAGED_WEBSPACE
HA_EMAIL_ADDRESS *==> HA_DOMAIN_EMAIL_MAILBOX_SETUP
HA_PGSQL_INSTANCE *==> HA_MANAGED_SERVER
HA_PGSQL_USER *==> HA_PGSQL_INSTANCE
HA_PGSQL_USER o..> HA_MANAGED_WEBSPACE
HA_PGSQL_DATABASE *==> HA_MANAGED_WEBSPACE
HA_PGSQL_DATABASE o..> HA_PGSQL_INSTANCE
HA_IP_NUMBER o..> HA_CLOUD_SERVER
HA_IP_NUMBER o..> HA_MANAGED_SERVER
HA_IP_NUMBER o..> HA_MANAGED_WEBSPACE
```
### packages Webspace, MariaDB, Server
```plantuml
@startuml
left to right direction
package Booking #99bcdb {
entity BI_PRIVATE_CLOUD
entity BI_CLOUD_SERVER
entity BI_MANAGED_SERVER
entity BI_MANAGED_WEBSPACE
entity BI_DOMAIN_DNS_SETUP
entity BI_DOMAIN_EMAIL_SUBMISSION_SETUP
}
package Hosting #white {
package Webspace #99bcdb {
entity HA_MANAGED_WEBSPACE
entity HA_UNIX_USER
entity HA_EMAIL_ALIAS
}
package MariaDB #99bcdb {
entity HA_MARIADB_INSTANCE
entity HA_MARIADB_USER
entity HA_MARIADB_DATABASE
}
package Server #99bcdb {
entity HA_CLOUD_SERVER
entity HA_MANAGED_SERVER
entity HA_IP_NUMBER
}
}
BI_CLOUD_SERVER o..> BI_PRIVATE_CLOUD
BI_MANAGED_SERVER o..> BI_PRIVATE_CLOUD
BI_MANAGED_WEBSPACE o..> BI_MANAGED_SERVER
HA_CLOUD_SERVER *==> BI_CLOUD_SERVER
HA_MANAGED_SERVER *==> BI_MANAGED_SERVER
HA_MANAGED_WEBSPACE *==> BI_MANAGED_WEBSPACE
HA_MANAGED_WEBSPACE o..> HA_MANAGED_SERVER
HA_UNIX_USER *==> HA_MANAGED_WEBSPACE
HA_EMAIL_ALIAS *==> HA_MANAGED_WEBSPACE
HA_MARIADB_INSTANCE *==> HA_MANAGED_SERVER
HA_MARIADB_USER *==> HA_MARIADB_INSTANCE
HA_MARIADB_USER o..> HA_MANAGED_WEBSPACE
@ -80,5 +114,59 @@ HA_IP_NUMBER o..> HA_CLOUD_SERVER
HA_IP_NUMBER o..> HA_MANAGED_SERVER
HA_IP_NUMBER o..> HA_MANAGED_WEBSPACE
```
### packages PostgreSQL, Webspace, Server
This code generated was by HsHostingAssetType.main, do not amend manually.
```plantuml
@startuml
left to right direction
package Booking #99bcdb {
entity BI_PRIVATE_CLOUD
entity BI_CLOUD_SERVER
entity BI_MANAGED_SERVER
entity BI_MANAGED_WEBSPACE
entity BI_DOMAIN_DNS_SETUP
entity BI_DOMAIN_EMAIL_SUBMISSION_SETUP
}
package Hosting #white {
package PostgreSQL #99bcdb {
entity HA_PGSQL_INSTANCE
entity HA_PGSQL_USER
entity HA_PGSQL_DATABASE
}
package Webspace #99bcdb {
entity HA_MANAGED_WEBSPACE
entity HA_UNIX_USER
entity HA_EMAIL_ALIAS
}
package Server #99bcdb {
entity HA_CLOUD_SERVER
entity HA_MANAGED_SERVER
entity HA_IP_NUMBER
}
}
BI_CLOUD_SERVER o..> BI_PRIVATE_CLOUD
BI_MANAGED_SERVER o..> BI_PRIVATE_CLOUD
BI_MANAGED_WEBSPACE o..> BI_MANAGED_SERVER
HA_CLOUD_SERVER *==> BI_CLOUD_SERVER
HA_MANAGED_SERVER *==> BI_MANAGED_SERVER
HA_MANAGED_WEBSPACE *==> BI_MANAGED_WEBSPACE
HA_MANAGED_WEBSPACE o..> HA_MANAGED_SERVER
HA_UNIX_USER *==> HA_MANAGED_WEBSPACE
HA_EMAIL_ALIAS *==> HA_MANAGED_WEBSPACE
HA_PGSQL_INSTANCE *==> HA_MANAGED_SERVER
HA_PGSQL_USER *==> HA_PGSQL_INSTANCE
HA_PGSQL_USER o..> HA_MANAGED_WEBSPACE
HA_PGSQL_DATABASE *==> HA_MANAGED_WEBSPACE
HA_PGSQL_DATABASE o..> HA_PGSQL_INSTANCE
HA_IP_NUMBER o..> HA_CLOUD_SERVER
HA_IP_NUMBER o..> HA_MANAGED_SERVER
HA_IP_NUMBER o..> HA_MANAGED_WEBSPACE
```
#This code generated was by HsHostingAssetType.main, do not amend manually.

View File

@ -9,11 +9,10 @@ import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.Set;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toSet;
import static net.hostsharing.hsadminng.hs.hosting.asset.EntityTypeRelation.*;
public enum HsHostingAssetType implements Node {
@ -137,13 +136,7 @@ public enum HsHostingAssetType implements Node {
return type == null ? null : type.name();
}
public static void main(final String[] args) throws IOException {
final var includedHostingGroups = stream(HsHostingAssetType.values())
.map(t -> t.groupName)
.collect(toSet());
// final var includedHostingGroups = Set.of("Domain", "Server", "Webspace");
private static void renderAsPlantUML(final Set<String> includedHostingGroups) throws IOException {
final String bookingNodes = stream(HsBookingItemType.values())
.map(t -> " entity " + t.nodeName())
.collect(joining("\n"));
@ -166,7 +159,7 @@ public enum HsHostingAssetType implements Node {
Files.writeString(
Path.of("doc/hs-hosting-asset-type-structure.md"),
"""
### HostingAsset Type Structure
### packages %{packages}
```plantuml
@startuml
@ -180,22 +173,18 @@ public enum HsHostingAssetType implements Node {
%{hostingGroups}
}
Booking -left-> Hosting
%{bookingItemEdges}
%{hostingAssetEdges}
```
This code generated was by %{this}.main, do not amend manually.
"""
.replace("%{this}", HsHostingAssetType.class.getSimpleName())
.replace("%{packages}", String.join(", ", includedHostingGroups))
.replace("%{bookingNodes}", bookingNodes)
.replace("%{hostingGroups}", hostingGroups)
.replace("%{hostingAssetNodeStyles}", hostingAssetNodes)
.replace("%{bookingItemEdges}", bookingItemEdges)
.replace("%{hostingAssetEdges}", hostingAssetEdges),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
StandardOpenOption.APPEND);
}
private static String generateGroup(final String group) {
@ -206,6 +195,33 @@ public enum HsHostingAssetType implements Node {
.collect(joining(" \n"))
+ "\n }\n";
}
public static void main(final String[] args) throws IOException {
Files.writeString(
Path.of("doc/hs-hosting-asset-type-structure.md"),
"""
## HostingAsset Type Structure
""",
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
// renderAsPlantUML(stream(HsHostingAssetType.values())
// .map(t -> t.groupName)
// .collect(toSet()));
renderAsPlantUML(Set.of("Domain", "Server", "Webspace"));
renderAsPlantUML(Set.of("Server", "Webspace", "MariaDB"));
renderAsPlantUML(Set.of("Server", "Webspace", "PostgreSQL"));
Files.writeString(
Path.of("doc/hs-hosting-asset-type-structure.md"),
"""
#This code generated was by %{this}.main, do not amend manually.
"""
.replace("%{this}", HsHostingAssetType.class.getSimpleName()),
StandardOpenOption.APPEND);
}
}
enum TypeRelationType {

View File

@ -2,7 +2,6 @@ package net.hostsharing.hsadminng.hs.hosting.asset.validators;
import lombok.SneakyThrows;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetEntity;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType;
import net.hostsharing.hsadminng.system.SystemProcess;
import java.util.List;