move Parter+Debitor person+contact to related Relationsship #20

Merged
hsh-michaelhoennig merged 101 commits from remove-direct-partner-person-and-contact into master 2024-03-28 12:15:14 +01:00
Showing only changes of commit 85ad05a77e - Show all commits

View File

@ -11,9 +11,9 @@ import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.String.join;
import static java.util.stream.Collectors.joining;
import static net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsMermaidService.Include.*;
@Service
@ -103,11 +103,22 @@ public class RbacGrantsMermaidService {
private String toMermaidFlowchart(final HashSet<RawRbacGrantEntity> graph) {
return "%%{init:{'flowchart':{'htmlLabels':false}}}%%\n" +
"flowchart TB\n\n" + graph.stream().sorted()
.map(g -> node(g.getAscendantIdName(), g.getAscendingUuid()) +
"flowchart TB\n\n"
+ graph.stream()
.flatMap(g -> Stream.of(
new Node(g.getAscendantIdName(), g.getAscendingUuid()),
new Node(g.getAscendantIdName(), g.getAscendingUuid()))
)
.map(n -> node(n.idName(), n.uuid()))
.sorted()
.collect(joining("\n\n"))
+ "\n"
+ graph.stream()
.map(g -> quoted(g.getAscendantIdName()) +
(g.isAssumed() ? " --> " : " -.-> ") +
node(g.getDescendantIdName(), g.getDescendantUuid()))
.collect(Collectors.joining("\n"));
quoted(g.getDescendantIdName()))
.sorted()
.collect(joining("\n"));
}
private String node(final String idName, final UUID uuid) {
@ -128,7 +139,7 @@ public class RbacGrantsMermaidService {
final var objectName = idName.substring(refType.length()+1, idName.length() - roleType.length() - 1);
final var tableName = objectName.contains("#") ? objectName.split("#")[0] : "";
final var instanceName = objectName.contains("#") ? objectName.split("#", 2)[1] : objectName;
final var displayName = "\n" + (tableName.equals("global") ? "" : tableName) + "\n" + instanceName + "\n" + uuid + "\n" + roleType;
final var displayName = (tableName.equals("global") ? "" : tableName) + "\n" + instanceName + "\n" + uuid + "\n" + roleType;
return "[" + displayName + "]";
}
if (refType.equals("perm")) {
@ -146,3 +157,7 @@ public class RbacGrantsMermaidService {
return idName.replace(" ", ":").replaceAll("@.*", "");
}
}
record Node(String idName, UUID uuid) {
}