import { Cmf } from "cmf.lbos"; import { MetadataTableType, Table, TableColumn } from "cmf.core/src/domain/metadata/table"; import { BasePropertyEditorOptions } from "cmf.core/src/domain/extensions/caches/entityType"; /** Core Business Controls */ import { DataGridBusinessColumn } from "../components/dataGrid/dataGrid"; import { CustomFilter } from "../components/filterBar/filterBar"; export import SmartTable = Cmf.Foundation.BusinessObjects.SmartTables.SmartTable; export import SmartTableProperty = Cmf.Foundation.BusinessObjects.SmartTables.SmartTableProperty; export import SmartTableProperties = Cmf.Foundation.BusinessObjects.SmartTables.SmartTablePropertiesCollection; export import PrecedenceKeys = Cmf.Foundation.BusinessObjects.SmartTables.PrecedenceKeysCollection; export import GenericTable = Cmf.Foundation.BusinessObjects.GenericTables.GenericTable; export import GenericTableProperty = Cmf.Foundation.BusinessObjects.GenericTables.GenericTableProperty; export import GenericTableProperties = Cmf.Foundation.BusinessObjects.GenericTables.GenericTablePropertiesCollection; /** * Context Resolution Table Name. */ export declare const CONTEXT_RESOLUTION_TABLE_NAME = "ContextResolution"; /** * Table Property wrapper interface. */ export interface TableProperty { /** * Generic or Smart Table Property. */ tableProperty: SmartTableProperty | GenericTableProperty; /** * Metadata Table Column. */ metadataTableColumn: TableColumn; /** * Entity Type. */ entityType: Cmf.Foundation.BusinessObjects.EntityType; } /** * TableService used as a helper class providing utils and table loading functions for the needed components/wizards. */ export declare class TableService { /** * Generic object that provides access to the Framework. */ private static _generic; /** * Returns all the metadata defined tables filtered by Entity Type Name, if set. * If the tables are not defined on the metadata or the Entity Type Name doesn't match any, it returns an empty array. * @param entityTypeName EntityType name. */ static getMetadataTables(entityTypeName?: string): Promise; /** * Returns the metadata defined table filtered by the Table's name, and Entity Type Name, if set. * If the Entity Type Name isn't set, it returns null. * @param tableName Table's name. * @param entityTypeName EntityType name. */ static getMetadataTable(tableName: string, entityTypeName: string): Table; static getAdminMetadataTableSync(tableName: string): Table; /** * Returns the (Smart or Generic) Table from the cache. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param tableName Table's name. * @param tableType Table's type. */ static getTable(table: { name?: string; id?: string; }, tableType: MetadataTableType): Promise; /** * Builds the input object to retrieve the (Smart or Generic) Table. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param tableName Table's name. * @param tableType Table's type. */ static buildGetTableInput(tableName: string, tableType: MetadataTableType): (Cmf.Foundation.BusinessOrchestration.TableManagement.InputObjects.GetSmartTableByNameInput | Cmf.Foundation.BusinessOrchestration.TableManagement.InputObjects.GetGenericTableByNameInput); /** * Returns the (Smart or Generic) Table nested on the Output object provided. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param output Output object. */ static handleGetTableOutput(output: Cmf.Foundation.BusinessOrchestration.BaseOutput): any; /** * Builds the input object to retrieve the (Smart or Generic) Table with data. * It sorts the data if the instance is provided. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param tableName Table's name. * @param tableType Table's type. * @param instance Entity instance. */ static buildGetTableDataInput(tableName: string, tableType: MetadataTableType, instance?: Cmf.Foundation.BusinessObjects.Entity, filterCollection?: Cmf.Foundation.BusinessObjects.QueryObject.FilterCollection): (Cmf.Foundation.BusinessOrchestration.TableManagement.InputObjects.GetSmartTableWithFilterInput | Cmf.Foundation.BusinessOrchestration.TableManagement.InputObjects.GetGenericTableWithFilterInput); /** * Returns the (Smart or Generic) Table (with data) nested on the Output object provided. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param output Output object. */ static handleGetTableDataOutput(output: Cmf.Foundation.BusinessOrchestration.TableManagement.OutputObjects.GetSmartTableWithFilterOutput | Cmf.Foundation.BusinessOrchestration.TableManagement.OutputObjects.GetGenericTableWithFilterOutput): any; /** * Returns a Generic or Smart Table object with data loaded. * It sorts the data if the instance is provided. * If it can't load the table from some reason, it returns null. * Supported MetadataTableTypes are SmartTable and GenericTable. The function returns null for unsupported types. * @param tableName Table's name. * @param tableType Table's type. * @param instance Entity instance. */ static getTableData(tableName: string, tableType: MetadataTableType, instance?: Cmf.Foundation.BusinessObjects.Entity): Promise; /** * Returns the Table's Data Columns list. * Smart or Generic Table objects are the only ones supported. The function returns an empty array for unsupported types. * @param table (Smart or Generic) Table object. */ static getTableColumns(table: SmartTable | GenericTable): Array; /** * Returns the Table's Data Rows list. * Smart or Generic Table objects are the only ones supported. The function returns an empty array for unsupported types. * @param table (Smart or Generic) Table object. */ static getTableDataObject(table: SmartTable | GenericTable): Array; /** * Builds a DataSet object from the provided table's name and rows list. * Returns null if the rows list is null or empty. * Smart or Generic Table type are the only ones supported. The function returns an empty DataSet object for unsupported types. * @param tableName Table's name. * @param tableType Table's type. * @param rows Rows list. */ private static buildDataSetForTable; /** * Returns the Table's keys names an array of strings. * @param table (Smart or Generic) Table object. */ static getTableKeysName(table: SmartTable | GenericTable): string[]; /** * Returns the Table's PrecedenceKeys ordered by the Order property present in each of them. * Precedence keys are can only present on SmartTables. This function returns an empty array for other table types. * @param table SmartTable object. */ static getTablePrecedenceKeysOrdered(table: any): PrecedenceKeys; /** * Returns a list of Table Properties. * @param table (Smart or Generic) Table object. */ static getTableProperties(table: SmartTable | GenericTable): SmartTableProperties | GenericTableProperties; /** * Returns a list of TableProperty wrapper. * @param table (Smart or Generic) Table object. * @param entityTypeName Entity Type Name. */ static getTableWrapperProperties(table: SmartTable | GenericTable, entityTypeName: string): Promise; /** * Returns the Context Resolution GenericTable Data. * If it fails to load it, it returns null. * @param tableName Table's name. Default value is the CONTEXT_RESOLUTION_TABLE_NAME constant. */ static getContextResolutionGenericTableData(tableName?: string): Promise; /** * Builds the FullUpdate input object for the provided table name and type. * If the rowsToAddOrUpdate or rowsToRemove are null or empty, it sets their properties on the input object to null. * @param tableName Table's name. * @param tableType Table's type. * @param rowsToAddOrUpdate Rows to Add or Update. * @param rowsToRemove Rows to Remove. */ static buildFullUpdateTableDataInput(tableName: string, tableType: MetadataTableType, rowsToAddOrUpdate: any[], rowsToRemove: any[]): Promise; /** * Builds the entity instance load object by Id or Name, whichever is provided. * Returns null if the instance is null or if neither the Id or Name are provided. * @param instance Entity instance. */ static buildReloadInstanceByIdOrNameInput(instance: Cmf.Foundation.BusinessObjects.Entity): (Cmf.Foundation.BusinessOrchestration.GenericServiceManagement.InputObjects.GetObjectByIdInput | Cmf.Foundation.BusinessOrchestration.GenericServiceManagement.InputObjects.GetObjectByNameInput); /** * Returns the Instance reloaded. * The output objects supported are GetObjectByIdOutput or GetObjectByNameOutput. This function returns null for unsupported output objects. * @param output Output object. */ static handleReloadInstanceOutput(output: Cmf.Foundation.BusinessOrchestration.BaseOutput): Cmf.Foundation.BusinessObjects.Entity; /** * Builds a ComplexType from a Table's Property. * @param prop Smart or Generic Table's Property. */ private static buildComplexTypeFromTableProperty; /** * Sets the type and template property on the DataGridBusinessColumn looking at the Table's property. * @param column DataGridBusinessColumn object to update. * @param prop Generic or Smart Table's property. * @param entityType Entity Type. * @param referencePropertyId ReferencePropertyId. */ static buildComplexTypeAndTemplateFromTablePropertyForDataGridColumn(column: DataGridBusinessColumn, prop: SmartTableProperty | GenericTableProperty, entityType: Cmf.Foundation.BusinessObjects.EntityType, referencePropertyId: string): void; /** * Builds the DataGridColumn object looking at the Table's property. * @param prop Generic or Smart Table's property. * @param entityType Entity Type. */ private static buildDataGridColumn; /** * Builds the DataGridColumns array from a Table and MetadataTableType provided. * @param table Table object. * @param instance Entity instance. */ static buildDataGridColumns(table: SmartTable | GenericTable, instance: Cmf.Foundation.BusinessObjects.Entity): Promise; /** * Transforms the Table's property provided into a PropertiesEditorProperty. * @param tableProp (Smart or Generic) Table's property. */ private static getPropertiesEditorPropertyFromTableProperty; /** * Builds the PropertiesEditorProperty map to feed to the EntityPropertiesEditor, looking at the TableProperty array provided. * @param tableProperties TableProperties array. */ static buildPropertiesEditorPropertiesFromTableProperties(tableProperties: TableProperty[]): Promise<{ [key: string]: BasePropertyEditorOptions; }>; /** * Something */ private static getEntityTypePropertyValueType; /** * Builds a FilterBar's Filter object. * @param prop Smart or Generic Table's Property. * @param entityType EntityType. */ private static buildFilterBarFilter; /** * Builds a FilterBar's CustomFilter object. * @param prop Smart or Generic Table's Property. * @param entityType EntityType. */ private static buildCustomFilter; /** * Builds the CustomFilters to feed a FilterBar component. * @param table Smart or Generic Table. * @param entityTypeName EntityTypeName. */ static buildCustomFiltersFromTable(table: GenericTable | SmartTable, entityTypeName: string): Promise; /** * Builds a CustomFilters need to feed a FilterBar component. * @param tableProperties TableProperties. */ static buildCustomFiltersFromTableProperties(tableProperties: TableProperty[]): CustomFilter[]; /** * Given a SmartTable\GenericTable property will calculate the label that will be displayed to the user. * @param tableProperty The TableProperty for which the label will be calculated. */ private static calculateLabelForProperty; }