use of org.contextmapper.dsl.contextMappingDSL.UserRequirement in project context-mapper-dsl by ContextMapper.
the class GenerateSubdomainFromUserRequirementsRefactoringHandler method executeRefactoring.
@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
Set<UserRequirement> userRequirements = getAllSelectedElements().stream().filter(o -> o instanceof UserRequirement).map(o -> (UserRequirement) o).collect(Collectors.toSet());
List<String> allDomains = getCurrentContextMappingModel().getDomains().stream().map(d -> d.getName()).collect(Collectors.toList());
String initialDomain = allDomains.isEmpty() ? "" : allDomains.iterator().next();
DeriveSubdomainsFromRequirementsContext refactoringContext = new DeriveSubdomainsFromRequirementsContext(initialDomain, collectAllDomainsAndSubdomains(getCurrentContextMappingModel()));
new WizardDialog(HandlerUtil.getActiveShell(event), new DeriveSubdomainsFromRequirementsWizard(refactoringContext, executionContext -> {
return finishRefactoring(new DeriveSubdomainFromUserRequirements(executionContext.getDomainName(), executionContext.getSubdomainName(), userRequirements.stream().map(ur -> ur.getName()).collect(Collectors.toSet())), resource, event);
})).open();
}
use of org.contextmapper.dsl.contextMappingDSL.UserRequirement in project context-mapper-dsl by ContextMapper.
the class CMLModelObjectsResolvingHelper method resolveUserRequirements.
public Set<UserRequirement> resolveUserRequirements(BoundedContext boundedContext) {
Set<UserRequirement> requirements = Sets.newHashSet();
for (DomainPart domainPart : boundedContext.getImplementedDomainParts()) {
if (!(domainPart instanceof Subdomain))
continue;
Subdomain subdomain = (Subdomain) domainPart;
requirements.addAll(subdomain.getSupportedFeatures());
}
return requirements;
}
use of org.contextmapper.dsl.contextMappingDSL.UserRequirement in project context-mapper-dsl by ContextMapper.
the class SplitStoryByVerbCommand method getSubject.
@Override
protected EObject getSubject(CMLResource cmlResource, ExecuteCommandParams params) {
JsonArray quickFixParams = (JsonArray) params.getArguments().get(1);
JsonPrimitive storyName = (JsonPrimitive) quickFixParams.get(0);
UserRequirement story = cmlResource.getContextMappingModel().getUserRequirements().stream().filter(ur -> ur.getName().equals(storyName.getAsString())).findFirst().get();
if (story.getFeatures().size() != 1)
throw new ContextMapperApplicationException("Wrong validation implementation! This quickfix is only applicable to user stories with one and only one 'I want to' parts (features).");
return story.getFeatures().get(0);
}
use of org.contextmapper.dsl.contextMappingDSL.UserRequirement in project context-mapper-dsl by ContextMapper.
the class ServiceCutterOutputToContextMappingModelConverter method reconstructSubdomainToFeatureReferences.
private void reconstructSubdomainToFeatureReferences(Subdomain subDomain) {
List<UserRequirement> urReferences = Lists.newLinkedList();
for (UserRequirement ur : subDomain.getSupportedFeatures()) urReferences.add(model.getUserRequirements().stream().filter(u -> u.getName().equals(ur.getName())).findFirst().get());
subDomain.getSupportedFeatures().clear();
subDomain.getSupportedFeatures().addAll(urReferences);
}
use of org.contextmapper.dsl.contextMappingDSL.UserRequirement in project context-mapper-dsl by ContextMapper.
the class UserRepresentationsBuilder method buildUseCases.
private void buildUseCases() {
model.getUseCases().clear();
for (UserRequirement ur : contextMappingModel.getUserRequirements()) {
Set<String> nanoEntitiesRead = new NanoentityCollector().getNanoentitiesRead(ur);
Set<String> nanoEntitiesWritten = new NanoentityCollector().getNanoentitiesWritten(ur);
if (nanoEntitiesRead.isEmpty() && nanoEntitiesWritten.isEmpty())
continue;
// create one use case for each user requirement in CML (use case or user story
// in CML)
UseCase uc = factory.createUseCase();
uc.setName(ur.getName());
uc.getNanoentitiesRead().addAll(nanoEntitiesRead);
uc.getNanoentitiesWritten().addAll(nanoEntitiesWritten);
model.getUseCases().add(uc);
}
}
Aggregations