use of org.archcnl.domain.input.model.presets.ArchitectureRuleConfig in project ArchCNL by Mari-Wie.
the class ArchitectureRuleSelection method addRulesToUi.
private void addRulesToUi(List<ArchitectureRuleConfig> rulesFromConfig) {
// TODO Auto-generated method stub
architectureRulesSelect = new CheckboxGroup<String>();
architectureRulesSelect.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL);
Set<String> knownRules = new HashSet<String>();
for (ArchitectureRuleConfig architectureRuleString : rulesFromConfig) {
knownRules.add(architectureRuleString.getRule());
}
architectureRulesSelect.setItems(knownRules);
VerticalLayout layout = new VerticalLayout();
layout.add(new Text("Please choose the architecture rules you want to apply."));
architectureRulesSelect.select(knownRules);
layout.setWidthFull();
layout.add(architectureRulesSelect);
add(layout);
}
use of org.archcnl.domain.input.model.presets.ArchitectureRuleConfig in project ArchCNL by Mari-Wie.
the class PresetsDialogPresenter method handleEvent.
private void handleEvent(ArchitectureRulesSelectedEvent event) {
ArchitectureRuleSelection ruleSelection = (ArchitectureRuleSelection) tabsToComponent.get(ruleSelectionTab);
Set<String> selectedRules = ruleSelection.getSelectedRules();
// deactivate the variable architecture informations that are not selected
for (ArchitectureRuleConfig ruleConfig : architectureConfig.getRules()) {
String ruleToCheck = ruleConfig.getRule();
if (!selectedRules.contains(ruleToCheck)) {
// if not selected set active to false
ruleConfig.setActive(false);
List<Integer> idsToDeactiate = ruleConfig.getRequiredArchitectureInformationIds();
List<ArchitectureInformation> variableArchitectureInfomation = architectureConfig.getVariableParts();
// loop all Architecture Information
for (ArchitectureInformation architectureInformation : variableArchitectureInfomation) {
// check if the id is within the ids that should be deactivated
if (idsToDeactiate.contains(architectureInformation.getId())) {
architectureInformation.setActive(false);
}
}
}
}
ArchitecturalStyleForm form = new ArchitecturalStyleForm(architectureConfig);
tabsToComponent.put(architectureInformationTab, form);
enableTab(architectureInformationTab);
tabs.setSelectedTab(architectureInformationTab);
view.updateTabsToComponent(tabsToComponent);
view.updateFooter(TabOptions.ARCHITECTURE_INFORMATION);
view.showTab(tabs.getSelectedTab());
}
use of org.archcnl.domain.input.model.presets.ArchitectureRuleConfig in project ArchCNL by Mari-Wie.
the class PresetsDialogPresenter method createRulesAndMappingsForMicroserviceArchitecture.
private void createRulesAndMappingsForMicroserviceArchitecture(ArchitectureRuleManager ruleManager, ConceptManager conceptManager, RelationManager relationManager) {
MicroserviceArchitectureBuilder microserviceArchitectureBuilder = new MicroserviceArchitectureBuilder();
ArchitecturalStyleForm form = (ArchitecturalStyleForm) tabsToComponent.get(architectureInformationTab);
Map<String, Binder<ArchitectureInformation>> architectureInfoBinders = form.getUngroupedArchitectureInformationBinders();
Map<Integer, Set<TwoColumnGridEntry>> architectureInformationGroupsAndEntries = form.getArchitectureInformationGroupsAndEntries();
// map ungrouped architecture information
mapUiInputToArchitectureInformation(microserviceArchitectureBuilder, architectureInfoBinders);
// map grouped architecture information
mapGroupedUIInputsToArchitectureInformation(microserviceArchitectureBuilder, architectureInformationGroupsAndEntries);
// create the rules
MicroserviceArchitecture microserviceArchitecture = microserviceArchitectureBuilder.build();
// only rules that are selected
Set<String> rulesToCreate = new HashSet<String>();
for (ArchitectureRuleConfig ruleConfig : architectureConfig.getRules()) {
if (ruleConfig.isActive()) {
rulesToCreate.add(ruleConfig.getRule());
}
}
microserviceArchitecture.setArchitectureRules(rulesToCreate);
microserviceArchitecture.createRulesAndMappings(ruleManager, conceptManager, relationManager);
// this updates Concepts/Rules/Relations in the MainView
fireEvent(new UpdateRulesConceptsAndRelationsRequestedEvent(this, false));
}
Aggregations