Search in sources :

Example 1 with ExtractAggregatesByVolatility

use of org.contextmapper.dsl.refactoring.ExtractAggregatesByVolatility in project context-mapper-dsl by ContextMapper.

the class ExtractAggregatesByVolatilityRefactoringHandler method executeRefactoring.

@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
    BoundedContext bc = (BoundedContext) getSelectedElement();
    ExtractAggregatesByVolatilityContext refactoringContext = new ExtractAggregatesByVolatilityContext(bc.getAggregates().stream().map(agg -> agg.getLikelihoodForChange()).collect(Collectors.toList()));
    new WizardDialog(HandlerUtil.getActiveShell(event), new ExtractAggregatesByVolatilityRefactoringWizard(refactoringContext, executionContext -> {
        ExtractAggregatesByVolatility ar = new ExtractAggregatesByVolatility(bc.getName(), executionContext.getVolatilityToExtract());
        return finishRefactoring(ar, resource, event);
    })).open();
}
Also used : ExtractAggregatesByVolatilityContext(org.contextmapper.dsl.ui.handler.wizard.ExtractAggregatesByVolatilityContext) BoundedContext(org.contextmapper.dsl.contextMappingDSL.BoundedContext) ExtractAggregatesByVolatilityRefactoringWizard(org.contextmapper.dsl.ui.handler.wizard.ExtractAggregatesByVolatilityRefactoringWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ExtractAggregatesByVolatility(org.contextmapper.dsl.refactoring.ExtractAggregatesByVolatility)

Example 2 with ExtractAggregatesByVolatility

use of org.contextmapper.dsl.refactoring.ExtractAggregatesByVolatility in project context-mapper-dsl by ContextMapper.

the class ExtractAggregatesByVolatilityCommand method getRefactoring.

@Override
protected SemanticCMLRefactoring getRefactoring(ExecuteCommandParams params) {
    JsonArray refactoringParams = (JsonArray) params.getArguments().get(1);
    JsonPrimitive boundedContextName = (JsonPrimitive) refactoringParams.get(0);
    JsonPrimitive volatilityToExtract = (JsonPrimitive) refactoringParams.get(1);
    return new ExtractAggregatesByVolatility(boundedContextName.getAsString(), Volatility.valueOf(volatilityToExtract.getAsString()));
}
Also used : JsonArray(com.google.gson.JsonArray) JsonPrimitive(com.google.gson.JsonPrimitive) ExtractAggregatesByVolatility(org.contextmapper.dsl.refactoring.ExtractAggregatesByVolatility)

Aggregations

ExtractAggregatesByVolatility (org.contextmapper.dsl.refactoring.ExtractAggregatesByVolatility)2 JsonArray (com.google.gson.JsonArray)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 BoundedContext (org.contextmapper.dsl.contextMappingDSL.BoundedContext)1 ExtractAggregatesByVolatilityContext (org.contextmapper.dsl.ui.handler.wizard.ExtractAggregatesByVolatilityContext)1 ExtractAggregatesByVolatilityRefactoringWizard (org.contextmapper.dsl.ui.handler.wizard.ExtractAggregatesByVolatilityRefactoringWizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1