use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method removeUncheckedWhereRuleIndicator.
/**
* DOC xqliu Comment method "removeUncheckedWhereRuleIndicator". ADD xqliu 2009-04-30 bug 6808
*
* @param ownedWhereRuleNodes
* @param results
* @param tableIndicator
*/
private void removeUncheckedWhereRuleIndicator(Object[] ownedWhereRuleNodes, Object[] results, TableIndicator tableIndicator) {
ArrayList<Object> removeList = new ArrayList<Object>();
for (Object node : ownedWhereRuleNodes) {
boolean remove = true;
for (Object result : results) {
if (node.equals(result)) {
remove = false;
break;
}
}
if (remove) {
removeList.add(node);
}
}
TableIndicatorUnit[] indicatorUnits = tableIndicator.getIndicatorUnits();
for (TableIndicatorUnit unit : indicatorUnits) {
IndicatorDefinition indicatorDefinition = unit.getIndicator().getIndicatorDefinition();
if (indicatorDefinition instanceof WhereRule) {
WhereRule wr = (WhereRule) indicatorDefinition;
RuleRepNode recursiveFindNode = RepositoryNodeHelper.recursiveFindRuleSql(wr);
for (Object obj : removeList) {
RuleRepNode node = (RuleRepNode) obj;
if (recursiveFindNode.equals(node)) {
// the order can not be changed
removeItemBranch(this.indicatorTreeItemMap.get(unit));
deleteIndicatorItems(tableIndicator, unit);
// ~the order can not be changed
break;
}
}
}
}
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorDefinitionMaterPage method getIndicatorRepNodeFromInput.
/**
* get PatternRepNode From editorInput
*
* @param editorInput
* @return
*/
private SysIndicatorDefinitionRepNode getIndicatorRepNodeFromInput(IEditorInput editorInput) {
if (editorInput instanceof FileEditorInput) {
FileEditorInput fileEditorInput = (FileEditorInput) editorInput;
IFile file = fileEditorInput.getFile();
if (file != null) {
IndicatorDefinition indicatorDefinition = IndicatorResourceFileHelper.getInstance().findIndDefinition(file);
indicatorDefinition = (IndicatorDefinition) EObjectHelper.resolveObject(indicatorDefinition);
return RepositoryNodeHelper.recursiveFindIndicatorDefinition(indicatorDefinition);
}
} else if (editorInput instanceof IndicatorDefinitionItemEditorInput) {
return ((IndicatorDefinitionItemEditorInput) editorInput).getRepNode();
}
return null;
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class PatternExplorer method getInvalidRowsStatement.
/**
* get the Invalid Rows Statement.
*
* @return
*/
public String getInvalidRowsStatement() {
// when the indicator is the use define match
IndicatorDefinition indicatorDefinition = this.indicator.getIndicatorDefinition();
if (indicatorDefinition instanceof UDIndicatorDefinition) {
EList<TdExpression> list = ((UDIndicatorDefinition) indicatorDefinition).getViewInvalidRowsExpression();
return getQueryAfterReplaced(indicatorDefinition, list);
}
String regexPatternString = dbmsLanguage.getRegexPatternString(this.indicator);
String regexCmp = getRegexNotLike(regexPatternString);
// add null as invalid rows
String nullClause = dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
// mzhao TDQ-4967 add "(" and ")" for regex and null clause.
// $NON-NLS-1$//$NON-NLS-2$
String pattCondStr = "(" + regexCmp + nullClause + ")";
return getRowsStatement(pattCondStr);
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class PatternExplorer method getValidRowsStatement.
/**
* get the Valid Rows Statement.
*
* @return
*/
public String getValidRowsStatement() {
// when the indicator is the use define match
IndicatorDefinition indicatorDefinition = this.indicator.getIndicatorDefinition();
if (indicatorDefinition instanceof UDIndicatorDefinition) {
EList<TdExpression> list = ((UDIndicatorDefinition) indicatorDefinition).getViewValidRowsExpression();
return getQueryAfterReplaced(indicatorDefinition, list);
}
String regexPatternString = dbmsLanguage.getRegexPatternString(this.indicator);
String regexCmp = getRegexLike(regexPatternString);
return getRowsStatement(regexCmp);
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UDIUtils method checkUDIDependency.
public static ReturnCode checkUDIDependency(IndicatorDefinition definition, File delFile) {
ReturnCode result = new ReturnCode(true);
IPath filePath = new Path(delFile.getPath());
if (!ResourceManager.getUDIJarFolder().getLocation().isPrefixOf(filePath)) {
// filePath.makeRelativeTo(ResourceManager.getRootFolderLocation()))) {
return result;
}
for (IRepositoryNode indiDefNode : RepositoryNodeHelper.getUdisRepositoryNodes(true)) {
IndicatorDefinition indiDef = null;
Item item = indiDefNode.getObject().getProperty().getItem();
if (item instanceof TDQIndicatorDefinitionItem) {
indiDef = ((TDQIndicatorDefinitionItem) item).getIndicatorDefinition();
} else {
continue;
}
// when it is itself, don't use this check.
if (indiDef == definition) {
continue;
}
// ADD end
TaggedValue tv = TaggedValueHelper.getTaggedValue(TaggedValueHelper.JAR_FILE_PATH, indiDef.getTaggedValue());
if (tv == null) {
continue;
}
// $NON-NLS-1$
String[] strArray = tv.getValue().split("\\|\\|");
int index = Arrays.binarySearch(strArray, filePath.lastSegment());
if (index >= 0) {
// $NON-NLS-1$ //$NON-NLS-2$
result.setMessage("The jar file(" + strArray[index] + ") has in use by UDI for " + indiDef.getName());
result.setOk(false);
return result;
}
}
return result;
}
Aggregations