Skip to content

Commit

Permalink
Stakeholder map: add descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-ka committed Aug 22, 2024
1 parent ab551e5 commit 50119ca
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,34 @@ public void canCreateStakeholderDiagramWithContext() throws IOException {
// then
assertEquals("@startmindmap" + System.lineSeparator()
+ System.lineSeparator()
+ "<style>" + System.lineSeparator()
+ "node {" + System.lineSeparator()
+ " MaximumWidth 300" + System.lineSeparator()
+ "}" + System.lineSeparator()
+ "</style>" + System.lineSeparator()
+ "" + System.lineSeparator()
+ "* SameDayDelivery" + System.lineSeparator()
+ "** Product_Suppliers" + System.lineSeparator()
+ "*** Managers" + System.lineSeparator()
+ "*** Logistics_Warehouse_Staff_of_Suppliers" + System.lineSeparator()
+ "*** Delivery_Staff_of_Suppliers" + System.lineSeparator()
+ "** Competing_Companies" + System.lineSeparator()
+ "** Government" + System.lineSeparator()
+ "** <b>Product_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Managers</b>" + System.lineSeparator()
+ "*** <b>Logistics_Warehouse_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Delivery_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "** <b>Competing_Companies</b>" + System.lineSeparator()
+ "** <b>Government</b>" + System.lineSeparator()
+ System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** Online_Shopping_Company" + System.lineSeparator()
+ "*** Development_Team" + System.lineSeparator()
+ "*** Product_Management" + System.lineSeparator()
+ "*** Customer_Relationship_Manager" + System.lineSeparator()
+ "** Delivery_Partners" + System.lineSeparator()
+ "*** Route_Planners" + System.lineSeparator()
+ "*** Drivers" + System.lineSeparator()
+ "** Logistics_Team" + System.lineSeparator()
+ "*** Logistics_Manager" + System.lineSeparator()
+ "*** Warehouse_Staff" + System.lineSeparator()
+ "** Customers_and_Shoppers" + System.lineSeparator()
+ "*** Shoppers_in_Emergency_Situations" + System.lineSeparator()
+ "*** Others" + System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** <b>Online_Shopping_Company</b>" + System.lineSeparator()
+ "*** <b>Development_Team</b>" + System.lineSeparator()
+ "*** <b>Product_Management</b>" + System.lineSeparator()
+ "*** <b>Customer_Relationship_Manager</b>" + System.lineSeparator()
+ "** <b>Delivery_Partners</b>" + System.lineSeparator()
+ "*** <b>Route_Planners</b>" + System.lineSeparator()
+ "*** <b>Drivers</b>" + System.lineSeparator()
+ "** <b>Logistics_Team</b>" + System.lineSeparator()
+ "*** <b>Logistics_Manager</b>" + System.lineSeparator()
+ "*** <b>Warehouse_Staff</b>" + System.lineSeparator()
+ "** <b>Customers_and_Shoppers</b>" + System.lineSeparator()
+ "*** <b>Shoppers_in_Emergency_Situations</b>" + System.lineSeparator()
+ "*** <b>Others</b>" + System.lineSeparator()
+ System.lineSeparator()
+ System.lineSeparator()
+ "@endmindmap" + System.lineSeparator(), stakeholderDiagram);
Expand All @@ -81,28 +87,34 @@ public void canCreateStakeholderDiagramWithMultipleContext() throws IOException
// then
assertEquals("@startmindmap" + System.lineSeparator()
+ System.lineSeparator()
+ "* SameDayDelivery, Context2" + System.lineSeparator()
+ "** Product_Suppliers" + System.lineSeparator()
+ "*** Managers" + System.lineSeparator()
+ "*** Logistics_Warehouse_Staff_of_Suppliers" + System.lineSeparator()
+ "*** Delivery_Staff_of_Suppliers" + System.lineSeparator()
+ "** Competing_Companies" + System.lineSeparator()
+ "** Government" + System.lineSeparator()
+ "<style>" + System.lineSeparator()
+ "node {" + System.lineSeparator()
+ " MaximumWidth 300" + System.lineSeparator()
+ "}" + System.lineSeparator()
+ "</style>" + System.lineSeparator()
+ System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** Online_Shopping_Company" + System.lineSeparator()
+ "*** Development_Team" + System.lineSeparator()
+ "*** Product_Management" + System.lineSeparator()
+ "*** Customer_Relationship_Manager" + System.lineSeparator()
+ "** Delivery_Partners" + System.lineSeparator()
+ "*** Route_Planners" + System.lineSeparator()
+ "*** Drivers" + System.lineSeparator()
+ "** Logistics_Team" + System.lineSeparator()
+ "*** Logistics_Manager" + System.lineSeparator()
+ "*** Warehouse_Staff" + System.lineSeparator()
+ "** Customers_and_Shoppers" + System.lineSeparator()
+ "*** Shoppers_in_Emergency_Situations" + System.lineSeparator()
+ "*** Others" + System.lineSeparator()
+ "* SameDayDelivery, Context2" + System.lineSeparator()
+ "** <b>Product_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Managers</b>" + System.lineSeparator()
+ "*** <b>Logistics_Warehouse_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Delivery_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "** <b>Competing_Companies</b>" + System.lineSeparator()
+ "** <b>Government</b>" + System.lineSeparator()
+ "" + System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** <b>Online_Shopping_Company</b>" + System.lineSeparator()
+ "*** <b>Development_Team</b>" + System.lineSeparator()
+ "*** <b>Product_Management</b>" + System.lineSeparator()
+ "*** <b>Customer_Relationship_Manager</b>" + System.lineSeparator()
+ "** <b>Delivery_Partners</b>" + System.lineSeparator()
+ "*** <b>Route_Planners</b>" + System.lineSeparator()
+ "*** <b>Drivers</b>" + System.lineSeparator()
+ "** <b>Logistics_Team</b>" + System.lineSeparator()
+ "*** <b>Logistics_Manager</b>" + System.lineSeparator()
+ "*** <b>Warehouse_Staff</b>" + System.lineSeparator()
+ "** <b>Customers_and_Shoppers</b>" + System.lineSeparator()
+ "*** <b>Shoppers_in_Emergency_Situations</b>" + System.lineSeparator()
+ "*** <b>Others</b>" + System.lineSeparator()
+ System.lineSeparator()
+ System.lineSeparator()
+ "@endmindmap" + System.lineSeparator(), stakeholderDiagram);
Expand All @@ -118,29 +130,35 @@ public void canCreateStakeholderDiagramWithDefaultContext() throws IOException {

// then
assertEquals("@startmindmap" + System.lineSeparator()
+ System.lineSeparator()
+ "<style>" + System.lineSeparator()
+ "node {" + System.lineSeparator()
+ " MaximumWidth 300" + System.lineSeparator()
+ "}" + System.lineSeparator()
+ "</style>" + System.lineSeparator()
+ System.lineSeparator()
+ "* System of Interest" + System.lineSeparator()
+ "** Product_Suppliers" + System.lineSeparator()
+ "*** Managers" + System.lineSeparator()
+ "*** Logistics_Warehouse_Staff_of_Suppliers" + System.lineSeparator()
+ "*** Delivery_Staff_of_Suppliers" + System.lineSeparator()
+ "** Competing_Companies" + System.lineSeparator()
+ "** Government" + System.lineSeparator()
+ "** <b>Product_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Managers</b>" + System.lineSeparator()
+ "*** <b>Logistics_Warehouse_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "*** <b>Delivery_Staff_of_Suppliers</b>" + System.lineSeparator()
+ "** <b>Competing_Companies</b>" + System.lineSeparator()
+ "** <b>Government</b>" + System.lineSeparator()
+ System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** Online_Shopping_Company" + System.lineSeparator()
+ "*** Development_Team" + System.lineSeparator()
+ "*** Product_Management" + System.lineSeparator()
+ "*** Customer_Relationship_Manager" + System.lineSeparator()
+ "** Delivery_Partners" + System.lineSeparator()
+ "*** Route_Planners" + System.lineSeparator()
+ "*** Drivers" + System.lineSeparator()
+ "** Logistics_Team" + System.lineSeparator()
+ "*** Logistics_Manager" + System.lineSeparator()
+ "*** Warehouse_Staff" + System.lineSeparator()
+ "** Customers_and_Shoppers" + System.lineSeparator()
+ "*** Shoppers_in_Emergency_Situations" + System.lineSeparator()
+ "*** Others" + System.lineSeparator()
+ "left side" + System.lineSeparator()
+ "** <b>Online_Shopping_Company</b>" + System.lineSeparator()
+ "*** <b>Development_Team</b>" + System.lineSeparator()
+ "*** <b>Product_Management</b>" + System.lineSeparator()
+ "*** <b>Customer_Relationship_Manager</b>" + System.lineSeparator()
+ "** <b>Delivery_Partners</b>" + System.lineSeparator()
+ "*** <b>Route_Planners</b>" + System.lineSeparator()
+ "*** <b>Drivers</b>" + System.lineSeparator()
+ "** <b>Logistics_Team</b>" + System.lineSeparator()
+ "*** <b>Logistics_Manager</b>" + System.lineSeparator()
+ "*** <b>Warehouse_Staff</b>" + System.lineSeparator()
+ "** <b>Customers_and_Shoppers</b>" + System.lineSeparator()
+ "*** <b>Shoppers_in_Emergency_Situations</b>" + System.lineSeparator()
+ "*** <b>Others</b>" + System.lineSeparator()
+ System.lineSeparator()
+ System.lineSeparator()
+ "@endmindmap" + System.lineSeparator(), stakeholderDiagram);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class PlantUMLStakeholderMapGenerator extends AbstractPlantUMLMindMapDiag
protected void printDiagramContent(final Stakeholders stakeholders) {
initData(stakeholders);

printStyles();

sb.append(STAR).append(" ").append(getStakeholderDiagramContextName(stakeholders.getContexts()));
linebreak();
printStakeholders(right);
Expand All @@ -47,6 +49,19 @@ protected void printDiagramContent(final Stakeholders stakeholders) {
printStakeholders(left);
}

private void printStyles() {
sb.append("<style>");
linebreak();
sb.append("node {");
linebreak();
sb.append(" MaximumWidth 300");
linebreak();
sb.append("}");
linebreak();
sb.append("</style>");
linebreak(2);
}

public String getStakeholderDiagramContextName(final List<BoundedContext> bcs) {
if (bcs != null && !bcs.isEmpty())
return String.join(", ", bcs.stream().map(bc -> bc.getName()).collect(Collectors.toList()));
Expand All @@ -58,19 +73,32 @@ private void printStakeholders(final List<AbstractStakeholder> stakeholders) {
if (s instanceof StakeholderGroup) {
printStakeholderGroup((StakeholderGroup) s);
} else if (s instanceof Stakeholder) {
sb.append(STAR).append(STAR).append(" " + s.getName());
linebreak();
printGeneralStakeholderLine(2, s.getName(), ((Stakeholder) s).getDescription());
}
}
}

private void printStakeholderGroup(final StakeholderGroup group) {
sb.append(STAR).append(STAR).append(" ").append(group.getName());
linebreak();
printGeneralStakeholderLine(2, group.getName(), null);
for (Stakeholder s : group.getStakeholders()) {
sb.append(STAR).append(STAR).append(STAR).append(" ").append(s.getName());
printGeneralStakeholderLine(3, s.getName(), s.getDescription());
}
}

private void printGeneralStakeholderLine(final int level, final String name, final String description) {
for (int i = 0; i < level; i++) {
sb.append(STAR);
}
if (description != null && !"".equals(description)) {
sb.append(":<b>").append(name).append("</b>");
linebreak();
sb.append("----");
linebreak();
sb.append(description).append(";");
} else {
sb.append(" <b>").append(name).append("</b>");
}
linebreak();
}

private void initData(final Stakeholders stakeholders) {
Expand Down

0 comments on commit 50119ca

Please sign in to comment.