use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class AddHiveCharMapInPatternFrenquencyTask method doExecute.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.migration.AMigrationTask#doExecute()
*/
@Override
protected boolean doExecute() throws Exception {
DefinitionHandler definitionHandler = DefinitionHandler.getInstance();
boolean isFrequencyAdded = true;
boolean isLowFrequencyAdded = true;
// Add CharacterMapping of hive to pattern frenquency indicator
IndicatorDefinition hiveDefinition = definitionHandler.getDefinitionById(PATTERN_FREQUENCY_UUID);
if (hiveDefinition != null && !IndicatorDefinitionFileHelper.isExistCharacterMappingWithLanguage(hiveDefinition, hive)) {
IndicatorDefinitionFileHelper.addCharacterMapping(hiveDefinition, hive, CHAR_NAME, CHAR_TOREPLACE, CHAR_REPLACE);
isFrequencyAdded = IndicatorDefinitionFileHelper.save(hiveDefinition);
}
// Update CharacterMapping of hive to pattern low frenquency indicator
IndicatorDefinition lowDefinition = definitionHandler.getDefinitionById(PATTERN_LOW_FREQUENCY_UUID);
if (hiveDefinition != null && !IndicatorDefinitionFileHelper.isExistCharacterMappingWithLanguage(lowDefinition, hive)) {
IndicatorDefinitionFileHelper.addCharacterMapping(lowDefinition, hive, CHAR_NAME, CHAR_TOREPLACE, CHAR_REPLACE);
isLowFrequencyAdded = IndicatorDefinitionFileHelper.save(lowDefinition);
}
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
if (!isFrequencyAdded || !isLowFrequencyAdded) {
return false;
}
return true;
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UpdateAllIndicators4DefaultTask method doExecute.
@Override
protected boolean doExecute() throws Exception {
boolean result = true;
List<IndicatorDefinition> indiDefinitions = DefinitionHandler.getInstance().getIndicatorsDefinitions();
for (IndicatorDefinition indiDefinition : indiDefinitions) {
if (indiDefinition != null) {
EList<TdExpression> sqlGenericExpression = indiDefinition.getSqlGenericExpression();
for (TdExpression exp : sqlGenericExpression) {
// both "Default" and "Default "
if (Language.equals(exp.getLanguage().trim())) {
exp.setLanguage(newLanguage);
break;
}
}
result = result && IndicatorDefinitionFileHelper.save(indiDefinition);
}
}
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
return result;
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorImpl method setIndicatorDefinition.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void setIndicatorDefinition(IndicatorDefinition newIndicatorDefinition) {
IndicatorDefinition oldIndicatorDefinition = indicatorDefinition;
indicatorDefinition = newIndicatorDefinition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IndicatorsPackage.INDICATOR__INDICATOR_DEFINITION, oldIndicatorDefinition, indicatorDefinition));
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UDIHelperTest method testContainsJavaUDI4.
/**
* Test method for
* {@link org.talend.dq.helper.UDIHelper#containsJavaUDI(org.talend.dataquality.indicators.definition.IndicatorDefinition)}
* .
*/
@Test
public void testContainsJavaUDI4() {
// prepare data
IndicatorDefinition javaIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
// testMethod
assertFalse(UDIHelper.containsJavaUDI(javaIndicatorDefinition));
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class MultiColumnAnalysisExecutorTest method setUp.
@Before
public void setUp() throws Exception {
analysis = AnalysisFactory.eINSTANCE.createAnalysis();
AnalysisContext context = AnalysisFactory.eINSTANCE.createAnalysisContext();
analysis.setContext(context);
// mock(Catalog.class);
Package catalog = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createCatalog();
// $NON-NLS-1$
catalog.setName("tbi");
TdTable tdTable = RelationalFactory.eINSTANCE.createTdTable();
// $NON-NLS-1$
tdTable.setName("customer");
tdTable.setNamespace(catalog);
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
tdColumn.setOwner(tdTable);
// $NON-NLS-1$
tdColumn.setName("date_accnt_opened");
tdColumn.setContentType(DataminingType.INTERVAL.getName());
TdColumn tdColumn2 = RelationalFactory.eINSTANCE.createTdColumn();
tdColumn2.setOwner(tdTable);
// $NON-NLS-1$
tdColumn2.setName("product_id");
tdColumn2.setContentType(DataminingType.INTERVAL.getName());
AnalysisParameters analysisPara = AnalysisFactory.eINSTANCE.createAnalysisParameters();
analysisPara.setStoreData(false);
// set analysis type is columnset
analysisPara.setAnalysisType(AnalysisType.COLUMN_SET);
analysis.setParameters(analysisPara);
context.getAnalysedElements().add(tdColumn);
context.getAnalysedElements().add(tdColumn2);
AnalysisResult analysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
ExecutionInformations info = AnalysisFactory.eINSTANCE.createExecutionInformations();
analysisResult.setResultMetadata(info);
simpleStatIndicator = ColumnsetFactory.eINSTANCE.createSimpleStatIndicator();
TdExpression expression = RelationalFactory.eINSTANCE.createTdExpression();
expression.setBody(// $NON-NLS-1$
"SELECT <%=__COLUMN_NAMES__%> FROM <%=__TABLE_NAME__%> <%=__WHERE_CLAUSE__%> GROUP BY <%=__GROUP_BY_ALIAS__%>");
// $NON-NLS-1$
expression.setLanguage("SQL");
IndicatorDefinition indicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
indicatorDefinition.getSqlGenericExpression().add(expression);
simpleStatIndicator.setIndicatorDefinition(indicatorDefinition);
// $NON-NLS-1$
simpleStatIndicator.getDateFunctions().add("");
// $NON-NLS-1$
simpleStatIndicator.getNumericFunctions().add("");
simpleStatIndicator.setDataminingType(DataminingType.NOMINAL);
simpleStatIndicator.getAnalyzedColumns().add(tdColumn);
simpleStatIndicator.getAnalyzedColumns().add(tdColumn2);
analysisResult.getIndicators().add(simpleStatIndicator);
analysis.setResults(analysisResult);
}
Aggregations