private static boolean isThirdColumnForDefaults(ILogicalTable table) { // If first or second row is blank or starts with number, it can't be a type name and field name respectively, // in this case we can assume that the third column is definitely for defaults return isDefault(table.getCell(DEFAULTS_COLUMN, TYPE_NAME_COLUMN)) || isDefault(table.getCell(DEFAULTS_COLUMN, FIELD_NAME_COLUMN)); }
/** * Returns all regions of a table. * * @param table the table with regions. * @return a the regions of the table. */ public static List<IGridRegion> getGridRegions(ILogicalTable table) { int height = table.getHeight(); int width = table.getWidth(); List<IGridRegion> regions = new ArrayList<IGridRegion>(); // Go through all possible cells for (int row = 0; row < height; row++) { for (int column = 0; column < width; column++) { ICell cell = table.getCell(column, row); regions.add(cell.getAbsoluteRegion()); } } return regions; } }
private boolean isHeaderRow(int row) { TableSyntaxNode syntaxNode = getTableSyntaxNode(); return syntaxNode.getTable().getCell(0, 0).getAbsoluteRow() == row; }
private boolean isHeaderCell(int row, int col) { TableSyntaxNode syntaxNode = getTableSyntaxNode(); return isNeededCell(syntaxNode.getTable().getCell(0, 0), row, col); }
private Integer getlookupValuesTableHeight(ILogicalTable originaltable, int firstLookupGridColumn, IGrid grid) { String stringValue = originaltable.getCell(0, 0).getStringValue(); if (stringValue == null) { stringValue = ""; } stringValue = stringValue.toUpperCase(); ILogicalTable valueTable = originaltable.getRows(DISPLAY_ROW + 1); if (DecisionTableHelper.isValidRuleHeader(stringValue) || DecisionTableHelper .isValidMergedConditionHeader(stringValue)) { return valueTable.getHeight(); } else { return null; } }
@Override public CellMetaInfo getBodyMetaInfo(int row, int col) { ILogicalTable body = getTableSyntaxNode().getTableBody(); int height = body.getHeight(); for (int i = 0; i < height; i++) { ICell cell = body.getCell(0, i); if (isNeededCell(cell, row, col)) { List<CellMetaInfo> metaInfoList = OpenLCellExpressionsCompiler.getMetaInfo( getSourceCodeModule(body), ((TableMethod) getBoundNode().getMethod()).getCompositeMethod() ); return metaInfoList.get(i); } } return null; }
private boolean isProperties(int row, int col) { TableSyntaxNode tableSyntaxNode = getTableSyntaxNode(); if (!tableSyntaxNode.hasPropertiesDefinedInTable()) { return false; } ILogicalTable propertiesSection = tableSyntaxNode.getTableProperties().getPropertiesSection(); ICell firstCell = propertiesSection.getCell(0, 0); int r = row - firstCell.getAbsoluteRow(); int c = col - firstCell.getAbsoluteColumn(); // When c == -1 and r == 0 it's the "properties" keyword. return c >= -1 && r >= 0 && r < propertiesSection.getHeight() && c < propertiesSection.getWidth(); }
@Override protected CellMetaInfo getBodyMetaInfo(int row, int col) { ConstantsTableBoundNode boundNode = getBoundNode(); ILogicalTable normalizedData = boundNode.getNormalizedData(); ICell firstCell = normalizedData.getCell(0, 0); boolean normalOrientation = normalizedData.isNormalOrientation(); int c; int r; if (normalOrientation) { r = row - firstCell.getAbsoluteRow(); c = col - firstCell.getAbsoluteColumn(); } else { r = col - firstCell.getAbsoluteColumn(); c = row - firstCell.getAbsoluteRow(); } if (c == 2 && r >= 0) { // Constant value column String constantName = normalizedData.getCell(1, r).getStringValue(); for (ConstantOpenField field : boundNode.getConstantOpenFields()) { if (field.getName().equals(constantName)) { IOpenClass type = field.getType(); return new CellMetaInfo(type, type.getAggregateInfo().isAggregate(type)); } } } return null; } }
@Override public CellMetaInfo getBodyMetaInfo(int row, int col) { ICell firstCell = getTableSyntaxNode().getTableBody().getCell(0, 2); if (operationColumn == -1) { log.error("Operation column isn't initialized"); } else { if (col == operationColumn) { return firstCell.getAbsoluteRow() <= row ? AlgorithmBuilder.CELL_META_INFO : null; } } Algorithm algorithm = getBoundNode().getAlgorithm(); if (algorithm != null) { CellMetaInfo metaInfo = searchMetaInfo(row, col, algorithm.getAlgorithmSteps()); if (metaInfo != NOT_FOUND) { return metaInfo; } for (AlgorithmSubroutineMethod method : algorithm.getSubroutines()) { metaInfo = searchMetaInfo(row, col, method.getAlgorithmSteps()); if (metaInfo != NOT_FOUND) { return metaInfo; } } } return null; }
private void saveDescriptionMetaInfo(FunctionalRow funcRow, IGridRegion region) { // Condition/Action code (expression) ICell codeCell = funcRow.getCodeTable().getCell(0, 0); int row = codeCell.getAbsoluteRow(); int col = codeCell.getAbsoluteColumn(); if (IGridRegion.Tool.contains(region, col, row)) { List<CellMetaInfo> metaInfoList = OpenLCellExpressionsCompiler.getMetaInfo( funcRow.getSourceCodeModule(), funcRow.getMethod() ); // Decision table always contains 1 meta info setPreparedMetaInfo(row, col, metaInfoList.get(0)); } // Condition/Action type definition ILogicalTable paramsTable = funcRow.getParamsTable(); // In the case of errors params will be null IParameterDeclaration[] params = funcRow.getParams(); if (params != null && params.length > 0 && params[0] != null) { IParameterDeclaration param = params[0]; ICell paramCell = paramsTable.getCell(0, 0); row = paramCell.getAbsoluteRow(); col = paramCell.getAbsoluteColumn(); if (IGridRegion.Tool.contains(region, col, row)) { setPreparedMetaInfo(row, col, getMetaInfo(paramsTable, param.getType())); } } }
private CellMetaInfo getPropertiesMetaInfo(int row, int col) { ILogicalTable propertiesSection = getTableSyntaxNode().getTableProperties().getPropertiesSection(); ICell firstCell = propertiesSection.getCell(0, 0); int r = row - firstCell.getAbsoluteRow(); int c = col - firstCell.getAbsoluteColumn(); if (c == 1) { // Create meta info for property value String fieldName = propertiesSection.getCell(0, r).getStringValue(); IOpenField field = JavaOpenClass.getOpenClass(TableProperties.class).getField(fieldName); if (field != null) { IOpenClass type = field.getType(); if (type.getAggregateInfo().isAggregate(type)) { return new CellMetaInfo(type.getAggregateInfo().getComponentType(type), true); } else { return new CellMetaInfo(type, false); } } return null; } return null; } }
ICell cell = valueCell.getCell(0, i); // See EPBDS-7774 for an example when "i" is needed int row = cell.getAbsoluteRow(); int col = cell.getAbsoluteColumn();
objectValue = String2DataConvertorFactory.parse(String.class, value, cxt); } else { objectValue = RuleRowHelper.loadNativeValue(row.getColumn(2).getCell(0, 0), constantType); if (objectValue == null) { objectValue = String2DataConvertorFactory.parse(constantType.getInstanceClass(), value, cxt);
IMetaInfo typeMeta = type.getMetaInfo(); if (typeMeta != null) { ICell c = cell.getCell(0, 0); ((SpreadsheetMetaInfoReader) metaInfoReader).addHeaderMetaInfo( c.getAbsoluteRow(),
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; }
private static void validateSimpleParam(ILogicalTable table, IBindingContext bindingContext) throws SyntaxNodeException { ICell theCell = table.getSource().getCell(0, 0); if (table.getWidth() > 1 || table.getHeight() > 1) { for (int i = 0; i < table.getHeight(); i++) { for (int j = 0; j < table.getWidth(); j++) { if ((!(i == 0 && j == 0))) { ICell cell = table.getCell(j, i); if ((theCell.getAbsoluteRegion().getTop() != cell.getAbsoluteRegion().getTop() || theCell .getAbsoluteRegion() .getLeft() != cell.getAbsoluteRegion().getLeft()) && cell.getStringValue() != null) { if (!cell.getStringValue().startsWith(COMMENTARY)) { IGridTable cellTable = getTopLeftCellFromMergedRegion(table.getSource()); throw SyntaxNodeExceptionUtils.createError( "Table structure is wrong. More than one cell with data found where only one cell is expected.", new GridCellSourceCodeModule(cellTable, bindingContext)); } } } } } } }
ILogicalTable logicalTable = getBoundNode().getTable(); ICell firstCell = logicalTable.getCell(0, 0); int r = row - firstCell.getAbsoluteRow(); int c = col - firstCell.getAbsoluteColumn();
ICell theCellValue = row.getColumn(2).getCell(0, 0); if (theCellValue.hasNativeType()) { Object value = RuleRowHelper.loadNativeValue(theCellValue, fieldType);
ICell theCellValue = cell.getCell(0, 0); Object result = null; if (String.class.equals(instanceClass)) {
ICell cell = data.getCell(i, 0); int logicalColStart = cell.getColumn(); int logicalWidth = data.getColumnWidth(i);