Skip to content

Instantly share code, notes, and snippets.

@simonbrowndotje
Last active August 29, 2015 14:03
Show Gist options
  • Save simonbrowndotje/711f3867c464d6958cb6 to your computer and use it in GitHub Desktop.
Save simonbrowndotje/711f3867c464d6958cb6 to your computer and use it in GitHub Desktop.
Creating one component view per controller
private static void createComponentViewsForWebApplication(Model model) {
SoftwareSystem techTribes = model.getSoftwareSystemWithName("techtribes.je");
Container contentUpdater = techTribes.getContainerWithName("Content Updater");
Container webApplication = techTribes.getContainerWithName("Web Application");
// create one component view per Spring controller
Set<Component> controllers = webApplication.getComponents().stream().filter(c -> c.getTechnology().equals("Spring Controller")).collect(Collectors.toSet());
for (Component controller : controllers) {
ComponentView view = model.createComponentView(techTribes, webApplication);
view.setDescription(controller.getName());
view.addAllSoftwareSystems();
view.addAllContainers();
view.remove(contentUpdater);
view.addAllComponents();
view.remove(webApplication.getComponentWithName("LoggingComponent"));
view.removeElementsThatCantBeReachedFrom(controller);
view.addAllPeople();
view.removeElementsWithNoRelationships();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment