use of org.eclipse.vorto.repository.api.content.Operation in project vorto by eclipse.
the class ModelDtoFactory method createOperation.
private static Operation createOperation(org.eclipse.vorto.core.api.model.functionblock.Operation o) {
Operation operation = new Operation();
operation.setBreakable(o.isBreakable());
operation.setDescription(o.getDescription());
operation.setName(o.getName());
operation.setParams(o.getParams().stream().map(p -> createParam(p)).collect(Collectors.toList()));
if (o.getReturnType() != null) {
ReturnType returnType = new ReturnType();
returnType.setMultiple(o.getReturnType().isMultiplicity());
if (o.getReturnType() instanceof ReturnPrimitiveType) {
returnType.setPrimitive(true);
PrimitiveType pt = ((ReturnPrimitiveType) o.getReturnType()).getReturnType();
returnType.setType(org.eclipse.vorto.repository.api.content.PrimitiveType.valueOf(pt.name()));
} else {
returnType.setPrimitive(false);
returnType.setType(createModelId(((ReturnObjectType) o.getReturnType()).getReturnType()));
}
operation.setResult(returnType);
}
return operation;
}
Aggregations