use of org.contextmapper.tactic.dsl.tacticdsl.ComplexType in project context-mapper-dsl by ContextMapper.
the class GetTypeOfComplexTypeMethod method exec.
@Override
public Object exec(List arguments) throws TemplateModelException {
if (arguments.size() != 1)
throw new TemplateModelException("The method 'getType' takes only one parameter (ComplexType object)!");
Object object = ((WrapperTemplateModel) arguments.get(0)).getWrappedObject();
if (!(object instanceof ComplexType))
throw new TemplateModelException("The method 'getType' takes an object of the type ComplexType only! The given value is of the type '" + object.getClass().getName() + "'.");
ComplexType complexType = (ComplexType) object;
String type = "Object";
if (complexType.getDomainObjectType() != null)
type = complexType.getDomainObjectType().getName();
else if (complexType.getType() != null)
type = complexType.getType();
if (complexType.getCollectionType() != null && !CollectionType.NONE.equals(complexType.getCollectionType()))
return complexType.getCollectionType().getName() + "<" + type + ">";
return type;
}
use of org.contextmapper.tactic.dsl.tacticdsl.ComplexType in project context-mapper-dsl by ContextMapper.
the class MDSLDataTypeCreator method createComplexTypeForReference.
private ComplexType createComplexTypeForReference(Reference reference) {
ComplexType type = TacticdslFactory.eINSTANCE.createComplexType();
type.setCollectionType(reference.getCollectionType());
type.setDomainObjectType(reference.getDomainObjectType());
return type;
}
use of org.contextmapper.tactic.dsl.tacticdsl.ComplexType in project context-mapper-dsl by ContextMapper.
the class DeriveBoundedContextFromSubdomains method createComplexType.
private ComplexType createComplexType(SimpleDomainObject object, CollectionType collectionType) {
ComplexType complexType = createComplexType(object);
complexType.setCollectionType(collectionType);
return complexType;
}
use of org.contextmapper.tactic.dsl.tacticdsl.ComplexType 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.ComplexType in project context-mapper-dsl by ContextMapper.
the class DeriveBoundedContextFromSubdomains method createComplexType.
private ComplexType createComplexType(SimpleDomainObject object) {
ComplexType complexType = TacticdslFactory.eINSTANCE.createComplexType();
complexType.setDomainObjectType(object);
return complexType;
}
Aggregations