Skip to content

Commit

Permalink
the data model controller failed in development
Browse files Browse the repository at this point in the history
as it was trying to fetch the count of data elements and data types using the mysql stored function
  • Loading branch information
musketyr committed Feb 2, 2017
1 parent e92e7e8 commit a4a3c22
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelcatalogue.core

import com.google.common.collect.ImmutableSet
import grails.util.GrailsNameUtils
import org.hibernate.SessionFactory
import org.modelcatalogue.core.api.ElementStatus
import org.modelcatalogue.core.export.inventory.CatalogueElementToXlsxExporter
import org.modelcatalogue.core.util.DataModelFilter
Expand All @@ -17,6 +18,7 @@ class DataModelController extends AbstractCatalogueElementController<DataModel>
DataClassService dataClassService
DataElementService dataElementService
DataTypeService dataTypeService
SessionFactory sessionFactory

DataModelController() {
super(DataModel, false)
Expand Down Expand Up @@ -107,10 +109,11 @@ class DataModelController extends AbstractCatalogueElementController<DataModel>
ListWithTotalAndType<Map> list = Lists.lazy(params, Map) {
List<Map> contentDescriptors = []

boolean isMysql = sessionFactory.currentSession.connection().metaData.databaseProductName == 'MySQL'

contentDescriptors << createContentDescriptor(dataModel, 'Data Classes', DataClass, dataClasses.total)
contentDescriptors << createContentDescriptor(dataModel, 'Data Elements', DataElement, dataElementService.findAllDataElementsInModel([:], dataModel).total)
contentDescriptors << createContentDescriptor(dataModel, 'Data Types', DataType, dataTypeService.findAllDataTypesInModel([:], dataModel).total)
//contentDescriptors << createContentDescriptor(dataModel, 'Data Types',DataType, stats["totalDataTypeCount"])
contentDescriptors << createContentDescriptor(dataModel, 'Data Elements', DataElement, isMysql ? dataElementService.findAllDataElementsInModel([:], dataModel).total : stats["totalDataElementCount"])
contentDescriptors << createContentDescriptor(dataModel, 'Data Types', DataType, isMysql ? dataTypeService.findAllDataTypesInModel([:], dataModel).total : stats["totalDataTypeCount"])
contentDescriptors << createContentDescriptor(dataModel, 'Measurement Units', MeasurementUnit, stats["totalMeasurementUnitCount"])
contentDescriptors << createContentDescriptor(dataModel, 'Business Rules', ValidationRule, stats["totalValidationRuleCount"])
contentDescriptors << createContentDescriptor(dataModel, 'Assets', Asset, stats["totalAssetCount"])
Expand Down

0 comments on commit a4a3c22

Please sign in to comment.