diff --git a/org.contextmapper.dsl.tests/src/org/contextmapper/dsl/generators/plantuml/PlantUMLStakeholderDiagramCreatorTest.java b/org.contextmapper.dsl.tests/src/org/contextmapper/dsl/generators/plantuml/PlantUMLStakeholderDiagramCreatorTest.java index 70820546..2fdb67db 100644 --- a/org.contextmapper.dsl.tests/src/org/contextmapper/dsl/generators/plantuml/PlantUMLStakeholderDiagramCreatorTest.java +++ b/org.contextmapper.dsl.tests/src/org/contextmapper/dsl/generators/plantuml/PlantUMLStakeholderDiagramCreatorTest.java @@ -43,28 +43,34 @@ public void canCreateStakeholderDiagramWithContext() throws IOException { // then assertEquals("@startmindmap" + System.lineSeparator() + System.lineSeparator() + + "" + 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() + + "** 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() + 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() + + "** 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() + System.lineSeparator() + System.lineSeparator() + "@endmindmap" + System.lineSeparator(), stakeholderDiagram); @@ -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() + + "" + 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() + + "** 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() + + "" + 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() + System.lineSeparator() + System.lineSeparator() + "@endmindmap" + System.lineSeparator(), stakeholderDiagram); @@ -118,29 +130,35 @@ public void canCreateStakeholderDiagramWithDefaultContext() throws IOException { // then assertEquals("@startmindmap" + System.lineSeparator() + + System.lineSeparator() + + "" + 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() + + "** 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() + 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() + + "** 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() + System.lineSeparator() + System.lineSeparator() + "@endmindmap" + System.lineSeparator(), stakeholderDiagram); diff --git a/org.contextmapper.dsl/src/org/contextmapper/dsl/generator/plantuml/PlantUMLStakeholderMapGenerator.java b/org.contextmapper.dsl/src/org/contextmapper/dsl/generator/plantuml/PlantUMLStakeholderMapGenerator.java index 99805f94..1ba8251f 100644 --- a/org.contextmapper.dsl/src/org/contextmapper/dsl/generator/plantuml/PlantUMLStakeholderMapGenerator.java +++ b/org.contextmapper.dsl/src/org/contextmapper/dsl/generator/plantuml/PlantUMLStakeholderMapGenerator.java @@ -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); @@ -47,6 +49,19 @@ protected void printDiagramContent(final Stakeholders stakeholders) { printStakeholders(left); } + private void printStyles() { + sb.append(""); + linebreak(2); + } + public String getStakeholderDiagramContextName(final List bcs) { if (bcs != null && !bcs.isEmpty()) return String.join(", ", bcs.stream().map(bc -> bc.getName()).collect(Collectors.toList())); @@ -58,19 +73,32 @@ private void printStakeholders(final List 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(":").append(name).append(""); + linebreak(); + sb.append("----"); linebreak(); + sb.append(description).append(";"); + } else { + sb.append(" ").append(name).append(""); } + linebreak(); } private void initData(final Stakeholders stakeholders) {