private static List<StreamColumn> convertOutputStreamColumns(List<OutputAttribute> outputAttributeList) { return outputAttributeList.stream().map(outputAttribute -> { StreamColumn streamColumn = new StreamColumn(); streamColumn.setName(outputAttribute.getRename()); streamColumn.setDescription(outputAttribute.getExpression().toString()); return streamColumn; }).collect(Collectors.toList()); } }
/** * obtains information of all the user defined Functions. */ private void loadFunctionData(SiddhiApp siddhiApp, List<OutputAttribute> functionList, SiddhiAppElements siddhiAppElements, String appData) { for (FunctionDefinition functionDefinition : siddhiApp.getFunctionDefinitionMap().values()) { for (OutputAttribute app : functionList) { if (app.getExpression() instanceof AttributeFunction) { if (functionDefinition.getId().equals(((AttributeFunction) app.getExpression()).getName())) { String functionDefinitionStr = getDefinition(functionDefinition, appData); siddhiAppElements.setFunction(functionDefinition.getId()); siddhiAppElements.setFunctionQuery(functionDefinitionStr); break; } } } } }
/** * Generates a SelectedAttribute object from the given Siddhi OutputAttribute * @param outputAttribute Siddhi OutputAttribute object * @return SelectedAttribute object * @throws DesignGenerationException Error while getting the definition of the OutputAttribute */ private SelectedAttribute generateSelectedAttribute(OutputAttribute outputAttribute) throws DesignGenerationException { SelectedAttribute selectedAttribute = new SelectedAttribute( ConfigBuildingUtilities.getDefinition(outputAttribute.getExpression(), siddhiAppString), outputAttribute.getRename()); preserveAndBindCodeSegment(outputAttribute, selectedAttribute); return selectedAttribute; } }