public FunctionalRow(String name, int row, ILogicalTable decisionTable, DTScale.RowScale scale) { this.name = name; this.row = row; this.decisionTable = decisionTable; this.paramsTable = decisionTable.getSubtable(IDecisionTableConstants.PARAM_COLUMN_INDEX, row, 1, 1); this.codeTable = decisionTable.getSubtable(IDecisionTableConstants.CODE_COLUMN_INDEX, row, 1, 1); this.presentationTable = decisionTable .getSubtable(IDecisionTableConstants.PRESENTATION_COLUMN_INDEX, row, 1, 1); this.scale = scale; }
private ILogicalTable getValueCell(int col) { return table.getSubtable(col + IDecisionTableConstants.SERVICE_COLUMNS_NUMBER, row, 1, 1); }
public ILogicalTable getValueCell(int column) { return decisionTable.getSubtable(column + IDecisionTableConstants.SERVICE_COLUMNS_NUMBER, row, 1, 1); }
/** * Returns foreign_key_tokens from the current column. * * @param bindingContext is used for optimization {@link GridCellSourceCodeModule} in execution mode. Can be * <code>null</code>. * @see #hasForeignKeysRow(ILogicalTable) */ private static IdentifierNode[] getForeignKeyTokens(IBindingContext bindingContext, ILogicalTable descriptorRows, int columnNum) throws OpenLCompilationException { ILogicalTable logicalRegion = descriptorRows.getSubtable(columnNum, 1, 1, 1); GridCellSourceCodeModule indexRowSourceModule = new GridCellSourceCodeModule(logicalRegion.getSource(), bindingContext); // Should be in format // "> reference_table_name [reference_table_key_column]" return Tokenizer.tokenize(indexRowSourceModule, INDEX_ROW_REFERENCE_DELIMITER); }
public Map<String, Integer> makeUniqueIndex(int colIdx) throws SyntaxNodeException { Map<String, Integer> index = new HashMap<>(); int rows = logicalTable.getHeight(); for (int i = 1; i < rows; i++) { IGridTable gridTable = logicalTable.getSubtable(colIdx, i, 1, 1).getSource(); String key = gridTable.getCell(0, 0).getStringValue(); if (key == null) { throw SyntaxNodeExceptionUtils.createError("Empty key in an unique index", new GridCellSourceCodeModule(gridTable)); } key = key.trim(); if (index.containsKey(key)) { throw SyntaxNodeExceptionUtils.createError("Duplicated key in an unique index: " + key, new GridCellSourceCodeModule(gridTable)); } index.put(key, i - 1); } return index; }
@Override public List<Object> getUniqueValues(int colIdx) throws SyntaxNodeException { List<Object> values = new ArrayList<>(); int rows = logicalTable.getHeight(); for (int i = 1; i < rows; i++) { IGridTable gridTable = logicalTable.getSubtable(colIdx, i, 1, 1).getSource(); Object value = gridTable.getCell(0, 0).getObjectValue(); if (value == null) { throw SyntaxNodeExceptionUtils.createError("Empty key in an unique index", new GridCellSourceCodeModule(gridTable)); } if (values.contains(value)) { throw SyntaxNodeExceptionUtils.createError("Duplicated key in an unique index: " + value, new GridCellSourceCodeModule(gridTable)); } values.add(value); } return values; }
if (descriptor.isConstructor()) { target = fkDescriptor.getLiteralByForeignKey(dataModel.getType(), logicalTable.getSubtable(j, i, 1, 1), dataBase, bindingContext); } else { fkDescriptor.populateLiteralByForeignKey(target, logicalTable.getSubtable(j, i, 1, 1), dataBase, bindingContext);
private Object processColumn(OpenlToolAdaptor openlAdapter, boolean constructor, int rowNum, Object literal, int columnNum, IRuntimeEnv env) throws SyntaxNodeException { ColumnDescriptor columnDescriptor = dataModel.getDescriptor()[columnNum]; if (columnDescriptor != null && !columnDescriptor.isReference()) { if (constructor) { literal = columnDescriptor.getLiteral(dataModel.getType(), logicalTable.getSubtable(columnNum, rowNum, 1, 1), openlAdapter); } else { try { ILogicalTable lTable = logicalTable.getSubtable(columnNum, rowNum, 1, 1); if (!(lTable.getHeight() == 1 && lTable.getWidth() == 1) || lTable.getCell(0, 0).getStringValue() != null) { //EPBDS-6104. For empty values should be used data type default value. return columnDescriptor.populateLiteral(literal, lTable, openlAdapter, env); } } catch (SyntaxNodeException ex) { tableSyntaxNode.addError(ex); openlAdapter.getBindingContext().addError(ex); } } } return literal; }
foreignKeyTable = foreignKeyTokens.length > 0 ? foreignKeyTokens[0] : null; foreignKey = foreignKeyTokens.length > 1 ? foreignKeyTokens[1] : null; foreignKeyCell = descriptorRows.getSubtable(columnNum, 1, 1, 1).getSource().getCell(0, 0);
ILogicalTable logicalTable = LogicalTableHelper .logicalTable(valuesTable.getSource().getSubtable(0, i, 1, i + 1)) .getSubtable(0, 0, 1, 1); if (valuesAnArray) { res = getArrayValues(logicalTable, toolAdapter, aggregateType, paramType);
ILogicalTable colTable = tableBody.getSubtable(column.getColumnIndex(), 2, 1, 1);
/** * Gets title for column if required or returns blank value. * * @param dataWithTitleRows Logical part of the data table. Consider to include all rows from base table after * header section (consists from header row + property section) and descriptor section (consists from * JavaBean name obligatory + optional index row, see {@link #hasForeignKeysRow(ILogicalTable)}).<br> * This part of table may consists from optional first title row and followed data rows. * @param bindingContext is used for optimization {@link GridCellSourceCodeModule} in execution mode. Can be * <code>null</code>. * @param column Number of column in data table. * @param hasColumnTitleRow Flag shows if data table has column tytle row. * @return Column title (aka Display name). */ public static StringValue makeColumnTitle(IBindingContext bindingContext, ILogicalTable dataWithTitleRows, int column, boolean hasColumnTitleRow) { String value = StringUtils.EMPTY; if (hasColumnTitleRow) { ILogicalTable titleCell = dataWithTitleRows.getSubtable(column, 0, 1, 1); value = titleCell.getSource().getCell(0, 0).getStringValue(); // remove extra spaces value = StringUtils.trimToEmpty(value); return new StringValue(value, value, value, new GridCellSourceCodeModule(titleCell.getSource(), bindingContext)); } return new StringValue(value, value, value, null); }
null, LogicalTableHelper.logicalTable(valuesTable.getSource().getSubtable(0, 0, 1, 1)) .getSubtable(0, 0, 1, 1), toolAdapter); if (res != null) {