use of org.eclipse.vorto.core.api.model.functionblock.ReturnType in project vorto by eclipse.
the class FunctionBlockXmlTemplate method handleOperations.
private void handleOperations(final FunctionBlock functionblock, final Object lwm2mObject, final InvocationContext context) {
final EList<Operation> operations = functionblock.getOperations();
for (final Operation operation : operations) {
if (!context.getMappedElement(operation, STEREOTYPE_RESOURCE).isMapped()) {
continue;
}
final Item item = new Item();
handleMappingRulesForOperations(lwm2mObject, operation, item, context);
// handle name
final String operName = operation.getName();
// 1:1 mapping
item.setName(operName);
// handle operation ==> operations : E
item.setOperations("E");
// handle description
String operDescr = operation.getDescription();
if (null == operDescr) {
// as default
operDescr = "";
}
item.setDescription(operDescr);
// handle operation parameters
final EList<Param> params = operation.getParams();
if (!params.isEmpty()) {
final String errMsg = "Unsupported operation <" + operName + "> with parameter(s) - Generator only supports One-way operations without parameter(s)!";
throw new IllegalArgumentException(errMsg);
}
final ReturnType returnType = operation.getReturnType();
if (returnType != null) {
final String errMsg = "Unsupported operation <" + operName + "> with return Type - Generator only supports One-way operations without parameter(s)!";
throw new IllegalArgumentException(errMsg);
}
checkResourceIdConflictAndFillSet(item);
}
}
Aggregations