Package org.openl.rules.data
Class DataTableBindHelper
- java.lang.Object
-
- org.openl.rules.data.DataTableBindHelper
-
public class DataTableBindHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static PatternCOLLECTION_ACCESS_BY_INDEX_PATTERNstatic PatternCOLLECTION_ACCESS_BY_KEY_PATTERNstatic PatternPRECISION_PATTERNstatic PatternSPREADSHEETRESULT_FIELD_PATTERN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IOpenFieldfindField(String fieldName, ITable table, IOpenClass tableType)static intgetCollectionIndex(IdentifierNode fieldNameNode)static ObjectgetCollectionKey(IdentifierNode currentFieldNameNode)static StringgetCollectionName(IdentifierNode fieldNameNode)static LinkedHashSet<IdentifierNodesBucket>getColumnIdentifiers(IBindingContext bindingContext, ITable table, ILogicalTable descriptorRows)static ILogicalTablegetDescriptorRows(ILogicalTable horizDataTableBody)Gets the descriptor rows from the data table body.static ILogicalTablegetHorizontalDataWithTitle(ILogicalTable horizDataTableBody)Gets the Data_With_Titles rows from the data table body.static ILogicalTablegetHorizontalTable(ILogicalTable tableBody, IOpenClass tableType)Gets the horizontal table representation from current table.static IntegergetPrecisionValue(IdentifierNode fieldNameNode)static ILogicalTablegetSubTableForBusinessView(ILogicalTable tableBody, IOpenClass tableType)Gets the sub table for displaying on business view.static ILogicalTablegetTableBody(TableSyntaxNode tsn)Gets the table body, by skipping the table header and properties sections.static booleanhasForeignKeysRow(ILogicalTable dataTable)Foreign keys row is optional for data table.static booleanisHorizontalTable(ILogicalTable dataTableBody, IOpenClass tableType)Checks if table representation is horizontal.static StringValuemakeColumnTitle(IBindingContext bindingContext, ILogicalTable dataWithTitleRows, int column, boolean hasColumnTitleRow)Gets title for column if required or returns blank value.static ColumnDescriptor[]makeDescriptors(IBindingContext bindingContext, ITable table, IOpenClass type, OpenL openl, ILogicalTable descriptorRows, ILogicalTable dataWithTitleRows, boolean hasForeignKeysRow, boolean hasColumnTitleRow, boolean supportConstructorFields)static IOpenFieldprocessFieldsChain(IBindingContext bindingContext, ITable table, IOpenClass type, IdentifierNode[] fieldAccessorChainTokens)Process the chain of fields, e.g.
-
-
-
Field Detail
-
COLLECTION_ACCESS_BY_INDEX_PATTERN
public static final Pattern COLLECTION_ACCESS_BY_INDEX_PATTERN
-
COLLECTION_ACCESS_BY_KEY_PATTERN
public static final Pattern COLLECTION_ACCESS_BY_KEY_PATTERN
-
PRECISION_PATTERN
public static final Pattern PRECISION_PATTERN
-
SPREADSHEETRESULT_FIELD_PATTERN
public static final Pattern SPREADSHEETRESULT_FIELD_PATTERN
-
-
Method Detail
-
hasForeignKeysRow
public static boolean hasForeignKeysRow(ILogicalTable dataTable)
Foreign keys row is optional for data table. It consists reference for field value to other table. Foreign keys always starts from 62 symbol.- Parameters:
dataTable- data table to check- Returns:
TRUEif second row in data table body (next to the field row) consists even one value, in any column, starts with 62 symbol.
-
getTableBody
public static ILogicalTable getTableBody(TableSyntaxNode tsn)
Gets the table body, by skipping the table header and properties sections.- Parameters:
tsn- inspecting table- Returns:
- Table body without table header and properties section.
-
isHorizontalTable
public static boolean isHorizontalTable(ILogicalTable dataTableBody, IOpenClass tableType)
Checks if table representation is horizontal. Horizontal is data table where parameters are listed from left to right. Example:param1 param2 param3 param1 value param2 value param3 value - Parameters:
dataTableBody- the body of a table to checktableType- the type of data table- Returns:
TRUEif table is horizontal.
-
findField
public static IOpenField findField(String fieldName, ITable table, IOpenClass tableType)
-
getHorizontalTable
public static ILogicalTable getHorizontalTable(ILogicalTable tableBody, IOpenClass tableType)
Gets the horizontal table representation from current table. If it was vertical it will be transposed.- Parameters:
tableBody- the body of a table to checktableType- the type of data table- Returns:
- Horizontal representation of table.
-
getHorizontalDataWithTitle
public static ILogicalTable getHorizontalDataWithTitle(ILogicalTable horizDataTableBody)
Gets the Data_With_Titles rows from the data table body. Data_With_Titles start row consider to be the next row after descriptor section of the table and till the end of the table.- Parameters:
horizDataTableBody- Horizontal representation of data table body.- Returns:
- Data_With_Titles rows for current data table body.
-
getSubTableForBusinessView
public static ILogicalTable getSubTableForBusinessView(ILogicalTable tableBody, IOpenClass tableType)
Gets the sub table for displaying on business view.- Parameters:
tableBody- data table body.tableType- the type of a table- Returns:
- Data_With_Titles section for current data table body.
-
getDescriptorRows
public static ILogicalTable getDescriptorRows(ILogicalTable horizDataTableBody)
Gets the descriptor rows from the data table body. Descriptor rows are obligatory parameter row and optional foreign key row if it exists in the table.- Parameters:
horizDataTableBody- Horizontal representation of data table body.- Returns:
- Descriptor rows for current data table body.
-
makeColumnTitle
public static StringValue makeColumnTitle(IBindingContext bindingContext, ILogicalTable dataWithTitleRows, int column, boolean hasColumnTitleRow)
Gets title for column if required or returns blank value.- Parameters:
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, seehasForeignKeysRow(ILogicalTable)).
This part of table may consists from optional first title row and followed data rows.bindingContext- is used for optimizationGridCellSourceCodeModulein execution mode. Can benull.column- Number of column in data table.hasColumnTitleRow- Flag shows if data table has column tytle row.- Returns:
- Column title (aka Display name).
-
makeDescriptors
public static ColumnDescriptor[] makeDescriptors(IBindingContext bindingContext, ITable table, IOpenClass type, OpenL openl, ILogicalTable descriptorRows, ILogicalTable dataWithTitleRows, boolean hasForeignKeysRow, boolean hasColumnTitleRow, boolean supportConstructorFields) throws Exception
- Parameters:
bindingContext- is used for optimizationGridCellSourceCodeModulein execution mode. Can benull.- Throws:
Exception
-
getColumnIdentifiers
public static LinkedHashSet<IdentifierNodesBucket> getColumnIdentifiers(IBindingContext bindingContext, ITable table, ILogicalTable descriptorRows)
- Parameters:
bindingContext- is used for optimizationGridCellSourceCodeModulein execution mode. Can benull.table- is needed only for error processing. Can benull.
-
processFieldsChain
public static IOpenField processFieldsChain(IBindingContext bindingContext, ITable table, IOpenClass type, IdentifierNode[] fieldAccessorChainTokens)
Process the chain of fields, e.g. driver.homeAdress.street;- Returns:
IOpenFieldfor fields chain.
-
getPrecisionValue
public static Integer getPrecisionValue(IdentifierNode fieldNameNode)
-
getCollectionIndex
public static int getCollectionIndex(IdentifierNode fieldNameNode)
-
getCollectionName
public static String getCollectionName(IdentifierNode fieldNameNode)
-
getCollectionKey
public static Object getCollectionKey(IdentifierNode currentFieldNameNode)
-
-