use of org.contextmapper.dsl.refactoring.DeriveBoundedContextFromSubdomains in project context-mapper-dsl by ContextMapper.
the class GenerateBoundedContextFromSubdomainRefactoringHandler method executeRefactoring.
@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
Set<Subdomain> subdomains = getAllSelectedElements().stream().filter(sd -> sd instanceof Subdomain).map(sd -> (Subdomain) sd).collect(Collectors.toSet());
Set<String> boundedContexts = resource.getContextMappingModel().getBoundedContexts().stream().map(bc -> bc.getName()).collect(Collectors.toSet());
Set<String> ids = subdomains.stream().map(sd -> sd.getName()).collect(Collectors.toSet());
DeriveBoundedContextFromSubdomainsContext refactoringContext = new DeriveBoundedContextFromSubdomainsContext("NewContextFromSubdomains", boundedContexts);
new WizardDialog(HandlerUtil.getActiveShell(event), new DeriveBoundedContextFromSubdomainsWizard(refactoringContext, executionContext -> {
return finishRefactoring(new DeriveBoundedContextFromSubdomains(executionContext.getBoundedContextName(), ids), resource, event);
})).open();
}
use of org.contextmapper.dsl.refactoring.DeriveBoundedContextFromSubdomains in project context-mapper-dsl by ContextMapper.
the class DeriveBoundedContextFromSubdomainsCommand method getRefactoring.
@Override
protected SemanticCMLRefactoring getRefactoring(ExecuteCommandParams params) {
JsonArray refactoringParams = (JsonArray) params.getArguments().get(1);
JsonPrimitive boundedContextName = (JsonPrimitive) refactoringParams.get(0);
JsonArray selectedSubdomainsArray = (JsonArray) refactoringParams.get(1);
Set<String> selectedSubdomains = Sets.newHashSet();
for (JsonElement element : selectedSubdomainsArray) {
selectedSubdomains.add(element.getAsString());
}
return new DeriveBoundedContextFromSubdomains(boundedContextName.getAsString(), selectedSubdomains);
}
Aggregations