use of org.contextmapper.tactic.dsl.tacticdsl.Service in project context-mapper-dsl by ContextMapper.
the class AbstractPlantUMLClassDiagramCreator method printModule.
protected void printModule(SculptorModule module) {
sb.append("package ");
if (module.getBasePackage() != null && !"".equals(module.getBasePackage()))
sb.append(module.getBasePackage()).append(".").append(module.getName());
else
sb.append(module.getName());
sb.append(" {");
linebreak();
for (Aggregate aggregate : module.getAggregates()) {
printAggregate(aggregate, 1);
}
for (SimpleDomainObject simpleDomainObject : module.getDomainObjects()) {
printDomainObject(simpleDomainObject, 1);
}
for (Service service : module.getServices()) {
printService(service, 1);
}
sb.append("}");
linebreak();
}
use of org.contextmapper.tactic.dsl.tacticdsl.Service in project context-mapper-dsl by ContextMapper.
the class PlantUMLBoundedContextClassDiagramCreator method printApplication.
private void printApplication(Application application, int indentation) {
printIndentation(indentation);
String name = StringUtils.isNotEmpty(application.getName()) ? application.getName() : "Application";
sb.append("package ").append("\"'").append(name).append("'").append("\"").append(" <<Rectangle>> ").append("{");
linebreak();
if (!application.getFlows().isEmpty()) {
printIndentation(indentation + 1);
sb.append("legend left");
linebreak();
printIndentation(indentation + 2);
sb.append("This application layer contains flow definitions (visualization available via BPMN Sketch Miner).");
linebreak();
printIndentation(indentation + 1);
sb.append("end legend");
linebreak();
}
for (DomainEvent event : application.getEvents()) {
printDomainObject(event, indentation + 1);
}
for (CommandEvent command : application.getCommands()) {
printDomainObject(command, indentation + 1);
}
for (Service service : application.getServices()) {
printService(service, indentation + 1);
}
printIndentation(indentation);
sb.append("}");
linebreak();
}
use of org.contextmapper.tactic.dsl.tacticdsl.Service in project context-mapper-dsl by ContextMapper.
the class DeriveBoundedContextFromSubdomains method copyAndEnhanceOperations.
private void copyAndEnhanceOperations(Aggregate aggregate, Service source, Service target) {
Set<String> existingOperations = target.getOperations().stream().map(o -> o.getName()).collect(Collectors.toSet());
for (ServiceOperation sourceOperation : source.getOperations()) {
if (existingOperations.contains(sourceOperation.getName()))
continue;
ServiceOperation targetOperation = TacticdslFactory.eINSTANCE.createServiceOperation();
targetOperation.setName(sourceOperation.getName());
targetOperation.setDelegateHolder(sourceOperation.getDelegateHolder());
targetOperation.setHint(sourceOperation.getHint());
targetOperation.setDoc(sourceOperation.getDoc());
targetOperation.setPublish(sourceOperation.getPublish());
targetOperation.setThrows(sourceOperation.getThrows());
targetOperation.setVisibility(sourceOperation.getVisibility());
if (sourceOperation.getReturnType() == null)
targetOperation.setReturnType(getReturnType4Operation(aggregate, sourceOperation.getName()));
if (sourceOperation.getParameters().isEmpty()) {
ComplexType parameterType = getParameterType4Operation(aggregate, sourceOperation.getName());
addElementToEList(targetOperation.getParameters(), createParameter(getParameterName4ComplexType(parameterType), parameterType));
}
addElementToEList(target.getOperations(), targetOperation);
}
}
use of org.contextmapper.tactic.dsl.tacticdsl.Service in project context-mapper-dsl by ContextMapper.
the class DeriveSubdomainFromUserRequirements method deriveSubdomainEntities4Features.
private void deriveSubdomainEntities4Features(Subdomain subdomain, String urName, List<Feature> features) {
for (Feature feature : features) {
if (feature.getEntity() == null || "".equals(feature.getEntity()))
continue;
// create the entity
String entityName = createEntityIfNotExisting(feature.getEntity(), subdomain, feature.getEntityAttributes());
// create the service
String serviceName = urName.substring(0, 1).toUpperCase() + urName.substring(1) + "Service";
Optional<Service> alreadyExistingService = subdomain.getServices().stream().filter(s -> serviceName.equals(s.getName())).findFirst();
Service service;
if (!alreadyExistingService.isPresent()) {
service = createService(serviceName, entityName, feature.getVerb());
addElementToEList(subdomain.getServices(), service);
} else {
service = alreadyExistingService.get();
}
String operationName = feature.getVerb().replace(" ", "_") + entityName;
Optional<ServiceOperation> alreadyExistingServiceOperation = service.getOperations().stream().filter(o -> operationName.equals(o.getName())).findFirst();
if (!alreadyExistingServiceOperation.isPresent())
addElementToEList(service.getOperations(), createServiceOperation(operationName));
// create the entity that contains the one created above
if (feature.getContainerEntity() != null && !"".equals(feature.getContainerEntity()))
createEntityIfNotExisting(feature.getContainerEntity(), subdomain, Lists.newLinkedList());
}
}
use of org.contextmapper.tactic.dsl.tacticdsl.Service in project context-mapper-dsl by ContextMapper.
the class DeriveSubdomainFromUserRequirements method createService.
private Service createService(String serviceName, String entityName, String verb) {
Service service = TacticdslFactory.eINSTANCE.createService();
service.setName(serviceName);
return service;
}
Aggregations