public static String autocast(StringValue x, String y) { return x.getValue(); } }
public String marshal(StringValue val) throws Exception { return val.getValue(); } }
public String getString() { return value.getValue(); }
public String marshal(StringValue val) throws Exception { return val.getValue(); } }
public static String autocast(StringValue x, String y) { return x.getValue(); } }
public String getDisplayName() { return displayValue.getValue(); }
public void addLabel(StringValue label) { if (!label.getValue().equals("")) { labels.add(label); } }
private boolean hasTypeAsReturn(StringValue fieldContent) { if (returnType == JavaOpenClass.VOID) { // for void functions return must be empty return fieldContent.getValue().equals(""); } IOpenClass typeOfField = getTypeOfField(fieldContent); return returnType.equals(typeOfField); } }
public static Map<String, AlgorithmTreeNode> getAllDeclaredLables(List<AlgorithmTreeNode> nodesToSearch) { Map<String, AlgorithmTreeNode> labels = new HashMap<String, AlgorithmTreeNode>(); for (AlgorithmTreeNode node : nodesToSearch) { for (StringValue labelOfNode : node.getLabels()) { labels.put(labelOfNode.getValue(), node); } labels.putAll(getAllDeclaredLables(node.getChildren())); } return labels; }
private static boolean isOperationNode(String operationName, AlgorithmTreeNode node) { return operationName.equalsIgnoreCase(node.getAlgorithmRow().getOperation().getValue()); }
private RuntimeOperation createOperationForFirstNodeField(List<AlgorithmTreeNode> nodesToCompile, String fieldName) throws Exception { // TODO: strange method, refactore String param = nodesToCompile.get(0).getAlgorithmRow().getOperation() + AlgorithmCompilerTool.FIELD_SEPARATOR + fieldName; StringValue content = AlgorithmCompilerTool.getCellContent(nodesToCompile, param); RuntimeOperation operation = null; if (content.getValue() != null && !content.getValue().trim().isEmpty()) { ConversionRuleStep conversionStep = new ConversionRuleStep("Perform", param, null, null, fieldName + " execution"); operation = operationFactory.createOperation(nodesToCompile, conversionStep); } return operation; }
public String getOperationName() { return sourceNode.getAlgorithmRow().getOperation().getValue(); }
@Override public boolean select(TableSyntaxNode node) { if (StringUtils.isBlank(value)) { return true; } String header = node.getHeaderLineValue().getValue(); return StringUtils.containsIgnoreCase(header, value); }
@Override public boolean select(TableSyntaxNode node) { if (StringUtils.isBlank(value)) { return true; } String header = node.getHeaderLineValue().getValue(); return StringUtils.containsIgnoreCase(header, value); }
@Override public Object convert(List<AlgorithmTreeNode> nodesToCompile, String operationParam) throws SyntaxNodeException { if (labelManager.isLabelInstruction(operationParam)) { return labelManager.getLabelByInstruction(operationParam); } else if (AlgorithmCompilerTool.isOperationFieldInstruction(operationParam)) { StringValue content = AlgorithmCompilerTool.getCellContent(nodesToCompile, operationParam); return content.getValue(); } else { // TODO FIXME Do not know how to process return operationParam; } } }
private void declareVariable(List<AlgorithmTreeNode> nodesToCompile, ConversionRuleStep conversionStep) throws SyntaxNodeException { String variableNameParameter = conversionStep.getOperationParam1(); String variableAssignmentParameter = conversionStep.getOperationParam2(); StringValue variableName = AlgorithmCompilerTool.getCellContent(nodesToCompile, variableNameParameter); IOpenClass variableType = getTypeOfField( AlgorithmCompilerTool.getCellContent(nodesToCompile, variableAssignmentParameter)); initNewInternalVariable(variableName.getValue(), variableType); }
private void createAlgorithmInternalMethod(List<AlgorithmTreeNode> nodesToCompile, IOpenClass returnType, CompileContext methodContext) throws SyntaxNodeException { // method name will be at every label for (StringValue label : nodesToCompile.get(0).getLabels()) { String methodName = label.getValue(); IOpenMethodHeader methodHeader = new OpenMethodHeader(methodName, returnType, IMethodSignature.VOID, thisTargetClass); AlgorithmSubroutineMethod method = new AlgorithmSubroutineMethod(methodHeader); thisTargetClass.addMethod(method); // to support parameters free call NoParamMethodField methodAlternative = new NoParamMethodField(methodName, method); thisTargetClass.addField(methodAlternative); functions.add(new AlgorithmFunctionCompiler(nodesToCompile, methodContext, method, this)); } Map<String, AlgorithmTreeNode> internalLablesOfMethod = AlgorithmCompilerTool .getAllDeclaredLables(nodesToCompile); methodContext.registerGroupOfLabels(internalLablesOfMethod); }
protected void initTableNames() { TableSyntaxNode node = getCopyingTable(); if (node != null) { tableTechnicalName = parseTechnicalName(node.getHeaderLineValue().getValue(), node.getType()); ITableProperties tableProperties = node.getTableProperties(); if (tableProperties != null) { tableBusinessName = node.getTableProperties().getName(); } } }
public IOpenClass getTypeOfField(StringValue fieldContent) { // TODO: make rational type detecting(without creating of // CompositeMethod) IOpenSourceCodeModule src = fieldContent.asSourceCodeModule(); OpenL openl = context.getOpenL(); IMethodSignature signature = header.getSignature(); return OpenLCellExpressionsCompiler .makeMethodWithUnknownType(openl, src, "cell_" + fieldContent.getValue(), signature, thisTargetClass, getAlgorithmBindingContext()) .getMethod() .getType(); }
private CellMetaInfo checkForeignKeyInHeader(ColumnDescriptor descriptor, int row, int col) { if (descriptor instanceof ForeignKeyColumnDescriptor) { ForeignKeyColumnDescriptor foreignDescriptor = (ForeignKeyColumnDescriptor) descriptor; CellKey cellKey = foreignDescriptor.getForeignKeyCellCoordinate(); if (isNeededCell(cellKey, row, col)) { // Found needed cell if (foreignDescriptor.isReference()) { IDataBase db = getBoundNode().getDataBase(); IdentifierNode foreignKeyTable = foreignDescriptor.getForeignKeyTable(); ITable foreignTable = db.getTable(foreignKeyTable.getIdentifier()); if (foreignTable != null) { NodeUsage nodeUsage = new SimpleNodeUsage( foreignKeyTable, foreignTable.getTableSyntaxNode().getHeaderLineValue().getValue(), foreignTable.getTableSyntaxNode().getUri(), NodeType.DATA); return new CellMetaInfo(JavaOpenClass.STRING, false, Collections.singletonList(nodeUsage)); } } return null; } } return NOT_FOUND; }