Search in sources :

Example 1 with SemanticCMLRefactoring

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

the class SplitAggregateByEntitiesRefactoringHandler method executeRefactoring.

@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
    Aggregate aggregate = (Aggregate) getSelectedElement();
    SemanticCMLRefactoring ar = new SplitAggregateByEntitiesRefactoring(aggregate.getName());
    ar.refactor(resource, getAllResources());
    ar.persistChanges(serializer);
}
Also used : SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) SplitAggregateByEntitiesRefactoring(org.contextmapper.dsl.refactoring.SplitAggregateByEntitiesRefactoring) Aggregate(org.contextmapper.dsl.contextMappingDSL.Aggregate)

Example 2 with SemanticCMLRefactoring

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

the class SplitBoundedContextByOwnerRefactoringHandler method executeRefactoring.

@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
    BoundedContext bc = (BoundedContext) getSelectedElement();
    SemanticCMLRefactoring ar = new SplitBoundedContextByOwner(bc.getName());
    ar.refactor(resource, getAllResources());
    ar.persistChanges(serializer);
}
Also used : SplitBoundedContextByOwner(org.contextmapper.dsl.refactoring.SplitBoundedContextByOwner) SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) BoundedContext(org.contextmapper.dsl.contextMappingDSL.BoundedContext)

Example 3 with SemanticCMLRefactoring

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

the class SwitchFromPartnershipToSharedKernelRefactoringHandler method executeRefactoring.

@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
    Partnership partnership = (Partnership) getSelectedElement();
    SemanticCMLRefactoring ar = new SwitchFromPartnershipToSharedKernelRefactoring(partnership.getParticipant1().getName(), partnership.getParticipant2().getName());
    ar.refactor(resource);
    ar.persistChanges(serializer);
}
Also used : Partnership(org.contextmapper.dsl.contextMappingDSL.Partnership) SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) SwitchFromPartnershipToSharedKernelRefactoring(org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring)

Example 4 with SemanticCMLRefactoring

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

the class AbstractRefactoringCommand method executeCommand.

@Override
public void executeCommand(CMLResource cmlResource, Document document, ILanguageServerAccess access, ExecuteCommandParams params) {
    access.getLanguageClient().applyEdit(new ApplyWorkspaceEditParams(editRecorder.recordWorkspaceEdit(access, cmlResource.getURI(), document, (Resource copiedResource) -> {
        CMLResource copiedCMLResource = new CMLResource(copiedResource);
        SemanticCMLRefactoring ar = getRefactoring(params);
        ar.refactor(copiedCMLResource);
    }), "Apply Architectural Refactoring (AR)"));
}
Also used : ApplyWorkspaceEditParams(org.eclipse.lsp4j.ApplyWorkspaceEditParams) SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) Resource(org.eclipse.emf.ecore.resource.Resource) CMLResource(org.contextmapper.dsl.cml.CMLResource) CMLResource(org.contextmapper.dsl.cml.CMLResource)

Example 5 with SemanticCMLRefactoring

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

the class RefactoringSerializationExceptionTest method canHandleNoEObjectDescriptionSerializationError.

@Test
public void canHandleNoEObjectDescriptionSerializationError() throws IOException {
    // given
    CMLResource cmlResource = getResourceCopyOfTestCML("NoEObjectDescriptionExceptionTest.cml");
    Set<String> userStories = Sets.newHashSet();
    userStories.add("UC1Ads");
    SemanticCMLRefactoring ar = new DeriveSubdomainFromUserRequirements("TestDomain", "TestSubdomain", userStories);
    // when, then
    assertThrows(RefactoringSerializationException.class, () -> {
        ar.refactor(cmlResource);
        ar.persistChanges(serializer);
    });
}
Also used : SemanticCMLRefactoring(org.contextmapper.dsl.refactoring.SemanticCMLRefactoring) DeriveSubdomainFromUserRequirements(org.contextmapper.dsl.refactoring.DeriveSubdomainFromUserRequirements) CMLResource(org.contextmapper.dsl.cml.CMLResource) Test(org.junit.jupiter.api.Test) AbstractCMLInputFileTest(org.contextmapper.dsl.AbstractCMLInputFileTest)

Aggregations

SemanticCMLRefactoring (org.contextmapper.dsl.refactoring.SemanticCMLRefactoring)9 CMLResource (org.contextmapper.dsl.cml.CMLResource)3 BoundedContext (org.contextmapper.dsl.contextMappingDSL.BoundedContext)3 SharedKernel (org.contextmapper.dsl.contextMappingDSL.SharedKernel)2 JsonArray (com.google.gson.JsonArray)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 Optional (java.util.Optional)1 AbstractCMLInputFileTest (org.contextmapper.dsl.AbstractCMLInputFileTest)1 Aggregate (org.contextmapper.dsl.contextMappingDSL.Aggregate)1 Partnership (org.contextmapper.dsl.contextMappingDSL.Partnership)1 ContextMapperApplicationException (org.contextmapper.dsl.exception.ContextMapperApplicationException)1 WorkspaceEditRecorder (org.contextmapper.dsl.ide.edit.WorkspaceEditRecorder)1 DeriveSubdomainFromUserRequirements (org.contextmapper.dsl.refactoring.DeriveSubdomainFromUserRequirements)1 ExtractSharedKernelRefactoring (org.contextmapper.dsl.refactoring.ExtractSharedKernelRefactoring)1 ExtractSuggestedService (org.contextmapper.dsl.refactoring.ExtractSuggestedService)1 SplitAggregateByEntitiesRefactoring (org.contextmapper.dsl.refactoring.SplitAggregateByEntitiesRefactoring)1 SplitBoundedContextByFeatures (org.contextmapper.dsl.refactoring.SplitBoundedContextByFeatures)1 SplitBoundedContextByOwner (org.contextmapper.dsl.refactoring.SplitBoundedContextByOwner)1 SwitchFromPartnershipToSharedKernelRefactoring (org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring)1 SwitchFromSharedKernelToPartnershipRefactoring (org.contextmapper.dsl.refactoring.SwitchFromSharedKernelToPartnershipRefactoring)1