├── .gitattributes ├── .github └── CODEOWNERS ├── .gitignore ├── LICENSE.txt ├── README.md ├── jdbc └── repository.properties ├── pom.xml └── src ├── it ├── java │ └── org │ │ └── pentaho │ │ ├── metadata │ │ ├── AdvancedQueryIT.java │ │ ├── AggregationScenariosIT.java │ │ ├── ComplexExpressionsIT.java │ │ ├── InlineEtlModelGeneratorIT.java │ │ ├── LocalizationUtilIT.java │ │ ├── RepositoryIT.java │ │ ├── RowLevelSecurityIT.java │ │ ├── SQLModelGeneratorIT.java │ │ ├── SqlGeneratorIT.java │ │ ├── SqlOpenFormulaIT.java │ │ ├── ThinModelIT.java │ │ ├── ThinQueryIT.java │ │ ├── XmiParserIT.java │ │ ├── model │ │ │ └── olap │ │ │ │ └── util │ │ │ │ └── OlapUtilIT.java │ │ └── query │ │ │ └── model │ │ │ └── util │ │ │ └── CsvDataReaderIT.java │ │ └── pms │ │ ├── AdvancedMQLQueryImplIT.java │ │ ├── AggregationScenariosIT.java │ │ ├── ComplexExpressionsIT.java │ │ ├── MQLQueryIT.java │ │ ├── MQLQueryImplIT.java │ │ ├── MetadataTestBase.java │ │ ├── OuterJoinSQLQueryIT.java │ │ ├── SQLQueryIT.java │ │ ├── factory │ │ └── CwmSchemaFactoryIT.java │ │ └── mql │ │ └── dialect │ │ ├── DB2DialectIT.java │ │ ├── DefaultSQLDialectIT.java │ │ ├── FirebirdDialectIT.java │ │ ├── GoogleBigQueryDialectIT.java │ │ ├── H2DialectIT.java │ │ ├── HiveDialectIT.java │ │ ├── HypersonicDialectIT.java │ │ ├── IngresDialectIT.java │ │ ├── MSSQLDialectIT.java │ │ ├── MSSQLNativeDialectIT.java │ │ ├── MariaDBDialectIT.java │ │ ├── MySQLDialectIT.java │ │ ├── NetezzaDialectIT.java │ │ ├── OracleDialectIT.java │ │ ├── PostgreSQLDialectIT.java │ │ ├── RedshiftDialectIT.java │ │ ├── SQLJoinIT.java │ │ └── SybaseDialectIT.java └── resources │ ├── agileBiGenerated.xmi │ ├── agileBiGenerated_en_US.properties │ ├── all_concept_properties.xmi │ ├── example_olap.xmi │ ├── exportedFromPME.xmi │ ├── exportedFromPME_en_US.properties │ ├── kettle-password-encoder-plugins.xml │ ├── missing_locale.xmi │ ├── missing_ref.xmi │ ├── modelWith_EN_US.xmi │ ├── modelWith_EN_US_en_US.properties │ ├── mqlquery01.xmql │ ├── mqlquery02.xmql │ ├── mqlquery03.xmql │ ├── mqlquery04.xmql │ ├── mqlquery_oldformat.xmql │ ├── olap-cubes-sample.xml │ ├── olap-roles-sample.xml │ ├── org │ └── pentaho │ │ └── metadata │ │ └── sampledata.script │ ├── partial_metadata.xmi │ ├── samples │ ├── complex_join.xmi │ ├── content-acl.txt │ ├── orders-olap.xmi │ ├── orders-pro.xmi │ ├── orders.xmi │ ├── outer-joins.xmi │ ├── sales.xmi │ └── steelwheels.xmi │ ├── simple_model.xmi │ ├── solution │ └── system │ │ ├── metadata │ │ └── csvfiles │ │ │ ├── People.csv │ │ │ ├── anotherexample.csv │ │ │ ├── csv_people.csv │ │ │ ├── csv_various_types.csv │ │ │ └── example.csv │ │ ├── pentaho.xml │ │ ├── pentahoObjects.spring.xml │ │ ├── pentahoSystemConfig.xml │ │ ├── simple-jndi │ │ └── jdbc.properties │ │ └── systemListeners.xml │ └── steel-wheels.xmi ├── main ├── java │ └── org │ │ └── pentaho │ │ ├── metadata │ │ ├── automodel │ │ │ ├── AutoModeler.java │ │ │ ├── AutoModelerScenario.java │ │ │ ├── PhysicalTableImporter.java │ │ │ ├── SchemaTable.java │ │ │ └── importing │ │ │ │ └── strategy │ │ │ │ ├── CsvDatasourceImportStrategy.java │ │ │ │ └── DefaultImportStrategy.java │ │ ├── datatable │ │ │ ├── Cell.java │ │ │ ├── Column.java │ │ │ ├── DataTable.java │ │ │ ├── Row.java │ │ │ └── Types.java │ │ ├── libformula │ │ │ ├── BeginsWithFunction.java │ │ │ ├── BeginsWithFunctionDescription.java │ │ │ ├── ContainsFunction.java │ │ │ ├── ContainsFunctionDescription.java │ │ │ ├── EndsWithFunction.java │ │ │ ├── EndsWithFunctionDescription.java │ │ │ ├── EqualsFunction.java │ │ │ ├── EqualsFunctionDescription.java │ │ │ ├── InFunction.java │ │ │ ├── InFunctionDescription.java │ │ │ ├── LikeFunction.java │ │ │ └── LikeFunctionDescription.java │ │ ├── messages │ │ │ ├── LocaleHelper.java │ │ │ └── Messages.java │ │ ├── model │ │ │ ├── Category.java │ │ │ ├── Domain.java │ │ │ ├── IMetadataQueryExec.java │ │ │ ├── IPhysicalColumn.java │ │ │ ├── IPhysicalModel.java │ │ │ ├── IPhysicalTable.java │ │ │ ├── InlineEtlPhysicalColumn.java │ │ │ ├── InlineEtlPhysicalModel.java │ │ │ ├── InlineEtlPhysicalTable.java │ │ │ ├── LogicalColumn.java │ │ │ ├── LogicalModel.java │ │ │ ├── LogicalRelationship.java │ │ │ ├── LogicalTable.java │ │ │ ├── SqlDataSource.java │ │ │ ├── SqlPhysicalColumn.java │ │ │ ├── SqlPhysicalModel.java │ │ │ ├── SqlPhysicalTable.java │ │ │ ├── concept │ │ │ │ ├── Concept.java │ │ │ │ ├── IConcept.java │ │ │ │ ├── security │ │ │ │ │ ├── RowLevelSecurity.java │ │ │ │ │ ├── Security.java │ │ │ │ │ └── SecurityOwner.java │ │ │ │ ├── types │ │ │ │ │ ├── AggregationType.java │ │ │ │ │ ├── Alignment.java │ │ │ │ │ ├── Color.java │ │ │ │ │ ├── ColumnWidth.java │ │ │ │ │ ├── DataType.java │ │ │ │ │ ├── FieldType.java │ │ │ │ │ ├── Font.java │ │ │ │ │ ├── JoinType.java │ │ │ │ │ ├── LocaleType.java │ │ │ │ │ ├── LocalizedString.java │ │ │ │ │ ├── RelationshipType.java │ │ │ │ │ ├── TableType.java │ │ │ │ │ ├── TargetColumnType.java │ │ │ │ │ └── TargetTableType.java │ │ │ │ └── util │ │ │ │ │ └── DataFormatter.java │ │ │ ├── olap │ │ │ │ ├── OlapAnnotation.java │ │ │ │ ├── OlapCalculatedMember.java │ │ │ │ ├── OlapCube.java │ │ │ │ ├── OlapDimension.java │ │ │ │ ├── OlapDimensionUsage.java │ │ │ │ ├── OlapHierarchy.java │ │ │ │ ├── OlapHierarchyLevel.java │ │ │ │ ├── OlapMeasure.java │ │ │ │ ├── OlapRole.java │ │ │ │ └── util │ │ │ │ │ └── OlapUtil.java │ │ │ └── thin │ │ │ │ ├── Category.java │ │ │ │ ├── Column.java │ │ │ │ ├── Condition.java │ │ │ │ ├── Element.java │ │ │ │ ├── MetadataModelsService.java │ │ │ │ ├── Model.java │ │ │ │ ├── ModelInfo.java │ │ │ │ ├── ModelInfoComparator.java │ │ │ │ ├── ModelProvider.java │ │ │ │ ├── Operator.java │ │ │ │ ├── Order.java │ │ │ │ ├── Parameter.java │ │ │ │ ├── Provider.java │ │ │ │ └── Query.java │ │ ├── query │ │ │ ├── BaseMetadataQueryExec.java │ │ │ ├── example │ │ │ │ ├── AdvancedQueryXmlHelper.java │ │ │ │ ├── AdvancedSqlGenerator.java │ │ │ │ ├── AliasAwareSqlOpenFormula.java │ │ │ │ └── AliasedSelection.java │ │ │ ├── impl │ │ │ │ ├── ietl │ │ │ │ │ └── InlineEtlQueryExecutor.java │ │ │ │ └── sql │ │ │ │ │ ├── MappedQuery.java │ │ │ │ │ ├── Path.java │ │ │ │ │ ├── SqlAndTables.java │ │ │ │ │ ├── SqlGenerator.java │ │ │ │ │ ├── SqlOpenFormula.java │ │ │ │ │ ├── SqlOpenFormulaContext.java │ │ │ │ │ ├── SqlQuery.java │ │ │ │ │ └── graph │ │ │ │ │ ├── Arc.java │ │ │ │ │ ├── ConsistencyException.java │ │ │ │ │ ├── GraphElement.java │ │ │ │ │ ├── GraphElementChangeListener.java │ │ │ │ │ ├── GraphElementDomain.java │ │ │ │ │ ├── GraphElementQueue.java │ │ │ │ │ ├── GraphElementRequirement.java │ │ │ │ │ ├── MqlGraph.java │ │ │ │ │ ├── Node.java │ │ │ │ │ └── PathType.java │ │ │ └── model │ │ │ │ ├── CombinationType.java │ │ │ │ ├── Constraint.java │ │ │ │ ├── Order.java │ │ │ │ ├── Parameter.java │ │ │ │ ├── Query.java │ │ │ │ ├── Selection.java │ │ │ │ └── util │ │ │ │ ├── BooleanComparator.java │ │ │ │ ├── CsvDataReader.java │ │ │ │ ├── CsvDataTypeEvaluator.java │ │ │ │ ├── DataTypeDetector.java │ │ │ │ ├── QueryModelMetaData.java │ │ │ │ └── QueryXmlHelper.java │ │ ├── repository │ │ │ ├── DomainAlreadyExistsException.java │ │ │ ├── DomainIdNullException.java │ │ │ ├── DomainStorageException.java │ │ │ ├── FileBasedMetadataDomainRepository.java │ │ │ ├── IMetadataDomainRepository.java │ │ │ └── InMemoryMetadataDomainRepository.java │ │ └── util │ │ │ ├── DatabaseMetaUtil.java │ │ │ ├── InlineEtlModelGenerator.java │ │ │ ├── LocalizationUtil.java │ │ │ ├── MondrianModelExporter.java │ │ │ ├── PropertyTypeRegistry.java │ │ │ ├── RowLevelSecurityHelper.java │ │ │ ├── SQLModelGenerator.java │ │ │ ├── SQLModelGeneratorException.java │ │ │ ├── SecurityHelper.java │ │ │ ├── SerializationService.java │ │ │ ├── ThinModelConverter.java │ │ │ ├── Util.java │ │ │ ├── XmiParser.java │ │ │ └── validation │ │ │ └── ValidationStatus.java │ │ └── pms │ │ ├── automodel │ │ ├── AutoModeler.java │ │ ├── AutoModelerScenario.java │ │ ├── PhysicalTableImporter.java │ │ └── SchemaTable.java │ │ ├── core │ │ ├── CWM.java │ │ ├── event │ │ │ ├── AllowsIDChangeListenersInterface.java │ │ │ ├── IDChangedEvent.java │ │ │ └── IDChangedListener.java │ │ └── exception │ │ │ ├── CWMException.java │ │ │ └── PentahoMetadataException.java │ │ ├── example │ │ ├── AdvancedMQLQuery.java │ │ ├── AdvancedSQLGenerator.java │ │ └── AliasAwarePMSFormula.java │ │ ├── factory │ │ ├── CwmSchemaFactory.java │ │ ├── CwmSchemaFactoryException.java │ │ └── CwmSchemaFactoryInterface.java │ │ ├── locale │ │ ├── LocaleInterface.java │ │ ├── LocaleMeta.java │ │ └── Locales.java │ │ ├── messages │ │ ├── MessageUtil.java │ │ ├── Messages.java │ │ └── util │ │ │ └── LocaleHelper.java │ │ ├── mql │ │ ├── DateMath.java │ │ ├── ExtendedMetaData.java │ │ ├── MQLQuery.java │ │ ├── MQLQueryFactory.java │ │ ├── MQLQueryImpl.java │ │ ├── MappedQuery.java │ │ ├── MariaDBDialect.java │ │ ├── OrderBy.java │ │ ├── PMSFormula.java │ │ ├── PMSFormulaContext.java │ │ ├── Path.java │ │ ├── Query.java │ │ ├── SQLAndTables.java │ │ ├── SQLGenerator.java │ │ ├── Selection.java │ │ ├── WhereCondition.java │ │ ├── dialect │ │ │ ├── BaseHiveDialect.java │ │ │ ├── DB2Dialect.java │ │ │ ├── DefaultSQLDialect.java │ │ │ ├── DefaultSQLFunctionGenerator.java │ │ │ ├── DefaultSQLOperatorGenerator.java │ │ │ ├── FirebirdDialect.java │ │ │ ├── FormulaTraversalInterface.java │ │ │ ├── GoogleBigQueryDialect.java │ │ │ ├── H2Dialect.java │ │ │ ├── Hive2Dialect.java │ │ │ ├── HiveDialect.java │ │ │ ├── HypersonicDialect.java │ │ │ ├── ImpalaDialect.java │ │ │ ├── IngresDialect.java │ │ │ ├── JoinType.java │ │ │ ├── LucidDbDialect.java │ │ │ ├── MSSQLDialect.java │ │ │ ├── MSSQLNativeDialect.java │ │ │ ├── MySQLDialect.java │ │ │ ├── NetezzaDialect.java │ │ │ ├── OracleDialect.java │ │ │ ├── PostgreSQLDialect.java │ │ │ ├── RedshiftDialect.java │ │ │ ├── SQLDialectFactory.java │ │ │ ├── SQLDialectInterface.java │ │ │ ├── SQLFunctionGeneratorInterface.java │ │ │ ├── SQLJoin.java │ │ │ ├── SQLOperatorGeneratorInterface.java │ │ │ ├── SQLQueryModel.java │ │ │ └── SybaseDialect.java │ │ └── graph │ │ │ ├── Arc.java │ │ │ ├── ConsistencyException.java │ │ │ ├── GraphElement.java │ │ │ ├── GraphElementChangeListener.java │ │ │ ├── GraphElementDomain.java │ │ │ ├── GraphElementQueue.java │ │ │ ├── GraphElementRequirement.java │ │ │ ├── MqlGraph.java │ │ │ ├── Node.java │ │ │ └── PathType.java │ │ ├── schema │ │ ├── BusinessCategory.java │ │ ├── BusinessColumn.java │ │ ├── BusinessColumnString.java │ │ ├── BusinessModel.java │ │ ├── BusinessTable.java │ │ ├── DefaultProperty.java │ │ ├── MondrianModelExporter.java │ │ ├── PhysicalColumn.java │ │ ├── PhysicalTable.java │ │ ├── RelationshipMeta.java │ │ ├── RequiredProperties.java │ │ ├── SchemaMeta.java │ │ ├── SelectionField.java │ │ ├── SelectionGroup.java │ │ ├── concept │ │ │ ├── Concept.java │ │ │ ├── ConceptIllegalValueException.java │ │ │ ├── ConceptInterface.java │ │ │ ├── ConceptPropertyInterface.java │ │ │ ├── ConceptUtilityBase.java │ │ │ ├── ConceptUtilityInterface.java │ │ │ ├── DefaultPropertyID.java │ │ │ ├── DeleteNotAllowedException.java │ │ │ └── types │ │ │ │ ├── ConceptPropertyBase.java │ │ │ │ ├── ConceptPropertyType.java │ │ │ │ ├── aggregation │ │ │ │ ├── AggregationSettings.java │ │ │ │ ├── ConceptPropertyAggregation.java │ │ │ │ └── ConceptPropertyAggregationList.java │ │ │ │ ├── alignment │ │ │ │ ├── AlignmentSettings.java │ │ │ │ └── ConceptPropertyAlignment.java │ │ │ │ ├── bool │ │ │ │ └── ConceptPropertyBoolean.java │ │ │ │ ├── color │ │ │ │ ├── ColorSettings.java │ │ │ │ └── ConceptPropertyColor.java │ │ │ │ ├── columnwidth │ │ │ │ ├── ColumnWidth.java │ │ │ │ └── ConceptPropertyColumnWidth.java │ │ │ │ ├── datatype │ │ │ │ ├── ConceptPropertyDataType.java │ │ │ │ └── DataTypeSettings.java │ │ │ │ ├── date │ │ │ │ └── ConceptPropertyDate.java │ │ │ │ ├── fieldtype │ │ │ │ ├── ConceptPropertyFieldType.java │ │ │ │ └── FieldTypeSettings.java │ │ │ │ ├── font │ │ │ │ ├── ConceptPropertyFont.java │ │ │ │ └── FontSettings.java │ │ │ │ ├── localstring │ │ │ │ ├── ConceptPropertyLocalizedString.java │ │ │ │ └── LocalizedStringSettings.java │ │ │ │ ├── number │ │ │ │ └── ConceptPropertyNumber.java │ │ │ │ ├── rowlevelsecurity │ │ │ │ └── ConceptPropertyRowLevelSecurity.java │ │ │ │ ├── security │ │ │ │ └── ConceptPropertySecurity.java │ │ │ │ ├── string │ │ │ │ └── ConceptPropertyString.java │ │ │ │ ├── tabletype │ │ │ │ ├── ConceptPropertyTableType.java │ │ │ │ └── TableTypeSettings.java │ │ │ │ └── url │ │ │ │ └── ConceptPropertyURL.java │ │ ├── olap │ │ │ ├── OlapCube.java │ │ │ ├── OlapDimension.java │ │ │ ├── OlapDimensionUsage.java │ │ │ ├── OlapHierarchy.java │ │ │ ├── OlapHierarchyLevel.java │ │ │ └── OlapMeasure.java │ │ └── security │ │ │ ├── RowLevelSecurity.java │ │ │ ├── Security.java │ │ │ ├── SecurityACL.java │ │ │ ├── SecurityOwner.java │ │ │ ├── SecurityReference.java │ │ │ └── SecurityService.java │ │ ├── test │ │ ├── TestBV.java │ │ └── TestCWM.java │ │ └── util │ │ ├── Const.java │ │ ├── FileUtil.java │ │ ├── IVersionHelper.java │ │ ├── ObjectAlreadyExistsException.java │ │ ├── Settings.java │ │ ├── UniqueArrayList.java │ │ ├── UniqueList.java │ │ └── VersionHelper.java └── resources │ ├── libformula.properties │ └── org │ └── pentaho │ ├── metadata │ ├── Model.gwt.xml │ ├── libformula │ │ ├── BeginsWith-Function.properties │ │ ├── Contains-Function.properties │ │ ├── EndsWith-Function.properties │ │ ├── Equals-Function.properties │ │ ├── In-Function.properties │ │ └── Like-Function.properties │ ├── messages │ │ ├── messages.properties │ │ ├── messages_CN.properties │ │ ├── messages_de.properties │ │ ├── messages_fr.properties │ │ ├── messages_ja.properties │ │ └── messages_zh_CN.properties │ └── query │ │ ├── Model.gwt.xml │ │ └── impl │ │ └── ietl │ │ ├── inlinecsv.ktr │ │ ├── inlinecsv_groupby.ktr │ │ └── inlinecsv_groupby_and_constraints.ktr │ └── pms │ ├── core │ └── PentahoCWM.xml │ ├── locale │ ├── messages.properties │ ├── messages_CN.properties │ ├── messages_de.properties │ ├── messages_fr.properties │ ├── messages_ja.properties │ └── messages_zh_CN.properties │ └── schema │ └── package.html └── test ├── java └── org │ └── pentaho │ ├── di │ └── core │ │ └── database │ │ └── mock │ │ ├── MockHive2DatabaseMeta.java │ │ ├── MockHiveDatabaseMeta.java │ │ └── MockImpalaDatabaseMeta.java │ ├── helpers │ └── SQLDialectHelper.java │ ├── metadata │ ├── DataTableTest.java │ ├── MetadataModelsServiceTest.java │ ├── MondrianModelExporterTest.java │ ├── SpiderWebTestModel.java │ ├── TestHelper.java │ ├── TestModelProvider.java │ ├── automodel │ │ ├── CsvDataSourceImportStrategyTest.java │ │ └── PhysicalTableImporterTest.java │ ├── libformula │ │ └── FunctionsTest.java │ ├── model │ │ ├── concept │ │ │ ├── types │ │ │ │ └── LocalizedStringTest.java │ │ │ └── util │ │ │ │ └── DataFormatterTest.java │ │ └── olap │ │ │ └── OlapCalculatedMemberTest.java │ ├── query │ │ ├── impl │ │ │ └── sql │ │ │ │ └── SqlGeneratorTest.java │ │ └── model │ │ │ └── util │ │ │ ├── QueryModelMetaDataTest.java │ │ │ └── QueryXmlHelperTest.java │ └── util │ │ ├── BooleanComparatorTest.java │ │ ├── CsvDataTypeEvaluatorTest.java │ │ ├── DataTypeDetectorTest.java │ │ ├── MessageSearchUtility.java │ │ ├── UtilTest.java │ │ └── XmiParserTest.java │ └── pms │ ├── MessageTest.java │ ├── RelationshipMetaTest.java │ ├── TstConcept.java │ ├── factory │ └── CwmSchemaFactoryTest.java │ ├── mql │ ├── MQLQueryTest.java │ ├── MappedQueryTest.java │ └── SpiderWebTestModel.java │ └── schema │ └── security │ └── RowLevelSecurityTest.java └── resources ├── ESAPI.properties └── log4j.properties /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | #* text=auto 3 | 4 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @pentaho/sp-branch-write -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .classpath 3 | .settings 4 | build 5 | target 6 | release.properties 7 | pom.xml.releaseBackup 8 | *.iml 9 | .idea 10 | bin 11 | *.class 12 | *.jar 13 | *.war 14 | *.ear 15 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pentaho Metadata 2 | Pentaho Metadata allows you to build Pentaho metadata domains and relational data models. A Pentaho Metadata Model maps the physical structure of your database into a logical business model. 3 | 4 | 5 | How to build 6 | -------------- 7 | 8 | Pentaho Metadata uses the maven framework. 9 | 10 | 11 | #### Pre-requisites for building the project: 12 | * Maven, version 3+ 13 | * Java JDK 11 14 | * This [settings.xml](https://raw.githubusercontent.com/pentaho/maven-parent-poms/master/maven-support-files/settings.xml) in your /.m2 directory 15 | 16 | #### Building it 17 | 18 | This is a maven project, and to build it use the following command 19 | 20 | ``` 21 | $ mvn clean install 22 | ``` 23 | Optionally you can specify -Drelease to trigger obfuscation and/or uglification (as needed) 24 | 25 | Optionally you can specify -Dmaven.test.skip=true to skip the tests (even though 26 | you shouldn't as you know) 27 | 28 | The build result will be a Pentaho package located in ```target```. 29 | 30 | #### Running the tests 31 | 32 | __Unit tests__ 33 | 34 | This will run all unit tests in the project (and sub-modules). To run integration tests as well, see Integration Tests below. 35 | 36 | ``` 37 | $ mvn test 38 | ``` 39 | 40 | If you want to remote debug a single java unit test (default port is 5005): 41 | 42 | ``` 43 | $ cd core 44 | $ mvn test -Dtest=<> -Dmaven.surefire.debug 45 | ``` 46 | 47 | __Integration tests__ 48 | 49 | In addition to the unit tests, there are integration tests that test cross-module operation. This will run the integration tests. 50 | 51 | ``` 52 | $ mvn verify -DrunITs 53 | ``` 54 | 55 | To run a single integration test: 56 | 57 | ``` 58 | $ mvn verify -DrunITs -Dit.test=<> 59 | ``` 60 | 61 | To run a single integration test in debug mode (for remote debugging in an IDE) on the default port of 5005: 62 | 63 | ``` 64 | $ mvn verify -DrunITs -Dit.test=<> -Dmaven.failsafe.debug 65 | ``` 66 | 67 | To skip test 68 | 69 | ``` 70 | $ mvn clean install -DskipTests 71 | ``` 72 | 73 | To get log as text file 74 | 75 | ``` 76 | $ mvn clean install test >log.txt 77 | ``` 78 | 79 | 80 | __IntelliJ__ 81 | 82 | * Don't use IntelliJ's built-in maven. Make it use the same one you use from the commandline. 83 | * Project Preferences -> Build, Execution, Deployment -> Build Tools -> Maven ==> Maven home directory 84 | ```` 85 | 86 | -------------------------------------------------------------------------------- /jdbc/repository.properties: -------------------------------------------------------------------------------- 1 | # This file is here for integration tests. Class CWM has a hard-coded file reference 2 | 3 | # Class name of MDR storage plugin factory 4 | org.netbeans.mdr.storagemodel.StorageFactoryClassName=org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl 5 | 6 | # The default filename is "mdr"... 7 | # org.netbeans.mdr.persistence.btreeimpl.filename=mdr 8 | 9 | # Perhaps we can set an alternative... 10 | # org.netbeans.mdr.persistence.btreeimpl.filename=PentahoMetaModel 11 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/DB2DialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class DB2DialectIT extends MetadataTestBase { 17 | 18 | public void testLimitSQL() { 19 | assertSelect( 20 | "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC FETCH FIRST 10 ROWS ONLY", 21 | new DB2Dialect(), createLimitedQuery() ); 22 | } 23 | 24 | public void testNoLimitSQL() { 25 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", new DB2Dialect(), 26 | createUnlimitedQuery() ); 27 | } 28 | 29 | public void testGetDateSQL() { 30 | String dateExpected = "DATE('2000-01-01')"; 31 | DefaultSQLDialect dialect = new DB2Dialect(); 32 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 33 | } 34 | 35 | public void testGetDateSQL_withTime() { 36 | String dateExpected = "TIMESTAMP('20000101120000')"; 37 | DefaultSQLDialect dialect = new DB2Dialect(); 38 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/FirebirdDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class FirebirdDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT FIRST 10 DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new FirebirdDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new FirebirdDialect(), createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/GoogleBigQueryDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | import org.junit.Assert; 16 | import org.pentaho.pms.MetadataTestBase; 17 | 18 | public class GoogleBigQueryDialectIT extends MetadataTestBase { 19 | 20 | public void testLimitSQL() { 21 | assertSelect( 22 | "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC LIMIT 10", 23 | new GoogleBigQueryDialect(), 24 | createLimitedQuery() ); 25 | } 26 | 27 | public void testNoLimitSQL() { 28 | assertSelect( 29 | "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 30 | new GoogleBigQueryDialect(), 31 | createUnlimitedQuery() ); 32 | } 33 | 34 | public void testGetDateSQL() { 35 | String dateExpected = "CAST('2000-01-01' AS DATE)"; 36 | DefaultSQLDialect dialect = new GoogleBigQueryDialect(); 37 | Assert.assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 38 | } 39 | 40 | public void testGetDateSQL_withTime() { 41 | String dateExpected = "CAST('2000-01-01 12:00:00.0' AS TIMESTAMP)"; 42 | DefaultSQLDialect dialect = new GoogleBigQueryDialect(); 43 | Assert.assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/H2DialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class H2DialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT TOP 10 DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new H2Dialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", new H2Dialect(), 24 | createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/HypersonicDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class HypersonicDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT TOP 10 DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new HypersonicDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new HypersonicDialect(), createUnlimitedQuery() ); 25 | } 26 | 27 | public void testGetDateSQL() { 28 | String dateExpected = "'2015-08-28 00:00:00.0'"; 29 | HypersonicDialect dialect = new HypersonicDialect(); 30 | assertEquals( dateExpected, dialect.getDateSQL( 2015, 8, 28 ) ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/IngresDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class IngresDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT FIRST 10 DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new IngresDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new IngresDialect(), createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/MSSQLDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class MSSQLDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT DISTINCT TOP 10 t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new MSSQLDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", new MSSQLDialect(), 24 | createUnlimitedQuery() ); 25 | } 26 | 27 | public void testGetDateSQL() { 28 | String dateExpected = "'20000101'"; 29 | MSSQLDialect dialect = new MSSQLDialect(); 30 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 31 | } 32 | 33 | public void testGetDateSQL_withTime() { 34 | String dateExpected = "'2000-01-01 12:00:00.0'"; 35 | MSSQLDialect dialect = new MSSQLDialect(); 36 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/MSSQLNativeDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class MSSQLNativeDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT DISTINCT TOP 10 t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new MSSQLNativeDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new MSSQLNativeDialect(), createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/MariaDBDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.pms.mql.dialect; 15 | 16 | public class MariaDBDialectIT extends MySQLDialectIT { 17 | 18 | public void testLimitSQL() { 19 | super.testLimitSQL(); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | super.testNoLimitSQL(); 24 | } 25 | 26 | public void testGetDateSQL() { 27 | super.testGetDateSQL(); 28 | } 29 | 30 | public void testGetDateSQL_withTime() { 31 | super.testGetDateSQL_withTime(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/MySQLDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class MySQLDialectIT extends MetadataTestBase { 17 | 18 | public void testLimitSQL() { 19 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC LIMIT 10", 20 | new MySQLDialect(), createLimitedQuery() ); 21 | } 22 | 23 | public void testNoLimitSQL() { 24 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", new MySQLDialect(), 25 | createUnlimitedQuery() ); 26 | } 27 | 28 | public void testGetDateSQL() { 29 | String dateExpected = "DATE('2000-01-01')"; 30 | DefaultSQLDialect dialect = new MySQLDialect(); 31 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 32 | } 33 | 34 | public void testGetDateSQL_withTime() { 35 | String dateExpected = "'2000-01-01 12:00:00.0'"; 36 | DefaultSQLDialect dialect = new MySQLDialect(); 37 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/NetezzaDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class NetezzaDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC LIMIT 10", 19 | new NetezzaDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new NetezzaDialect(), createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/OracleDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class OracleDialectIT extends MetadataTestBase { 17 | 18 | public void testLimitSQL() { 19 | assertSelect( 20 | "SELECT * FROM (SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC ) WHERE ROWNUM <= 10", 21 | new OracleDialect(), createLimitedQuery() ); 22 | } 23 | 24 | public void testNoLimitSQL() { 25 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC ", 26 | new OracleDialect(), createUnlimitedQuery() ); 27 | } 28 | 29 | public void testGetDateSQL() { 30 | String dateExpected = "TO_DATE('2000-01-01','YYYY-MM-DD')"; 31 | DefaultSQLDialect dialect = new OracleDialect(); 32 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 33 | } 34 | 35 | public void testGetDateSQL_withTime() { 36 | String dateExpected = "TO_DATE('2000-01-01 12:00:00','YYYY-MM-DD HH24:MI:SS')"; 37 | DefaultSQLDialect dialect = new OracleDialect(); 38 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/PostgreSQLDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.pms.mql.dialect; 15 | 16 | import org.pentaho.pms.MetadataTestBase; 17 | 18 | public class PostgreSQLDialectIT extends MetadataTestBase { 19 | 20 | public void testLimitSQL() { 21 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC LIMIT 10", 22 | new PostgreSQLDialect(), createLimitedQuery() ); 23 | } 24 | 25 | public void testNoLimitSQL() { 26 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 27 | new PostgreSQLDialect(), createUnlimitedQuery() ); 28 | } 29 | 30 | public void testGetDateSQL() { 31 | String dateExpected = "date '2000-01-01'"; 32 | DefaultSQLDialect dialect = new PostgreSQLDialect(); 33 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1 ) ); 34 | } 35 | 36 | public void testGetDateSQL_withTime() { 37 | String dateExpected = "timestamp '2000-01-01 12:00:00.0'"; 38 | DefaultSQLDialect dialect = new PostgreSQLDialect(); 39 | assertEquals( dateExpected, dialect.getDateSQL( 2000, 1, 1, 12, 0, 0, 0 ) ); 40 | } 41 | 42 | public void testQuoteStringLiteralNLS() { 43 | DefaultSQLDialect redshiftDialect = new PostgreSQLDialect(); 44 | String quotedWord = redshiftDialect.quoteStringLiteral( "Instalação" ); 45 | assertEquals( "N'Instalação'", quotedWord ); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/RedshiftDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.pms.mql.dialect; 15 | 16 | import org.pentaho.pms.MetadataTestBase; 17 | 18 | public class RedshiftDialectIT extends MetadataTestBase { 19 | 20 | public void testQuoteStringLiteralNLS() { 21 | DefaultSQLDialect redshiftDialect = new RedshiftDialect(); 22 | String quotedWord = redshiftDialect.quoteStringLiteral( "Instalação" ); 23 | assertEquals( "'Instalação'", quotedWord ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/it/java/org/pentaho/pms/mql/dialect/SybaseDialectIT.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.pms.mql.dialect; 13 | 14 | import org.pentaho.pms.MetadataTestBase; 15 | 16 | public class SybaseDialectIT extends MetadataTestBase { 17 | public void testLimitSQL() { 18 | assertSelect( "SELECT DISTINCT TOP 10 t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 19 | new SybaseDialect(), createLimitedQuery() ); 20 | } 21 | 22 | public void testNoLimitSQL() { 23 | assertSelect( "SELECT DISTINCT t.id FROM TABLE t WHERE ( ( t.id is null ) ) ORDER BY t.id ASC", 24 | new SybaseDialect(), createUnlimitedQuery() ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/it/resources/kettle-password-encoder-plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Kettle Password Encoder 5 | org.pentaho.support.encryption.KettleTwoWayPasswordEncoder 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/it/resources/mqlquery01.xmql: -------------------------------------------------------------------------------- 1 | 2 | 3 | relational 4 | Orders 5 | Orders 6 | Orders 7 | 8 | false 9 | 10 | 11 | 12 | bc_CUSTOMER_W_TER 13 | BC_CUSTOMERS_CUSTOMERNAME 14 | 15 | 16 | bc_CUSTOMER_W_TER 17 | BC_CUSTOMERS_COUNTRY 18 | 19 | 20 | 21 | 22 | 23 | asc 24 | bc_CUSTOMER_W_TER 25 | BC_CUSTOMERS_COUNTRY 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/it/resources/mqlquery02.xmql: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | relational 5 | Orders 6 | Orders 7 | Orders 8 | 9 | true 10 | 11 | 12 | 13 | bc_CUSTOMER_W_TER 14 | BC_CUSTOMERS_CUSTOMERNAME 15 | 16 | 17 | bc_CUSTOMER_W_TER 18 | BC_CUSTOMERS_COUNTRY 19 | 20 | 21 | 22 | 23 | 24 | asc 25 | bc_CUSTOMER_W_TER 26 | BC_CUSTOMERS_COUNTRY 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/it/resources/mqlquery03.xmql: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | relational 5 | Orders 6 | Orders 7 | Orders 8 | 9 | 10 | bc_ORDERS 11 | BC_ORDERS_ORDERNUMBER 12 | 13 | 14 | 15 | 16 | AND 17 | [bc_ORDERS.BC_ORDERS_ORDERDATE] >= DATE(1;1;2007) 18 | 19 | 20 | 21 | 22 | asc 23 | bc_ORDERS 24 | BC_ORDERS_ORDERNUMBER 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/it/resources/mqlquery04.xmql: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | relational 5 | Orders 6 | Orders 7 | Orders 8 | 9 | true 10 | 10 11 | 12 | 13 | 14 | bc_CUSTOMER_W_TER 15 | BC_CUSTOMERS_CUSTOMERNAME 16 | 17 | 18 | bc_CUSTOMER_W_TER 19 | BC_CUSTOMERS_COUNTRY 20 | 21 | 22 | 23 | 24 | 25 | asc 26 | bc_CUSTOMER_W_TER 27 | BC_CUSTOMERS_COUNTRY 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/it/resources/mqlquery_oldformat.xmql: -------------------------------------------------------------------------------- 1 | 2 | 3 | relational 4 | Orders 5 | Orders 6 | Orders 7 | 8 | 9 | bc_CUSTOMER_W_TER 10 | BC_CUSTOMERS_CUSTOMERNAME 11 | 12 | 13 | bc_CUSTOMER_W_TER 14 | BC_CUSTOMERS_COUNTRY 15 | 16 | 17 | 18 | 19 | 20 | asc 21 | bc_CUSTOMER_W_TER 22 | BC_CUSTOMERS_COUNTRY 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/it/resources/olap-cubes-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quadrant Analysis 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Variance Percent 15 | Measures 16 | ([Measures].[Variance]/[Measures].[Budget])*100 17 | #,###% 18 | 19 | 20 | Hidden Variance Percent 21 | Measures 22 | ([Measures].[Variance]/[Measures].[Budget])*100 23 | #,###% 24 | Y 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/it/resources/olap-roles-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | role1 5 | definition 1 6 | 7 | 8 | role2 9 | definition 2 10 | 11 | -------------------------------------------------------------------------------- /src/it/resources/samples/content-acl.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | tiffany 4 | joe 5 | suzy 6 | pat 7 | admin 8 | 9 | 10 | ROLE_DEV 11 | ROLE_AUTHENTICATED 12 | ROLE_IS 13 | ROLE_ADMIN 14 | ROLE_DEVMGR 15 | ROLE_CEO 16 | ROLE_CTO 17 | 18 | 19 | 20 | Create 4 21 | Subscribe 2 22 | Update 8 23 | Execute 1 24 | NONE 0 25 | All 31 26 | Delete 16 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/metadata/csvfiles/People.csv: -------------------------------------------------------------------------------- 1 | Fname,Lname,Empno,city,Zip,County,Age 2 | Gold,David,101,Orlando,32829,Orange,36 3 | Kim,Possible,102,Metroeast,32828,Orange,29 4 | Han,Montana,103,Lakemary,32829,Seminole,32 5 | Herm,Deer,104,Winterpark,32828,Orange,36 6 | Jem,Jonas,105,Moss Park,32829,Orange,30 7 | Nick,Jonas,106,St. Cloud,32828,Volusia,31 8 | Nick,Rippa,107,Altamonte,32888,Orange,33 9 | Mat,Ray,108,Wekiva,32805,Orange,30 10 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/metadata/csvfiles/anotherexample.csv: -------------------------------------------------------------------------------- 1 | Task,Est'd Time,Time Left,Time Spent,Time Left 2 | Server Smoke Testing,3.5,3.5,0.5,3.5 3 | Automated Testing,8,4,4,0 4 | Load Testing,13,0,13,12.5 5 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/metadata/csvfiles/csv_people.csv: -------------------------------------------------------------------------------- 1 | id,name,gender,age 2 | 1,"mike",male,18 3 | 2,"michael",male,19 4 | 3,"peter",male,18 5 | 4,"bob",male,17 6 | 5,"barbara, barb",female,18 7 | 6,"charlotte",female,18 8 | 7,"hillary",female,20 9 | 8,"vera",female,17 10 | 9,"carrie",female,17 -------------------------------------------------------------------------------- /src/it/resources/solution/system/metadata/csvfiles/csv_various_types.csv: -------------------------------------------------------------------------------- 1 | date,time,description,rating,holiday 2 | 2008-11-04,12:00,election day,8.8,no 3 | 2008-12-24,00:00,christmas day,9.0,true 4 | 2007-12-31,23:59,new years eve,6.4 5 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/metadata/csvfiles/example.csv: -------------------------------------------------------------------------------- 1 | "Data1","Data2","Data3","Data4" 2 | 1,4.5,02/12/77,"String Value" 3 | 2,5.7,03/12/08,"Bigger String Value" 4 | 3,3.4,04/01/09,"Very Long String Value for testing columns" 5 | 4,1.1,01/01/09,"A String" 6 | 5,15,02/12/77,"String Value" 7 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/pentaho.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | server.log 5 | DEBUG 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/pentahoSystemConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/simple-jndi/jdbc.properties: -------------------------------------------------------------------------------- 1 | SampleData/type=javax.sql.DataSource 2 | SampleData/driver=org.hsqldb.jdbcDriver 3 | SampleData/url=jdbc:hsqldb:file:test/solution/system/data/sampledata 4 | SampleData/user=pentaho_user 5 | SampleData/password=password 6 | SampleDataAdmin/type=javax.sql.DataSource 7 | SampleDataAdmin/driver=org.hsqldb.jdbcDriver 8 | SampleDataAdmin/url=jdbc:hsqldb:file:test/solution/system/data/sampledata 9 | SampleDataAdmin/user=pentaho_admin 10 | SampleDataAdmin/password=password 11 | -------------------------------------------------------------------------------- /src/it/resources/solution/system/systemListeners.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/automodel/importing/strategy/DefaultImportStrategy.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.metadata.automodel.importing.strategy; 15 | 16 | import org.pentaho.di.core.row.ValueMetaInterface; 17 | import org.pentaho.metadata.automodel.PhysicalTableImporter; 18 | 19 | public class DefaultImportStrategy implements PhysicalTableImporter.ImportStrategy { 20 | 21 | @Override 22 | public boolean shouldInclude( final ValueMetaInterface valueMeta ) { 23 | return true; 24 | } 25 | 26 | @Override 27 | public String displayName( final ValueMetaInterface valueMeta ) { 28 | return valueMeta.getName(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/datatable/Cell.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.datatable; 14 | 15 | import java.math.BigDecimal; 16 | 17 | /** 18 | * Defines a cell in a @see DataTable 19 | * 20 | * @author jamesdixon 21 | * 22 | */ 23 | public class Cell { 24 | 25 | private String f; 26 | 27 | private BigDecimal v; 28 | 29 | public Cell() { 30 | } 31 | 32 | public Cell( BigDecimal value ) { 33 | this.v = value; 34 | } 35 | 36 | public Cell( BigDecimal value, String formatted ) { 37 | this.v = value; 38 | this.f = formatted; 39 | } 40 | 41 | /** 42 | * Returns the string value of this cell. Can be the formatted value of a numeric column, a string value, a formatted 43 | * date value etc. 44 | * 45 | * @return 46 | */ 47 | public String getf() { 48 | return f; 49 | } 50 | 51 | /** 52 | * Sets the string value of this cell 53 | * 54 | * @param f 55 | */ 56 | public void setf( String f ) { 57 | this.f = f; 58 | } 59 | 60 | /** 61 | * Returns the numeric value, if any. Can be null. 62 | * 63 | * @return 64 | */ 65 | 66 | public BigDecimal getv() { 67 | return v; 68 | } 69 | 70 | /** 71 | * Sets the numeric value of the cell 72 | * 73 | * @param v 74 | */ 75 | public void setv( BigDecimal v ) { 76 | this.v = v; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/datatable/Column.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.datatable; 14 | 15 | /** 16 | * Defines the metadata for a column in a @see DataTable 17 | * 18 | * @author jamesdixon 19 | * 20 | */ 21 | public class Column { 22 | 23 | private String id; 24 | private String type; 25 | private String label; 26 | 27 | public Column() { 28 | } 29 | 30 | public Column( String id, String label, String type ) { 31 | this.id = id; 32 | this.label = label; 33 | this.type = type; 34 | } 35 | 36 | /** 37 | * Returns the id of this column 38 | * 39 | * @return 40 | */ 41 | public String getId() { 42 | return id; 43 | } 44 | 45 | /** 46 | * Sets the id of this column 47 | * 48 | * @param id 49 | */ 50 | public void setId( String id ) { 51 | this.id = id; 52 | } 53 | 54 | /** 55 | * Gets the type of this column - 'string', 'numeric', 'date', or 'boolean' 56 | * 57 | * @return 58 | */ 59 | public String getType() { 60 | return type; 61 | } 62 | 63 | /** 64 | * Sets the type of this column 65 | * 66 | * @param type 67 | */ 68 | public void setType( String type ) { 69 | this.type = type; 70 | } 71 | 72 | /** 73 | * Returns the label of this column 74 | * 75 | * @return 76 | */ 77 | public String getLabel() { 78 | return label; 79 | } 80 | 81 | /** 82 | * Sets the label of this column 83 | * 84 | * @param label 85 | */ 86 | public void setLabel( String label ) { 87 | this.label = label; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/datatable/DataTable.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.datatable; 14 | 15 | /** 16 | * A serializable data table. The JSON serialization of this class is compatible with the javascript objects expected by 17 | * the Data Access client API and the Visualization API. 18 | * 19 | * @author jamesdixon 20 | * 21 | */ 22 | public class DataTable { 23 | 24 | private Column[] cols; 25 | 26 | private Row[] rows; 27 | 28 | public DataTable() { 29 | 30 | } 31 | 32 | public DataTable( Row[] rows, Column[] cols ) { 33 | this.rows = rows; 34 | this.cols = cols; 35 | } 36 | 37 | /** 38 | * Returns an array of @see Column metadata 39 | * 40 | * @return 41 | */ 42 | public Column[] getCols() { 43 | return cols; 44 | } 45 | 46 | /** 47 | * Sets the column metadata 48 | * 49 | * @param cols 50 | */ 51 | public void setCols( Column[] cols ) { 52 | this.cols = cols; 53 | } 54 | 55 | /** 56 | * Returns the @see Row objects for this table 57 | * 58 | * @return 59 | */ 60 | public Row[] getRows() { 61 | return rows; 62 | } 63 | 64 | /** 65 | * Sets the rows for this table 66 | * 67 | * @param rows 68 | */ 69 | public void setRows( Row[] rows ) { 70 | this.rows = rows; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/datatable/Row.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.datatable; 14 | 15 | /** 16 | * An object that stores the @see Cell objects for a row in a @see DataTable 17 | * 18 | * @author jamesdixon 19 | * 20 | */ 21 | public class Row { 22 | 23 | private Cell[] c; 24 | 25 | public Row() { 26 | } 27 | 28 | public Row( Cell[] cells ) { 29 | c = cells; 30 | } 31 | 32 | /** 33 | * Returns the @see cell objects for this row 34 | * 35 | * @return 36 | */ 37 | public Cell[] getc() { 38 | return c; 39 | } 40 | 41 | /** 42 | * Sets the cells for this row 43 | * 44 | * @param c 45 | */ 46 | public void setc( Cell[] c ) { 47 | this.c = c; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/datatable/Types.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.datatable; 14 | 15 | /** 16 | * A helper object that provides constants for the @see DataTable, @see Column, and @see Row objects 17 | * 18 | * @author jamesdixon 19 | * 20 | */ 21 | public class Types { 22 | 23 | public static final String TYPE_STRING = "string"; 24 | public static final String TYPE_NUMERIC = "number"; 25 | public static final String TYPE_DATE = "date"; 26 | public static final String TYPE_BOOLEAN = "boolean"; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/BeginsWithFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.libformula; 14 | 15 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 16 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 17 | import org.pentaho.reporting.libraries.formula.function.text.TextFunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.typing.Type; 19 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; 21 | 22 | /** 23 | * Describes the BEGINSWITH function 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | * 27 | */ 28 | public class BeginsWithFunctionDescription extends AbstractFunctionDescription { 29 | 30 | private static final long serialVersionUID = 8787262061507547672L; 31 | 32 | public BeginsWithFunctionDescription() { 33 | super( "BeginsWith", "org.pentaho.metadata.libformula.BeginsWith-Function" ); 34 | } 35 | 36 | public FunctionCategory getCategory() { 37 | return TextFunctionCategory.CATEGORY; 38 | } 39 | 40 | public int getParameterCount() { 41 | return 2; 42 | } 43 | 44 | public Type getParameterType( final int position ) { 45 | return TextType.TYPE; 46 | } 47 | 48 | public Type getValueType() { 49 | return LogicalType.TYPE; 50 | } 51 | 52 | public boolean isParameterMandatory( final int position ) { 53 | return true; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/ContainsFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.libformula; 14 | 15 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 16 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 17 | import org.pentaho.reporting.libraries.formula.function.text.TextFunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.typing.Type; 19 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; 21 | 22 | /** 23 | * Describes the CONTAINS function 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | * 27 | */ 28 | public class ContainsFunctionDescription extends AbstractFunctionDescription { 29 | 30 | private static final long serialVersionUID = 8787262061507547672L; 31 | 32 | public ContainsFunctionDescription() { 33 | super( "Contains", "org.pentaho.metadata.libformula.Contains-Function" ); 34 | } 35 | 36 | public FunctionCategory getCategory() { 37 | return TextFunctionCategory.CATEGORY; 38 | } 39 | 40 | public int getParameterCount() { 41 | return 2; 42 | } 43 | 44 | public Type getParameterType( final int position ) { 45 | return TextType.TYPE; 46 | } 47 | 48 | public Type getValueType() { 49 | return LogicalType.TYPE; 50 | } 51 | 52 | public boolean isParameterMandatory( final int position ) { 53 | return true; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/EndsWithFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.libformula; 14 | 15 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 16 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 17 | import org.pentaho.reporting.libraries.formula.function.text.TextFunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.typing.Type; 19 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; 21 | 22 | /** 23 | * Describes the ENDSWITH function 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | * 27 | */ 28 | public class EndsWithFunctionDescription extends AbstractFunctionDescription { 29 | 30 | private static final long serialVersionUID = 8787262061507547672L; 31 | 32 | public EndsWithFunctionDescription() { 33 | super( "EndsWith", "org.pentaho.metadata.libformula.EndsWith-Function" ); 34 | } 35 | 36 | public FunctionCategory getCategory() { 37 | return TextFunctionCategory.CATEGORY; 38 | } 39 | 40 | public int getParameterCount() { 41 | return 2; 42 | } 43 | 44 | public Type getParameterType( final int position ) { 45 | return TextType.TYPE; 46 | } 47 | 48 | public Type getValueType() { 49 | return LogicalType.TYPE; 50 | } 51 | 52 | public boolean isParameterMandatory( final int position ) { 53 | return true; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/EqualsFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.libformula; 14 | 15 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 16 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 17 | import org.pentaho.reporting.libraries.formula.function.logical.LogicalFunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.typing.Type; 19 | import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 21 | 22 | public class EqualsFunctionDescription extends AbstractFunctionDescription { 23 | private static final long serialVersionUID = -796481383341381910L; 24 | 25 | public EqualsFunctionDescription() { 26 | super( "EQUALS", "org.pentaho.metadata.libformula.Equals-Function" ); 27 | } 28 | 29 | public int getParameterCount() { 30 | return 1; 31 | } 32 | 33 | public boolean isInfiniteParameterCount() { 34 | return true; 35 | } 36 | 37 | public Type getParameterType( final int position ) { 38 | return AnyType.TYPE; 39 | } 40 | 41 | public Type getValueType() { 42 | return LogicalType.TYPE; 43 | } 44 | 45 | /** 46 | * Defines, whether the parameter at the given position is mandatory. A mandatory parameter must be filled in, while 47 | * optional parameters need not to be filled in. 48 | * 49 | * @return 50 | */ 51 | public boolean isParameterMandatory( final int position ) { 52 | return true; 53 | } 54 | 55 | public FunctionCategory getCategory() { 56 | return LogicalFunctionCategory.CATEGORY; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/InFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.metadata.libformula; 15 | 16 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 17 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.function.information.InformationFunctionCategory; 19 | import org.pentaho.reporting.libraries.formula.typing.Type; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType; 21 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 22 | 23 | /** 24 | * Creation-Date: 04.11.2006, 18:28:55 25 | * 26 | * @author Thomas Morgner 27 | */ 28 | public class InFunctionDescription extends AbstractFunctionDescription { 29 | private static final long serialVersionUID = -796481383341381910L; 30 | 31 | public InFunctionDescription() { 32 | super( "IN", "org.pentaho.metadata.libformula.In-Function" ); 33 | } 34 | 35 | public int getParameterCount() { 36 | return 1; 37 | } 38 | 39 | public boolean isInfiniteParameterCount() { 40 | return true; 41 | } 42 | 43 | public Type getParameterType( final int position ) { 44 | return AnyType.TYPE; 45 | } 46 | 47 | public Type getValueType() { 48 | return LogicalType.TYPE; 49 | } 50 | 51 | /** 52 | * Defines, whether the parameter at the given position is mandatory. A mandatory parameter must be filled in, while 53 | * optional parameters need not to be filled in. 54 | * 55 | * @return 56 | */ 57 | public boolean isParameterMandatory( final int position ) { 58 | return false; 59 | } 60 | 61 | public FunctionCategory getCategory() { 62 | return InformationFunctionCategory.CATEGORY; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/libformula/LikeFunctionDescription.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.libformula; 14 | 15 | import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; 16 | import org.pentaho.reporting.libraries.formula.function.FunctionCategory; 17 | import org.pentaho.reporting.libraries.formula.function.text.TextFunctionCategory; 18 | import org.pentaho.reporting.libraries.formula.typing.Type; 19 | import org.pentaho.reporting.libraries.formula.typing.coretypes.LogicalType; 20 | import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; 21 | 22 | /** 23 | * Describes the LIKE function 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | * 27 | */ 28 | public class LikeFunctionDescription extends AbstractFunctionDescription { 29 | 30 | private static final long serialVersionUID = 8787262061507547672L; 31 | 32 | public LikeFunctionDescription() { 33 | super( "Like", "org.pentaho.metadata.libformula.Like-Function" ); 34 | } 35 | 36 | public FunctionCategory getCategory() { 37 | return TextFunctionCategory.CATEGORY; 38 | } 39 | 40 | public int getParameterCount() { 41 | return 2; 42 | } 43 | 44 | public Type getParameterType( final int position ) { 45 | return TextType.TYPE; 46 | } 47 | 48 | public Type getValueType() { 49 | return LogicalType.TYPE; 50 | } 51 | 52 | public boolean isParameterMandatory( final int position ) { 53 | return true; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/IPhysicalColumn.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model; 14 | 15 | import java.util.List; 16 | 17 | import org.pentaho.metadata.model.concept.IConcept; 18 | import org.pentaho.metadata.model.concept.types.AggregationType; 19 | import org.pentaho.metadata.model.concept.types.DataType; 20 | import org.pentaho.metadata.model.concept.types.FieldType; 21 | 22 | /** 23 | * This interface defines the API for all physical columns. 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | * 27 | */ 28 | public interface IPhysicalColumn extends IConcept { 29 | public static final String FIELDTYPE_PROPERTY = "fieldtype"; //$NON-NLS-1$ 30 | public static final String DATATYPE_PROPERTY = "datatype"; //$NON-NLS-1$ 31 | public static final String AGGREGATIONTYPE_PROPERTY = "aggregation"; //$NON-NLS-1$ 32 | public static final String AGGREGATIONLIST_PROPERTY = "aggregation_list"; //$NON-NLS-1$ 33 | 34 | public DataType getDataType(); 35 | 36 | public void setDataType( DataType dataType ); 37 | 38 | public FieldType getFieldType(); 39 | 40 | public void setFieldType( FieldType fieldType ); 41 | 42 | public AggregationType getAggregationType(); 43 | 44 | public void setAggregationType( AggregationType aggType ); 45 | 46 | public List getAggregationList(); 47 | 48 | public void setAggregationList( List aggList ); 49 | 50 | public IPhysicalTable getPhysicalTable(); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/IPhysicalModel.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model; 14 | 15 | import java.util.List; 16 | 17 | import org.pentaho.metadata.model.concept.IConcept; 18 | 19 | /** 20 | * This interface defines the API for all physical models. 21 | * 22 | * @author Will Gorman (wgorman@pentaho.com) 23 | * 24 | */ 25 | public interface IPhysicalModel extends IConcept { 26 | public List getPhysicalTables(); 27 | 28 | public String getQueryExecName(); 29 | 30 | public String getDefaultQueryClassname(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/IPhysicalTable.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model; 14 | 15 | import java.util.List; 16 | 17 | import org.pentaho.metadata.model.concept.IConcept; 18 | 19 | public interface IPhysicalTable extends IConcept { 20 | 21 | public static final String TABLETYPE_PROPERTY = "tabletype"; //$NON-NLS-1$ 22 | 23 | public IPhysicalModel getPhysicalModel(); 24 | 25 | public List getPhysicalColumns(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/InlineEtlPhysicalTable.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import org.pentaho.metadata.model.concept.Concept; 19 | import org.pentaho.metadata.model.concept.IConcept; 20 | import org.pentaho.metadata.model.concept.types.LocalizedString; 21 | 22 | /** 23 | * The inline etl physical table simply holds pointers to the physical columns. 24 | * 25 | * @author Will Gorman (wgorman@pentaho.com) 26 | */ 27 | public class InlineEtlPhysicalTable extends Concept implements IPhysicalTable { 28 | 29 | private static final long serialVersionUID = 587552752354101051L; 30 | 31 | private List physicalColumns = new ArrayList(); 32 | 33 | public InlineEtlPhysicalTable() { 34 | super(); 35 | // physical table has the following default properties: 36 | setName( new LocalizedString() ); 37 | setDescription( new LocalizedString() ); 38 | } 39 | 40 | @Override 41 | public List getChildren() { 42 | List children = new ArrayList(); 43 | children.addAll( physicalColumns ); 44 | return children; 45 | } 46 | 47 | public InlineEtlPhysicalTable( InlineEtlPhysicalModel parent ) { 48 | setParent( parent ); 49 | } 50 | 51 | public List getPhysicalColumns() { 52 | return physicalColumns; 53 | } 54 | 55 | public IPhysicalModel getPhysicalModel() { 56 | return (IPhysicalModel) getParent(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/AggregationType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * the aggregation type of a physical or logical column. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum AggregationType { 22 | NONE( "AggregationType.USER_NONE_DESC" ), //$NON-NLS-1$ 23 | SUM( "AggregationType.USER_SUM_DESC" ), //$NON-NLS-1$ 24 | AVERAGE( "AggregationType.USER_AVERAGE_DESC" ), //$NON-NLS-1$ 25 | COUNT( "AggregationType.USER_COUNT_DESC" ), //$NON-NLS-1$ 26 | COUNT_DISTINCT( "AggregationType.USER_COUNT_DISTINCT_DESC" ), //$NON-NLS-1$ 27 | MINIMUM( "AggregationType.USER_MINIMUM_DESC" ), //$NON-NLS-1$ 28 | MAXIMUM( "AggregationType.USER_MAXIMUM_DESC" ); //$NON-NLS-1$ 29 | 30 | private String description; 31 | 32 | private AggregationType( String description ) { 33 | this.description = description; 34 | } 35 | 36 | public String getDescription() { 37 | return description; 38 | } 39 | 40 | public void setDescription( String description ) { 41 | this.description = description; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/Alignment.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | public enum Alignment { 16 | LEFT( "Alignment.USER_LEFT_DESC" ), //$NON-NLS-1$ 17 | RIGHT( "Alignment.USER_RIGHT_DESC" ), //$NON-NLS-1$ 18 | CENTERED( "Alignment.USER_CENTERED_DESC" ), //$NON-NLS-1$ 19 | JUSTIFIED( "Alignment.USER_JUSTIFIED_DESC" ); //$NON-NLS-1$ 20 | 21 | private String description; 22 | 23 | Alignment( String description ) { 24 | this.description = description; 25 | } 26 | 27 | public String getDescription() { 28 | return description; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/DataType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * The data type of a physical or logical column. 17 | * 18 | *
  • {@link #UNKNOWN} 19 | *
  • {@link #STRING} 20 | *
  • {@link #DATE} 21 | *
  • {@link #BOOLEAN} 22 | *
  • {@link #NUMERIC} 23 | *
  • {@link #BINARY} 24 | *
  • {@link #IMAGE} 25 | *
  • {@link #URL} 26 | * 27 | * @author Will Gorman (wgorman@pentaho.com) 28 | * 29 | */ 30 | public enum DataType { 31 | UNKNOWN( 0, "Unknown", "DataType.USER_UNKNOWN_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 32 | STRING( 1, "String", "DataType.USER_STRING_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 33 | DATE( 2, "Date", "DataType.USER_DATE_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 34 | BOOLEAN( 3, "Boolean", "DataType.USER_BOOLEAN_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 35 | NUMERIC( 4, "Numeric", "DataType.USER_NUMERIC_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 36 | BINARY( 5, "Binary", "DataType.USER_BINARY_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 37 | IMAGE( 6, "Image", "DataType.USER_IMAGE_DESC" ), //$NON-NLS-1$ //$NON-NLS-2$ 38 | URL( 7, "URL", "DataType.USER_URL_DESC" ); //$NON-NLS-1$ //$NON-NLS-2$ 39 | 40 | private int type; 41 | private String name, description; 42 | 43 | DataType( int type, String name, String description ) { 44 | this.type = type; 45 | this.name = name; 46 | this.description = description; 47 | } 48 | 49 | public int getType() { 50 | return type; 51 | } 52 | 53 | public void setType( int type ) { 54 | this.type = type; 55 | } 56 | 57 | public String getName() { 58 | return name; 59 | } 60 | 61 | public void setName( String name ) { 62 | this.name = name; 63 | } 64 | 65 | public String getDescription() { 66 | return description; 67 | } 68 | 69 | public void setDescription( String description ) { 70 | this.description = description; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/FieldType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | public enum FieldType { 16 | OTHER( "FieldType.USER_OTHER_DESC" ), //$NON-NLS-1$ 17 | DIMENSION( "FieldType.USER_DIMENSION_DESC" ), //$NON-NLS-1$ 18 | FACT( "FieldType.USER_FACT_DESC" ), //$NON-NLS-1$ 19 | KEY( "FieldType.USER_KEY_DESC" ), //$NON-NLS-1$ 20 | ATTRIBUTE( "FieldType.USER_ATTRIBUTE_DESC" ); //$NON-NLS-1$ 21 | 22 | private String description; 23 | 24 | FieldType( String description ) { 25 | this.description = description; 26 | } 27 | 28 | public String getDescription() { 29 | return description; 30 | } 31 | 32 | public static FieldType guessFieldType( String name ) { 33 | String fieldname = name.toLowerCase(); 34 | String[] ids = new String[] { "id", "pk", "tk", "sk" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 35 | 36 | // Is it a key field? 37 | boolean isKey = false; 38 | for ( int i = 0; i < ids.length && !isKey; i++ ) { 39 | if ( fieldname.startsWith( ids[i] + "_" ) || fieldname.endsWith( "_" + ids[i] ) ) { 40 | isKey = true; //$NON-NLS-1$ //$NON-NLS-2$ 41 | } 42 | } 43 | 44 | if ( isKey ) { 45 | return KEY; 46 | } 47 | 48 | return DIMENSION; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/JoinType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * The join type between two logical tables. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum JoinType { 22 | INNER( "Inner" ), //$NON-NLS-1$ 23 | LEFT_OUTER( "Left outer" ), //$NON-NLS-1$ 24 | RIGHT_OUTER( "Right outer" ), //$NON-NLS-1$ 25 | FULL_OUTER( "Full outer" ); //$NON-NLS-1$ 26 | 27 | String type; 28 | 29 | private JoinType( String type ) { 30 | this.type = type; 31 | } 32 | 33 | public String getType() { 34 | return type; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/LocaleType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * The LocaleType contains metadata information about a locale. 19 | * 20 | * @author Will Gorman (wgorman@pentaho.com) 21 | * 22 | */ 23 | public class LocaleType implements Serializable { 24 | 25 | private static final long serialVersionUID = 5282520977042081601L; 26 | 27 | private String code; 28 | private String description; 29 | 30 | public LocaleType() { 31 | } 32 | 33 | public LocaleType( String code, String description ) { 34 | this.code = code; 35 | this.description = description; 36 | } 37 | 38 | public void setCode( String code ) { 39 | this.code = code; 40 | } 41 | 42 | /** 43 | * the locale code 44 | * 45 | * @return the locale code 46 | */ 47 | public String getCode() { 48 | return code; 49 | } 50 | 51 | public void setDescription( String description ) { 52 | this.description = description; 53 | } 54 | 55 | /** 56 | * a user friendly description of the locale 57 | * 58 | * @return description 59 | */ 60 | public String getDescription() { 61 | return description; 62 | } 63 | 64 | @Override 65 | public boolean equals( Object object ) { 66 | LocaleType l = (LocaleType) object; 67 | return ( ( getDescription() == null && l.getDescription() == null ) || ( getDescription() != null && getDescription() 68 | .equals( l.getDescription() ) ) ) 69 | && ( ( getCode() == null && l.getCode() == null ) || ( getCode() != null && getCode().equals( l.getCode() ) ) ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/RelationshipType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * The relationship type between two logical tables. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum RelationshipType { 22 | UNDEFINED( "undefined" ), //$NON-NLS-1$ 23 | _1_N( "1:N" ), //$NON-NLS-1$ 24 | _N_1( "N:1" ), //$NON-NLS-1$ 25 | _1_1( "1:1" ), //$NON-NLS-1$ 26 | _0_N( "0:N" ), //$NON-NLS-1$ 27 | _N_0( "N:0" ), //$NON-NLS-1$ 28 | _0_1( "0:1" ), //$NON-NLS-1$ 29 | _1_0( "1:0" ), //$NON-NLS-1$ 30 | _N_N( "N:N" ), //$NON-NLS-1$ 31 | _0_0( "0:0" ); //$NON-NLS-1$ 32 | 33 | private String type; 34 | 35 | private RelationshipType( String type ) { 36 | this.type = type; 37 | } 38 | 39 | public String getType() { 40 | return type; 41 | } 42 | 43 | /** 44 | * Calculate the mapping between the relationship type and the join type. 45 | * 46 | * @param relationshipType 47 | * the type of relationship 48 | * @return the join type (inner, left outer, right outer or full outer) 49 | */ 50 | public static JoinType getJoinType( RelationshipType relationshipType ) { 51 | switch ( relationshipType ) { 52 | case _0_N: 53 | return JoinType.LEFT_OUTER; 54 | case _N_0: 55 | return JoinType.RIGHT_OUTER; 56 | case _0_1: 57 | return JoinType.LEFT_OUTER; 58 | case _1_0: 59 | return JoinType.RIGHT_OUTER; 60 | case _0_0: 61 | return JoinType.FULL_OUTER; 62 | default: 63 | return JoinType.INNER; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/TableType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | public enum TableType { 16 | OTHER( "TableType.USER_OTHER_DESC" ), //$NON-NLS-1$ 17 | DIMENSION( "TableType.USER_DIMENSION_DESC" ), //$NON-NLS-1$ 18 | FACT( "TableType.USER_FACT_DESC" ); //$NON-NLS-1$ 19 | 20 | private String description; 21 | 22 | TableType( String description ) { 23 | this.description = description; 24 | } 25 | 26 | public String getDescription() { 27 | return description; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/TargetColumnType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * enum defining the various column types. This replaces the earlier version metadata property isExact(). 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum TargetColumnType { 22 | COLUMN_NAME(), OPEN_FORMULA(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/concept/types/TargetTableType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.concept.types; 14 | 15 | /** 16 | * This enum defines the type of physical table. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum TargetTableType { 22 | TABLE(), INLINE_SQL(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/olap/OlapAnnotation.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | package org.pentaho.metadata.model.olap; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * Created by IntelliJ IDEA. User: rfellows Date: 9/23/11 Time: 3:03 PM To change this template use File | Settings | 18 | * File Templates. 19 | */ 20 | public class OlapAnnotation implements Serializable { 21 | private String name; 22 | private String value; 23 | 24 | public OlapAnnotation() { 25 | } 26 | 27 | public OlapAnnotation( String name, String value ) { 28 | this.name = name; 29 | this.value = value; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName( String name ) { 37 | this.name = name; 38 | } 39 | 40 | public String getValue() { 41 | return value; 42 | } 43 | 44 | public void setValue( String value ) { 45 | this.value = value; 46 | } 47 | 48 | public String asXml() { 49 | if ( name != null & value != null ) { 50 | return " " + value + ""; 51 | } 52 | return ""; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/olap/OlapDimensionUsage.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.olap; 14 | 15 | import java.io.Serializable; 16 | 17 | public class OlapDimensionUsage implements Cloneable, Serializable { 18 | private String name; 19 | private OlapDimension olapDimension; 20 | 21 | public OlapDimensionUsage() { 22 | } 23 | 24 | /** 25 | * @param name 26 | * @param olapDimension 27 | */ 28 | public OlapDimensionUsage( String name, OlapDimension olapDimension ) { 29 | super(); 30 | this.name = name; 31 | this.olapDimension = olapDimension; 32 | } 33 | 34 | public Object clone() { 35 | // shallow copy of the dimension is fine. 36 | OlapDimensionUsage usage = new OlapDimensionUsage(); 37 | usage.name = this.name; 38 | usage.olapDimension = this.olapDimension; 39 | return usage; 40 | } 41 | 42 | public boolean equals( Object obj ) { 43 | return name.equals( ( (OlapDimensionUsage) obj ).name ); 44 | } 45 | 46 | public int hashCode() { 47 | return name.hashCode(); 48 | } 49 | 50 | /** 51 | * @return the name 52 | */ 53 | public String getName() { 54 | return name; 55 | } 56 | 57 | /** 58 | * @param name 59 | * the name to set 60 | */ 61 | public void setName( String name ) { 62 | this.name = name; 63 | } 64 | 65 | /** 66 | * @return the olapDimension 67 | */ 68 | public OlapDimension getOlapDimension() { 69 | return olapDimension; 70 | } 71 | 72 | /** 73 | * @param olapDimension 74 | * the olapDimension to set 75 | */ 76 | public void setOlapDimension( OlapDimension olapDimension ) { 77 | this.olapDimension = olapDimension; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/olap/OlapMeasure.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.olap; 14 | 15 | import java.io.Serializable; 16 | 17 | import org.pentaho.metadata.model.LogicalColumn; 18 | 19 | public class OlapMeasure implements Cloneable, Serializable { 20 | private String name; 21 | private LogicalColumn logicalColumn; 22 | private boolean hidden; 23 | 24 | public static final String MEASURE_HIDDEN = "MEASURE_HIDDEN"; 25 | 26 | public OlapMeasure() { 27 | } 28 | 29 | /** 30 | * @param name 31 | * @param logicalColumn 32 | */ 33 | public OlapMeasure( String name, LogicalColumn logicalColumn ) { 34 | this(); 35 | this.name = name; 36 | this.logicalColumn = logicalColumn; 37 | } 38 | 39 | public Object clone() { 40 | // shallow copy of logical column is desired 41 | return new OlapMeasure( name, logicalColumn ); 42 | } 43 | 44 | /** 45 | * @return the logicalColumn 46 | */ 47 | public LogicalColumn getLogicalColumn() { 48 | return logicalColumn; 49 | } 50 | 51 | /** 52 | * @param logicalColumn 53 | * the logicalColumn to set 54 | */ 55 | public void setLogicalColumn( LogicalColumn logicalColumn ) { 56 | this.logicalColumn = logicalColumn; 57 | } 58 | 59 | /** 60 | * @return the name 61 | */ 62 | public String getName() { 63 | return name; 64 | } 65 | 66 | /** 67 | * @param name 68 | * the name to set 69 | */ 70 | public void setName( String name ) { 71 | this.name = name; 72 | } 73 | 74 | public boolean isHidden() { 75 | return hidden; 76 | } 77 | 78 | public void setHidden( boolean hidden ) { 79 | this.hidden = hidden; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/olap/OlapRole.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.olap; 14 | 15 | import java.io.Serializable; 16 | 17 | public class OlapRole implements Cloneable, Serializable { 18 | 19 | private String name; 20 | private String definition; 21 | 22 | public OlapRole() { 23 | } 24 | 25 | public OlapRole( String name, String roleXml ) { 26 | super(); 27 | this.name = name; 28 | this.definition = roleXml; 29 | } 30 | 31 | @Override 32 | protected Object clone() { 33 | return new OlapRole( name, definition ); 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName( String name ) { 41 | this.name = name; 42 | } 43 | 44 | public String getDefinition() { 45 | return definition; 46 | } 47 | 48 | public void setDefinition( String roleXml ) { 49 | this.definition = roleXml; 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/Category.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * Concrete, lightweight, serializable implementation of an {@see ICategory} object 19 | * 20 | * @author jamesdixon 21 | * 22 | */ 23 | public class Category implements Serializable { 24 | 25 | private static final long serialVersionUID = -454688567483551796L; 26 | private String id, name, description; 27 | private Column[] columns = new Column[0]; 28 | 29 | /** 30 | * Returns the id of the category 31 | */ 32 | public String getId() { 33 | return this.id; 34 | } 35 | 36 | /** 37 | * Returns the name of the cateogry for the current locale 38 | */ 39 | public String getName() { 40 | return this.name; 41 | } 42 | 43 | /** 44 | * Returns the id of the category 45 | * 46 | * @param id 47 | */ 48 | public void setId( String id ) { 49 | this.id = id; 50 | } 51 | 52 | /** 53 | * Sets the name of the category 54 | * 55 | * @param name 56 | */ 57 | public void setName( String name ) { 58 | this.name = name; 59 | } 60 | 61 | /** 62 | * Returns the array of {@see IColumn}s for this category 63 | */ 64 | public Column[] getColumns() { 65 | return columns; 66 | } 67 | 68 | /** 69 | * Sets the array of {@see IColumn}s for this category 70 | * 71 | * @param columns 72 | */ 73 | public void setColumns( Column[] columns ) { 74 | this.columns = columns; 75 | } 76 | 77 | public void setDescription( String description ) { 78 | this.description = description; 79 | } 80 | 81 | public String getDescription() { 82 | return description; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/ModelInfoComparator.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | import java.util.Comparator; 16 | 17 | /** 18 | * compares two model info objects so that they can be sorted by name 19 | * 20 | * @author jamesdixon 21 | * 22 | */ 23 | public class ModelInfoComparator implements Comparator { 24 | 25 | @Override 26 | public int compare( Object obj1, Object obj2 ) { 27 | ModelInfo model1 = (ModelInfo) obj1; 28 | ModelInfo model2 = (ModelInfo) obj2; 29 | return model1.getName().compareTo( model2.getName() ); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/ModelProvider.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | import org.pentaho.metadata.datatable.DataTable; 16 | 17 | /** 18 | * An interface for implementing a data source provider. 19 | * 20 | * @author jamesdixon 21 | * 22 | */ 23 | public interface ModelProvider { 24 | 25 | /** 26 | * Returns the id of this model provider 27 | * 28 | * @return 29 | */ 30 | public String getId(); 31 | 32 | /** 33 | * Returns a model with the specified id. If the model does not exist, returns null 34 | * 35 | * @param id 36 | * @return 37 | */ 38 | public Model getModel( String id ); 39 | 40 | /** 41 | * Returns an array of model descriptions. If the provider id does not match the current provider returns an empty 42 | * array. 43 | * 44 | * @param provider 45 | * @param group 46 | * Optional the group id of the models to search 47 | * @param match 48 | * Optional a string to match on the model name/description 49 | * @return 50 | */ 51 | public ModelInfo[] getModelList( String provider, String group, String match ); 52 | 53 | /** 54 | * Exexcutes a query and returns the results in a DataTable object. If row limit is specified returns only the 55 | * specified number of rows or less. rowLimit of -1 indicates all rows. 56 | * 57 | * @param query 58 | * @param rowLimit 59 | * @return 60 | */ 61 | public DataTable executeQuery( Query query, int rowLimit ); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/Order.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | /** 16 | * Concrete, lightweight, serializable object that holds information about sorting 17 | * 18 | * @author jamesdixon 19 | * 20 | */ 21 | public class Order { 22 | 23 | private static final long serialVersionUID = 4824503466813354111L; 24 | 25 | private String elementId; 26 | 27 | private String parentId; 28 | 29 | private String orderType; 30 | 31 | public String getElementId() { 32 | return this.elementId; 33 | } 34 | 35 | public void setElementId( String elementId ) { 36 | this.elementId = elementId; 37 | } 38 | 39 | public String getOrderType() { 40 | return orderType; 41 | } 42 | 43 | public void setOrderType( String orderType ) { 44 | this.orderType = orderType; 45 | } 46 | 47 | public String getParentId() { 48 | return parentId; 49 | } 50 | 51 | public void setParentId( String parentId ) { 52 | this.parentId = parentId; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/Parameter.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * Concrete, lightweight, serializable object that holds information about parameters 19 | * 20 | * @author jamesdixon 21 | * 22 | */ 23 | public class Parameter implements Serializable { 24 | 25 | private static final long serialVersionUID = -3581457277760183764L; 26 | private String elementId; 27 | private String name; 28 | private String type; 29 | private String[] defaultValue; 30 | private String[] value; 31 | 32 | public Parameter() { 33 | } 34 | 35 | public String getType() { 36 | return type; 37 | } 38 | 39 | public String[] getDefaultValue() { 40 | return defaultValue; 41 | } 42 | 43 | public void setType( String type ) { 44 | this.type = type; 45 | } 46 | 47 | public void setDefaultValue( String[] defaultValue ) { 48 | this.defaultValue = defaultValue; 49 | } 50 | 51 | public String getElementId() { 52 | return elementId; 53 | } 54 | 55 | public void setElementId( String elementId ) { 56 | this.elementId = elementId; 57 | } 58 | 59 | public String getName() { 60 | return name; 61 | } 62 | 63 | public void setName( String name ) { 64 | this.name = name; 65 | } 66 | 67 | public String[] getValue() { 68 | if ( value != null ) { 69 | return value; 70 | } else { 71 | return defaultValue; 72 | } 73 | } 74 | 75 | public void setValue( String[] value ) { 76 | this.value = value; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/model/thin/Provider.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.thin; 14 | 15 | /** 16 | * Concrete, lightweight, serializable object that holds information about a model provider 17 | * 18 | * @author jamesdixon 19 | * 20 | */ 21 | public class Provider { 22 | 23 | private String id; 24 | 25 | private String name; 26 | 27 | public Provider() { 28 | 29 | } 30 | 31 | public Provider( String id, String name ) { 32 | this.id = id; 33 | this.name = name; 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public void setId( String id ) { 41 | this.id = id; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName( String name ) { 49 | this.name = name; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/SqlOpenFormulaContext.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql; 14 | 15 | import org.pentaho.metadata.messages.Messages; 16 | import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; 17 | import org.pentaho.reporting.libraries.formula.typing.Type; 18 | 19 | /** 20 | * This is a singleton class that manages SqlOpenFormula's context. the SqlOpenFormula uses this class to validate 21 | * operators and functions, and it also uses this class to convert Formula terms to SQL. 22 | * 23 | * @author Will Gorman (wgorman@pentaho.org) 24 | * 25 | */ 26 | public class SqlOpenFormulaContext extends DefaultFormulaContext { 27 | 28 | /** singleton instance, one per classloader */ 29 | private static SqlOpenFormulaContext singleton = new SqlOpenFormulaContext(); 30 | 31 | /** 32 | * static, thread safe singleton retrieval 33 | * 34 | * @return SqlOpenFormulaContext singleton object 35 | */ 36 | public static SqlOpenFormulaContext getInstance() { 37 | return singleton; 38 | } 39 | 40 | /** 41 | * SqlOpenFormulaContext and SqlOpenFormula do not use libFormula in the traditional manner of executing a formula. 42 | * Instead they generate the necessary SQL to be executed from an RDBMS. 43 | */ 44 | public Object resolveReference( Object name ) { 45 | throw new UnsupportedOperationException( Messages.getErrorString( "SqlOpenFormulaContext.ERROR_0001_INVALID_USE" ) ); //$NON-NLS-1$ 46 | } 47 | 48 | /** 49 | * SqlOpenFormulaContext and SqlOpenFormula do not use libFormula in the traditional manner of executing a formula. 50 | * Instead they generate the necessary SQL to be executed from an RDBMS. 51 | */ 52 | public Type resolveReferenceType( Object name ) { 53 | throw new UnsupportedOperationException( Messages.getErrorString( "SqlOpenFormulaContext.ERROR_0001_INVALID_USE" ) ); //$NON-NLS-1$ 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/SqlQuery.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql; 14 | 15 | import org.pentaho.commons.connection.IPentahoMetaData; 16 | 17 | /** 18 | * TODO: I'd prefer if the Sql Execution was done in this package, not having the SQL Execution happen outside of 19 | * metadata To make this happen, we'd need to move SQLConnection and SQLResultSet into a commons project. 20 | * 21 | * This interface defines the result of executing an MQLQuery 22 | * 23 | * @author Will Gorman (wgorman@pentaho.org) 24 | * 25 | */ 26 | public interface SqlQuery { 27 | 28 | public String getQuery(); 29 | 30 | public IPentahoMetaData generateMetadata( IPentahoMetaData nativeMetadata ); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/ConsistencyException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | public class ConsistencyException extends Exception { 16 | private static final long serialVersionUID = 1L; 17 | 18 | private GraphElement element; 19 | 20 | public ConsistencyException() { 21 | 22 | } 23 | 24 | public ConsistencyException( GraphElement element ) { 25 | this.element = element; 26 | } 27 | 28 | public GraphElement getElement() { 29 | return element; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/GraphElement.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | /** 16 | * Interface implements by all elements of the graph 17 | */ 18 | public interface GraphElement { 19 | 20 | /** 21 | * Returns true if this GraphElement is required by the graph 22 | * 23 | * @return True if GraphElement is required 24 | */ 25 | public boolean isRequired(); 26 | 27 | /** 28 | * Returns true if this GraphElement is not required by the graph 29 | * 30 | * @return True if GraphElement is not required 31 | */ 32 | public boolean isNotRequired(); 33 | 34 | /** 35 | * Returns true if this GraphElement is known to be required or not required by the graph 36 | * 37 | * @return True if GraphElement requirement is known 38 | */ 39 | public boolean isRequirementKnown(); 40 | 41 | /** 42 | * Assigns a requirement value to this element 43 | * 44 | * @param required 45 | * True if element is required / false if not required 46 | * @throws ConsistencyException 47 | * When assignment is inconsistent with graph constrains 48 | */ 49 | public void setRequirement( boolean required ) throws ConsistencyException; 50 | 51 | /** 52 | * Changes requirement setting to unknown 53 | */ 54 | public void clearRequirement(); 55 | 56 | /** 57 | * Returns the status of the queued flag which is used by the graphing functions to determine if this 58 | * GraphElement is currently in the queue waiting to be processed. 59 | * 60 | * @return value of queued flag 61 | */ 62 | public boolean isQueued(); 63 | 64 | /** 65 | * Sets value of queued flag 66 | * 67 | * @param queued 68 | * New value of queued flag 69 | * @see #isQueued() 70 | */ 71 | public void setQueued( boolean queued ); 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/GraphElementChangeListener.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | public interface GraphElementChangeListener { 16 | public void graphElementChanged( GraphElement element ); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/GraphElementQueue.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | import java.util.Iterator; 16 | import java.util.PriorityQueue; 17 | 18 | public class GraphElementQueue extends PriorityQueue { 19 | private static final long serialVersionUID = 1L; 20 | 21 | public boolean offer( GraphElement e ) { 22 | if ( e.isQueued() ) { 23 | return false; 24 | } 25 | 26 | if ( super.offer( e ) ) { 27 | e.setQueued( true ); 28 | return true; 29 | } 30 | 31 | return false; 32 | } 33 | 34 | @Override 35 | public boolean remove( Object o ) { 36 | GraphElement e = (GraphElement) o; 37 | 38 | if ( super.remove( e ) ) { 39 | e.setQueued( false ); 40 | return true; 41 | } 42 | 43 | return false; 44 | } 45 | 46 | @Override 47 | public Iterator iterator() { 48 | return new Iter( super.iterator() ); 49 | } 50 | 51 | private static final class Iter implements Iterator { 52 | private Iterator parentIter; 53 | private GraphElement last; 54 | 55 | public Iter( Iterator parentIter ) { 56 | this.parentIter = parentIter; 57 | } 58 | 59 | public boolean hasNext() { 60 | return parentIter.hasNext(); 61 | } 62 | 63 | public GraphElement next() { 64 | last = parentIter.next(); 65 | return last; 66 | } 67 | 68 | public void remove() { 69 | parentIter.remove(); 70 | if ( last != null ) { 71 | last.setQueued( false ); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/GraphElementRequirement.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | public enum GraphElementRequirement { 16 | UNKNOWN, REQUIRED, NOT_REQUIRED 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/impl/sql/graph/PathType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.impl.sql.graph; 14 | 15 | public enum PathType { 16 | ANY_RELEVANT, FIRST_SHORT, SHORTEST, LOWEST_SCORE, ALL 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/model/CombinationType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.model; 14 | 15 | /** 16 | * This enum defines how individual constraints combine. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | * 20 | */ 21 | public enum CombinationType { 22 | AND( "AND" ), OR( "OR" ), AND_NOT( "AND NOT" ), OR_NOT( "OR NOT" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 23 | 24 | private String toStringVal; 25 | 26 | private CombinationType( String val ) { 27 | toStringVal = val; 28 | } 29 | 30 | public static CombinationType getCombinationType( String value ) { 31 | for ( CombinationType type : values() ) { 32 | if ( type.toString().equalsIgnoreCase( value ) ) { 33 | return type; 34 | } 35 | } 36 | return null; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return toStringVal; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/model/Constraint.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.model; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * A constraint within a logical query model. This contains a combination type which defines how it relates to other 19 | * constraints, and an open formula expression defining the constraint. 20 | * 21 | * @author Will Gorman (wgorman@pentaho.com) 22 | * 23 | */ 24 | public class Constraint implements Serializable { 25 | 26 | private static final long serialVersionUID = -8703652534217339403L; 27 | 28 | private CombinationType combinationType; 29 | private String formula; 30 | 31 | public Constraint( CombinationType combinationType, String formula ) { 32 | this.combinationType = combinationType; 33 | this.formula = formula; 34 | } 35 | 36 | public CombinationType getCombinationType() { 37 | return combinationType; 38 | } 39 | 40 | public String getFormula() { 41 | return formula; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/model/Order.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.model; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * This class defines the order of the results from a logical query model. 19 | * 20 | * @author Will Gorman (wgorman@pentaho.com) 21 | * 22 | */ 23 | public class Order implements Serializable { 24 | 25 | private static final long serialVersionUID = 7828692078614137281L; 26 | 27 | public enum Type { 28 | ASC, DESC 29 | }; 30 | 31 | private Selection selection; 32 | private Type type; 33 | 34 | public Order( Selection selection, Type type ) { 35 | this.selection = selection; 36 | this.type = type; 37 | } 38 | 39 | public Selection getSelection() { 40 | return selection; 41 | } 42 | 43 | public Type getType() { 44 | return type; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/query/model/Parameter.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.query.model; 14 | 15 | import java.io.Serializable; 16 | 17 | import org.pentaho.metadata.model.concept.types.DataType; 18 | 19 | /** 20 | * This defines a parameter within a logical query model. 21 | * 22 | * @author Will Gorman (wgorman@pentaho.com) 23 | * 24 | */ 25 | public class Parameter implements Serializable { 26 | 27 | private static final long serialVersionUID = -1562891705335709848L; 28 | 29 | private String name; 30 | private DataType type; 31 | private Object defaultValue; 32 | 33 | public Parameter( String name, DataType type, Object defaultValue ) { 34 | this.name = name; 35 | this.type = type; 36 | this.defaultValue = defaultValue; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public DataType getType() { 44 | return type; 45 | } 46 | 47 | public Object getDefaultValue() { 48 | return defaultValue; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/repository/DomainAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.repository; 14 | 15 | /** 16 | * This exception occurs if a domain is being written and already exists. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | */ 20 | public class DomainAlreadyExistsException extends Exception { 21 | private static final long serialVersionUID = -8381261699174809443L; 22 | 23 | public DomainAlreadyExistsException( String str ) { 24 | super( str ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/repository/DomainIdNullException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.repository; 14 | 15 | /** 16 | * This exception occurs if a domain has a null id. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | */ 20 | public class DomainIdNullException extends Exception { 21 | private static final long serialVersionUID = -8381261699174809443L; 22 | 23 | public DomainIdNullException( String str ) { 24 | super( str ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/repository/DomainStorageException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.repository; 14 | 15 | /** 16 | * This is a general exception if the domain failed to get stored. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.com) 19 | */ 20 | public class DomainStorageException extends Exception { 21 | private static final long serialVersionUID = -8381261699174809443L; 22 | 23 | public DomainStorageException( String str, Exception e ) { 24 | super( str, e ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/util/SQLModelGeneratorException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.util; 14 | 15 | public class SQLModelGeneratorException extends Exception { 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = -6089798664483298023L; 20 | 21 | /** 22 | * 23 | */ 24 | public SQLModelGeneratorException() { 25 | super(); 26 | } 27 | 28 | /** 29 | * @param message 30 | */ 31 | public SQLModelGeneratorException( String message ) { 32 | super( message ); 33 | } 34 | 35 | /** 36 | * @param message 37 | * @param reas 38 | */ 39 | public SQLModelGeneratorException( String message, Throwable reas ) { 40 | super( message, reas ); 41 | } 42 | 43 | /** 44 | * @param reas 45 | */ 46 | public SQLModelGeneratorException( Throwable reas ) { 47 | super( reas ); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/metadata/util/validation/ValidationStatus.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.util.validation; 14 | 15 | /** 16 | * Created by Yury_Bakhmutski on 10/26/2017. 17 | */ 18 | public class ValidationStatus { 19 | public final StatusEnum statusEnum; 20 | private String localizedMessage; 21 | 22 | private ValidationStatus() { 23 | statusEnum = StatusEnum.VALID; 24 | } 25 | 26 | private ValidationStatus( String message ) { 27 | statusEnum = StatusEnum.INVALID; 28 | this.localizedMessage = message; 29 | } 30 | 31 | public static ValidationStatus valid() { 32 | return new ValidationStatus(); 33 | } 34 | 35 | public static ValidationStatus invalid( String localizedValidationFailMessage ) { 36 | return new ValidationStatus( localizedValidationFailMessage ); 37 | } 38 | 39 | public String getLocalizedMessage() { 40 | return localizedMessage; 41 | } 42 | 43 | public enum StatusEnum { 44 | VALID, INVALID; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/core/event/AllowsIDChangeListenersInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.core.event; 14 | 15 | public interface AllowsIDChangeListenersInterface { 16 | public void addIDChangedListener( IDChangedListener listener ); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/core/event/IDChangedEvent.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.core.event; 14 | 15 | /** 16 | * In case the ID of an Object changes (name, ID, in general the unique identifier) this is the event that is fired. 17 | * 18 | * @author Matt 19 | * @since 2007-03-20 20 | */ 21 | public class IDChangedEvent { 22 | public String oldID; 23 | public String newID; 24 | 25 | public Object object; 26 | 27 | /** 28 | * @param oldID 29 | * @param newID 30 | * @param object 31 | */ 32 | public IDChangedEvent( String oldID, String newID, Object object ) { 33 | this.oldID = oldID; 34 | this.newID = newID; 35 | this.object = object; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/core/event/IDChangedListener.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.core.event; 14 | 15 | import org.pentaho.pms.util.ObjectAlreadyExistsException; 16 | 17 | public interface IDChangedListener { 18 | public void IDChanged( IDChangedEvent event ) throws ObjectAlreadyExistsException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/core/exception/CWMException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.core.exception; 14 | 15 | public class CWMException extends Exception { 16 | private static final long serialVersionUID = 3858588189630708963L; 17 | 18 | public CWMException() { 19 | super(); 20 | } 21 | 22 | public CWMException( String arg0, Throwable arg1 ) { 23 | super( arg0, arg1 ); 24 | } 25 | 26 | public CWMException( String arg0 ) { 27 | super( arg0 ); 28 | } 29 | 30 | public CWMException( Throwable arg0 ) { 31 | super( arg0 ); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/core/exception/PentahoMetadataException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.core.exception; 14 | 15 | public class PentahoMetadataException extends Exception { 16 | 17 | private static final long serialVersionUID = 1291055530614616329L; 18 | 19 | public PentahoMetadataException() { 20 | super(); 21 | } 22 | 23 | public PentahoMetadataException( String arg0, Throwable arg1 ) { 24 | super( arg0, arg1 ); 25 | } 26 | 27 | public PentahoMetadataException( String arg0 ) { 28 | super( arg0 ); 29 | } 30 | 31 | public PentahoMetadataException( Throwable arg0 ) { 32 | super( arg0 ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/factory/CwmSchemaFactoryException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.factory; 14 | 15 | public class CwmSchemaFactoryException extends RuntimeException { 16 | 17 | private static final long serialVersionUID = -2992524487791975326L; 18 | 19 | public CwmSchemaFactoryException() { 20 | super(); 21 | } 22 | 23 | public CwmSchemaFactoryException( String msg ) { 24 | super( msg ); 25 | } 26 | 27 | public CwmSchemaFactoryException( String msg, Throwable th ) { 28 | super( msg, th ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/locale/LocaleInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.locale; 14 | 15 | import org.pentaho.di.core.changed.ChangedFlagInterface; 16 | 17 | public interface LocaleInterface extends ChangedFlagInterface, Comparable { 18 | public void setCode( String code ); 19 | 20 | public String getCode(); 21 | 22 | public void setDescription( String description ); 23 | 24 | public String getDescription(); 25 | 26 | public void setOrder( int order ); 27 | 28 | public int getOrder(); 29 | 30 | public void setActive( boolean active ); 31 | 32 | public boolean isActive(); 33 | 34 | public void clearChanged(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/MQLQuery.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql; 14 | 15 | import java.util.List; 16 | 17 | import org.pentaho.di.core.database.DatabaseMeta; 18 | import org.pentaho.pms.core.exception.PentahoMetadataException; 19 | import org.pentaho.pms.schema.BusinessModel; 20 | import org.pentaho.pms.schema.SchemaMeta; 21 | 22 | /** 23 | * @deprecated as of metadata 3.0. Please use org.pentaho.metadata.query.model.Query 24 | */ 25 | public interface MQLQuery { 26 | 27 | public MappedQuery getQuery() throws PentahoMetadataException; 28 | 29 | public DatabaseMeta getDatabaseMeta(); 30 | 31 | public SchemaMeta getSchemaMeta(); 32 | 33 | public void setSchemaMeta( SchemaMeta schemaMeta ); 34 | 35 | public BusinessModel getModel(); 36 | 37 | public void setModel( BusinessModel model ); 38 | 39 | public boolean getDisableDistinct(); 40 | 41 | public void setDisableDistinct( boolean value ); 42 | 43 | public int getLimit(); 44 | 45 | public void setLimit( int limit ); 46 | 47 | public List getSelections(); 48 | 49 | public void setSelections( List list ); 50 | 51 | public List getConstraints(); 52 | 53 | public void setConstraints( List list ); 54 | 55 | public List getOrder(); 56 | 57 | public void setOrder( List list ); 58 | 59 | public String getXML(); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/MariaDBDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.pms.mql; 15 | 16 | import org.pentaho.pms.mql.dialect.MySQLDialect; 17 | 18 | public class MariaDBDialect extends MySQLDialect { 19 | 20 | public MariaDBDialect() { 21 | super( "MARIADB" ); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/OrderBy.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql; 14 | 15 | /** 16 | * Contains a selection and the sort direction, used to specify the sorting of that column. 17 | * 18 | * @author Matt 19 | * 20 | * @deprecated as of metadata 3.0. Please use org.pentaho.metadata.query.model.Order 21 | */ 22 | public class OrderBy { 23 | private Selection selection; 24 | private boolean ascending; 25 | 26 | /** 27 | * @param selection 28 | * the selection to sort on (ascending) 29 | */ 30 | public OrderBy( Selection selection ) { 31 | super(); 32 | this.selection = selection; 33 | this.ascending = true; 34 | } 35 | 36 | /** 37 | * @param selection 38 | * the selection to sort on 39 | * @param ascending 40 | * true if you want to sort ascending, false if you want to sort descending 41 | */ 42 | public OrderBy( Selection selection, boolean ascending ) { 43 | super(); 44 | this.selection = selection; 45 | this.ascending = ascending; 46 | } 47 | 48 | /** 49 | * @return the ascending flag, true = ascending, false = descending 50 | */ 51 | public boolean isAscending() { 52 | return ascending; 53 | } 54 | 55 | /** 56 | * @param ascending 57 | * the ascending flag to set, true = ascending, false = descending 58 | */ 59 | public void setAscending( boolean ascending ) { 60 | this.ascending = ascending; 61 | } 62 | 63 | /** 64 | * @return the selection to sort on 65 | */ 66 | public Selection getSelection() { 67 | return selection; 68 | } 69 | 70 | /** 71 | * @param selection 72 | * the selection to sort on 73 | */ 74 | public void setSelection( Selection selection ) { 75 | this.selection = selection; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/PMSFormulaContext.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql; 14 | 15 | import org.pentaho.pms.messages.Messages; 16 | import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; 17 | import org.pentaho.reporting.libraries.formula.typing.Type; 18 | 19 | /** 20 | * This is a singleton class that manages PMSFormula's context. the PMSFormula uses this class to validate operators and 21 | * functions, and it also uses this class to convert Formula terms to SQL. 22 | * 23 | * @author Will Gorman (wgorman@pentaho.org) 24 | * 25 | * @deprecated as of metadata 3.0. Please use org.pentaho.metadata.query.model.impl.sql.SqlOpenFormulaContext 26 | */ 27 | public class PMSFormulaContext extends DefaultFormulaContext { 28 | 29 | /** singleton instance, one per classloader */ 30 | private static PMSFormulaContext singleton = new PMSFormulaContext(); 31 | 32 | /** 33 | * static, thread safe singleton retrieval 34 | * 35 | * @return PMSFormulaContext singleton object 36 | */ 37 | public static PMSFormulaContext getInstance() { 38 | return singleton; 39 | } 40 | 41 | /** 42 | * PMSFormulaContext and PMSFormula do not use libFormula in the traditional manner of executing a formula. Instead 43 | * they generate the necessary SQL to be executed from an RDBMS. 44 | */ 45 | public Object resolveReference( Object name ) { 46 | throw new UnsupportedOperationException( Messages.getErrorString( "PMSFormulaContext.ERROR_0001_INVALID_USE" ) ); //$NON-NLS-1$ 47 | } 48 | 49 | /** 50 | * PMSFormulaContext and PMSFormula do not use libFormula in the traditional manner of executing a formula. Instead 51 | * they generate the necessary SQL to be executed from an RDBMS. 52 | */ 53 | public Type resolveReferenceType( Object name ) { 54 | throw new UnsupportedOperationException( Messages.getErrorString( "PMSFormulaContext.ERROR_0001_INVALID_USE" ) ); //$NON-NLS-1$ 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/Query.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql; 14 | 15 | import org.pentaho.commons.connection.IPentahoMetaData; 16 | 17 | /** 18 | * This interface defines the result of executing an MQLQuery 19 | * 20 | * @author Will Gorman (wgorman@pentaho.org) 21 | * 22 | * @deprecated as of metadata 3.0. Please use org.pentaho.metadata.query.model.impl.sql.SqlQuery 23 | */ 24 | public interface Query { 25 | 26 | public String getQuery(); 27 | 28 | public IPentahoMetaData generateMetadata( IPentahoMetaData nativeMetadata ); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/Selection.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql; 14 | 15 | import org.pentaho.pms.schema.BusinessColumn; 16 | import org.pentaho.pms.schema.concept.types.aggregation.AggregationSettings; 17 | 18 | /** 19 | * This class defines an MQL selection 20 | * 21 | * @author Will Gorman (wgorman@pentaho.org) 22 | * 23 | * @deprecated as of metadata 3.0. Please use org.pentaho.metadata.query.model.Selection 24 | */ 25 | public class Selection { 26 | 27 | protected BusinessColumn businessColumn; 28 | protected AggregationSettings aggregationType; 29 | 30 | public Selection( BusinessColumn businessColumn ) { 31 | this.businessColumn = businessColumn; 32 | } 33 | 34 | public Selection( BusinessColumn businessColumn, AggregationSettings aggregationType ) { 35 | this.businessColumn = businessColumn; 36 | this.aggregationType = aggregationType; 37 | } 38 | 39 | /** 40 | * get the selected business column 41 | * 42 | * @return business column 43 | */ 44 | public BusinessColumn getBusinessColumn() { 45 | return businessColumn; 46 | } 47 | 48 | public AggregationSettings getAggregationType() { 49 | return aggregationType; 50 | } 51 | 52 | public boolean hasAggregate() { 53 | // this selection is an aggregate if the business column is an aggregate and the agg type is not null 54 | return !getActiveAggregationType().equals( AggregationSettings.NONE ); 55 | } 56 | 57 | public AggregationSettings getActiveAggregationType() { 58 | if ( getAggregationType() == null ) { 59 | return businessColumn.getAggregationType(); 60 | } else { 61 | return getAggregationType(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/DefaultSQLOperatorGenerator.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | /** 16 | * This is the default implementation of the SQL Operator Generator Interface 17 | * 18 | * @author Will Gorman (wgorman@pentaho.org) 19 | * 20 | */ 21 | public class DefaultSQLOperatorGenerator implements SQLOperatorGeneratorInterface { 22 | 23 | /** sql to return to sql generator */ 24 | private String sql; 25 | 26 | /** 27 | * constructor 28 | * 29 | * @param sql 30 | */ 31 | public DefaultSQLOperatorGenerator( String sql ) { 32 | this.sql = sql; 33 | } 34 | 35 | /** 36 | * return the sql specified in the constructor 37 | * 38 | * @return sql 39 | */ 40 | public String getOperatorSQL() { 41 | return sql; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/FirebirdDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class FirebirdDialect extends DefaultSQLDialect { 16 | 17 | private static final String TOP_KEYWORD = "FIRST"; //$NON-NLS-1$ 18 | 19 | public FirebirdDialect() { 20 | super( "FIREBIRD" ); //$NON-NLS-1$ 21 | } 22 | 23 | @Override 24 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 25 | generateTopBeforeDistinct( query, sql, TOP_KEYWORD ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/FormulaTraversalInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | import org.pentaho.pms.core.exception.PentahoMetadataException; 16 | import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; 17 | 18 | /** 19 | * This interface is implemented by PMSFormula in order to traverse the libformula object model and call the appropriate 20 | * dialect related classes in this package. 21 | * 22 | * @author Will Gorman (wgorman@pentaho.org) 23 | * 24 | */ 25 | public interface FormulaTraversalInterface { 26 | 27 | /** 28 | * this method traverses the libformula object model recursively 29 | * 30 | * @param parent 31 | * current object's parent in libformula object model 32 | * @param val 33 | * current object in libformula object model 34 | * @param sb 35 | * string buffer to append sql to 36 | * @param locale 37 | * specific locale of the sql 38 | * @throws PentahoMetadataException 39 | * if a problem occurs during the generation of sql 40 | */ 41 | public void generateSQL( Object parent, Object val, StringBuffer sb, String locale ) throws PentahoMetadataException; 42 | 43 | /** 44 | * this method allows access to parameter values, so if a function needs to perform runtime evaluation before 45 | * generating SQL, it can. 46 | * 47 | * @param lookup 48 | * parameter value 49 | * @return value of the parameter 50 | * @throws PentahoMetadataException 51 | */ 52 | public Object getParameterValue( ContextLookup lookup ) throws PentahoMetadataException; 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/GoogleBigQueryDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | /** 16 | * Google BigQuery Implementation of Metadata SQL Dialect 17 | * 18 | * @author lucboudreau 19 | * 20 | */ 21 | public class GoogleBigQueryDialect extends DefaultSQLDialect { 22 | 23 | public GoogleBigQueryDialect() { 24 | super( "GOOGLEBIGQUERY" ); //$NON-NLS-1$ 25 | } 26 | 27 | protected GoogleBigQueryDialect( String compatibleDialect ) { 28 | super( compatibleDialect ); //$NON-NLS-1$ 29 | } 30 | 31 | /** 32 | * CAST('YYYY-MM-DD' AS DATE) 33 | */ 34 | @Override 35 | public String getDateSQL( int year, int month, int day ) { 36 | return "CAST(" + super.getDateSQL( year, month, day ) + " AS DATE)"; 37 | } 38 | 39 | @Override 40 | public String getDateSQL( int year, int month, int day, int hour, int minute, 41 | int second, int milli ) { 42 | return "CAST(" + //$NON-NLS-1$ 43 | super.getDateSQL( year, month, day, hour, minute, second, milli ) 44 | + " AS TIMESTAMP)"; //$NON-NLS-1$ 45 | } 46 | 47 | public int getMaxTableNameLength() { 48 | return 1024; 49 | } 50 | 51 | @Override 52 | protected String getStringConcatOperator() { 53 | return null; //$NON-NLS-1$ 54 | } 55 | 56 | @Override 57 | protected String generateStringConcat( String... vals ) { 58 | StringBuilder sb = new StringBuilder(); 59 | sb.append( "CONCAT(" ); 60 | for ( int i = 0; i < vals.length; i++ ) { 61 | if ( i != 0 ) { 62 | sb.append( ", " ); //$NON-NLS-1$ //$NON-NLS-2$ 63 | } 64 | sb.append( vals[i] ); 65 | } 66 | sb.append( ")" ); 67 | return sb.toString(); 68 | } 69 | 70 | @Override 71 | protected void generatePostOrderBy( SQLQueryModel query, StringBuilder sql ) { 72 | generateLimit( query, sql ); 73 | } 74 | 75 | @Override 76 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 77 | generateDistinct( query, sql ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/H2Dialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class H2Dialect extends DefaultSQLDialect { 16 | 17 | private static final String TOP_KEYWORD = "TOP"; //$NON-NLS-1$ 18 | 19 | public H2Dialect() { 20 | super( "H2" ); //$NON-NLS-1$ 21 | } 22 | 23 | @Override 24 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 25 | generateTopBeforeDistinct( query, sql, TOP_KEYWORD ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/Hive2Dialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | /** 16 | * Apache Hadoop Hive Server 2 Implementation of Metadata SQL Dialect 17 | * 18 | */ 19 | public class Hive2Dialect extends BaseHiveDialect { 20 | 21 | protected static final String HIVE_DIALECT_TYPE = "HIVE2"; 22 | 23 | protected static final String DRIVER_CLASS_NAME = "org.apache.hive.jdbc.HiveDriver"; 24 | 25 | public Hive2Dialect() { 26 | super( HIVE_DIALECT_TYPE ); //$NON-NLS-1$ 27 | } 28 | 29 | @Override 30 | protected String getDriverClassName() { 31 | return DRIVER_CLASS_NAME; 32 | } 33 | 34 | protected static String getHiveDialectType() { 35 | return HIVE_DIALECT_TYPE; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/HiveDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | /** 16 | * Apache Hadoop Hive Implementation of Metadata SQL Dialect 17 | * 18 | */ 19 | public class HiveDialect extends BaseHiveDialect { 20 | 21 | // The base implementation (BaseHiveDialect) is for Hive 1, so this class is just a concrete 22 | // instantiation of the abstract base class 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/HypersonicDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class HypersonicDialect extends DefaultSQLDialect { 16 | 17 | private static final String TOP_KEYWORD = "TOP"; //$NON-NLS-1$ 18 | 19 | public HypersonicDialect() { 20 | super( "HYPERSONIC" ); //$NON-NLS-1$ 21 | } 22 | 23 | @Override 24 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 25 | generateTopBeforeDistinct( query, sql, TOP_KEYWORD ); 26 | } 27 | 28 | /** 29 | * return HSQL formatted date, 'YYYY-MM-DD hh:mm:ss' 30 | * 31 | * @param year 32 | * @param month 33 | * @param day 34 | * 35 | * @return date string 36 | */ 37 | @Override 38 | public String getDateSQL( int year, int month, int day ) { 39 | return getDateSQL( year, month, day, 0, 0, 0, 0 ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/IngresDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class IngresDialect extends DefaultSQLDialect { 16 | 17 | private static final String TOP_KEYWORD = "FIRST"; //$NON-NLS-1$ 18 | 19 | public IngresDialect() { 20 | super( "INGRES" ); //$NON-NLS-1$ 21 | } 22 | 23 | @Override 24 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 25 | generateTopBeforeDistinct( query, sql, TOP_KEYWORD ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/JoinType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | import org.pentaho.pms.schema.RelationshipMeta; 16 | 17 | @SuppressWarnings( "deprecation" ) 18 | public enum JoinType { 19 | /** 20 | * Inner join 21 | */ 22 | INNER_JOIN, 23 | 24 | /** 25 | * Left outer join 26 | */ 27 | LEFT_OUTER_JOIN, 28 | 29 | /** 30 | * Right outer join 31 | */ 32 | RIGHT_OUTER_JOIN, 33 | 34 | /** 35 | * Full outer join 36 | */ 37 | FULL_OUTER_JOIN; 38 | 39 | public static JoinType getJoinType( int joinType ) { 40 | switch ( joinType ) { 41 | case RelationshipMeta.TYPE_JOIN_LEFT_OUTER: 42 | return LEFT_OUTER_JOIN; 43 | case RelationshipMeta.TYPE_JOIN_RIGHT_OUTER: 44 | return RIGHT_OUTER_JOIN; 45 | case RelationshipMeta.TYPE_JOIN_FULL_OUTER: 46 | return FULL_OUTER_JOIN; 47 | default: 48 | return INNER_JOIN; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/LucidDbDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | import org.pentaho.pms.core.exception.PentahoMetadataException; 16 | import org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction; 17 | 18 | /** 19 | * LucidDb Implementation of Metadata SQL Dialect 20 | * 21 | * @author Dan Kinsley (dan@thinkingphones.com) 22 | * 23 | */ 24 | public class LucidDbDialect extends DefaultSQLDialect { 25 | 26 | public LucidDbDialect() { 27 | super( "LucidDB" ); //$NON-NLS-1$ 28 | 29 | // Luciddb specific date functions 30 | supportedFunctions.put( 31 | "NOW", new DefaultSQLFunctionGenerator( SQLFunctionGeneratorInterface.PARAM_FUNCTION, "CURRENT_TIMESTAMP", 0 ) { //$NON-NLS-1$ //$NON-NLS-2$ 32 | public void generateFunctionSQL( FormulaTraversalInterface formula, StringBuffer sb, String locale, 33 | FormulaFunction f ) throws PentahoMetadataException { 34 | sb.append( sql ); 35 | } 36 | } ); 37 | } 38 | 39 | /** 40 | * return LucidDb formatted date, date'YYYY-MM-DD' 41 | * 42 | * @param year 43 | * @param month 44 | * @param day 45 | * 46 | * @return date string 47 | */ 48 | public String getDateSQL( int year, int month, int day ) { 49 | return "date" + //$NON-NLS-1$ 50 | quoteStringLiteral( year + "-" + displayAsTwoOrMoreDigits( month ) + "-" + displayAsTwoOrMoreDigits( day ) ); //$NON-NLS-1$ //$NON-NLS-2$ 51 | } 52 | 53 | @Override 54 | protected String getStringConcatOperator() { 55 | return "||"; //$NON-NLS-1$ 56 | } 57 | 58 | @Override 59 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 60 | generateDistinct( query, sql ); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/MSSQLNativeDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class MSSQLNativeDialect extends MSSQLDialect { 16 | 17 | public MSSQLNativeDialect() { 18 | super( "MSSQLNATIVE" ); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/NetezzaDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class NetezzaDialect extends DefaultSQLDialect { 16 | 17 | public NetezzaDialect() { 18 | super( "NETEZZA" ); //$NON-NLS-1$ 19 | } 20 | 21 | @Override 22 | protected void generatePostOrderBy( SQLQueryModel query, StringBuilder sql ) { 23 | generateLimit( query, sql ); 24 | } 25 | 26 | @Override 27 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 28 | generateDistinct( query, sql ); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/RedshiftDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class RedshiftDialect extends PostgreSQLDialect { 16 | 17 | public RedshiftDialect() { 18 | super( "REDSHIFT" ); 19 | } 20 | 21 | @Override 22 | public boolean supportsNLSLiteral() { 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/SQLFunctionGeneratorInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | import org.pentaho.pms.core.exception.PentahoMetadataException; 16 | import org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction; 17 | 18 | /** 19 | * this interface defines how a function validates and renders it's sql 20 | * 21 | * @author Will Gorman (wgorman@pentaho.org) 22 | * 23 | */ 24 | public interface SQLFunctionGeneratorInterface { 25 | 26 | // various types of ODF terms 27 | public static final int INLINE_FUNCTION = 0; 28 | public static final int PARAM_FUNCTION = 1; 29 | public static final int PARAM_AGG_FUNCTION = 2; 30 | 31 | /** 32 | * this is called during the validation phase of the PMSFormula throws a formula exception if there is a validation 33 | * problem. 34 | */ 35 | public void validateFunction( FormulaFunction f ) throws PentahoMetadataException; 36 | 37 | /** 38 | * This method manages the generation of the SQL for a specific function. 39 | * 40 | * @param formula 41 | * @param sb 42 | * @param locale 43 | * @param f 44 | */ 45 | public void 46 | generateFunctionSQL( FormulaTraversalInterface formula, StringBuffer sb, String locale, FormulaFunction f ) 47 | throws PentahoMetadataException; 48 | 49 | /** 50 | * return the type of this specific term 51 | * 52 | * @return type enumerator 53 | */ 54 | public int getType(); 55 | 56 | /** 57 | * This method indicates whether or not the function supports multi-valued parameters 58 | * 59 | * @return 60 | */ 61 | public boolean isMultiValuedParamAware(); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/SQLOperatorGeneratorInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | /** 16 | * This method manages the generation of the SQL for a specific function. 17 | * 18 | * @author Will Gorman (wgorman@pentaho.org) 19 | * 20 | */ 21 | public interface SQLOperatorGeneratorInterface { 22 | 23 | /** 24 | * return the sql for this operator 25 | * 26 | * @return sql 27 | */ 28 | public String getOperatorSQL(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/dialect/SybaseDialect.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.dialect; 14 | 15 | public class SybaseDialect extends DefaultSQLDialect { 16 | 17 | private static final String TOP_KEYWORD = "TOP"; //$NON-NLS-1$ 18 | 19 | public SybaseDialect() { 20 | super( "SYBASE" ); //$NON-NLS-1$ 21 | } 22 | 23 | @Override 24 | protected void generateSelectPredicate( SQLQueryModel query, StringBuilder sql ) { 25 | generateTopAfterDistinct( query, sql, TOP_KEYWORD ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/ConsistencyException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | public class ConsistencyException extends Exception { 16 | private static final long serialVersionUID = 1L; 17 | 18 | private GraphElement element; 19 | 20 | public ConsistencyException() { 21 | 22 | } 23 | 24 | public ConsistencyException( GraphElement element ) { 25 | this.element = element; 26 | } 27 | 28 | public GraphElement getElement() { 29 | return element; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/GraphElement.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | /** 16 | * Interface implements by all elements of the graph 17 | */ 18 | public interface GraphElement { 19 | 20 | /** 21 | * Returns true if this GraphElement is required by the graph 22 | * 23 | * @return True if GraphElement is required 24 | */ 25 | public boolean isRequired(); 26 | 27 | /** 28 | * Returns true if this GraphElement is not required by the graph 29 | * 30 | * @return True if GraphElement is not required 31 | */ 32 | public boolean isNotRequired(); 33 | 34 | /** 35 | * Returns true if this GraphElement is known to be required or not required by the graph 36 | * 37 | * @return True if GraphElement requirement is known 38 | */ 39 | public boolean isRequirementKnown(); 40 | 41 | /** 42 | * Assigns a requirement value to this element 43 | * 44 | * @param required 45 | * True if element is required / false if not required 46 | * @throws ConsistencyException 47 | * When assignment is inconsistent with graph constrains 48 | */ 49 | public void setRequirement( boolean required ) throws ConsistencyException; 50 | 51 | /** 52 | * Changes requirement setting to unknown 53 | */ 54 | public void clearRequirement(); 55 | 56 | /** 57 | * Returns the status of the queued flag which is used by the graphing functions to determine if this 58 | * GraphElement is currently in the queue waiting to be processed. 59 | * 60 | * @return value of queued flag 61 | */ 62 | public boolean isQueued(); 63 | 64 | /** 65 | * Sets value of queued flag 66 | * 67 | * @param queued 68 | * New value of queued flag 69 | * @see #isQueued() 70 | */ 71 | public void setQueued( boolean queued ); 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/GraphElementChangeListener.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | public interface GraphElementChangeListener { 16 | public void graphElementChanged( GraphElement element ); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/GraphElementDomain.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | /** 16 | * Contains the Domain of possible values for an element of the graph 17 | */ 18 | public class GraphElementDomain { 19 | private GraphElement element; 20 | private GraphElementRequirement requirement; 21 | 22 | public GraphElementDomain( GraphElement element ) { 23 | this.element = element; 24 | this.requirement = GraphElementRequirement.UNKNOWN; 25 | } 26 | 27 | /** 28 | * Assigns a requirement value to this domain 29 | * 30 | * @param required 31 | * True if element is required / false if not required 32 | * @return True if domain is altered 33 | * @throws ConsistencyException 34 | * When assignment is inconsistent with graph constraints or an attempt to set a different value when one is 35 | * already set 36 | */ 37 | public boolean setRequirement( boolean required ) throws ConsistencyException { 38 | // check that changes are actually occuring 39 | if ( ( !required && requirement == GraphElementRequirement.NOT_REQUIRED ) 40 | || ( required && requirement == GraphElementRequirement.REQUIRED ) ) { 41 | return false; 42 | } 43 | 44 | // ensure that domain has not already been bound to another value 45 | if ( requirement != GraphElementRequirement.UNKNOWN ) { 46 | throw new ConsistencyException( element ); 47 | } 48 | 49 | if ( required ) { 50 | requirement = GraphElementRequirement.REQUIRED; 51 | } else { 52 | requirement = GraphElementRequirement.NOT_REQUIRED; 53 | } 54 | 55 | return true; 56 | } 57 | 58 | /** 59 | * Changes requirement setting to unknown 60 | */ 61 | public void clearRequirement() { 62 | requirement = GraphElementRequirement.UNKNOWN; 63 | } 64 | 65 | /** 66 | * Returns the current value assigned for requirement of the graph element 67 | */ 68 | public GraphElementRequirement getRequirement() { 69 | return requirement; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/GraphElementQueue.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | import java.util.Iterator; 16 | import java.util.PriorityQueue; 17 | 18 | public class GraphElementQueue extends PriorityQueue { 19 | private static final long serialVersionUID = 1L; 20 | 21 | public boolean offer( GraphElement e ) { 22 | if ( e.isQueued() ) { 23 | return false; 24 | } 25 | 26 | if ( super.offer( e ) ) { 27 | e.setQueued( true ); 28 | return true; 29 | } 30 | 31 | return false; 32 | } 33 | 34 | @Override 35 | public boolean remove( Object o ) { 36 | GraphElement e = (GraphElement) o; 37 | 38 | if ( super.remove( e ) ) { 39 | e.setQueued( false ); 40 | return true; 41 | } 42 | 43 | return false; 44 | } 45 | 46 | @Override 47 | public Iterator iterator() { 48 | return new Iter( super.iterator() ); 49 | } 50 | 51 | private static final class Iter implements Iterator { 52 | private Iterator parentIter; 53 | private GraphElement last; 54 | 55 | public Iter( Iterator parentIter ) { 56 | this.parentIter = parentIter; 57 | } 58 | 59 | public boolean hasNext() { 60 | return parentIter.hasNext(); 61 | } 62 | 63 | public GraphElement next() { 64 | last = parentIter.next(); 65 | return last; 66 | } 67 | 68 | public void remove() { 69 | parentIter.remove(); 70 | if ( last != null ) { 71 | last.setQueued( false ); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/GraphElementRequirement.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | public enum GraphElementRequirement { 16 | UNKNOWN, REQUIRED, NOT_REQUIRED 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/mql/graph/PathType.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.mql.graph; 14 | 15 | public enum PathType { 16 | ANY_RELEVANT, FIRST_SHORT, SHORTEST, LOWEST_SCORE, ALL 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/SelectionField.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema; 14 | 15 | /** 16 | * Created on 6-feb-04 17 | * 18 | * @deprecated as of metadata 3.0. 19 | */ 20 | public class SelectionField { 21 | private String name; 22 | private PhysicalColumn field; 23 | private SelectionGroup group; 24 | 25 | public SelectionField( String name, PhysicalColumn field, SelectionGroup group ) { 26 | this.name = name; 27 | this.field = field; 28 | this.group = group; 29 | } 30 | 31 | public SelectionField( String name, PhysicalColumn field ) { 32 | this( name, field, null ); 33 | } 34 | 35 | public void setName( String name ) { 36 | this.name = name; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setField( PhysicalColumn field ) { 44 | this.field = field; 45 | } 46 | 47 | public PhysicalColumn getField() { 48 | return field; 49 | } 50 | 51 | public void setGroup( SelectionGroup group ) { 52 | this.group = group; 53 | } 54 | 55 | public SelectionGroup getGroup() { 56 | return group; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/SelectionGroup.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema; 14 | 15 | import java.util.ArrayList; 16 | 17 | /** 18 | * @deprecated as of metadata 3.0. 19 | */ 20 | public class SelectionGroup { 21 | private String name; 22 | private SelectionGroup parent; 23 | private String description; 24 | private ArrayList selectionGroups; 25 | private ArrayList selectionFields; 26 | 27 | public SelectionGroup( String name, SelectionGroup parent ) { 28 | clear(); 29 | 30 | this.name = name; 31 | this.parent = parent; 32 | } 33 | 34 | public SelectionGroup( String name ) { 35 | this( name, null ); 36 | } 37 | 38 | public void clear() { 39 | name = ""; //$NON-NLS-1$ 40 | parent = null; 41 | selectionGroups = new ArrayList(); 42 | selectionFields = new ArrayList(); 43 | } 44 | 45 | public void setName( String name ) { 46 | this.name = name; 47 | } 48 | 49 | public String getName() { 50 | return name; 51 | } 52 | 53 | public String getDescription() { 54 | return description; 55 | } 56 | 57 | public void setDescription( String desc ) { 58 | this.description = desc; 59 | } 60 | 61 | public void setParent( SelectionGroup parent ) { 62 | this.parent = parent; 63 | } 64 | 65 | public SelectionGroup getParent() { 66 | return parent; 67 | } 68 | 69 | public ArrayList getSelectionFields() { 70 | return selectionFields; 71 | } 72 | 73 | public ArrayList getSelectionGroups() { 74 | return selectionGroups; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/ConceptIllegalValueException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept; 14 | 15 | /** 16 | * @deprecated as of metadata 3.0. 17 | */ 18 | public class ConceptIllegalValueException extends Exception { 19 | private static final long serialVersionUID = 4397770344129366440L; 20 | 21 | /** 22 | * 23 | */ 24 | public ConceptIllegalValueException() { 25 | super(); 26 | } 27 | 28 | /** 29 | * @param arg0 30 | * @param arg1 31 | */ 32 | public ConceptIllegalValueException( String arg0, Throwable arg1 ) { 33 | super( arg0, arg1 ); 34 | } 35 | 36 | /** 37 | * @param arg0 38 | */ 39 | public ConceptIllegalValueException( String arg0 ) { 40 | super( arg0 ); 41 | } 42 | 43 | /** 44 | * @param arg0 45 | */ 46 | public ConceptIllegalValueException( Throwable arg0 ) { 47 | super( arg0 ); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/ConceptPropertyInterface.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept; 14 | 15 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 16 | 17 | /** 18 | * The interface that describes a concept property 19 | * 20 | * @author Matt 21 | * 22 | * @deprecated as of metadata 3.0. in the new model, these are just Serializable objects. 23 | */ 24 | public interface ConceptPropertyInterface extends Cloneable { 25 | /** @return the concept property type */ 26 | public ConceptPropertyType getType(); 27 | 28 | /** @return a string representation for this concept property */ 29 | public String toString(); 30 | 31 | /** @return get the id of the property */ 32 | public String getId(); 33 | 34 | /** 35 | * @param id 36 | * the property id to set 37 | */ 38 | public void setId( String id ); 39 | 40 | /** @return the value of this property */ 41 | public Object getValue(); 42 | 43 | /** 44 | * @param value 45 | * the value of this property to set 46 | */ 47 | public void setValue( Object value ); 48 | 49 | public boolean equals( Object obj ); 50 | 51 | public int hashCode(); 52 | 53 | public Object clone() throws CloneNotSupportedException; 54 | 55 | // /** 56 | // * @return a copy of the concept property 57 | // * @throws CloneNotSupportedException 58 | // */ 59 | // public Object clone() throws CloneNotSupportedException; 60 | 61 | /** 62 | * Returns true if this property is a default property for this concept, otherwise false. A 63 | * property's default status varies from subject to subject. 64 | */ 65 | public boolean isRequired(); 66 | 67 | public void setRequired( boolean required ); 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/DeleteNotAllowedException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept; 14 | 15 | public class DeleteNotAllowedException extends Exception { 16 | private static final long serialVersionUID = -7170300183550487484L; 17 | 18 | /** 19 | * 20 | */ 21 | public DeleteNotAllowedException() { 22 | super(); 23 | } 24 | 25 | /** 26 | * @param arg0 27 | * @param arg1 28 | */ 29 | public DeleteNotAllowedException( String arg0, Throwable arg1 ) { 30 | super( arg0, arg1 ); 31 | } 32 | 33 | /** 34 | * @param arg0 35 | */ 36 | public DeleteNotAllowedException( String arg0 ) { 37 | super( arg0 ); 38 | } 39 | 40 | /** 41 | * @param arg0 42 | */ 43 | public DeleteNotAllowedException( Throwable arg0 ) { 44 | super( arg0 ); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/ConceptPropertyBase.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types; 14 | 15 | import org.pentaho.pms.schema.concept.ConceptPropertyInterface; 16 | 17 | /** 18 | * Base class for all concept properties. 19 | * 20 | * @author Matt 21 | * @deprecated as of metadata 3.0. 22 | */ 23 | public abstract class ConceptPropertyBase implements ConceptPropertyInterface, Cloneable { 24 | private String id; 25 | private boolean required; 26 | 27 | /** 28 | * @param id 29 | */ 30 | public ConceptPropertyBase( String id ) { 31 | this( id, false ); 32 | } 33 | 34 | public ConceptPropertyBase( String id, boolean required ) { 35 | super(); 36 | this.id = id; 37 | this.required = required; 38 | } 39 | 40 | /** 41 | * @return the id 42 | */ 43 | public String getId() { 44 | return id; 45 | } 46 | 47 | /** 48 | * @param id 49 | * the id to set 50 | */ 51 | public void setId( String id ) { 52 | this.id = id; 53 | } 54 | 55 | public boolean isRequired() { 56 | return required; 57 | } 58 | 59 | public void setRequired( final boolean required ) { 60 | this.required = required; 61 | } 62 | 63 | public Object clone() throws CloneNotSupportedException { 64 | return super.clone(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/bool/ConceptPropertyBoolean.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.bool; 14 | 15 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 16 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 17 | 18 | /** 19 | * @deprecated as of metadata 3.0. 20 | */ 21 | public class ConceptPropertyBoolean extends ConceptPropertyBase implements Cloneable { 22 | private Boolean value; 23 | 24 | public ConceptPropertyBoolean( String name, Boolean value ) { 25 | this( name, null != value ? value.booleanValue() : false ); 26 | } 27 | 28 | public ConceptPropertyBoolean( String name, boolean value ) { 29 | this( name, value, false ); 30 | } 31 | 32 | public ConceptPropertyBoolean( String name, boolean value, boolean required ) { 33 | super( name, required ); 34 | this.value = new Boolean( value ); 35 | } 36 | 37 | public String toString() { 38 | if ( value == null ) { 39 | return null; 40 | } 41 | return value.booleanValue() ? "Y" : "N"; //$NON-NLS-1$ //$NON-NLS-2$ 42 | } 43 | 44 | public Object clone() throws CloneNotSupportedException { 45 | ConceptPropertyBoolean rtn = (ConceptPropertyBoolean) super.clone(); 46 | if ( value != null ) { 47 | rtn.value = new Boolean( value.booleanValue() ); 48 | } 49 | return rtn; 50 | } 51 | 52 | public ConceptPropertyType getType() { 53 | return ConceptPropertyType.BOOLEAN; 54 | } 55 | 56 | public Object getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue( Object value ) { 61 | this.value = (Boolean) value; 62 | } 63 | 64 | public boolean equals( Object obj ) { 65 | return value.equals( obj ); 66 | } 67 | 68 | public int hashCode() { 69 | return value.hashCode(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/color/ConceptPropertyColor.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.color; 14 | 15 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 16 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 17 | 18 | /** 19 | * @deprecated as of metadata 3.0. 20 | */ 21 | public class ConceptPropertyColor extends ConceptPropertyBase implements Cloneable { 22 | private ColorSettings value; 23 | 24 | public ConceptPropertyColor( String name, ColorSettings value ) { 25 | this( name, value, false ); 26 | } 27 | 28 | public ConceptPropertyColor( String name, ColorSettings value, boolean required ) { 29 | super( name, required ); 30 | this.value = value; 31 | } 32 | 33 | public String toString() { 34 | if ( value == null ) { 35 | return null; 36 | } 37 | return value.toString(); 38 | } 39 | 40 | public Object clone() throws CloneNotSupportedException { 41 | ConceptPropertyColor rtn = (ConceptPropertyColor) super.clone(); 42 | if ( value != null ) { 43 | rtn.value = new ColorSettings( value.red, value.green, value.blue ); 44 | } 45 | return rtn; 46 | } 47 | 48 | public ConceptPropertyType getType() { 49 | return ConceptPropertyType.COLOR; 50 | } 51 | 52 | public Object getValue() { 53 | return value; 54 | } 55 | 56 | public void setValue( Object value ) { 57 | this.value = (ColorSettings) value; 58 | } 59 | 60 | public boolean equals( Object obj ) { 61 | return value.equals( obj ); 62 | } 63 | 64 | public int hashCode() { 65 | return value.hashCode(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/date/ConceptPropertyDate.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.date; 14 | 15 | import java.text.SimpleDateFormat; 16 | import java.util.Date; 17 | 18 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 19 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 20 | 21 | /** 22 | * @deprecated as of metadata 3.0. 23 | */ 24 | public class ConceptPropertyDate extends ConceptPropertyBase implements Cloneable { 25 | private Date value; 26 | 27 | public ConceptPropertyDate( String name, Date value ) { 28 | this( name, value, false ); 29 | } 30 | 31 | public ConceptPropertyDate( String name, Date value, boolean required ) { 32 | super( name, required ); 33 | this.value = value; 34 | } 35 | 36 | public String toString() { 37 | if ( value == null ) { 38 | return null; 39 | } 40 | SimpleDateFormat sdf = new SimpleDateFormat( ConceptPropertyType.ISO_DATE_FORMAT ); 41 | return sdf.format( value ); 42 | } 43 | 44 | public Object clone() throws CloneNotSupportedException { 45 | ConceptPropertyDate rtn = (ConceptPropertyDate) super.clone(); 46 | if ( value != null ) { 47 | rtn.value = new Date( value.getTime() ); 48 | } 49 | return rtn; 50 | } 51 | 52 | public ConceptPropertyType getType() { 53 | return ConceptPropertyType.DATE; 54 | } 55 | 56 | public Object getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue( Object value ) { 61 | this.value = (Date) value; 62 | } 63 | 64 | public boolean equals( Object obj ) { 65 | return value.equals( obj ); 66 | } 67 | 68 | public int hashCode() { 69 | return value.hashCode(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/localstring/ConceptPropertyLocalizedString.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.localstring; 14 | 15 | import org.apache.commons.lang.builder.ToStringBuilder; 16 | import org.apache.commons.lang.builder.ToStringStyle; 17 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 18 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 19 | 20 | /** 21 | * @deprecated as of metadata 3.0. 22 | */ 23 | public class ConceptPropertyLocalizedString extends ConceptPropertyBase implements Cloneable { 24 | private LocalizedStringSettings value; 25 | 26 | public ConceptPropertyLocalizedString( String name, LocalizedStringSettings value ) { 27 | this( name, value, false ); 28 | } 29 | 30 | public ConceptPropertyLocalizedString( String name, LocalizedStringSettings value, boolean required ) { 31 | super( name, required ); 32 | if ( null != value ) { 33 | this.value = value; 34 | } else { 35 | this.value = new LocalizedStringSettings(); 36 | } 37 | } 38 | 39 | public String toString() { 40 | return new ToStringBuilder( this, ToStringStyle.SHORT_PREFIX_STYLE ).append( getId() ).append( isRequired() ) 41 | .append( value ).toString(); 42 | } 43 | 44 | public Object clone() throws CloneNotSupportedException { 45 | ConceptPropertyLocalizedString locString = (ConceptPropertyLocalizedString) super.clone(); 46 | if ( value != null ) { 47 | locString.value = (LocalizedStringSettings) value.clone(); 48 | } 49 | return locString; 50 | } 51 | 52 | public ConceptPropertyType getType() { 53 | return ConceptPropertyType.LOCALIZED_STRING; 54 | } 55 | 56 | public Object getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue( Object value ) { 61 | this.value = (LocalizedStringSettings) value; 62 | } 63 | 64 | public boolean equals( Object obj ) { 65 | return value.equals( obj ); 66 | } 67 | 68 | public int hashCode() { 69 | return value.hashCode(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/security/ConceptPropertySecurity.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.security; 14 | 15 | import org.pentaho.pms.schema.concept.ConceptPropertyInterface; 16 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 17 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 18 | import org.pentaho.pms.schema.security.Security; 19 | 20 | /** 21 | * @deprecated as of metadata 3.0. 22 | */ 23 | public class ConceptPropertySecurity extends ConceptPropertyBase implements ConceptPropertyInterface, Cloneable { 24 | private Security value; 25 | 26 | public ConceptPropertySecurity( String name, Security value ) { 27 | this( name, value, false ); 28 | } 29 | 30 | public ConceptPropertySecurity( String name, Security value, boolean required ) { 31 | super( name, required ); 32 | if ( null != value ) { 33 | this.value = value; 34 | } else { 35 | this.value = new Security(); 36 | } 37 | } 38 | 39 | public String toString() { 40 | if ( value == null ) { 41 | return null; 42 | } 43 | return value.toString(); 44 | } 45 | 46 | public Object clone() throws CloneNotSupportedException { 47 | ConceptPropertySecurity clone = (ConceptPropertySecurity) super.clone(); 48 | clone.setValue( value.clone() ); 49 | return clone; 50 | } 51 | 52 | public ConceptPropertyType getType() { 53 | return ConceptPropertyType.SECURITY; 54 | } 55 | 56 | public Object getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue( Object value ) { 61 | this.value = (Security) value; 62 | } 63 | 64 | public boolean equals( Object obj ) { 65 | return value.equals( obj ); 66 | } 67 | 68 | public int hashCode() { 69 | return value.hashCode(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/concept/types/string/ConceptPropertyString.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.concept.types.string; 14 | 15 | import org.pentaho.pms.schema.concept.ConceptPropertyInterface; 16 | import org.pentaho.pms.schema.concept.types.ConceptPropertyBase; 17 | import org.pentaho.pms.schema.concept.types.ConceptPropertyType; 18 | 19 | /** 20 | * @deprecated as of metadata 3.0. 21 | */ 22 | public class ConceptPropertyString extends ConceptPropertyBase implements ConceptPropertyInterface, Cloneable { 23 | private String value; 24 | private static final String EMPTY_STRING = ""; 25 | 26 | public ConceptPropertyString( String name, String value ) { 27 | this( name, value, false ); 28 | } 29 | 30 | public ConceptPropertyString( String name, String value, boolean required ) { 31 | super( name, required ); 32 | setValue( value ); 33 | } 34 | 35 | public String toString() { 36 | return value; 37 | } 38 | 39 | public Object clone() throws CloneNotSupportedException { 40 | return super.clone(); 41 | } 42 | 43 | public ConceptPropertyType getType() { 44 | return ConceptPropertyType.STRING; 45 | } 46 | 47 | public Object getValue() { 48 | return value; 49 | } 50 | 51 | public void setValue( Object value ) { 52 | if ( null != value ) { 53 | this.value = (String) value; 54 | } else { 55 | this.value = EMPTY_STRING; 56 | } 57 | } 58 | 59 | public boolean equals( Object obj ) { 60 | return value.equals( obj ); 61 | } 62 | 63 | public int hashCode() { 64 | return value.hashCode(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/olap/OlapDimensionUsage.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.olap; 14 | 15 | public class OlapDimensionUsage implements Cloneable { 16 | private String name; 17 | private OlapDimension olapDimension; 18 | 19 | public OlapDimensionUsage() { 20 | } 21 | 22 | /** 23 | * @param name 24 | * @param olapDimension 25 | */ 26 | public OlapDimensionUsage( String name, OlapDimension olapDimension ) { 27 | super(); 28 | this.name = name; 29 | this.olapDimension = olapDimension; 30 | } 31 | 32 | public Object clone() { 33 | try { 34 | OlapDimensionUsage usage = (OlapDimensionUsage) super.clone(); // shallow copy of the dimension is fine. 35 | return usage; 36 | } catch ( CloneNotSupportedException e ) { 37 | return null; 38 | } 39 | } 40 | 41 | public boolean equals( Object obj ) { 42 | return name.equals( ( (OlapDimensionUsage) obj ).name ); 43 | } 44 | 45 | public int hashCode() { 46 | return name.hashCode(); 47 | } 48 | 49 | /** 50 | * @return the name 51 | */ 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | /** 57 | * @param name 58 | * the name to set 59 | */ 60 | public void setName( String name ) { 61 | this.name = name; 62 | } 63 | 64 | /** 65 | * @return the olapDimension 66 | */ 67 | public OlapDimension getOlapDimension() { 68 | return olapDimension; 69 | } 70 | 71 | /** 72 | * @param olapDimension 73 | * the olapDimension to set 74 | */ 75 | public void setOlapDimension( OlapDimension olapDimension ) { 76 | this.olapDimension = olapDimension; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/schema/olap/OlapMeasure.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.schema.olap; 14 | 15 | import org.pentaho.pms.schema.BusinessColumn; 16 | 17 | @SuppressWarnings( "deprecation" ) 18 | public class OlapMeasure implements Cloneable { 19 | private String name; 20 | private BusinessColumn businessColumn; 21 | 22 | public OlapMeasure() { 23 | } 24 | 25 | /** 26 | * @param name 27 | * @param businessColumn 28 | */ 29 | public OlapMeasure( String name, BusinessColumn businessColumn ) { 30 | this(); 31 | this.name = name; 32 | this.businessColumn = businessColumn; 33 | } 34 | 35 | public Object clone() { 36 | return new OlapMeasure( name, businessColumn ); // shallow copy of business column is desired 37 | } 38 | 39 | /** 40 | * @return the businessColumn 41 | */ 42 | public BusinessColumn getBusinessColumn() { 43 | return businessColumn; 44 | } 45 | 46 | /** 47 | * @param businessColumn 48 | * the businessColumn to set 49 | */ 50 | public void setBusinessColumn( BusinessColumn businessColumn ) { 51 | this.businessColumn = businessColumn; 52 | } 53 | 54 | /** 55 | * @return the name 56 | */ 57 | public String getName() { 58 | return name; 59 | } 60 | 61 | /** 62 | * @param name 63 | * the name to set 64 | */ 65 | public void setName( String name ) { 66 | this.name = name; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/test/TestBV.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.test; 14 | 15 | import org.pentaho.pms.schema.BusinessModel; 16 | 17 | @SuppressWarnings( "deprecation" ) 18 | public class TestBV { 19 | public static void main( String[] args ) { 20 | // Top level object: BusinessModel 21 | // this contains one or more localized business model metadata sets. 22 | // 23 | BusinessModel businessModel = new BusinessModel(); 24 | businessModel.getConcept().setName( "en_US", "Customer information" ); //$NON-NLS-1$ //$NON-NLS-2$ 25 | businessModel.getConcept().setDescription( "en_US", "This is the customer information Business Model" ); //$NON-NLS-1$ //$NON-NLS-2$ 26 | 27 | // Add one or more business Tables to this... 28 | /* 29 | * BusinessTable table1 = new BusinessTable(); BusinessColumn table1Column1 = new BusinessColumn("Customer name"); 30 | * table1.addColumn(table1Column1); 31 | */ 32 | // The business column uses a physical column 33 | // 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.util; 14 | 15 | import java.io.File; 16 | import java.io.FileInputStream; 17 | import java.io.FileOutputStream; 18 | import java.io.IOException; 19 | 20 | public class FileUtil { 21 | 22 | public static String readAsXml( String filename ) throws IOException { 23 | File file = new File( filename ); 24 | FileInputStream fileInputStream = new FileInputStream( file ); 25 | byte[] bytes = new byte[(int) file.length()]; 26 | fileInputStream.read( bytes ); 27 | fileInputStream.close(); 28 | return new String( bytes, Const.XML_ENCODING ); 29 | } 30 | 31 | public static void saveAsXml( String queryFile, String xml ) throws IOException { 32 | File file = new File( queryFile ); 33 | FileOutputStream fileOutputStream = new FileOutputStream( file ); 34 | fileOutputStream.write( xml.getBytes( Const.XML_ENCODING ) ); 35 | fileOutputStream.close(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/util/IVersionHelper.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.util; 14 | 15 | public interface IVersionHelper { 16 | 17 | public String getVersionInformation(); 18 | 19 | public String getVersionInformation( Class clazz ); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/util/ObjectAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.util; 14 | 15 | public class ObjectAlreadyExistsException extends Exception { 16 | private static final long serialVersionUID = 1947159965766738332L; 17 | 18 | /** 19 | * 20 | */ 21 | public ObjectAlreadyExistsException() { 22 | super(); 23 | } 24 | 25 | /** 26 | * @param arg0 27 | * @param arg1 28 | */ 29 | public ObjectAlreadyExistsException( String arg0, Throwable arg1 ) { 30 | super( arg0, arg1 ); 31 | } 32 | 33 | /** 34 | * @param arg0 35 | */ 36 | public ObjectAlreadyExistsException( String arg0 ) { 37 | super( arg0 ); 38 | } 39 | 40 | /** 41 | * @param arg0 42 | */ 43 | public ObjectAlreadyExistsException( Throwable arg0 ) { 44 | super( arg0 ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/pentaho/pms/util/UniqueList.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms.util; 14 | 15 | import java.util.Collection; 16 | import java.util.Iterator; 17 | import java.util.List; 18 | import java.util.ListIterator; 19 | 20 | public interface UniqueList extends Iterable { 21 | public boolean add( E o ) throws ObjectAlreadyExistsException; 22 | 23 | public void add( int index, E element ) throws ObjectAlreadyExistsException; 24 | 25 | public boolean addAll( Collection c ) throws ObjectAlreadyExistsException; 26 | 27 | public void clear(); 28 | 29 | public boolean contains( E o ); 30 | 31 | public boolean containsAll( Collection c ); 32 | 33 | public E get( int index ); 34 | 35 | public int indexOf( E o ); 36 | 37 | public boolean isEmpty(); 38 | 39 | public Iterator iterator(); 40 | 41 | public int lastIndexOf( E o ); 42 | 43 | public ListIterator listIterator(); 44 | 45 | public ListIterator listIterator( int index ); 46 | 47 | public E remove( int index ); 48 | 49 | public boolean remove( E o ); 50 | 51 | public boolean removeAll( Collection c ); 52 | 53 | public boolean retainAll( Collection c ); 54 | 55 | public Object set( int index, E element ) throws ObjectAlreadyExistsException; 56 | 57 | public int size(); 58 | 59 | public List subList( int fromIndex, int toIndex ); 60 | 61 | public Object[] toArray(); 62 | 63 | public T[] toArray( T[] a ); 64 | 65 | public List getList(); 66 | } 67 | -------------------------------------------------------------------------------- /src/main/resources/libformula.properties: -------------------------------------------------------------------------------- 1 | org.pentaho.reporting.libraries.formula.functions.information.Like.class=org.pentaho.metadata.libformula.LikeFunction 2 | org.pentaho.reporting.libraries.formula.functions.information.Like.description=org.pentaho.metadata.libformula.LikeFunctionDescription 3 | org.pentaho.reporting.libraries.formula.functions.information.Contains.class=org.pentaho.metadata.libformula.ContainsFunction 4 | org.pentaho.reporting.libraries.formula.functions.information.Contains.description=org.pentaho.metadata.libformula.ContainsFunctionDescription 5 | org.pentaho.reporting.libraries.formula.functions.information.BeginsWith.class=org.pentaho.metadata.libformula.BeginsWithFunction 6 | org.pentaho.reporting.libraries.formula.functions.information.BeginsWith.description=org.pentaho.metadata.libformula.BeginsWithFunctionDescription 7 | org.pentaho.reporting.libraries.formula.functions.information.EndsWith.class=org.pentaho.metadata.libformula.EndsWithFunction 8 | org.pentaho.reporting.libraries.formula.functions.information.EndsWith.description=org.pentaho.metadata.libformula.EndsWithFunctionDescription 9 | org.pentaho.reporting.libraries.formula.functions.information.Equals.class=org.pentaho.metadata.libformula.EqualsFunction 10 | org.pentaho.reporting.libraries.formula.functions.information.Equals.description=org.pentaho.metadata.libformula.EqualsFunctionDescription 11 | org.pentaho.reporting.libraries.formula.functions.information.In.class=org.pentaho.metadata.libformula.InFunction 12 | org.pentaho.reporting.libraries.formula.functions.information.In.description=org.pentaho.metadata.libformula.InFunctionDescription 13 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/Model.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/BeginsWith-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=BEGINSWITH 5 | description=This function checks to see if a string is begins with another string. 6 | parameter.0.display-name=text 7 | parameter.0.description=The text to check for the substring. 8 | parameter.1.display-name=substring 9 | parameter.1.description=The substring to look for in the text. 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/Contains-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=CONTAINS 5 | description=This function checks to see if a string is within another string. 6 | parameter.0.display-name=text 7 | parameter.0.description=The text to check for the substring. 8 | parameter.1.display-name=substring 9 | parameter.1.description=The substring to look for in the text. 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/EndsWith-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=ENDSSWITH 5 | description=This function checks to see if a string is ends with another string. 6 | parameter.0.display-name=text 7 | parameter.0.description=The text to check for the substring. 8 | parameter.1.display-name=substring 9 | parameter.1.description=The substring to look for in the text. 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/Equals-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=EQUALS 5 | description=Returns TRUE if both parameters equal one another 6 | parameter.0.display-name=value 1 7 | parameter.0.description=The first parameter 8 | parameter.1.display-name=value 2 9 | parameter.1.description=The second parameter 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/In-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2011 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=IN 5 | description=Returns TRUE if any of the subsequent arguments match the first argument. 6 | parameter.0.display-name=Value 7 | parameter.0.description=Logical value 1, logical value 2;...are 1 to 30 conditions to be tested and each returns either TRUE or FALSE. 8 | parameter.1.display-name=Comparison Value 9 | parameter.1.description=Value 1, Value 2;... are any number of values that are compared to the first, if a match is found the function returns true. 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/libformula/Like-Function.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009 - 2017, Hitachi Vantara. All Rights Reserved. 3 | # 4 | display-name=LIKE 5 | description=Acts like the SQL LIKE function, comparing the first value to a regular expression 6 | parameter.0.display-name=text 7 | parameter.0.description=The text to compare to the regular expression. 8 | parameter.1.display-name=regular expression 9 | parameter.1.description=The regular expression. 10 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/metadata/query/Model.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/org/pentaho/pms/schema/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains the classes to handle a database Schema 4 | 5 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/di/core/database/mock/MockHive2DatabaseMeta.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.di.core.database.mock; 14 | 15 | import org.pentaho.di.core.database.DatabaseInterface; 16 | import org.pentaho.di.core.plugins.DatabaseMetaPlugin; 17 | 18 | /** 19 | * Mock database interface for Hive 2 so we don't have to depend on the Pentaho Big Data Plugin project at all. It is 20 | * purely a runtime dependency. 21 | * 22 | */ 23 | @DatabaseMetaPlugin( type = "HIVE2", typeDescription = "Hadoop Hive 2" ) 24 | public class MockHive2DatabaseMeta extends MockHiveDatabaseMeta implements DatabaseInterface { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/di/core/database/mock/MockHiveDatabaseMeta.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.di.core.database.mock; 14 | 15 | import org.pentaho.di.core.database.BaseDatabaseMeta; 16 | import org.pentaho.di.core.database.DatabaseInterface; 17 | import org.pentaho.di.core.exception.KettleDatabaseException; 18 | import org.pentaho.di.core.plugins.DatabaseMetaPlugin; 19 | import org.pentaho.di.core.row.ValueMetaInterface; 20 | 21 | /** 22 | * Mock database interface for Hive so we don't have to depend on the Pentaho Big Data Plugin project at all. It is 23 | * purely a runtime dependency. 24 | * 25 | * @author Jordan Ganoff (jganoff@pentaho.com) 26 | * 27 | */ 28 | @DatabaseMetaPlugin( type = "HIVE", typeDescription = "Hadoop Hive" ) 29 | public class MockHiveDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface { 30 | 31 | @Override 32 | public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, 33 | boolean add_fieldname, boolean add_cr ) { 34 | return null; 35 | } 36 | 37 | @Override 38 | public String getDriverClass() { 39 | return null; 40 | } 41 | 42 | @Override 43 | public String getURL( String hostname, String port, String databaseName ) throws KettleDatabaseException { 44 | return null; 45 | } 46 | 47 | @Override 48 | public String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, 49 | String pk, boolean semicolon ) { 50 | return null; 51 | } 52 | 53 | @Override 54 | public String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, 55 | String pk, boolean semicolon ) { 56 | return null; 57 | } 58 | 59 | @Override 60 | public String[] getUsedLibraries() { 61 | return null; 62 | } 63 | 64 | @Override 65 | public int[] getAccessTypeList() { 66 | return null; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/di/core/database/mock/MockImpalaDatabaseMeta.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.di.core.database.mock; 14 | 15 | import org.pentaho.di.core.database.DatabaseInterface; 16 | import org.pentaho.di.core.plugins.DatabaseMetaPlugin; 17 | 18 | /** 19 | * Mock database interface for Impala so we don't have to depend on the Pentaho Big Data Plugin project at all. It is 20 | * purely a runtime dependency. 21 | * 22 | */ 23 | @DatabaseMetaPlugin( type = "IMPALA", typeDescription = "Impala" ) 24 | public class MockImpalaDatabaseMeta extends MockHiveDatabaseMeta implements DatabaseInterface { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/metadata/automodel/CsvDataSourceImportStrategyTest.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | 14 | package org.pentaho.metadata.automodel; 15 | 16 | import org.junit.Assert; 17 | import org.junit.Test; 18 | import org.pentaho.di.core.row.ValueMetaInterface; 19 | import org.pentaho.di.core.row.value.ValueMetaString; 20 | import org.pentaho.metadata.automodel.importing.strategy.CsvDatasourceImportStrategy; 21 | import org.pentaho.metadata.model.thin.Column; 22 | 23 | public class CsvDataSourceImportStrategyTest { 24 | 25 | @Test 26 | public void nameWithProhibitChars_DisplayedWithNoChanges() { 27 | final String nameWithProhibitChars = "Month 1-2"; 28 | final String id = "Month 1_HYPHEN_2"; 29 | 30 | Column[] columns = new Column[] { createColumn( id, nameWithProhibitChars ) }; 31 | 32 | CsvDatasourceImportStrategy importStrategy = new CsvDatasourceImportStrategy( columns ); 33 | ValueMetaInterface meta = new ValueMetaString( id ); 34 | 35 | Assert.assertEquals( importStrategy.displayName( meta ), nameWithProhibitChars ); 36 | } 37 | 38 | @Test 39 | public void nameWithNoProhibitChars_DisplayedWithNoChanges() { 40 | final String nameWithProhibitChars = "Month 1"; 41 | final String id = "Month 1"; 42 | 43 | Column[] columns = new Column[] { createColumn( id, nameWithProhibitChars ) }; 44 | 45 | CsvDatasourceImportStrategy importStrategy = new CsvDatasourceImportStrategy( columns ); 46 | ValueMetaInterface meta = new ValueMetaString( id ); 47 | 48 | Assert.assertEquals( importStrategy.displayName( meta ), nameWithProhibitChars ); 49 | } 50 | 51 | private Column createColumn( String id, String name ) { 52 | Column column = new Column(); 53 | column.setId( id ); 54 | column.setName( name ); 55 | 56 | return column; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/metadata/model/olap/OlapCalculatedMemberTest.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.metadata.model.olap; 14 | 15 | import org.junit.Test; 16 | 17 | import static org.junit.Assert.*; 18 | 19 | public class OlapCalculatedMemberTest { 20 | @Test 21 | public void testConstructor() throws Exception { 22 | OlapCalculatedMember member = 23 | new OlapCalculatedMember( "aName", "aDimension", "someFormula", "anyFormat", false ); 24 | assertEquals( "aName", member.getName() ); 25 | assertEquals( "aDimension", member.getDimension() ); 26 | assertEquals( "someFormula", member.getFormula() ); 27 | assertEquals( "anyFormat", member.getFormatString() ); 28 | assertFalse( member.isCalculateSubtotals() ); 29 | } 30 | 31 | @Test 32 | public void testSetters() throws Exception { 33 | OlapCalculatedMember member = new OlapCalculatedMember(); 34 | member.setName( "bName" ); 35 | member.setDimension( "bDimension" ); 36 | member.setFormula( "otherFormula" ); 37 | member.setFormatString( "noFormat" ); 38 | member.setCalculateSubtotals( true ); 39 | 40 | assertEquals( "bName", member.getName() ); 41 | assertEquals( "bDimension", member.getDimension() ); 42 | assertEquals( "otherFormula", member.getFormula() ); 43 | assertEquals( "noFormat", member.getFormatString() ); 44 | assertTrue( member.isCalculateSubtotals() ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/org/pentaho/pms/MessageTest.java: -------------------------------------------------------------------------------- 1 | /*! ****************************************************************************** 2 | * 3 | * Pentaho 4 | * 5 | * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com 6 | * 7 | * Use of this software is governed by the Business Source License included 8 | * in the LICENSE.TXT file. 9 | * 10 | * Change Date: 2029-07-20 11 | ******************************************************************************/ 12 | 13 | package org.pentaho.pms; 14 | 15 | import junit.framework.TestCase; 16 | 17 | import org.pentaho.pms.messages.Messages; 18 | 19 | /** 20 | * Tests the MetaData version of the localices messages to ensure we are getting the properties / messages from the 21 | * correct messages.properties file. 22 | * 23 | * @author David Kincade 24 | */ 25 | @SuppressWarnings( "deprecation" ) 26 | public class MessageTest extends TestCase { 27 | public void testMessages() { 28 | // In the messages.propeties file, the following is defined: 29 | // MessagesTest.CODE_TEST_MESSAGE=Test Message 30 | String result = Messages.getString( "MessagesTest.CODE_TEST_MESSAGE" ); //$NON-NLS-1$ 31 | assertEquals( "Test Message", result ); //$NON-NLS-1$ 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/ESAPI.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pentaho/pentaho-metadata/d7181e77e94aa25f4a03b7cb9de5e9006c7d3c68/src/test/resources/ESAPI.properties -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root category priority to INFO and its only appender to CONSOLE. 2 | log4j.rootCategory=DEBUG, CONSOLE 3 | #log4j.rootCategory=INFO, CONSOLE, LOGFILE 4 | 5 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 6 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 7 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{1} %m %n 9 | 10 | --------------------------------------------------------------------------------