use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method hasIndicatorParameters.
/**
* DOC msjian Comment method "hasIndicatorParameters".
*
* @param indicatorUnit
* @return
*/
private boolean hasIndicatorParameters(IndicatorUnit indicatorUnit) {
IndicatorParameters parameters = indicatorUnit.getIndicator().getParameters();
if (parameters == null) {
return false;
}
if (hideParameters(indicatorUnit)) {
return false;
}
if (indicatorUnit.getIndicator() instanceof FrequencyIndicator) {
// set on tree
if (parameters.getBins() == null) {
return false;
}
// ~
return true;
}
TextParameters tParameter = parameters.getTextParameter();
if (tParameter != null && !hideTextParameters(indicatorUnit)) {
return true;
}
DateParameters dParameters = parameters.getDateParameters();
if (dParameters != null) {
return true;
}
Domain indicatorValidDomain = parameters.getIndicatorValidDomain();
if (indicatorValidDomain != null) {
if (indicatorValidDomain.getRanges() != null && !indicatorValidDomain.getRanges().isEmpty()) {
return true;
}
}
Domain bins = parameters.getBins();
if (bins != null) {
return true;
}
return false;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class IndicatorsComp method hasIndicatorParameters.
private boolean hasIndicatorParameters(Indicator indicator) {
IndicatorParameters parameters = indicator.getParameters();
if (parameters == null) {
return false;
}
Domain indicatorValidDomain = parameters.getIndicatorValidDomain();
if (indicatorValidDomain != null) {
return true;
}
return false;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class SummaryStastictisExplorer method getInvalidRowsStatement.
/**
* zqin use this method in a menu ".
*
* View invalid rows" Method "getInvalidRowsStatement".
*
* @return the query to get the invalid rows (or null when all rows are valid)
*/
private String getInvalidRowsStatement() {
double value = Double.valueOf(entity.getValue());
String whereClause = null;
TdColumn column = (TdColumn) indicator.getAnalyzedElement();
IndicatorParameters parameters = indicator.getParameters();
if (parameters != null) {
String where1 = null;
Domain domain = parameters.getIndicatorValidDomain();
if (domain != null) {
where1 = getWhereInvalidClause(value, domain);
}
String where2 = null;
domain = parameters.getDataValidDomain();
if (domain != null) {
where2 = getWhereInvalidClause(value, domain);
}
if (where1 != null) {
whereClause = where1;
if (where2 != null) {
whereClause += dbmsLanguage.or() + where2;
}
} else if (where2 != null) {
whereClause = where2;
}
}
// add the data filter where clause
return whereClause != null ? SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(column) + dbmsLanguage.where() + inBrackets(whereClause) + andDataFilterClause() : null;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class DbmsLanguage method getRegexPatternString.
/**
* Method "getRegexPatternString".
*
* @param indicator
* @return the regular expression or null if none was found
*/
public String getRegexPatternString(Indicator indicator) {
if (indicator instanceof PatternMatchingIndicator || (indicator instanceof UserDefIndicator && IndicatorCategoryHelper.isUserDefMatching(IndicatorCategoryHelper.getCategory(indicator.getIndicatorDefinition())))) {
IndicatorParameters parameters = indicator.getParameters();
if (parameters == null) {
return null;
}
Domain dataValidDomain = parameters.getDataValidDomain();
if (dataValidDomain == null) {
return null;
}
EList<Pattern> patterns = dataValidDomain.getPatterns();
for (Pattern pattern : patterns) {
Expression expression = this.getRegexp(pattern);
return expression == null ? null : expression.getBody();
}
}
return null;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class UDIUtils method createIndicatorUnit.
public static IndicatorUnit[] createIndicatorUnit(IndicatorDefinition udid, ModelElementIndicator meIndicator, Analysis analysis) throws Throwable {
List<IndicatorUnit> addIndicatorUnits = new ArrayList<IndicatorUnit>();
// can't add the same user defined indicator
for (Indicator indicator : meIndicator.getIndicators()) {
// MOD xwang 2011-08-01 bug TDQ-2730
if (udid.getName().equals(indicator.getName()) && indicator instanceof UserDefIndicator) {
// $NON-NLS-1$
MessageUI.openWarning(DefaultMessagesImpl.getString("UDIUtils.UDISelected", udid.getName()));
return null;
}
}
Indicator udi = UDIFactory.createUserDefIndicator(udid);
udi.setIndicatorDefinition(udid);
// MOD mzhao feature 11128, Handle Java User Defined Indicator.
Indicator judi = UDIHelper.adaptToJavaUDI(udi);
if (judi != null) {
udi = judi;
}
IEditorPart activeEditor = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor == null || !(activeEditor instanceof AnalysisEditor)) {
return null;
}
ExecutionLanguage executionLanguage = ((AnalysisEditor) activeEditor).getUIExecuteEngin();
boolean isJavaEngin = ExecutionLanguage.JAVA.equals(executionLanguage);
DbmsLanguage dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(analysis, executionLanguage);
Expression returnExpression = dbmsLanguage.getExpression(udi);
String executeType = isJavaEngin ? executionLanguage.getName() : dbmsLanguage.getDbmsName();
// MOD qiongli 2013.5.22 TDQ-7282.if don't find a valid java expression for JUDI,should also pop this dialog.
boolean finddExpression = true;
if (isJavaEngin && judi == null || !isJavaEngin && returnExpression == null) {
finddExpression = false;
}
if (!finddExpression) {
// open the editor
boolean openUDI = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("PatternUtilities.Warning"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("UDIUtils.NoExpression", executeType));
if (openUDI) {
RepositoryNode node = RepositoryNodeHelper.recursiveFind(udid);
if (RepositoryNodeHelper.canOpenEditor(node)) {
new OpenItemEditorAction(new IRepositoryNode[] { node }).run();
}
}
return null;
}
// dbmsLanguage
IndicatorParameters parameters = udi.getParameters();
if (parameters == null) {
parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
udi.setParameters(parameters);
}
Domain indicatorValidDomain = parameters.getIndicatorValidDomain();
if (indicatorValidDomain == null) {
// $NON-NLS-1$
indicatorValidDomain = DomainHelper.createDomain("JAVA_UDI_PARAMETERS");
parameters.setIndicatorValidDomain(indicatorValidDomain);
}
List<IndicatorDefinitionParameter> indicatorDefs = udid.getIndicatorDefinitionParameter();
for (IndicatorDefinitionParameter idp : indicatorDefs) {
JavaUDIIndicatorParameter judip = DomainHelper.createJavaUDIIndicatorParameter(idp.getKey(), idp.getValue());
indicatorValidDomain.getJavaUDIIndicatorParameter().add(judip);
}
IndicatorEnum indicatorType = IndicatorEnum.findIndicatorEnum(udi.eClass());
addIndicatorUnits.add(meIndicator.addSpecialIndicator(indicatorType, udi));
DependenciesHandler.getInstance().setUsageDependencyOn(analysis, udid);
return addIndicatorUnits.toArray(new IndicatorUnit[addIndicatorUnits.size()]);
}
Aggregations