Created
October 9, 2016 09:53
-
-
Save JRuumis/bd6b4f52c9cab8d2f095bb2846e12e48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package rpd.load | |
import rpd.extract._ | |
/** | |
* Created by janis on 04/10/2016. | |
*/ | |
case class DataStore ( | |
// Business Layer | |
businessModels: List[BusinessModel], | |
logicalTables: List[LogicalTable], | |
dimensions: List[Dimension], | |
logicalTableSources: List[LogicalTableSource], | |
logicalJoins: List[LogicalJoin], | |
logicalTableColumns: List[LogicalColumn], | |
logicalTableSourceColumns: List[LogicalTableSourceColumn], | |
dimensionLevels: List[DimensionLevel], | |
//Physical Layer | |
databases: List[Database], | |
schemas: List[Schema], | |
physicalTables: List[PhysicalTable], | |
physicalColumns: List[PhysicalColumn], | |
// Presentation Layer | |
presentationCatalogs: List[PresentationCatalog], | |
presentationTables: List[PresentationTable], | |
presentationTableColumns: List[PresentationTableColumn] | |
) | |
{ | |
def allEntities: List[TargetEntity] = businessModels ++ logicalTables ++ dimensions ++ logicalTableSources ++ logicalJoins ++ logicalTableColumns ++ logicalTableSourceColumns ++ dimensionLevels ++ databases ++ schemas ++ physicalTables ++ physicalColumns ++ presentationCatalogs ++ presentationTables ++ presentationTableColumns | |
def setDataStoreForAllEntities: Unit = allEntities foreach (_.dataStore = this) | |
//todo: get this working!!! | |
// private def createKeyMap(entityList: List[TargetEntity]) = entityList map (entity => entity.mdsid -> entity) toMap | |
// PK indexes | |
val businessModelsIndex: Map[String, BusinessModel] = businessModels map (entity => entity.mdsid -> entity) toMap | |
val logicalTablesIndex: Map[String, LogicalTable] = logicalTables map (entity => entity.mdsid -> entity) toMap | |
val logicalTableColumnsIndex: Map[String, LogicalColumn] = logicalTableColumns map (entity => entity.mdsid -> entity) toMap | |
val logicalTableSourcesIndex: Map[String, LogicalTableSource] = logicalTableSources map (entity => entity.mdsid -> entity) toMap | |
val logicalTableSourceColumnsIndex: Map[String, LogicalTableSourceColumn] = logicalTableSourceColumns map (entity => entity.mdsid -> entity) toMap | |
val dimensionsIndex = dimensions map (entity => entity.mdsid -> entity) toMap | |
val dimensionLevelsIndex = dimensionLevels map (entity => entity.mdsid -> entity) toMap | |
val logicalJoinsIndex = logicalJoins map (entity => entity.mdsid -> entity) toMap | |
val databasesIndex = databases map (entity => entity.mdsid -> entity) toMap | |
val schemasIndex = schemas map (entity => entity.mdsid -> entity) toMap | |
val physicalTablesIndex = physicalTables map (entity => entity.mdsid -> entity) toMap | |
val physicalColumnsIndex = physicalColumns map (entity => entity.mdsid -> entity) toMap | |
val presentationCatalogsIndex = presentationCatalogs map (entity => entity.mdsid -> entity) toMap | |
val presentationTablesIndex = presentationTables map (entity => entity.mdsid -> entity) toMap | |
val presentationTableColumnsIndex = presentationTableColumns map (entity => entity.mdsid -> entity) toMap | |
// parent key indexes | |
val logicalTablesParentIndex = logicalTables groupBy (_.parentId) | |
val logicalTableColumnsParentIndex = logicalTableColumns groupBy (_.parentId) | |
val logicalTableSourceColumnsParentIndex = logicalTableSourceColumns groupBy (_.parentId) | |
val dimensionLevelsParentIndex = dimensionLevels groupBy (_.parentId) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment